MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / G_initializeEvents

Function G_initializeEvents

engine/src/game.cpp:299–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void G_initializeEvents()
300{
301 game.clips.fadeIn = Timeline("fadetoblack", 50);
302 game.clips.fadeIn.AddEvent(0, []() {});
303 for (int i = 1; i < 25; i++)
304 game.clips.fadeIn.AddEvent(2 * i,
305 []() { game.menu.menuDarken += 0.04f; });
306 game.clips.fadeIn.AddEvent(49, []() { game.menu.menuDarken = 1.0f; });
307
308 game.clips.fadeOut = Timeline("fadefromblack", 50);
309 game.clips.fadeOut.AddEvent(1, []() { game.menu.menuDarken = 1.0f; });
310 for (int i = 1; i < 25; i++)
311 game.clips.fadeOut.AddEvent(2 * i,
312 []() { game.menu.menuDarken -= 0.04f; });
313 game.clips.fadeOut.AddEvent(49, []() { game.menu.menuDarken = 0.0f; });
314
315 game.clips.gameStart = Timeline("start", 100);
316 game.clips.gameStart.AddEvent(0,
317 []()
318 {
319 btransitioning = true;
320 P_pause(false);
321 game.menu.current = &game.menu.pause;
322 bplayercontrol = false;
323 G_playEvent("fadetoblack", false);
324 });
325 game.clips.gameStart.AddEvent(50,
326 []()
327 {
328 game.clips.demo.Stop();
329 G_loadLevel("levels/stage1.lvl");
330 sound.sfxVolume = game.menu.savedVolume;
331 G_playEvent("fadefromblack", false);
332 });
333 game.clips.gameStart.AddEvent(99,
334 []()
335 {
336 btransitioning = false;
337 bstarted = true;
338 bplayercontrol = true;
339 camera.isTargeting = true;
340 I_zeroGameInput();
341 I_resetControls();
342 });
343
344 game.clips.gameQuit = Timeline("quit", 50);
345 game.clips.gameQuit.AddEvent(0,
346 []()
347 {
348 btransitioning = true;
349 P_pause(false);
350 game.menu.current = &game.menu.start;
351 bstarted = false;
352 bplayercontrol = false;
353 G_playEvent("fadetoblack", false);
354 });
355 game.clips.gameQuit.AddEvent(49,
356 []()

Callers 1

G_initializeGameFunction · 0.85

Calls 9

TimelineClass · 0.85
P_pauseFunction · 0.85
G_playEventFunction · 0.85
G_loadLevelFunction · 0.85
I_zeroGameInputFunction · 0.85
I_resetControlsFunction · 0.85
U_Load_demoFunction · 0.85
StopMethod · 0.80
AddEventMethod · 0.45

Tested by

no test coverage detected