gaming-pads/base.c

67 lines
1.3 KiB
C

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "include/raylib.h"
#include "raymath.h"
#define SCREEN_WIDTH 1300
#define SCREEN_HEIGHT 1000
#define TARGET_FPS 60
typedef struct GameState {
float dt;
float time_elapsed;
int frame_count;
Camera3D cam3d;
} GameState;
GameState *Init() {
InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Base");
SetTargetFPS(TARGET_FPS);
GameState state = {0};
GameState *state_ptr = RL_MALLOC(sizeof(GameState));
memcpy(state_ptr, &state, sizeof(GameState));
return state_ptr;
}
void Input(GameState *S) { (void)S; }
void Update(GameState *S) { (void)S; }
void Draw3D(const GameState *S) { (void)S; }
void Draw2D(const GameState *S) { (void)S; }
void Draw2DDebug(GameState *S) { (void)S; }
int main(void) {
GameState *state = Init();
while (!WindowShouldClose()) {
state->dt = GetFrameTime();
state->time_elapsed = GetTime();
Input(state);
Update(state);
BeginDrawing();
{
ClearBackground(RAYWHITE);
BeginMode3D(state->cam3d);
{
Draw3D(state);
}
EndMode3D();
Draw2D(state);
Draw2DDebug(state);
}
EndDrawing();
state->frame_count++;
}
CloseWindow();
free(state);
}