Пример #1
0
static PyObject* ekg_cmd_window_list(PyObject *self, PyObject *args)
{
	int i, start, stop, *windowlist;
	PyObject *wynik, *val;

	if (!PyArg_ParseTuple(args, "ii", &start, &stop))
		return NULL;

	if (start < 1 || start > stop) {
		PyErr_SetString(PyExc_ValueError, "invalid range");
		return NULL;
	}

	windowlist = xmalloc((stop - start + 2) * sizeof(int));

	ui_event("get_window_list", windowlist, start, stop);

	wynik = PyList_New(windowlist[0]);

	for (i = 0; i < windowlist[0]; i++) {
		val = Py_BuildValue("i", windowlist[i + 1]);
		PyList_SetItem(wynik, i, val);
	}

	xfree(windowlist);

	return wynik;
}
Пример #2
0
static PyObject* ekg_cmd_window_printat(PyObject *self, PyObject *args)
{
	char *target = NULL, *text = NULL;
	int id, x, y;

	if (PyArg_ParseTuple(args, "siis", &target, &x, &y, &text)) {
		ui_event("printat", target, 0, x, y, text, NULL);
		return Py_BuildValue("");
	}

	if (PyArg_ParseTuple(args, "iiis", &id, &x, &y, &text)) {
		ui_event("printat", NULL, id, x, y, text, NULL);
		return Py_BuildValue("");
	}

	return NULL;
}
Пример #3
0
int main(int argc, char **argv) {

    corange_init("../../core_assets");

    sea_init();

    int running = 1;
    SDL_Event event;

    while(running) {

        frame_begin();

        while(SDL_PollEvent(&event)) {
            switch(event.type) {
            case SDL_KEYDOWN:
            case SDL_KEYUP:
                if (event.key.keysym.sym == SDLK_ESCAPE) {
                    running = 0;
                }
                if (event.key.keysym.sym == SDLK_PRINT) {
                    graphics_viewport_screenshot();
                }
                break;
            case SDL_QUIT:
                running = 0;
                break;
            }
            sea_event(event);
            ui_event(event);
        }

        sea_update();
        ui_update();

        sea_render();
        ui_render();

        SDL_GL_SwapBuffers();

        frame_end();
    }

    sea_finish();

    corange_finish();

    return 0;

}
Пример #4
0
/// Undisplay the popup menu (later).
void pum_undisplay(void)
{
  pum_is_visible = false;
  pum_array = NULL;

  if (pum_external) {
    Array args = ARRAY_DICT_INIT;
    ui_event("popupmenu_hide", args);
  } else {
    redraw_all_later(SOME_VALID);
    redraw_tabline = true;
    status_redraw_all();
  }
}
Пример #5
0
static void
spectrum_frame_event_fn( libspectrum_dword last_tstates, int type,
			 void *user_data )
{
  if( rzx_playback ) event_force_events();
  rzx_frame();
  psg_frame();
  spectrum_frame();
  z80_interrupt();
  ui_joystick_poll();
  timer_estimate_speed();
  debugger_add_time_events();
  ui_event();
  ui_error_frame();
}
Пример #6
0
static PyObject* ekg_cmd_window_commit(PyObject *self, PyObject *args)
{
	ui_event("commit", NULL);

	return Py_BuildValue("");
}
Пример #7
0
int main(int argc, char **argv) {
  
  corange_init("../../core_assets");
  
  scotland_init();
  
  int running = 1;
  SDL_Event event;
  
  while(running) {
    
    frame_begin();
    
    while(SDL_PollEvent(&event)) {
      switch(event.type){
      case SDL_KEYDOWN:
      case SDL_KEYUP:
        if (event.key.keysym.sym == SDLK_ESCAPE) { running = 0; }
        if (event.key.keysym.sym == SDLK_PRINT) { graphics_viewport_screenshot(); }
        break;
      case SDL_QUIT:
        running = 0;
        break;
      }
      if (loading_resources) {
        ui_event(event);
      } else {
        scotland_event(event);
        ui_event(event);
      }
      
    }
    
    if (loading_resources) {
      ui_update();
    } else {
      scotland_update();
      ui_update();
    }
    
    
    if (loading_resources) {
      glClearColor(0.0, 0.0, 0.0, 0.0);
      glClear(GL_COLOR_BUFFER_BIT);
      ui_render();
    } else {
      scotland_render();
      ui_render();
    }
    
    SDL_GL_SwapBuffers(); 
    
    frame_end();
  }
  
  scotland_finish();
  
  corange_finish();
  
  return 0;
}
Пример #8
0
int main(int argc, char **argv) {

#ifdef _WIN32
    FILE* ctt = fopen("CON", "w" );
    FILE* fout = freopen( "CON", "w", stdout );
    FILE* ferr = freopen( "CON", "w", stderr );
#endif

    corange_init("../../assets_core");

    graphics_viewport_set_size(1280, 720);
    graphics_viewport_set_title("Noise");

    folder_load(P("./"));
    file_load(P("$CORANGE/textures/random.dds"));

    glClearColor(1.0, 0.0, 0.0, 1.0);

    ui_button* info_button = ui_elem_new("info_button", ui_button);
    ui_button_move(info_button, vec2_new(10, 10));
    ui_button_resize(info_button, vec2_new(460,25));
    ui_button_set_label(info_button, "Procedural texture from perlin noise and feedback functions");

    ui_button* save_button = ui_elem_new("save_button", ui_button);
    ui_button_move(save_button, vec2_new(480, 10));
    ui_button_resize(save_button, vec2_new(380,25));
    ui_button_set_label(save_button, "Click Here to save tileable perlin noise to file");
    ui_button_set_onclick(save_button, save_noise_to_file);

    ui_button* spinner_box = ui_elem_new("spinner_box", ui_button);
    ui_button_resize(spinner_box, vec2_new(32, 32));
    ui_button_move(spinner_box, vec2_new(870, 7));
    ui_button_set_label(spinner_box, "");

    ui_spinner* save_spinner = ui_elem_new("save_spinner", ui_spinner);
    save_spinner->color = vec4_new(1,1,1,0);
    save_spinner->top_left = vec2_new(874, 11);
    save_spinner->bottom_right = vec2_add(save_spinner->top_left, vec2_new(24,24));

    srand(time(NULL));
    shader_time = (float)rand() / (RAND_MAX / 1000);

    bool running = true;
    while(running) {
        frame_begin();

        SDL_Event event;
        while(SDL_PollEvent(&event)) {

            switch(event.type) {
            case SDL_KEYDOWN:
            case SDL_KEYUP:
                if (event.key.keysym.sym == SDLK_ESCAPE) {
                    running = 0;
                }
                if (event.key.keysym.sym == SDLK_PRINTSCREEN) {
                    graphics_viewport_screenshot();
                }
                break;
            case SDL_QUIT:
                running = 0;
                break;
                break;
            }

            ui_event(event);

        }

        shader_time += frame_time();
        ui_update();

        noise_render();
        ui_render();

        graphics_swap();

        frame_end();

    }

    SDL_WaitThread(save_thread, NULL);

    corange_finish();

    return 0;
}
Пример #9
0
/// Show the popup menu with items "array[size]".
/// "array" must remain valid until pum_undisplay() is called!
/// When possible the leftmost character is aligned with screen column "col".
/// The menu appears above the screen line "row" or at "row" + "height" - 1.
///
/// @param array
/// @param size
/// @param selected index of initially selected item, none if out of range
/// @param array_changed if true, array contains different items since last call
///                      if false, a new item is selected, but the array
///                      is the same
void pum_display(pumitem_T *array, int size, int selected, bool array_changed)
{
  int w;
  int def_width;
  int max_width;
  int kind_width;
  int extra_width;
  int i;
  int top_clear;
  int row;
  int context_lines;
  int col;
  int above_row = cmdline_row;
  int redo_count = 0;

  if (!pum_is_visible) {
    // To keep the code simple, we only allow changing the
    // draw mode when the popup menu is not being displayed
    pum_external = pum_wants_external;
  }

redo:
  // Mark the pum as visible already here,
  // to avoid that must_redraw is set when 'cursorcolumn' is on.
  pum_is_visible = true;
  validate_cursor_col();

  // anchor position: the start of the completed word
  row = curwin->w_wrow + curwin->w_winrow;
  if (curwin->w_p_rl) {
    col = curwin->w_wincol + curwin->w_width - curwin->w_wcol - 1;
  } else {
    col = curwin->w_wincol + curwin->w_wcol;
  }

  if (pum_external) {
    Array args = ARRAY_DICT_INIT;
    if (array_changed) {
      Array arr = ARRAY_DICT_INIT;
      for (i = 0; i < size; i++) {
        Array item = ARRAY_DICT_INIT;
        ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_text)));
        ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_kind)));
        ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_extra)));
        ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_info)));
        ADD(arr, ARRAY_OBJ(item));
      }
      ADD(args, ARRAY_OBJ(arr));
      ADD(args, INTEGER_OBJ(selected));
      ADD(args, INTEGER_OBJ(row));
      ADD(args, INTEGER_OBJ(col));
      ui_event("popupmenu_show", args);
    } else {
      ADD(args, INTEGER_OBJ(selected));
      ui_event("popupmenu_select", args);
    }
    return;
  }

  def_width = PUM_DEF_WIDTH;
  max_width = 0;
  kind_width = 0;
  extra_width = 0;

  if (firstwin->w_p_pvw) {
    top_clear = firstwin->w_height;
  } else {
    top_clear = 0;
  }

  // When the preview window is at the bottom stop just above it.  Also
  // avoid drawing over the status line so that it's clear there is a window
  // boundary.
  if (lastwin->w_p_pvw) {
    above_row -= lastwin->w_height + lastwin->w_status_height + 1;
  }

  // Figure out the size and position of the pum.
  if (size < PUM_DEF_HEIGHT) {
    pum_height = size;
  } else {
    pum_height = PUM_DEF_HEIGHT;
  }

  if ((p_ph > 0) && (pum_height > p_ph)) {
    pum_height = (int)p_ph;
  }

  // Put the pum below "row" if possible.  If there are few lines decide on
  // where there is more room.
  if ((row  + 2 >= above_row - pum_height)
      && (row > (above_row - top_clear) / 2)) {
    // pum above "row"

    // Leave two lines of context if possible
    if (curwin->w_wrow - curwin->w_cline_row >= 2) {
      context_lines = 2;
    } else {
      context_lines = curwin->w_wrow - curwin->w_cline_row;
    }

    if (row >= size + context_lines) {
      pum_row = row - size - context_lines;
      pum_height = size;
    } else {
      pum_row = 0;
      pum_height = row - context_lines;
    }

    if ((p_ph > 0) && (pum_height > p_ph)) {
      pum_row += pum_height - (int)p_ph;
      pum_height = (int)p_ph;
    }
  } else {
    // pum below "row"

    // Leave two lines of context if possible
    if (curwin->w_cline_row + curwin->w_cline_height - curwin->w_wrow >= 3) {
      context_lines = 3;
    } else {
      context_lines = curwin->w_cline_row
                      + curwin->w_cline_height - curwin->w_wrow;
    }

    pum_row = row + context_lines;
    if (size > above_row - pum_row) {
      pum_height = above_row - pum_row;
    } else {
      pum_height = size;
    }

    if ((p_ph > 0) && (pum_height > p_ph)) {
      pum_height = (int)p_ph;
    }
  }

  // don't display when we only have room for one line
  if ((pum_height < 1) || ((pum_height == 1) && (size > 1))) {
    return;
  }

  // If there is a preview window at the top avoid drawing over it.
  if (firstwin->w_p_pvw
      && (pum_row < firstwin->w_height)
      && (pum_height > firstwin->w_height + 4)) {
    pum_row += firstwin->w_height;
    pum_height -= firstwin->w_height;
  }

  // Compute the width of the widest match and the widest extra.
  for (i = 0; i < size; ++i) {
    w = vim_strsize(array[i].pum_text);

    if (max_width < w) {
      max_width = w;
    }

    if (array[i].pum_kind != NULL) {
      w = vim_strsize(array[i].pum_kind) + 1;

      if (kind_width < w) {
        kind_width = w;
      }
    }

    if (array[i].pum_extra != NULL) {
      w = vim_strsize(array[i].pum_extra) + 1;

      if (extra_width < w) {
        extra_width = w;
      }
    }
  }
  pum_base_width = max_width;
  pum_kind_width = kind_width;

  // if there are more items than room we need a scrollbar
  if (pum_height < size) {
    pum_scrollbar = 1;
    max_width++;
  } else {
    pum_scrollbar = 0;
  }

  if (def_width < max_width) {
    def_width = max_width;
  }

  if ((((col < Columns - PUM_DEF_WIDTH) || (col < Columns - max_width))
       && !curwin->w_p_rl)
      || (curwin->w_p_rl && ((col > PUM_DEF_WIDTH) || (col > max_width)))) {
    // align pum column with "col"
    pum_col = col;
    if (curwin->w_p_rl) {
      pum_width = pum_col - pum_scrollbar + 1;
    } else {
      assert(Columns - pum_col - pum_scrollbar >= INT_MIN
             && Columns - pum_col - pum_scrollbar <= INT_MAX);
      pum_width = (int)(Columns - pum_col - pum_scrollbar);
    }

    if ((pum_width > max_width + kind_width + extra_width + 1)
        && (pum_width > PUM_DEF_WIDTH)) {
      pum_width = max_width + kind_width + extra_width + 1;

      if (pum_width < PUM_DEF_WIDTH) {
        pum_width = PUM_DEF_WIDTH;
      }
    }
  } else if (Columns < def_width) {
    // not enough room, will use what we have
    if (curwin->w_p_rl) {
      assert(Columns - 1 >= INT_MIN);
      pum_col = (int)(Columns - 1);
    } else {
      pum_col = 0;
    }
    assert(Columns - 1 >= INT_MIN);
    pum_width = (int)(Columns - 1);
  } else {
    if (max_width > PUM_DEF_WIDTH) {
      // truncate
      max_width = PUM_DEF_WIDTH;
    }

    if (curwin->w_p_rl) {
      pum_col = max_width - 1;
    } else {
      assert(Columns - max_width >= INT_MIN && Columns - max_width <= INT_MAX);
      pum_col = (int)(Columns - max_width);
    }
    pum_width = max_width - pum_scrollbar;
  }

  pum_array = array;
  pum_size = size;

  // Set selected item and redraw.  If the window size changed need to redo
  // the positioning.  Limit this to two times, when there is not much
  // room the window size will keep changing.
  if (pum_set_selected(selected, redo_count) && (++redo_count <= 2)) {
    goto redo;
  }
}
Пример #10
0
int main(int argc, char **argv) {
  
  #ifdef _WIN32
    FILE* ctt = fopen("CON", "w" );
    FILE* fout = freopen( "CON", "w", stdout );
    FILE* ferr = freopen( "CON", "w", stderr );
  #endif
  
  corange_init("../../assets_core");
  
  graphics_viewport_set_title("Teapot");
  graphics_viewport_set_size(1280, 720);
  
  camera* cam = entity_new("camera", camera);
  cam->position = vec3_new(5, 5, 5);
  cam->target =  vec3_new(0, 0, 0);
  
  teapot_shader = asset_hndl_new_load(P("./assets/teapot.mat"));
  teapot_object = asset_hndl_new_load(P("./assets/teapot.obj"));
  
  int running = 1;
  SDL_Event e = {0};
  
  while(running) {
    
    frame_begin();
    
    camera* cam = entity_get("camera");
    
    while(SDL_PollEvent(&e)) {
      switch(e.type){
      case SDL_KEYDOWN:
      case SDL_KEYUP:
        if (e.key.keysym.sym == SDLK_ESCAPE) { running = 0; }
        if (e.key.keysym.sym == SDLK_PRINTSCREEN) { graphics_viewport_screenshot(); }
        if (e.key.keysym.sym == SDLK_r &&
            e.key.keysym.mod == KMOD_LCTRL) {
            asset_reload_all();
        }
        break;
      case SDL_QUIT:
        running = 0;
        break;
      }
      camera_control_orbit(cam, e);
      ui_event(e);
    }
    
    ui_update();
    
    glClearColor(0.25, 0.25, 0.25, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);
    
    shader_program* shader = material_first_program(asset_hndl_ptr(&teapot_shader));
    shader_program_enable(shader);
    shader_program_set_mat4(shader, "world", mat4_id());
    shader_program_set_mat4(shader, "view", camera_view_matrix(cam));
    shader_program_set_mat4(shader, "proj", camera_proj_matrix(cam));
      
    shader_program_set_texture(shader, "cube_beach", 0, asset_hndl_new_load(P("$CORANGE/water/cube_sea.dds")));
    shader_program_set_vec3(shader, "camera_direction", camera_direction(cam));
    
    renderable* r = asset_hndl_ptr(&teapot_object);
    
    for(int i=0; i < r->num_surfaces; i++) {
      
      renderable_surface* s = r->surfaces[i];
      
      int mentry_id = min(i, ((material*)asset_hndl_ptr(&r->material))->num_entries-1);
      material_entry* me = material_get_entry(asset_hndl_ptr(&r->material), mentry_id);
      
      glBindBuffer(GL_ARRAY_BUFFER, s->vertex_vbo);
      
      shader_program_enable_attribute(shader, "vPosition",  3, 18, (void*)0);
      shader_program_enable_attribute(shader, "vNormal",    3, 18, (void*)(sizeof(float) * 3));
      //shader_program_enable_attribute(shader, "vTangent",   3, 18, (void*)(sizeof(float) * 6));
      //shader_program_enable_attribute(shader, "vBinormal",  3, 18, (void*)(sizeof(float) * 9));
      //shader_program_enable_attribute(shader, "vTexcoord",  2, 18, (void*)(sizeof(float) * 12));
      
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->triangle_vbo);
        glDrawElements(GL_TRIANGLES, s->num_triangles * 3, GL_UNSIGNED_INT, (void*)0);
      
      shader_program_disable_attribute(shader, "vPosition");
      shader_program_disable_attribute(shader, "vNormal");
      //shader_program_disable_attribute(shader, "vTangent");
      //shader_program_disable_attribute(shader, "vBinormal");
      //shader_program_disable_attribute(shader, "vTexcoord");
      
      glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
      glBindBuffer(GL_ARRAY_BUFFER, 0);

    }
  
    shader_program_disable(shader);
    
    glDisable(GL_DEPTH_TEST);
    ui_render();
    
    graphics_swap();
    
    frame_end();
  }
  
  corange_finish();
  
  return 0;
  
}
Пример #11
0
int main(int argc, char **argv) {
  
  #ifdef _WIN32
    FILE* ctt = fopen("CON", "w" );
    FILE* fout = freopen( "CON", "w", stdout );
    FILE* ferr = freopen( "CON", "w", stderr );
  #endif
  
  /* Init Corange, pointing to the assets_core folder */
  corange_init("../../assets_core");
  graphics_viewport_set_title("Birdy");
  graphics_viewport_set_size(800, 600);

  platformer_init();
  
  /* Set the game running, create SDL_Event struct to monitor events */
  bool running = 1;
  SDL_Event event;
  
  while(running) {
    
    /* Frame functions used to monitor frame times, FPS and other */
    frame_begin();
    
    while(SDL_PollEvent(&event)) {

      switch(event.type){
      case SDL_KEYUP:
        /* Exit on ESCAPE and Screenshot on print screen */
        if (event.key.keysym.sym == SDLK_ESCAPE) { running = false; }
        if (event.key.keysym.sym == SDLK_PRINTSCREEN) { graphics_viewport_screenshot(); }
        break;
      case SDL_QUIT:
        /* A quitting event such as pressing cross in top right corner */
        running = false;
        break;
      }
      
      /* Also send this event off to the game and ui */
      platformer_event(event);
      ui_event(event);
    }
    
    platformer_update();
    ui_update();
    
    platformer_render();
    ui_render();
    
    /* Flip the Screen Buffer. We've finished with this frame. */
    graphics_swap(); 
    
    /* This allows us to fix the framerate to 60 fps, even on my laptop with vsync broken */
    frame_end();
  }
  
  platformer_finish();
  
  /* Corange will unload remaining assets and delete any remaining entities */
  corange_finish();
  
  return 0;
}
Пример #12
0
/*
 * variable_set()
 *
 * ustawia warto¶æ podanej zmiennej. je¶li to zmienna liczbowa lub boolowska,
 * zmienia ci±g na liczbê. w przypadku boolowskich, rozumie zwroty typu `on',
 * `off', `yes', `no' itp. je¶li dana zmienna jest bitmap±, akceptuje warto¶æ
 * w postaci listy flag oraz konstrukcje `+flaga' i `-flaga'.
 *
 *  - name - nazwa zmiennej,
 *  - value - nowa warto¶æ,
 *  - allow_foreign - czy ma pozwalaæ dopisywaæ obce zmienne.
 */
int variable_set(const char *name, const char *value, int allow_foreign)
{
	struct variable *v = variable_find(name);

	if (!v && allow_foreign) {
		variable_add(name, "##", VAR_FOREIGN, 2, xstrdup(value), NULL, NULL, NULL);
		return -1;
	}

	if (!v && !allow_foreign)
		return -1;

	switch (v->type) {
		case VAR_INT:
		case VAR_MAP:
		{
			const char *p = value;
			int hex, tmp;

			if (!value)
				return -2;

			if (v->map && v->type == VAR_INT && !xisdigit(*p)) {
				int i;

				for (i = 0; v->map[i].label; i++)
					if (!strcasecmp(v->map[i].label, value))
						value = itoa(v->map[i].value);
			}

			if (v->map && v->type == VAR_MAP && !xisdigit(*p)) {
				int i, k = *(int*)(v->ptr);
				int mode = 0; /* 0 set, 1 add, 2 remove */
				char **args;

				if (*p == '+') {
					mode = 1;
					p++;
				} else if (*p == '-') {
					mode = 2;
					p++;
				}

				if (!mode)
					k = 0;

				args = array_make(p, ",", 0, 1, 0);

				for (i = 0; args[i]; i++) {
					int j, found = 0;

					for (j = 0; v->map[j].label; j++) {
						if (!strcasecmp(args[i], v->map[j].label)) {
							found = 1;

							if (mode == 2)
								k &= ~(v->map[j].value);
							if (mode == 1)
								k &= ~(v->map[j].conflicts);
							if (mode == 1 || !mode)
								k |= v->map[j].value;
						}
					}

					if (!found) {
						array_free(args);
						return -2;
					}
				}

				array_free(args);

				value = itoa(k);
			}

			p = value;
				
			if ((hex = !strncasecmp(p, "0x", 2)))
				p += 2;

			while (*p && *p != ' ') {
				if (hex && !xisxdigit(*p))
					return -2;
				
				if (!hex && !xisdigit(*p))
					return -2;
				p++;
			}

			tmp = strtol(value, NULL, 0);

			if (v->map) {
				int i;

				for (i = 0; v->map[i].label; i++) {
					if ((tmp & v->map[i].value) && (tmp & v->map[i].conflicts))
						return -2;
				}
			}

			*(int*)(v->ptr) = tmp;

			if (v->notify)
				(v->notify)(v->name);

			if (ui_event)
				ui_event("variable_changed", v->name);
			
			return 0;
		}

		case VAR_BOOL:
		{
			int tmp;
		
			if (!value)
				return -2;
		
			if ((tmp = on_off(value)) == -1)
				return -2;

			*(int*)(v->ptr) = tmp;

			if (v->notify)
				(v->notify)(v->name);

			if (ui_event)
				ui_event("variable_changed", v->name);
		
			return 0;
		}

		case VAR_STR:
		{
			char **tmp = (char**)(v->ptr);
			
			xfree(*tmp);
			
			if (value) {
				if (*value == 1)
					*tmp = base64_decode(value + 1);
				else
					*tmp = xstrdup(value);
			} else
				*tmp = NULL;
	
			if (v->notify)
				(v->notify)(v->name);

			if (ui_event)
				ui_event("variable_changed", v->name);

			return 0;
		}
	}

	return -1;
}
Пример #13
0
void Input::poll() {
    // Process events
    initFrame();
    sf::Event Event;


    while (App->GetEvent(Event))
    {
        // Close window : exit
        if (Event.Type == sf::Event::Closed)
            inputQuit = true;

        if (ui_event(Event))
            continue;

        if (Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Escape)
            ui_togglePause();

        if (!ui_menuOpen()) {
            if (Event.Type == sf::Event::KeyPressed) {
                if(Event.Key.Code == inputs[INPUT_JUMP].key)
                    inputJump = true;
                if (Event.Key.Code == inputs[INPUT_SHOOT].key)
                    inputShoot = true;
                if (Event.Key.Code == inputs[INPUT_CROUCH].key)
                    inputCrouch = true;
            } else if(Event.Type == sf::Event::JoyButtonPressed
                      && Event.JoyButton.JoystickId == 0) {
                if(Event.JoyButton.Button == 0) {
                    inputShoot = true;
                } else if(Event.JoyButton.Button == 1) {
                    inputJump = true;
                }
            } else if(Event.Type == sf::Event::KeyReleased) {
                if(Event.Key.Code == inputs[INPUT_JUMP].key)
                    inputStopJump = true;
            } else if (Event.Type == sf::Event::JoyButtonReleased
                       && Event.JoyButton.JoystickId == 0) {
                if(Event.JoyButton.Button == 1) {
                    inputStopJump = true;
                }
            }
        }
        /*
        if(Event.Type == sf::Event::JoyButtonPressed) {
        	cout << "Button: " << Event.JoyButton.JoystickId <<
        		": " << Event.JoyButton.Button << "\n";
        }
        */
    }

    if (!ui_menuOpen()) {
        const sf::Input& appInput = App->GetInput();

        if(appInput.IsKeyDown(inputs[INPUT_LEFT].key) && !appInput.IsKeyDown(inputs[INPUT_RIGHT].key)) {
            inputDirection = Facing::Left;
        } else if(appInput.IsKeyDown(inputs[INPUT_RIGHT].key)) {
            inputDirection = Facing::Right;
        }

        float xAxis = appInput.GetJoystickAxis(0, sf::Joy::AxisX);
        float yAxis = appInput.GetJoystickAxis(0, sf::Joy::AxisY);

        if(xAxis > 50)
            inputDirection = Facing::Right;
        else if(xAxis < -50)
            inputDirection = Facing::Left;

        if(yAxis > 50)
            inputCrouch = true;


        if(appInput.IsKeyDown(inputs[INPUT_CROUCH].key)) {
            inputCrouch = true;
        }

        if(appInput.IsJoystickButtonDown(0, 0)) {
            inputShoot = true;
        }

        if(appInput.IsJoystickButtonDown(0, 1)) {
            inputCrouch = true;
        }
    }
}