Exemplo n.º 1
0
    void loop(void *arg, long period){
    int c;
    hal_u32_t scan = 0;
    kb_inst_t *inst = arg;
    
    if (inst->scan){ //scanning request
        for (c = 0; c < inst->ncols; c++){
            scan += ((*inst->hal.cols[c] != inst->param.invert) << c);
        }
        if (scan == inst->now[inst->row] && scan != inst->then[inst->row]){
            // debounced and changed
            for (c = 0; c < inst->ncols; c++){
                int mask = 1 << c;
                if ((inst->then[inst->row] & mask) && !(scan & mask)){ //keyup
                    *inst->hal.keycode = inst->keyup 
                    + (inst->row << inst->rowshift) 
                    + c;
                    keyup(inst);
                }
                else if (!(inst->then[inst->row] & mask) && (scan & mask)){//keydown
                    *inst->hal.keycode = inst->keydown 
                    + (inst->row << inst->rowshift) 
                    + c;
                    
                    keydown(inst);
                }
            }
        }
        
        inst->then[inst->row] = inst->now[inst->row];
        inst->now[inst->row] = scan;
        
        *inst->hal.rows[inst->row] = inst->param.invert;
        inst->row++;
        if (inst->row >= inst->nrows) inst->row = 0;
        *inst->hal.rows[inst->row] = !inst->param.invert;
    }
    else
    {
        if (*inst->hal.keycode == 0x40) return;
        if ((*inst->hal.keycode & inst->keydown) == inst->keydown){
            keydown(inst);
        }
        else if ((*inst->hal.keycode & inst->keydown) == inst->keyup)
        {
            keyup(inst);
        }
    }
}
Exemplo n.º 2
0
void	gere_event(t_graph *g, int *cont, int i, int dec)
{
  Uint32	pause;
  Uint32	to;
  SDL_Event	event;

  pause = SDL_GetTicks();
  if (dec)
    set_cursor(g);
  to = SDL_GetTicks();
  while ((to - pause < 1 && *cont) || (i && *cont))
    {
      if (g->key)
	iterate(g);
      aff(g, i);
      while (SDL_PollEvent(&event))
	{
	  if (event.type == SDL_KEYDOWN)
	    keydown(g, event, cont);
	  if (event.type == SDL_KEYUP)
	    keyup(g, event);
	  if (event.type == SDL_MOUSEMOTION)
	    mousemove(g, event);
	}
      to = SDL_GetTicks();
    }
  if (i)
    *cont = -1;
}
Exemplo n.º 3
0
Arquivo: main.c Projeto: Aiur/Airtab
bool execCommand(Command *cmd) {
    double x, y;
    int key;
    if (strcmp(cmd->cmd, "mm") == 0) {
        x = strtod(cmd->arg1, NULL);
        y = strtod(cmd->arg2, NULL);
        mousemove(x, y);
        return true;
    } else if (strcmp(cmd->cmd, "kd") == 0) {
        key = (int) strtol(cmd->arg1, NULL, 10);
        keydown(key);
    } else if (strcmp(cmd->cmd, "ku") == 0) {
        key = (int)strtol(cmd->arg1, NULL, 10);
        keyup(key);
    } else if (strcmp(cmd->cmd, "md") == 0) {
        mousedown(cmd->arg1[0]);
    } else if (strcmp(cmd->cmd, "mu") == 0) {
        mouseup(cmd->arg1[0]);
    } else if (strcmp(cmd->cmd, "sy") == 0) {
        scrollY(strtod(cmd->arg1, NULL));
    } else if (strcmp(cmd->cmd, "sx") == 0) {
        scrollX(strtod(cmd->arg1, NULL));
    }
    
    return false;
}
Exemplo n.º 4
0
Arquivo: win32.c Projeto: B-Rich/simh
/* thoingggg!! "message for you sir!!!" */
static LRESULT CALLBACK
patsy(HWND wh, UINT msg, WPARAM wp, LPARAM lp) /* "WndProc" */
{
    /* printf("msg %d\n", msg); */
    switch (msg) {
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;

    case WM_MOUSEMOVE:
        if (wp & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) {
#ifdef SWITCH_CURSORS
            if (ws_lp_x == -1 && !display_tablet)
                SetCursor(cross);
#endif
            mousepos(lp);
        }
#ifdef SWITCH_CURSORS
        else if (ws_lp_x != -1 && !display_tablet)
            SetCursor(arrow);
#endif
        break;                          /* return?? */

    case WM_LBUTTONDOWN:
        display_lp_sw = 1;
    case WM_MBUTTONDOWN:
    case WM_RBUTTONDOWN:
#ifdef SWITCH_CURSORS
        if (!display_tablet)
            SetCursor(cross);
#endif
        mousepos(lp);
        break;                          /* return?? */

    case WM_LBUTTONUP:
        display_lp_sw = 0;
    case WM_MBUTTONUP:
    case WM_RBUTTONUP:
#ifdef SWITCH_CURSORS
        if (!display_tablet)
            SetCursor(arrow);
#endif
        ws_lp_x = ws_lp_y = -1;
        break;                          /* return?? */

    case WM_KEYDOWN:
        keydown(wp);
        break;

    case WM_KEYUP:
        keyup(wp);
        break;

    case WM_PAINT:
        display_repaint();
        break;                          /* return?? */
    }
    return DefWindowProc(wh, msg, wp, lp);
}
Exemplo n.º 5
0
END_TEST

/* Test passes!*/
START_TEST(test_keyup){
    SDL_Event event;
    GameData gameData;
    SDL_Init(SDL_INIT_VIDEO);
    /* see startGame in game.c */

    event.type = SDL_KEYUP;
    event.key.type = SDL_KEYUP;
    event.key.state = SDL_RELEASED;

    fail_unless(keyup(&gameData.controlsData, &gameData.gameObjectData,&gameData.uiData,&event) == 1, "keyup function failed.");
    SDL_Quit();

  }
Exemplo n.º 6
0
void WindowTestCase::KeyEvent()
{
#if wxUSE_UIACTIONSIMULATOR
    EventCounter keydown(m_window, wxEVT_KEY_DOWN);
    EventCounter keyup(m_window, wxEVT_KEY_UP);
    EventCounter keychar(m_window, wxEVT_CHAR);

    wxUIActionSimulator sim;

    m_window->SetFocus();

    sim.Text("text");
    sim.Char(WXK_SHIFT);
    wxYield();

    CPPUNIT_ASSERT_EQUAL(5, keydown.GetCount());
    CPPUNIT_ASSERT_EQUAL(5, keyup.GetCount());
    CPPUNIT_ASSERT_EQUAL(4, keychar.GetCount());
#endif
}
Exemplo n.º 7
0
int
main(void)
{
  asteroids.lives         = START_LIVES;
  asteroids.display       = NULL;
  asteroids.timer         = NULL;
  asteroids.event_queue   = NULL;
  SHIP *ship;

  bool redraw = true;
  bool quit   = false;
  bool key[7] = { false };

  seed_rand();
  atexit(shutdown);

  if(!init())
    exit(EXIT_FAILURE);

  if((asteroids.high_score = get_config_value("high_score")) == NULL)
    asteroids.high_score = "0";

  asteroids.level = level_create(0, 0);

  if(!(ship = ship_create()))
    exit(EXIT_FAILURE);

  al_flip_display();
  al_start_timer(asteroids.timer);

  while(!quit) {
    ALLEGRO_EVENT ev;
    al_wait_for_event(asteroids.event_queue, &ev);

    if(ev.type == ALLEGRO_EVENT_TIMER) {
      /* start game */
      if(asteroids.level->number == 0 && key[KEY_S]) {
        start();
        continue;
      }

      /* are we out of asteroids to destroy? */
      if(list_length(asteroids.level->asteroids) == 0)
        asteroids.level = level_next(asteroids.level);

      /* update objects */
      ship = ship_update(ship, key, asteroids.timer);
      explosions_update();
      asteroids.level = level_update(asteroids.level, ship, key, asteroids.timer);

      /* ship->asteroid collisions. */
      check_ship_asteroid_collisions(ship, asteroids.level->asteroids);

      /* ship[missile] -> asteroid collisions. */
      check_ship_missile_asteroid_collisions(asteroids.level, ship);

      /* ship[missile] -> saucer collisions. */
      check_ship_missile_saucer_collisions(asteroids.level, ship);

      /* saucer[missile] -> ship collisions. */
      check_saucer_missile_ship_collisions(asteroids.level, ship);

      /* saucer[missile] -> asteroid collisions. */
      check_saucer_missile_asteroids_collisions(asteroids.level);

      /* saucer->asteroid collisions. */
      check_saucer_asteroid_collisions(asteroids.level);

      redraw = true;
    } else if(ev.type == ALLEGRO_EVENT_KEY_DOWN) {
      keydown(ev, key);
      quit = key[KEY_ESCAPE];
    } else if(ev.type == ALLEGRO_EVENT_KEY_UP) {
      keyup(ev, key);
      ship->fire_debounce  = key[KEY_SPACE];
      ship->hyper_debounce = key[KEY_LCONTROL];
    }

    if(redraw && al_is_event_queue_empty(asteroids.event_queue)) {
      redraw = false;
      al_clear_to_color(al_map_rgb(BLACK));

      level_draw(asteroids.level);
      draw_lives();
      draw_high_score();
      animation_draw_list(asteroids.explosions);

      if(asteroids.level->number == 0) {
        draw_home();
        al_flip_display();
        continue;
      }

      if(asteroids.lives > 0) {
        ship_draw(ship, key[KEY_UP]);
        missile_draw_list(ship->missiles);
      } else {
        if(ship->explosion)
          ship_draw(ship, false);
        draw_gameover();
      }

      al_flip_display();
    }
  };

  /* FIXME: cleanup */
  if(asteroids.timer != NULL)
    al_destroy_timer(asteroids.timer);
  if(asteroids.event_queue != NULL)
    al_destroy_event_queue(asteroids.event_queue);
  if(asteroids.display != NULL)
    al_destroy_display(asteroids.display);

  LIST *head = list_first(asteroids.level->asteroids);
  while(head != NULL) {
    ASTEROID *rock = (ASTEROID *) head->data;
    asteroid_free(rock);
    head = head->next;
  }
  ship_free(ship);

  al_destroy_bitmap(asteroids.lives_sprite);
  ship_shutdown();
  missile_shutdown();
  asteroid_shutdown();
  explosion_shutdown();

  al_uninstall_keyboard();

  exit(EXIT_SUCCESS);
}
Exemplo n.º 8
0
// The main Allegro loop, all input handling, animation and drawing is done here
_Bool main_loop(void)
{
    // Flag for drawing
    _Bool needredraw = true;
    // Declare primitive data types
    float old_time = 0.0, current_time = 0, dt = 0;

    while(!data->exit)
    {
        if(needredraw && al_event_queue_is_empty(data->queue) && al_event_queue_is_empty(data->queue2))
        {
            // Clear, draw, flip
            al_clear_to_color(data->background_color);
            render();
            if(get_fps_status())
                al_draw_textf(data->font, data->text_color, 0, res_height-30, 0, "fps: %.2f", 1/dt);
            al_flip_display();
            needredraw = false;
        }

        // Block until an event enters the queue
        al_wait_for_event(data->queue, &(data->event));

        while(!al_event_queue_is_empty(data->queue2))
        {
            al_get_next_event(data->queue2, &(data->event2));
            switch(data->event2.type)
            {
                case ALLEGRO_EVENT_DISPLAY_CLOSE:
                {
                    // If x button is pressed on window
                    data->exit = true;
                    data->gamestarted = false;
                }
                break;
                case ALLEGRO_EVENT_DISPLAY_RESIZE:
                {
                    al_acknowledge_resize(data->event2.display.source);
                    scale(res_width, res_height);
                }
                break;
                case ALLEGRO_EVENT_MOUSE_AXES:
                {
                    // Stores the mouse's new position and change in position
                    mouseaxes(&(data->event2.mouse));
                }
                case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN:
                {
                    // Stores the mouse button pressed
                    mousedown(&(data->event2.mouse));
                }
                break;
                case ALLEGRO_EVENT_MOUSE_BUTTON_UP:
                {
                    // Stores the mouse button released
                    mouseup(&(data->event2.mouse));
                }
                break;
                case ALLEGRO_EVENT_KEY_DOWN:
                {
                    // Stores keydown keycode into keycode array for processing
                    keydown(&(data->event2.keyboard));
                }
                break;
                case ALLEGRO_EVENT_KEY_UP:
                {
                    // Stores keycode into keycode array for processing
                    keyup(&(data->event2.keyboard));
                }
                break;
                default:
                break;
            }
        }

        switch (data->event.type)
        {
            case ALLEGRO_EVENT_TIMER:
            {
                // Determine the change in time between frames, in seconds
				current_time = al_current_time();
				dt = current_time-old_time;

				// If the computer lags for some reason, don't penalize the player
				// Cap dt at 0.5 seconds
				if(dt > 0.25)
				{
                    dt = 0.25;
				}

				// Handle Mouse and Keyboard events and Button Events
				buttoncheck(&buttonhandler, data);
				keycheck(&keyhandler, data);
				mousecheck(&mousehandler, data);
				keyupdate();
                mouseupdate();

                // Check if data->quit has been set before updating and drawing
                if(data->exit) break;

                // Update the game, always
                update();

                // Skip drawing frames if computer lags
                if(current_time - data->event.timer.timestamp <= 1.0/al_get_display_refresh_rate(data->display))
                {
                    needredraw = true;
                }

				// Make the time at this frame the old time, for the next frame
				old_time = current_time;
            }
            break;
            default:
            break;
        }
    }
    return true;
}
Exemplo n.º 9
0
static void g15_process_keys(g15daemon_t *masterlist, unsigned int currentkeys, unsigned int lastkeys)
{
    /* 'G' keys */
    if((currentkeys & G15_KEY_G1) && !(lastkeys & G15_KEY_G1))
        keydown(GKEY_OFFSET);
    else if(!(currentkeys & G15_KEY_G1) && (lastkeys & G15_KEY_G1))
        keyup(GKEY_OFFSET);

    if((currentkeys & G15_KEY_G2) && !(lastkeys & G15_KEY_G2))
        keydown(GKEY_OFFSET+1);
    else if(!(currentkeys & G15_KEY_G2) && (lastkeys & G15_KEY_G2))
        keyup(GKEY_OFFSET+1);

    if((currentkeys & G15_KEY_G3) && !(lastkeys & G15_KEY_G3))
        keydown(GKEY_OFFSET+2);
    else if(!(currentkeys & G15_KEY_G3) && (lastkeys & G15_KEY_G3))
        keyup(GKEY_OFFSET+2);

    if((currentkeys & G15_KEY_G4) && !(lastkeys & G15_KEY_G4))
        keydown(GKEY_OFFSET+3);
    else if(!(currentkeys & G15_KEY_G4) && (lastkeys & G15_KEY_G4))
        keyup(GKEY_OFFSET+3);

    if((currentkeys & G15_KEY_G5) && !(lastkeys & G15_KEY_G5))
        keydown(GKEY_OFFSET+4);
    else if(!(currentkeys & G15_KEY_G5) && (lastkeys & G15_KEY_G5))
        keyup(GKEY_OFFSET+4);

    if((currentkeys & G15_KEY_G6) && !(lastkeys & G15_KEY_G6))
        keydown(GKEY_OFFSET+5);
    else if(!(currentkeys & G15_KEY_G6) && (lastkeys & G15_KEY_G6))
        keyup(GKEY_OFFSET+5);

    if((currentkeys & G15_KEY_G7) && !(lastkeys & G15_KEY_G7))
        keydown(GKEY_OFFSET+6);
    else if(!(currentkeys & G15_KEY_G7) && (lastkeys & G15_KEY_G7))
        keyup(GKEY_OFFSET+6);

    if((currentkeys & G15_KEY_G8) && !(lastkeys & G15_KEY_G8))
        keydown(GKEY_OFFSET+7);
    else if(!(currentkeys & G15_KEY_G8) && (lastkeys & G15_KEY_G8))
        keyup(GKEY_OFFSET+7);

    if((currentkeys & G15_KEY_G9) && !(lastkeys & G15_KEY_G9))
        keydown(GKEY_OFFSET+8);
    else if(!(currentkeys & G15_KEY_G9) && (lastkeys & G15_KEY_G9))
        keyup(GKEY_OFFSET+8);

    if((currentkeys & G15_KEY_G10) && !(lastkeys & G15_KEY_G10))
        keydown(GKEY_OFFSET+9);
    else if(!(currentkeys & G15_KEY_G10) && (lastkeys & G15_KEY_G10))
        keyup(GKEY_OFFSET+9);

    if((currentkeys & G15_KEY_G11) && !(lastkeys & G15_KEY_G11))
        keydown(GKEY_OFFSET+10);
    else if(!(currentkeys & G15_KEY_G11) && (lastkeys & G15_KEY_G11))
        keyup(GKEY_OFFSET+10);

    if((currentkeys & G15_KEY_G12) && !(lastkeys & G15_KEY_G12))
        keydown(GKEY_OFFSET+11);
    else if(!(currentkeys & G15_KEY_G12) && (lastkeys & G15_KEY_G12))
        keyup(GKEY_OFFSET+11);

    if((currentkeys & G15_KEY_G13) && !(lastkeys & G15_KEY_G13))
        keydown(GKEY_OFFSET+12);
    else if(!(currentkeys & G15_KEY_G13) && (lastkeys & G15_KEY_G13))
        keyup(GKEY_OFFSET+12);

    if((currentkeys & G15_KEY_G14) && !(lastkeys & G15_KEY_G14))
        keydown(GKEY_OFFSET+13);
    else if(!(currentkeys & G15_KEY_G14) && (lastkeys & G15_KEY_G14))
        keyup(GKEY_OFFSET+13);

    if((currentkeys & G15_KEY_G15) && !(lastkeys & G15_KEY_G15))
        keydown(GKEY_OFFSET+14);
    else if(!(currentkeys & G15_KEY_G15) && (lastkeys & G15_KEY_G15))
        keyup(GKEY_OFFSET+14);

    if((currentkeys & G15_KEY_G16) && !(lastkeys & G15_KEY_G16))
        keydown(GKEY_OFFSET+15);
    else if(!(currentkeys & G15_KEY_G16) && (lastkeys & G15_KEY_G16))
        keyup(GKEY_OFFSET+15);

    if((currentkeys & G15_KEY_G17) && !(lastkeys & G15_KEY_G17))
        keydown(GKEY_OFFSET+16);
    else if(!(currentkeys & G15_KEY_G17) && (lastkeys & G15_KEY_G17))
        keyup(GKEY_OFFSET+16);

    if((currentkeys & G15_KEY_G18) && !(lastkeys & G15_KEY_G18))
        keydown(GKEY_OFFSET+17);
    else if(!(currentkeys & G15_KEY_G18) && (lastkeys & G15_KEY_G18))
        keyup(GKEY_OFFSET+17);

    /* 'M' keys */

    if((currentkeys & G15_KEY_M1) && !(lastkeys & G15_KEY_M1))
        keydown(MKEY_OFFSET);
    else if(!(currentkeys & G15_KEY_M1) && (lastkeys & G15_KEY_M1))
        keyup(MKEY_OFFSET);

    if((currentkeys & G15_KEY_M2) && !(lastkeys & G15_KEY_M2))
        keydown(MKEY_OFFSET+1);
    else if(!(currentkeys & G15_KEY_M2) && (lastkeys & G15_KEY_M2))
        keyup(MKEY_OFFSET+1);

    if((currentkeys & G15_KEY_M3) && !(lastkeys & G15_KEY_M3))
        keydown(MKEY_OFFSET+2);
    else if(!(currentkeys & G15_KEY_M3) && (lastkeys & G15_KEY_M3))
        keyup(MKEY_OFFSET+2);

    if((currentkeys & G15_KEY_MR) && !(lastkeys & G15_KEY_MR))
        keydown(MKEY_OFFSET+3);
    else if(!(currentkeys & G15_KEY_MR) && (lastkeys & G15_KEY_MR))
        keyup(MKEY_OFFSET+3);
    
    if(map_Lkeys){
        /* 'L' keys...  */
        if((currentkeys & G15_KEY_L1) && !(lastkeys & G15_KEY_L1))
            keydown(LKEY_OFFSET);
        else if(!(currentkeys & G15_KEY_L1) && (lastkeys & G15_KEY_L1))
            keyup(LKEY_OFFSET);

        if((currentkeys & G15_KEY_L2) && !(lastkeys & G15_KEY_L2))
            keydown(LKEY_OFFSET+1);
        else if(!(currentkeys & G15_KEY_L2) && (lastkeys & G15_KEY_L2))
            keyup(LKEY_OFFSET+1);

        if((currentkeys & G15_KEY_L3) && !(lastkeys & G15_KEY_L3))
            keydown(LKEY_OFFSET+2);
        else if(!(currentkeys & G15_KEY_L3) && (lastkeys & G15_KEY_L3))
            keyup(LKEY_OFFSET+2);

        if((currentkeys & G15_KEY_L4) && !(lastkeys & G15_KEY_L4))
            keydown(LKEY_OFFSET+3);
        else if(!(currentkeys & G15_KEY_L4) && (lastkeys & G15_KEY_L4))
            keyup(LKEY_OFFSET+3);

        if((currentkeys & G15_KEY_L5) && !(lastkeys & G15_KEY_L5))
            keydown(LKEY_OFFSET+4);
        else if(!(currentkeys & G15_KEY_L5) && (lastkeys & G15_KEY_L5))
            keyup(LKEY_OFFSET+4);
    }
}
Exemplo n.º 10
0
void window::main_loop()
{
  SDL_Event event;

  while(true)
  {
    while(SDL_PollEvent(&event))
    {
      switch(event.type) {
        case SDL_KEYDOWN:
          switch(event.key.keysym.sym)
	  {
            case SDLK_ESCAPE:
              exit(0);
              break;

            default:
	      keydown(event.key.keysym.sym);
              break;
          }
          break;
	case SDL_KEYUP:
	  keyup(event.key.keysym.sym);
          break;
	case SDL_MOUSEBUTTONDOWN:
	  switch(event.button.button)
	  {
	    case SDL_BUTTON_LEFT:
	      {
		const float x_screen = static_cast<float>(event.button.x);
		const float y_screen = static_cast<float>(event.button.y);

		// scaling from <0,width> to <-1,1>
		const float x_scaled =
		  2.0 * (x_screen - static_cast<float>(width) / 2.0)
		  / static_cast<float>(width);
		const float y_scaled = 
		  2.0 * (y_screen - static_cast<float>(height) / 2.0)
		  / static_cast<float>(height);
		
		mousedown(x_scaled, y_scaled);
	      }
	      break;
	    case SDL_BUTTON_WHEELUP:
	      mousewheelup();
	      break;
	    case SDL_BUTTON_WHEELDOWN:
	      mousewheeldown();
	      break;
	  }
	  break;
	case SDL_MOUSEBUTTONUP:
	  if(event.button.button == SDL_BUTTON_LEFT)
	    mouseup();
	  break;
	case SDL_MOUSEMOTION:
	  {
	    const float x_screen = static_cast<float>(event.motion.x);
	    const float y_screen = static_cast<float>(event.motion.y);

	    // scaling from <0,width> to <-1,1>
	    const float x_scaled =
	      2.0 * (x_screen - static_cast<float>(width) / 2.0)
	      / static_cast<float>(width);
	    const float y_scaled = 
	      2.0 * (y_screen - static_cast<float>(height) / 2.0)
	      / static_cast<float>(height);

	    mousemotion(x_scaled, y_scaled);
	  }
	  break;
	case SDL_VIDEORESIZE:
	  handle_resize(event.resize.w, event.resize.h);
	  break;
        case SDL_QUIT:
          exit(0);
          break;
      }
    }

    frame();
  }
}
Exemplo n.º 11
0
int handleEvent(SDL_Event *event, GameObjectData *gameObjectData, UIData *uiData, ControlsData *controlsData, GraphicsData *graphicsData){
		uiData->event = event;
		switch (event->type)
		{
			/* Closing the Window will exit the program */
			case SDL_WINDOWEVENT:
				switch (event->window.event){
					case SDL_WINDOWEVENT_RESIZED:
						UIRoot_Execute(uiData,WINDOW_RESIZE,0);
						break;
				}
				break;
			case SDL_MOUSEMOTION:
				UIRoot_Execute(uiData,MOTION,0);
				break;
			case SDL_MOUSEBUTTONDOWN:
				if(isMouseFree(controlsData)){
					/* We only want to catch new mouse clicks if the mouse is not having
					   a button held down */
					/* trust me */
					if(event->button.button == SDL_BUTTON_LEFT){
					  UIRoot_ExecuteUpwards(uiData,LEFT_CLICK,1);
						selectGameObject(gameObjectData,graphicsData,event);

					}
					else if(event->button.button == SDL_BUTTON_RIGHT){
					  UIRoot_ExecuteUpwards(uiData,RIGHT_CLICK,1);
					}
				}
				break;
			case SDL_MOUSEBUTTONUP:
				if(event->button.button == SDL_BUTTON_LEFT){
				  UIRoot_Execute(uiData,LEFT_RELEASE,0);
							controlsData->mouseButtons[LEFT_CLICK_BUTTON] = 0;
				}
				else if(event->button.button == SDL_BUTTON_RIGHT){
				  UIRoot_Execute(uiData,RIGHT_RELEASE,0);
							controlsData->mouseButtons[RIGHT_CLICK_BUTTON] = 0;
				}
				break;
			case SDL_KEYDOWN:
				return keydown(controlsData,gameObjectData, graphicsData, uiData,event);
				break;
			case SDL_KEYUP:
				return keyup(controlsData,gameObjectData, uiData,event);
				break;
			case SDL_QUIT:
				return 0;
			case SDL_MOUSEWHEEL:
				UIRoot_Execute(uiData,MOUSEWHEEL,0);
				break;
		    default:
		    	if(gameObjectData->gameOverEventNum == event->type){
		      		UIRoot_Execute(uiData,GAME_OVER,0);
		      	}else if(gameObjectData->objectDisplayEventNum == event->type){
		      		UIRoot_Execute(uiData,OBJECT_DISPLAY,0);
		      	}
		    	break;
		}
		return 1;
}