From 873c3d3e3d296cda3a6bb930b244be7cfb0d1c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mi=20Lef=C3=A8vre?= Date: Tue, 21 Apr 2026 12:41:38 +0200 Subject: [PATCH 1/3] Add mrsh sprite --- raw/mrsh.ase | Bin 0 -> 611 bytes raw/mrsh.json | 24 ++++++++++++++++++++++++ raw/mrsh.png | Bin 0 -> 206 bytes 3 files changed, 24 insertions(+) create mode 100644 raw/mrsh.ase create mode 100644 raw/mrsh.json create mode 100644 raw/mrsh.png diff --git a/raw/mrsh.ase b/raw/mrsh.ase new file mode 100644 index 0000000000000000000000000000000000000000..5f38dc0fd769cd35d5375d38b4fced7ce5ae9fca GIT binary patch literal 611 zcmcK1O(?^09LMqRJfxNKR34)CZ%IyUOC&^!@)UNMkW6E>rFlpqrAQQM7bQk1xpBb3 z!$B=MN!&avAruZm9I*Vomr(A0Yp?!0ecr$SY(XOD3mS>!qliXCn)&`7<@fPlo-Ubu zdkpzmJz*t5`Ciri-Bd;NN(L6C=Au2@h;B;`o^_<)@ths+x2N&_DHErztI)Y+z^n-u zmO0YVT$YTc+-%Ix??Quh5bIqRX!EGpxOauSK0m4)5zo>Z4)u?q!|B9Yiy6BMM{&_) z!s8kn9`3C_ztd{;ytf7ciN4Sq?e=TsF;s+|G;8wgKnj+ Z_3mLO(dg0_=cVOnr`(m{GHYM;egX&Auu%X2 literal 0 HcmV?d00001 diff --git a/raw/mrsh.json b/raw/mrsh.json new file mode 100644 index 0000000..e823828 --- /dev/null +++ b/raw/mrsh.json @@ -0,0 +1,24 @@ +{ "frames": { + "mrsh.ase": { + "frame": { "x": 0, "y": 0, "w": 16, "h": 16 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 16, "h": 16 }, + "sourceSize": { "w": 16, "h": 16 }, + "duration": 100 + } + }, + "meta": { + "app": "https://github.com/LibreSprite/LibreSprite/", + "version": "1.2-973d0e3d-SDL", + "image": "C:\\Code\\test-game\\raw\\mrsh.png", + "format": "RGBA8888", + "size": { "w": 16, "h": 16 }, + "scale": "1", + "frameTags": [ + ], + "layers": [ + { "name": "Layer 1", "opacity": 255, "blendMode": "normal" } + ] + } +} diff --git a/raw/mrsh.png b/raw/mrsh.png new file mode 100644 index 0000000000000000000000000000000000000000..91868357238ef517bbcd5703f428f71799c12477 GIT binary patch literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Q$1ZALo9le6BdXWY})w8zt7Gs ziN~`1iG{LRp$KzFDdVn09fPya`()BhfYS2XM_cYQnAi!M1&iDNZVxp!E9BY#wLS9i z-ljE-&o&(jbvNAGz%B5JkD2)j_Y{UX7n|RRmZU2)i|9Y-@=7WE!r<=7Zs0kiEkaYR z!a?b@qIA Date: Tue, 21 Apr 2026 12:52:38 +0200 Subject: [PATCH 2/3] ajout du sprite dans la ressource --- raylib.make | 26 +++++++++++++------------- resources/mrsh.png | Bin 0 -> 206 bytes src/main.c | 6 ++++-- 3 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 resources/mrsh.png diff --git a/raylib.make b/raylib.make index 690992f..df81886 100644 --- a/raylib.make +++ b/raylib.make @@ -44,54 +44,54 @@ endef ifeq ($(config),debug_x64) TARGETDIR = bin/Debug -TARGET = $(TARGETDIR)/raylib.lib +TARGET = $(TARGETDIR)/libraylib.a OBJDIR = obj/x64/Debug/raylib -DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 +DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11 ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 else ifeq ($(config),debug_x86) TARGETDIR = bin/Debug -TARGET = $(TARGETDIR)/raylib.lib +TARGET = $(TARGETDIR)/libraylib.a OBJDIR = obj/x86/Debug/raylib -DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 +DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11 ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 else ifeq ($(config),debug_arm64) TARGETDIR = bin/Debug -TARGET = $(TARGETDIR)/raylib.lib +TARGET = $(TARGETDIR)/libraylib.a OBJDIR = obj/ARM64/Debug/raylib -DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 +DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11 ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g ALL_LDFLAGS += $(LDFLAGS) else ifeq ($(config),release_x64) TARGETDIR = bin/Release -TARGET = $(TARGETDIR)/raylib.lib +TARGET = $(TARGETDIR)/libraylib.a OBJDIR = obj/x64/Release/raylib -DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 +DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11 ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2 ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2 ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s else ifeq ($(config),release_x86) TARGETDIR = bin/Release -TARGET = $(TARGETDIR)/raylib.lib +TARGET = $(TARGETDIR)/libraylib.a OBJDIR = obj/x86/Release/raylib -DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 +DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11 ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2 ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2 ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s else ifeq ($(config),release_arm64) TARGETDIR = bin/Release -TARGET = $(TARGETDIR)/raylib.lib +TARGET = $(TARGETDIR)/libraylib.a OBJDIR = obj/ARM64/Release/raylib -DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 +DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11 ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2 ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2 ALL_LDFLAGS += $(LDFLAGS) -s @@ -159,7 +159,7 @@ ifeq (posix,$(SHELLTYPE)) $(SILENT) rm -rf $(OBJDIR) else $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) $(foreach f,$(subst /,\\,$(GENERATED)),if exist $(f) del /s /q $(f) >nul &) + $(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED)) $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) endif diff --git a/resources/mrsh.png b/resources/mrsh.png new file mode 100644 index 0000000000000000000000000000000000000000..91868357238ef517bbcd5703f428f71799c12477 GIT binary patch literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Q$1ZALo9le6BdXWY})w8zt7Gs ziN~`1iG{LRp$KzFDdVn09fPya`()BhfYS2XM_cYQnAi!M1&iDNZVxp!E9BY#wLS9i z-ljE-&o&(jbvNAGz%B5JkD2)j_Y{UX7n|RRmZU2)i|9Y-@=7WE!r<=7Zs0kiEkaYR z!a?b@qIA Date: Tue, 21 Apr 2026 13:19:08 +0200 Subject: [PATCH 3/3] test movement du personnage --- src/main.c | 89 +++++++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 52 deletions(-) diff --git a/src/main.c b/src/main.c index 23d8db9..97d973c 100644 --- a/src/main.c +++ b/src/main.c @@ -12,6 +12,17 @@ by Jeffery Myers is marked with CC0 1.0. To view a copy of this license, visit h #include "resource_dir.h" // utility header for SearchAndSetResourceDir #include +typedef struct Player { + Vector2 position; + Vector2 size; + int life; +} Player; + +static Player player = {0}; + +static void characterMovement(void); + + int main () { // Tell the window to use vsync and work on high DPI displays @@ -31,14 +42,6 @@ int main () int HorizontalPosition = 400; int VerticalPosition = 300; - int point = 0; - - //Start point of the colectible - - int positionXCollectible = GetRandomValue(0, 600); - int positionYCollectible = GetRandomValue(0, 800); - - // game loop while (!WindowShouldClose()) // run the loop until the user presses ESCAPE or presses the Close button on the window { @@ -49,53 +52,11 @@ int main () ClearBackground(BLACK); // DrawRectangle(HorizontalPosition, VerticalPosition, 10, 10, BLUE); - DrawTexture(emi, HorizontalPosition, VerticalPosition, WHITE); - + DrawTexture(emi, player.position.x, player.position.y, WHITE); - DrawCircle(positionXCollectible, positionYCollectible, 10, YELLOW); - - //draw score - DrawText(TextFormat("score : %d", point), 500,50,20,PINK); + characterMovement(); - if(point >= 10){ - DrawText("Emi la plus belle", 50,50,20,PINK); - if (IsKeyDown(74) ) { - point=0; - }; - }else{ - - //up - if (IsKeyDown(74) && VerticalPosition != 580 ) { - // draw some text using the default font - VerticalPosition = VerticalPosition+10; - }; - //down - if (IsKeyDown(75) && VerticalPosition != 0) { - VerticalPosition = VerticalPosition-10; - // draw some text using the default font - }; - //left - if (IsKeyDown(72) && HorizontalPosition != 0) { - HorizontalPosition = HorizontalPosition-10; - // draw some text using the default font - }; - //right - if (IsKeyDown(76)&& HorizontalPosition != 780) { - HorizontalPosition = HorizontalPosition+10; - // draw some text using the default font - }; - - } - - if (abs(positionXCollectible - HorizontalPosition) < 10 && - abs(positionYCollectible - VerticalPosition) < 10){ - positionXCollectible = GetRandomValue(0, 800); - positionYCollectible = GetRandomValue(0, 600); - point = point + 1; - } - - // end the frame and get ready for the next one (display frame, poll input, etc...) EndDrawing(); } @@ -107,3 +68,27 @@ int main () CloseWindow(); return 0; } +void characterMovement(void){ + + //up + if (IsKeyDown(74) ) { + // draw some text using the default font + player.position.y = player.position.y+10; + }; + //down + if (IsKeyDown(75) ) { + player.position.y = player.position.y-10; + // draw some text using the default font + }; + //left + if (IsKeyDown(72) ) { + player.position.x = player.position.x-10; + // draw some text using the default font + }; + //right + if (IsKeyDown(76)) { + player.position.x = player.position.x+10; + // draw some text using the default font + }; + +} \ No newline at end of file