diff --git a/handmade.c b/handmade.c index dcf1c73..f187d0d 100644 --- a/handmade.c +++ b/handmade.c @@ -2,7 +2,7 @@ #include "handmade.h" #include "sdl_handmade.h" -#include +#include "handmade_intrinsics.h" #include /* memset */ static void GameOutputSound(game_state *GameState, @@ -51,18 +51,6 @@ static void ClearBackground(game_offscreen_buffer *Buffer) } } -static S32 RoundF32toS32(F32 Real32) -{ - S32 Result = (S32)(Real32 + 0.5f); - return Result; -} - -static S32 FloorF32toS32(F32 Real32) -{ - S32 Result = (S32)floorf(Real32); - return Result; -} - static void DrawRectangle(game_offscreen_buffer *Buffer, F32 RealMinX, F32 RealMinY, F32 RealMaxX, F32 RealMaxY, diff --git a/handmade_intrinsics.h b/handmade_intrinsics.h new file mode 100644 index 0000000..950a089 --- /dev/null +++ b/handmade_intrinsics.h @@ -0,0 +1,39 @@ +#ifndef HANDMADE_INTRINSICS_H_SENTRY +#define HANDMADE_INTRINSICS_H_SENTRY + +/* TODO: Re-implement these functions so we do not have to rely on + math.h. */ + +#include + +S32 RoundF32toS32(F32 Real32) +{ + S32 Result = (S32)(Real32 + 0.5f); + return Result; +} + +S32 FloorF32toS32(F32 Real32) +{ + S32 Result = (S32)floorf(Real32); + return Result; +} + +F32 Sin(F32 Angle) +{ + F32 Result = sinf(Angle); + return Result; +} + +F32 Cos(F32 Angle) +{ + F32 Result = cosf(Angle); + return Result; +} + +F32 ATan2(F32 Y, F32 X) +{ + F32 Result = atan2f(Y, X); + return Result; +} + +#endif \ No newline at end of file