Compare commits

..

24 Commits

Author SHA1 Message Date
056cdf9799 Merge branch 'features/character-movement'
This is for my sanity
2026-04-21 13:27:20 +02:00
a385a24d0f test movement du personnage 2026-04-21 13:19:08 +02:00
93bca5b327 ajout du sprite dans la ressource 2026-04-21 12:52:38 +02:00
Émi Lefèvre
873c3d3e3d Add mrsh sprite 2026-04-21 12:41:38 +02:00
Émi Lefèvre
5fc8c8f94f Add windows makefile 2026-04-21 11:18:45 +02:00
Émi Lefèvre
e1c3fea1f0 Ignore Windows specific changes 2026-04-21 11:18:45 +02:00
3d3c028997 Merge pull request 'ajout end game' (#2) from dev into main
Reviewed-on: #2
2026-04-21 07:12:30 +00:00
4071b771e4 ajout end game 2026-04-21 09:07:46 +02:00
962e15debc fin mini snake trop fatiguee 2026-04-20 23:42:49 +02:00
f99152341c test snake 2026-04-20 23:23:15 +02:00
dc5d0aef86 test snake 2026-04-20 23:15:15 +02:00
d6724e4c73 init branch dev 2026-04-20 22:07:28 +02:00
cfd672bf25 remove jpg and first png 2026-04-20 22:05:24 +02:00
397a08f313 first commit test 2026-04-20 22:03:51 +02:00
Jeffery Myers
8073c2af18 default to a size that works on 720p monitors 2026-03-31 10:01:22 -07:00
Jeffery Myers
a8458007cd make release and clean tasks show up in the VSCode build tasks list.
Add bat for MSVC 2026
Make README.md direct to 2026
2026-03-31 08:53:20 -07:00
Jeffery Myers
b32f9edd5f use correct software define 2026-03-23 15:45:13 -07:00
Jeffery Myers
cd3340ce57 build in the root, so that vscode can find the files 2026-02-25 13:54:12 -08:00
Jeffery Myers
4cf96e771f add info about software render target 2026-01-13 11:47:28 -08:00
Jeffery Myers
759d3ff61a better filters for game and app resources 2026-01-07 18:49:51 -08:00
Jeffery Myers
3f4dfdc483 remove exe from common launch commands and let each platform define it's own 2026-01-07 08:53:30 -08:00
Jeffery Myers
c8e40f3845 Revise license section in README.md
Updated license information to reflect CC0 1.0.
2026-01-06 16:34:47 -08:00
Peter0x44
8853ece16a Update README.md 2026-01-06 23:18:43 +00:00
Jeffery Myers
75d4e7fc9f add debug task that does not regenerate the makefile 2025-12-11 09:52:03 -08:00
16 changed files with 574 additions and 39 deletions

9
.gitignore vendored
View File

@@ -405,3 +405,12 @@ Makefile
*.swp *.swp
*.swo *.swo
*.swn *.swn
/build/compile_commands.json
raylib.make
raylib.vcxproj
raylib.vcxproj.filters
test-game.make
test-game.vcxproj
test-game.vcxproj.filters
raylib.make

39
.vscode/launch.json vendored
View File

@@ -4,11 +4,11 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Debug", "name": "Debug",
"type": "cppdbg", "type": "cppdbg",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}.exe",
"args": [], "args": [],
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
@@ -23,7 +23,8 @@
} }
], ],
"windows": { "windows": {
"miDebuggerPath": "gdb.exe", "program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}.exe",
"miDebuggerPath": "gdb.exe"
}, },
"osx": { "osx": {
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}", "program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
@@ -36,7 +37,38 @@
"preLaunchTask": "build debug" "preLaunchTask": "build debug"
}, },
{ {
"name": "Run", "name": "Debug NoPremake",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
],
"windows": {
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}.exe",
"miDebuggerPath": "gdb.exe"
},
"osx": {
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
"MIMode": "lldb"
},
"linux": {
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
"miDebuggerPath": "/usr/bin/gdb",
},
"preLaunchTask": "build debug no premake"
},
{
"name": "Run Release",
"type": "cppdbg", "type": "cppdbg",
"request": "launch", "request": "launch",
"args": [], "args": [],
@@ -44,7 +76,6 @@
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"environment": [], "environment": [],
"externalConsole": false, "externalConsole": false,
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",
"MIMode": "gdb", "MIMode": "gdb",
"windows": { "windows": {
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe", "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",

View File

@@ -7,5 +7,6 @@
"**/.DS_Store": true, "**/.DS_Store": true,
"**/*.o": true, "**/*.o": true,
"**/*.exe": true, "**/*.exe": true,
} },
"cmake.sourceDirectory": "/home/mrsh/Games/test-text/build/external/raylib-master"
} }

30
.vscode/tasks.json vendored
View File

@@ -24,6 +24,26 @@
], ],
"dependsOn":["UpdateMake"] "dependsOn":["UpdateMake"]
}, },
{
"label": "build debug no premake",
"type": "process",
"command": "make",
"windows": {
"command": "mingw32-make.exe",
},
"osx": {
"args": [
"config=debug_arm64"
],
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{ {
"label": "build release", "label": "build release",
"type": "process", "type": "process",
@@ -44,7 +64,10 @@
"config=release_arm64" "config=release_arm64"
], ],
}, },
"group": "build", "group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": [ "problemMatcher": [
"$gcc" "$gcc"
], ],
@@ -70,7 +93,10 @@
"clean" "clean"
], ],
}, },
"group": "build", "group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": [ "problemMatcher": [
"$gcc" "$gcc"
], ],

View File

@@ -10,7 +10,7 @@ Once you have downloaded the template, rename it to your project name.
or or
Clone the repository with git, form the url Clone the repository with git, from the url
``` ```
https://github.com/raylib-extras/raylib-quickstart.git https://github.com/raylib-extras/raylib-quickstart.git
``` ```
@@ -68,10 +68,10 @@ To your path environment variable so that the compiler that came with raylib can
DO NOT INSTALL ANOTHER MinGW-W64 from another source such as msys2, you don't need it. DO NOT INSTALL ANOTHER MinGW-W64 from another source such as msys2, you don't need it.
## Microsoft Visual Studio ## Microsoft Visual Studio 2026
* Rename the folder to your game name * Rename the folder to your game name
* Run `build-VisualStudio2022.bat` * Run `build-VisualStudio2026.bat`
* double click the `.sln` file that is generated * double click the `.slnx` file that is generated
* develop your game * develop your game
* you are good to go * you are good to go
@@ -121,6 +121,13 @@ If you need to build for a different OpenGL version than the default (OpenGL 3.3
## For OpenGLES 3.0 ## For OpenGLES 3.0
`--graphics=opengles3` `--graphics=opengles3`
## For Software Rendering
`--graphics=software`
*Note*
Sofware rendering does not work with glfw, use Win32 or SDL platforms
`--backend=win32`
# Adding External Libraries # Adding External Libraries
Quickstart is intentionally minimal — it only includes what is required to compile and run a basic raylib project. Quickstart is intentionally minimal — it only includes what is required to compile and run a basic raylib project.
@@ -150,19 +157,5 @@ Different libraries will have different dependencies on different platforms.
# License # License
Copyright (c) 2020-2025 Jeffery Myers Raylib-Quickstart by Jeffery Myers is marked with CC0 1.0. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/
This software is provided "as-is", without any express or implied warranty. In no event
will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you
wrote the original software. If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented
as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@@ -0,0 +1,3 @@
cd build
premake5.exe vs2026 || pause
cd ../

View File

@@ -101,7 +101,7 @@ function platform_defines()
defines{"GRAPHICS_API_OPENGL_ES2"} defines{"GRAPHICS_API_OPENGL_ES2"}
filter {"options:graphics=software"} filter {"options:graphics=software"}
defines{"GRAPHICS_API_OPENGL_11_SOFTWARE"} defines{"GRAPHICS_API_OPENGL_SOFTWARE"}
filter {"system:macosx"} filter {"system:macosx"}
disablewarnings {"deprecated-declarations"} disablewarnings {"deprecated-declarations"}
@@ -170,7 +170,7 @@ if (downloadRaylib) then
project (workspaceName) project (workspaceName)
kind "ConsoleApp" kind "ConsoleApp"
location "build_files/" location "../"
targetdir "../bin/%{cfg.buildcfg}" targetdir "../bin/%{cfg.buildcfg}"
filter {"system:windows", "configurations:Release", "action:gmake*"} filter {"system:windows", "configurations:Release", "action:gmake*"}
@@ -192,13 +192,15 @@ if (downloadRaylib) then
{ {
["Header Files/*"] = { "../include/**.h", "../include/**.hpp", "../src/**.h", "../src/**.hpp"}, ["Header Files/*"] = { "../include/**.h", "../include/**.hpp", "../src/**.h", "../src/**.hpp"},
["Source Files/*"] = {"../src/**.c", "src/**.cpp"}, ["Source Files/*"] = {"../src/**.c", "src/**.cpp"},
["Windows Resource Files/*"] = {"../src/**.rc", "src/**.ico"}, ["Windows Resource Files/*"] = {"../src/**.rc", "../src/**.ico"},
["Game Resource Files/*"] = {"../resources/**"},
} }
files {"../src/**.c", "../src/**.cpp", "../src/**.h", "../src/**.hpp", "../include/**.h", "../include/**.hpp"} files {"../src/**.c", "../src/**.cpp", "../src/**.h", "../src/**.hpp", "../include/**.h", "../include/**.hpp"}
filter {"system:windows", "action:vs*"} filter {"system:windows", "action:vs*"}
files {"../src/*.rc", "../src/*.ico"} files {"../src/*.rc", "../src/*.ico"}
files {"../resources/**"}
filter{} filter{}
@@ -247,7 +249,7 @@ if (downloadRaylib) then
platform_defines() platform_defines()
location "build_files/" location "../"
language "C" language "C"
targetdir "../bin/%{cfg.buildcfg}" targetdir "../bin/%{cfg.buildcfg}"

BIN
raw/mrsh.ase Normal file

Binary file not shown.

24
raw/mrsh.json Normal file
View File

@@ -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" }
]
}
}

BIN
raw/mrsh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

213
raylib.make Normal file
View File

@@ -0,0 +1,213 @@
# GNU Make project makefile autogenerated by Premake
ifndef config
config=debug_x64
endif
ifndef verbose
SILENT = @
endif
.PHONY: clean prebuild
SHELLTYPE := posix
ifeq ($(shell echo "test"), "test")
SHELLTYPE := msdos
endif
# Configurations
# #############################################
ifeq ($(origin CC), default)
CC = gcc
endif
ifeq ($(origin CXX), default)
CXX = g++
endif
ifeq ($(origin AR), default)
AR = ar
endif
RESCOMP = windres
INCLUDES += -Ibuild/external/raylib-master/src -Ibuild/external/raylib-master/src/external/glfw/include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
LINKCMD = $(AR) -rcs "$@" $(OBJECTS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
ifeq ($(config),debug_x64)
TARGETDIR = bin/Debug
TARGET = $(TARGETDIR)/libraylib.a
OBJDIR = obj/x64/Debug/raylib
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)/libraylib.a
OBJDIR = obj/x86/Debug/raylib
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)/libraylib.a
OBJDIR = obj/ARM64/Debug/raylib
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)/libraylib.a
OBJDIR = obj/x64/Release/raylib
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)/libraylib.a
OBJDIR = obj/x86/Release/raylib
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)/libraylib.a
OBJDIR = obj/ARM64/Release/raylib
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
endif
# Per File Configurations
# #############################################
# File sets
# #############################################
GENERATED :=
OBJECTS :=
GENERATED += $(OBJDIR)/raudio.o
GENERATED += $(OBJDIR)/rcore.o
GENERATED += $(OBJDIR)/rglfw.o
GENERATED += $(OBJDIR)/rmodels.o
GENERATED += $(OBJDIR)/rshapes.o
GENERATED += $(OBJDIR)/rtext.o
GENERATED += $(OBJDIR)/rtextures.o
OBJECTS += $(OBJDIR)/raudio.o
OBJECTS += $(OBJDIR)/rcore.o
OBJECTS += $(OBJDIR)/rglfw.o
OBJECTS += $(OBJDIR)/rmodels.o
OBJECTS += $(OBJDIR)/rshapes.o
OBJECTS += $(OBJDIR)/rtext.o
OBJECTS += $(OBJDIR)/rtextures.o
# Rules
# #############################################
all: $(TARGET)
@:
$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
$(PRELINKCMDS)
@echo Linking raylib
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS)
$(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif
$(OBJDIR):
@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(OBJDIR)
else
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif
clean:
@echo Cleaning raylib
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(GENERATED)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild: | $(OBJDIR)
$(PREBUILDCMDS)
ifneq (,$(PCH))
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
$(GCH): $(PCH) | prebuild
@echo $(notdir $<)
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) touch "$@"
else
$(SILENT) echo $null >> "$@"
endif
else
$(OBJECTS): | prebuild
endif
# File Rules
# #############################################
$(OBJDIR)/raudio.o: build/external/raylib-master/src/raudio.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/rcore.o: build/external/raylib-master/src/rcore.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/rglfw.o: build/external/raylib-master/src/rglfw.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/rmodels.o: build/external/raylib-master/src/rmodels.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/rshapes.o: build/external/raylib-master/src/rshapes.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/rtext.o: build/external/raylib-master/src/rtext.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/rtextures.o: build/external/raylib-master/src/rtextures.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
-include $(PCH_PLACEHOLDER).d
endif

BIN
resources/emi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

BIN
resources/mrsh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

View File

@@ -10,6 +10,18 @@ by Jeffery Myers is marked with CC0 1.0. To view a copy of this license, visit h
#include "raylib.h" #include "raylib.h"
#include "resource_dir.h" // utility header for SearchAndSetResourceDir #include "resource_dir.h" // utility header for SearchAndSetResourceDir
#include <stdlib.h>
typedef struct Player {
Vector2 position;
Vector2 size;
int life;
} Player;
static Player player = {0};
static void characterMovement(void);
int main () int main ()
{ {
@@ -17,13 +29,18 @@ int main ()
SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI); SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
// Create the window and OpenGL context // Create the window and OpenGL context
InitWindow(1280, 800, "Hello Raylib"); InitWindow(800, 600, "Hello Emi");
// Utility function from resource_dir.h to find the resources folder and set it as the current working directory so we can load from it // Utility function from resource_dir.h to find the resources folder and set it as the current working directory so we can load from it
SearchAndSetResourceDir("resources"); SearchAndSetResourceDir("resources");
// Load a texture from the resources directory // Load a texture from the resources directory
Texture wabbit = LoadTexture("wabbit_alpha.png"); Image image = LoadImage("mrsh.png");
Texture2D emi = LoadTextureFromImage(image);
UnloadImage(image);
int HorizontalPosition = 400;
int VerticalPosition = 300;
// game loop // game loop
while (!WindowShouldClose()) // run the loop until the user presses ESCAPE or presses the Close button on the window while (!WindowShouldClose()) // run the loop until the user presses ESCAPE or presses the Close button on the window
@@ -34,21 +51,44 @@ int main ()
// Setup the back buffer for drawing (clear color and depth buffers) // Setup the back buffer for drawing (clear color and depth buffers)
ClearBackground(BLACK); ClearBackground(BLACK);
// draw some text using the default font // DrawRectangle(HorizontalPosition, VerticalPosition, 10, 10, BLUE);
DrawText("Hello Raylib", 200,200,20,WHITE); DrawTexture(emi, player.position.x, player.position.y, WHITE);
characterMovement();
// draw our texture to the screen
DrawTexture(wabbit, 400, 200, WHITE);
// end the frame and get ready for the next one (display frame, poll input, etc...)
EndDrawing(); EndDrawing();
} }
// cleanup // cleanup
// unload our texture so it can be cleaned up // unload our texture so it can be cleaned up
UnloadTexture(wabbit); UnloadTexture(emi);
// destroy the window and cleanup the OpenGL context // destroy the window and cleanup the OpenGL context
CloseWindow(); CloseWindow();
return 0; 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
};
}

193
test-text.make Normal file
View File

@@ -0,0 +1,193 @@
# GNU Make project makefile autogenerated by Premake
ifndef config
config=debug_x64
endif
ifndef verbose
SILENT = @
endif
.PHONY: clean prebuild
SHELLTYPE := posix
ifeq ($(shell echo "test"), "test")
SHELLTYPE := msdos
endif
# Configurations
# #############################################
ifeq ($(origin CC), default)
CC = gcc
endif
ifeq ($(origin CXX), default)
CXX = g++
endif
ifeq ($(origin AR), default)
AR = ar
endif
RESCOMP = windres
INCLUDES += -Isrc -Iinclude -Ibuild/external/raylib-master/src
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
ifeq ($(config),debug_x64)
TARGETDIR = bin/Debug
TARGET = $(TARGETDIR)/test-text
OBJDIR = obj/x64/Debug/test-text
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -g -std=c17
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -g -std=c++17
LIBS += bin/Debug/libraylib.a -lpthread -lm -ldl -lrt -lX11
LDDEPS += bin/Debug/libraylib.a
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64
else ifeq ($(config),debug_x86)
TARGETDIR = bin/Debug
TARGET = $(TARGETDIR)/test-text
OBJDIR = obj/x86/Debug/test-text
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -g -std=c17
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -g -std=c++17
LIBS += bin/Debug/libraylib.a -lpthread -lm -ldl -lrt -lX11
LDDEPS += bin/Debug/libraylib.a
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32
else ifeq ($(config),debug_arm64)
TARGETDIR = bin/Debug
TARGET = $(TARGETDIR)/test-text
OBJDIR = obj/ARM64/Debug/test-text
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wshadow -g -std=c17
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wshadow -g -std=c++17
LIBS += bin/Debug/libraylib.a -lpthread -lm -ldl -lrt -lX11
LDDEPS += bin/Debug/libraylib.a
ALL_LDFLAGS += $(LDFLAGS)
else ifeq ($(config),release_x64)
TARGETDIR = bin/Release
TARGET = $(TARGETDIR)/test-text
OBJDIR = obj/x64/Release/test-text
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -O2 -std=c17
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -O2 -std=c++17
LIBS += bin/Release/libraylib.a -lpthread -lm -ldl -lrt -lX11
LDDEPS += bin/Release/libraylib.a
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s
else ifeq ($(config),release_x86)
TARGETDIR = bin/Release
TARGET = $(TARGETDIR)/test-text
OBJDIR = obj/x86/Release/test-text
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -O2 -std=c17
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -O2 -std=c++17
LIBS += bin/Release/libraylib.a -lpthread -lm -ldl -lrt -lX11
LDDEPS += bin/Release/libraylib.a
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s
else ifeq ($(config),release_arm64)
TARGETDIR = bin/Release
TARGET = $(TARGETDIR)/test-text
OBJDIR = obj/ARM64/Release/test-text
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wshadow -O2 -std=c17
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wshadow -O2 -std=c++17
LIBS += bin/Release/libraylib.a -lpthread -lm -ldl -lrt -lX11
LDDEPS += bin/Release/libraylib.a
ALL_LDFLAGS += $(LDFLAGS) -s
endif
# Per File Configurations
# #############################################
# File sets
# #############################################
GENERATED :=
OBJECTS :=
GENERATED += $(OBJDIR)/main.o
OBJECTS += $(OBJDIR)/main.o
# Rules
# #############################################
all: $(TARGET)
@:
$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
$(PRELINKCMDS)
@echo Linking test-text
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS)
$(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif
$(OBJDIR):
@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(OBJDIR)
else
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif
clean:
@echo Cleaning test-text
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(GENERATED)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild: | $(OBJDIR)
$(PREBUILDCMDS)
ifneq (,$(PCH))
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
$(GCH): $(PCH) | prebuild
@echo $(notdir $<)
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) touch "$@"
else
$(SILENT) echo $null >> "$@"
endif
else
$(OBJECTS): | prebuild
endif
# File Rules
# #############################################
$(OBJDIR)/main.o: src/main.c
@echo "$(notdir $<)"
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
-include $(PCH_PLACEHOLDER).d
endif