static bool InputHandler_HandleCoreKey(Key key) {
	struct Screen* active = Gui_GetActiveScreen();

	if (key == KeyBinds[KEYBIND_HIDE_FPS]) {
		Gui_ShowFPS = !Gui_ShowFPS;
	} else if (key == KeyBinds[KEYBIND_FULLSCREEN]) {
		int state = Window_GetWindowState();
		if (state != WINDOW_STATE_MINIMISED) {
			bool fullscreen = state == WINDOW_STATE_FULLSCREEN;
			Window_SetWindowState(fullscreen ? WINDOW_STATE_NORMAL : WINDOW_STATE_FULLSCREEN);
		}
	} else if (key == KeyBinds[KEYBIND_FOG]) {
		short* viewDists = Gui_ClassicMenu ? classicViewDists : normViewDists;
		int count = Gui_ClassicMenu ? Array_Elems(classicViewDists) : Array_Elems(normViewDists);

		if (Key_IsShiftPressed()) {
			InputHandler_CycleDistanceBackwards(viewDists, count);
		} else {
			InputHandler_CycleDistanceForwards(viewDists, count);
		}
	} else if (key == KeyBinds[KEYBIND_INVENTORY] && active == Gui_HUD) {
		Gui_FreeActive();
		Gui_SetActive(InventoryScreen_MakeInstance());
	} else if (key == KEY_F5 && Game_ClassicMode) {
		int weather = Env.Weather == WEATHER_SUNNY ? WEATHER_RAINY : WEATHER_SUNNY;
		Env_SetWeather(weather);
	} else {
		if (Game_ClassicMode) return false;
		return InputHandler_HandleNonClassicKey(key);
	}
	return true;
}
Exemple #2
0
Int32 Atlas1D_UsedAtlasesCount(void) {
	TextureLoc maxTexLoc = 0;
	Int32 i;

	for (i = 0; i < Array_Elems(Block_Textures); i++) {
		maxTexLoc = max(maxTexLoc, Block_Textures[i]);
	}
	return Atlas1D_Index(maxTexLoc) + 1;
}
/* Index of maximum used 1D atlas + 1 */
CC_NOINLINE static int MapRenderer_UsedAtlases(void) {
	TextureLoc maxLoc = 0;
	int i;

	for (i = 0; i < Array_Elems(Blocks.Textures); i++) {
		maxLoc = max(maxLoc, Blocks.Textures[i]);
	}
	return Atlas1D_Index(maxLoc) + 1;
}