Clean up after core.h updates.

This commit is contained in:
2026-03-15 00:05:54 -07:00
parent 58b3e04129
commit a5cff85e22
3 changed files with 68 additions and 63 deletions
+9 -7
View File
@@ -1,8 +1,10 @@
#include "handmade.h"
internal void GameOutputSound(game_sound_output_buffer *SoundBuffer, S32 ToneHz)
#include <math.h>
static void GameOutputSound(game_sound_output_buffer *SoundBuffer, S32 ToneHz)
{
local_persist F32 tSine;
static F32 tSine;
S16 ToneVolume = 8000;
S32 WavePeriod = SoundBuffer->SamplesPerSecond / ToneHz;
@@ -13,11 +15,11 @@ internal void GameOutputSound(game_sound_output_buffer *SoundBuffer, S32 ToneHz)
*SampleOut++ = SampleValue;
*SampleOut++ = SampleValue;
tSine += 2.0f * pi32 * 1.0f / (F32)WavePeriod;
tSine += 2.0f * PI * 1.0f / (F32)WavePeriod;
}
}
internal void RenderWeirdGradient(game_offscreen_buffer *Buffer, S32 XOffset, S32 YOffset)
static void RenderWeirdGradient(game_offscreen_buffer *Buffer, S32 XOffset, S32 YOffset)
{
S32 Width = Buffer->Width;
S32 Height = Buffer->Height;
@@ -35,9 +37,9 @@ internal void RenderWeirdGradient(game_offscreen_buffer *Buffer, S32 XOffset, S3
}
}
internal void GameUpdateAndRender(game_memory *Memory, game_input *Input, game_offscreen_buffer *Buffer, game_sound_output_buffer *SoundBuffer)
static void GameUpdateAndRender(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]) == ArrayCount(Input->Controllers[0].Buttons));
Assert((&Input->Controllers[0].Terminator - &Input->Controllers[0].Buttons[0]) == ARRAY_SIZE(Input->Controllers[0].Buttons));
Assert(sizeof(game_state) <= Memory->PermanentStorageSize);
game_state *GameState = (game_state *)Memory->PermanentStorage;
@@ -58,7 +60,7 @@ internal void GameUpdateAndRender(game_memory *Memory, game_input *Input, game_o
// GameState.GreenOffset;
// GameState.BlueOffset;
for(U32 ControllerIndex = 0; ControllerIndex < ArrayCount(Input->Controllers); ControllerIndex++) {
for(U32 ControllerIndex = 0; ControllerIndex < ARRAY_SIZE(Input->Controllers); ControllerIndex++) {
game_controller_input *Controller = GetController(Input, ControllerIndex);
if(Controller->IsAnalog) {
GameState->GreenOffset += (int)(4.0f*(Controller->StickAverageY));