Hello all!

I'm doing a 3D simulation. Now I need something like variables in
imperative languages. My mainLoop check for new events and renders
scene. To use input for controling camera position I need variables. An
equivalent code in C:

  void main_loop() {
    int loop_num = 0;
    bool run = 1;
    SDLEvent e;

    while(run) {
      while(SDL_PollEvent(&e)) {
          if(e.type == SDL_KeyDown) {
           if(... == SDLK_Left)
                camera_pos_x--;
          } else if ...
          ...
      }
    
     drawScene();
    
      loop_num++;
    }
  }

How to implement camera_pos_x, y and z as variables, which chage values
in run? This is only simplified example, but it's important to implement
it in as most imperative form as possible.

Thank fo all answers.

Matej 'Yin' Gagyi

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to