internal void GameUpdateAndRender(game_offscreen_buffer *Buffer, int BlueOffset, int GreenOffset, game_sound_output_buffer *SoundBuffer, int ToneHz) { // TODO: Allow sample offsets here for more robust platform options GameOutputSound(SoundBuffer, ToneHz); RenderWeirdGradient(Buffer, BlueOffset, GreenOffset); }
internal void GameUpdateAndRender( game_offscreen_buffer* Buffer, int BlueOffset, int GreenOffset, game_sound_output_buffer* SoundBuffer, int ToneHz) { // allow sample offsets here GameOutputSound(SoundBuffer, ToneHz); RenderWeirdGradient(Buffer, BlueOffset, GreenOffset); }
internal void GameUpdateAndRender( game_memory *Memory, game_input *Input, game_offscreen_buffer *Buffer, game_sound_output_buffer *SoundBuffer ) { Assert(sizeof(game_state) <= Memory->PermanentStorageSize); game_state *GameState = (game_state *)Memory->PermanentStorage; if (Memory->IsInitialized) { char *Filename = "test.bmp"; debug_read_file_result Result = DEBUGPlatformReadEntireFile(Filename); if (Result.Contents) { DEBUGPlatformFreeFileMemory(Result.Contents); } GameState->ToneHz = 256; GameState->GreenOffset = 0; GameState->BlueOffset = 0; Memory->IsInitialized = true; } for (int ControllerIndex = 0; ControllerIndex < ArrayCount(Input->Controllers); ControllerIndex++) { game_controller_input *Controller = GetController(Input, ControllerIndex); if (Controller->IsAnalog) { // Analog GameState->ToneHz = 256 + (int)(128.0f * (Controller->StickAverageX)); GameState->BlueOffset += (int)(4.0f * (Controller->StickAverageY)); } else { // Digital if (Controller->MoveLeft.EndedDown) { GameState->BlueOffset--; } else if (Controller->MoveRight.EndedDown) { GameState->BlueOffset++; } } if (Controller->ActionDown.EndedDown) { GameState->GreenOffset += 1; } else if (Controller->ActionUp.EndedDown) { GameState->GreenOffset -= 1; } } GameOutputSound(SoundBuffer); RenderWeirdGradient(Buffer, GameState->BlueOffset, GameState->GreenOffset); }
internal void GameGetSoundSamples(game_memory *Memory, game_sound_output_buffer *SoundBuffer) { game_state *GameState = (game_state *) Memory->PermanentStorage; GameOutputSound(SoundBuffer, GameState->ToneHz); }