windows support

This commit is contained in:
Rebecca Beyer
2025-03-20 11:55:34 +01:00
parent e55db94d48
commit 61e9916bb2
5 changed files with 2994 additions and 26 deletions
+12 -13
View File
@@ -1,22 +1,21 @@
COMPILER = gcc
C_FLAGS = -std=c99 -g -Wall -Werror -Wpedantic -Wshadow -Wstrict-prototypes
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
COMPILER = gcc SRC = src\main.c
RAYLIB_FLAGS = -I path\to\raylib\include -L path\to\raylib\lib -lraylib TARGET = bin\win\game.exe
RAYLIB_FLAGS = -I%RAYLIB% -L%RAYLIB% -lraylib -lopengl32 -lgdi32 -lwinmm
else else
COMPILER = clang SRC = src/main.c
TARGET = bin/osx/game
RAYLIB_FLAGS = $(shell pkg-config --libs --cflags raylib) RAYLIB_FLAGS = $(shell pkg-config --libs --cflags raylib)
endif endif
C_FLAGS = -std=c99 -g -Wall -Werror -Wpedantic -Wconversion -Wshadow -Wstrict-prototypes -fsanitize=address,undefined -O0 -I../include build: $(SRC)
SUPPRESSED_FLAGS = -Wno-conversion -Wno-sign-conversion -Wno-unused-variable -Wno-unused-but-set-variable $(COMPILER) $(SRC) -o $(TARGET) $(C_FLAGS) $(RAYLIB_FLAGS)
SRC = src/main.c
TARGET = bin/game
build: $(TARGET)
$(TARGET): $(SRC)
$(COMPILER) $(C_FLAGS) $(RAYLIB_FLAGS) $(SRC) -o $(TARGET) $(SUPPRESSED_FLAGS)
clean: clean:
rm -f $(TARGET) rm -f $(TARGET)
run: clean build run: clean build
./$(TARGET) .\$(TARGET)
+3
View File
@@ -0,0 +1,3 @@
Make 4.4.1
GCC 14.2
RAYLIB 5.5
+2966
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -22,21 +22,21 @@ Floor CreateFloor(Texture2D texture, float textureWidth){
}; };
} }
void UpdateFloor(Floor *Floor, const Camera2D *camera){ void UpdateFloor(Floor *floor, const Camera2D *camera){
Floor->bounds.x = (int)((camera->target.x - (GetScreenWidth() / 2.0f / camera->zoom)) / Floor->sprite.frameSize.x) - 1; floor->bounds.x = (int)((camera->target.x - (GetScreenWidth() / 2.0f / camera->zoom)) / floor->sprite.frameSize.x) - 1;
Floor->bounds.width = (int)((camera->target.x + (GetScreenWidth() / 2.0f / camera->zoom)) / Floor->sprite.frameSize.x) + 1; floor->bounds.width = (int)((camera->target.x + (GetScreenWidth() / 2.0f / camera->zoom)) / floor->sprite.frameSize.x) + 1;
Floor->bounds.y = (int)((camera->target.y - (GetScreenHeight() / 2.0f / camera->zoom)) / Floor->sprite.frameSize.y) - 1; floor->bounds.y = (int)((camera->target.y - (GetScreenHeight() / 2.0f / camera->zoom)) / floor->sprite.frameSize.y) - 1;
Floor->bounds.height = (int)((camera->target.y + (GetScreenHeight() / 2.0f / camera->zoom)) / Floor->sprite.frameSize.y) + 1; floor->bounds.height = (int)((camera->target.y + (GetScreenHeight() / 2.0f / camera->zoom)) / floor->sprite.frameSize.y) + 1;
} }
void RenderFloor(Floor *Floor){ void RenderFloor(Floor *floor){
for (int y = (int)Floor->bounds.y; y <= (int)Floor->bounds.height; y++) for (int y = (int)floor->bounds.y; y <= (int)floor->bounds.height; y++)
{ {
for (int x = (int)Floor->bounds.x; x <= (int)Floor->bounds.width; x++) for (int x = (int)floor->bounds.x; x <= (int)floor->bounds.width; x++)
{ {
Vector2 floorPosition = {x * Floor->sprite.frameSize.x, y * Floor->sprite.frameSize.y}; Vector2 floorPosition = {x * floor->sprite.frameSize.x, y * floor->sprite.frameSize.y};
UpdateSpriteDestRec(&Floor->sprite, &floorPosition); UpdateSpriteDestRec(&floor->sprite, &floorPosition);
RenderSprite(&Floor->sprite); RenderSprite(&floor->sprite);
} }
} }
} }
+2 -2
View File
@@ -1,5 +1,5 @@
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include "../include/raymath.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "engine/screen.h" #include "engine/screen.h"
@@ -20,7 +20,7 @@ typedef struct {
int main(void) int main(void)
{ {
Application app; Application app;
app.state.currentScreen = GAMEPLAY; app.state.currentScreen = LOGO;
app.state.running = true; app.state.running = true;
app.state.gameStarted = false; app.state.gameStarted = false;
app.display.name = "The Last Hive"; app.display.name = "The Last Hive";