Game code is now loaded dynamically.
This commit is contained in:
+6
-5
@@ -1,4 +1,5 @@
|
||||
#include "handmade.h"
|
||||
#include "sdl_handmade.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -37,7 +38,7 @@ static void RenderWeirdGradient(game_offscreen_buffer *Buffer, S32 XOffset, S32
|
||||
}
|
||||
}
|
||||
|
||||
static void GameUpdateAndRender(game_memory *Memory, game_input *Input, game_offscreen_buffer *Buffer, game_sound_output_buffer *SoundBuffer)
|
||||
void UpdateAndRender(game_memory *Memory, game_input *Input, game_offscreen_buffer *Buffer, game_sound_output_buffer *SoundBuffer)
|
||||
{
|
||||
Assert((&Input->Controllers[0].Terminator - &Input->Controllers[0].Buttons[0]) == ARRAY_SIZE(Input->Controllers[0].Buttons));
|
||||
Assert(sizeof(game_state) <= Memory->PermanentStorageSize);
|
||||
@@ -45,10 +46,10 @@ static void GameUpdateAndRender(game_memory *Memory, game_input *Input, game_off
|
||||
game_state *GameState = (game_state *)Memory->PermanentStorage;
|
||||
if(!Memory->IsInitialized) {
|
||||
char FileName[] = "/Users/igor/Developer/handmade_hero_course/handmade/code/sdl_handmade.cpp";
|
||||
debug_read_file_result BitmapMemory = DEBUGPlatformReadEntireFile(FileName);
|
||||
debug_read_file_result BitmapMemory = Memory->DEBUGPlatformReadEntireFile(FileName);
|
||||
if(BitmapMemory.Contents) {
|
||||
DEBUGPlatformWriteEntireFile("test.out", BitmapMemory.ContentsSize, BitmapMemory.Contents);
|
||||
DEBUGPlatformFreeFileMemory(BitmapMemory.Contents);
|
||||
Memory->DEBUGPlatformWriteEntireFile("test.out", BitmapMemory.ContentsSize, BitmapMemory.Contents);
|
||||
Memory->DEBUGPlatformFreeFileMemory(BitmapMemory.Contents);
|
||||
}
|
||||
|
||||
GameState->ToneHz = 256;
|
||||
@@ -71,7 +72,7 @@ static void GameUpdateAndRender(game_memory *Memory, game_input *Input, game_off
|
||||
GameState->GreenOffset -= 1;
|
||||
}
|
||||
if(Controller->MoveDown.EndedDown) {
|
||||
GameState->GreenOffset += 1;
|
||||
GameState->GreenOffset += 2;
|
||||
}
|
||||
if(Controller->MoveLeft.EndedDown) {
|
||||
GameState->BlueOffset -= 1;
|
||||
|
||||
Reference in New Issue
Block a user