void Screen_CommonInit(void* screen) { struct Screen* s = screen; Event_RegisterVoid(&GfxEvents.ContextLost, s, s->VTABLE->ContextLost); Event_RegisterVoid(&GfxEvents.ContextRecreated, s, s->VTABLE->ContextRecreated); if (Gfx.LostContext) return; s->VTABLE->ContextRecreated(s); }
static void Particles_Init(void) { Random_InitFromCurrentTime(&rnd); Particles_ContextRecreated(NULL); Event_RegisterBlock(&UserEvents_BlockChanged, NULL, Particles_BreakBlockEffect_Handler); Event_RegisterStream(&TextureEvents_FileChanged, NULL, Particles_FileChanged); Event_RegisterVoid(&GfxEvents_ContextLost, NULL, Particles_ContextLost); Event_RegisterVoid(&GfxEvents_ContextRecreated, NULL, Particles_ContextRecreated); }
static void Gui_Init(void) { Event_RegisterVoid(&ChatEvents.FontChanged, NULL, Gui_FontChanged); Event_RegisterEntry(&TextureEvents.FileChanged, NULL, Gui_FileChanged); Gui_LoadOptions(); Gui_Status = StatusScreen_MakeInstance(); Gui_HUD = HUDScreen_MakeInstance(); Elem_Init(Gui_Status); Elem_Init(Gui_HUD); }
void InputHandler_Init(void) { Event_RegisterFloat(&MouseEvents.Wheel, NULL, InputHandler_MouseWheel); Event_RegisterMouseMove(&MouseEvents.Moved, NULL, InputHandler_MouseMove); Event_RegisterInt(&MouseEvents.Down, NULL, InputHandler_MouseDown); Event_RegisterInt(&MouseEvents.Up, NULL, InputHandler_MouseUp); Event_RegisterInt(&KeyEvents.Down, NULL, InputHandler_KeyDown); Event_RegisterInt(&KeyEvents.Up, NULL, InputHandler_KeyUp); Event_RegisterInt(&KeyEvents.Press, NULL, InputHandler_KeyPress); Event_RegisterVoid(&UserEvents.HackPermissionsChanged, NULL, InputHandler_CheckZoomFov); KeyBind_Init(); Hotkeys_Init(); }
static void MapRenderer_Init(void) { Event_RegisterVoid(&TextureEvents.AtlasChanged, NULL, MapRenderer_TerrainAtlasChanged); Event_RegisterInt(&WorldEvents.EnvVarChanged, NULL, MapRenderer_EnvVariableChanged); Event_RegisterVoid(&BlockEvents.BlockDefChanged, NULL, MapRenderer_BlockDefinitionChanged); Event_RegisterVoid(&GfxEvents.ViewDistanceChanged, NULL, MapRenderer_RecalcVisibility); Event_RegisterVoid(&GfxEvents.ProjectionChanged, NULL, MapRenderer_RecalcVisibility); Event_RegisterVoid(&GfxEvents.ContextLost, NULL, MapRenderer_DeleteChunks_); Event_RegisterVoid(&GfxEvents.ContextRecreated, NULL, MapRenderer_Refresh_); /* This = 87 fixes map being invisible when no textures */ MapRenderer_1DUsedCount = 87; /* Atlas1D_UsedAtlasesCount(); */ chunkPos = Vector3I_MaxValue(); MapRenderer_MaxUpdates = Options_GetInt(OPT_MAX_CHUNK_UPDATES, 4, 1024, 30); Builder_Init(); Builder_ApplyActive(); MapRenderer_CalcViewDists(); }
static void PickedPosRenderer_Init(void) { PickedPosRenderer_ContextRecreated(NULL); Event_RegisterVoid(&GfxEvents_ContextLost, NULL, PickedPosRenderer_ContextLost); Event_RegisterVoid(&GfxEvents_ContextRecreated, NULL, PickedPosRenderer_ContextRecreated); }
static void AxisLinesRenderer_Init(void) { Event_RegisterVoid(&GfxEvents_ContextLost, NULL, AxisLinesRenderer_ContextLost); }