Compare commits
24 Commits
31630dded8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 056cdf9799 | |||
| a385a24d0f | |||
| 93bca5b327 | |||
|
|
873c3d3e3d | ||
|
|
5fc8c8f94f | ||
|
|
e1c3fea1f0 | ||
| 3d3c028997 | |||
| 4071b771e4 | |||
| 962e15debc | |||
| f99152341c | |||
| dc5d0aef86 | |||
| d6724e4c73 | |||
| cfd672bf25 | |||
| 397a08f313 | |||
|
|
8073c2af18 | ||
|
|
a8458007cd | ||
|
|
b32f9edd5f | ||
|
|
cd3340ce57 | ||
|
|
4cf96e771f | ||
|
|
759d3ff61a | ||
|
|
3f4dfdc483 | ||
|
|
c8e40f3845 | ||
|
|
8853ece16a | ||
|
|
75d4e7fc9f |
9
.gitignore
vendored
9
.gitignore
vendored
@@ -405,3 +405,12 @@ Makefile
|
||||
*.swp
|
||||
*.swo
|
||||
*.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
39
.vscode/launch.json
vendored
@@ -4,11 +4,11 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Debug",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
@@ -23,7 +23,8 @@
|
||||
}
|
||||
],
|
||||
"windows": {
|
||||
"miDebuggerPath": "gdb.exe",
|
||||
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}.exe",
|
||||
"miDebuggerPath": "gdb.exe"
|
||||
},
|
||||
"osx": {
|
||||
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
|
||||
@@ -36,7 +37,38 @@
|
||||
"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",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
@@ -44,7 +76,6 @@
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",
|
||||
"MIMode": "gdb",
|
||||
"windows": {
|
||||
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",
|
||||
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -7,5 +7,6 @@
|
||||
"**/.DS_Store": true,
|
||||
"**/*.o": true,
|
||||
"**/*.exe": true,
|
||||
}
|
||||
},
|
||||
"cmake.sourceDirectory": "/home/mrsh/Games/test-text/build/external/raylib-master"
|
||||
}
|
||||
30
.vscode/tasks.json
vendored
30
.vscode/tasks.json
vendored
@@ -24,6 +24,26 @@
|
||||
],
|
||||
"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",
|
||||
"type": "process",
|
||||
@@ -44,7 +64,10 @@
|
||||
"config=release_arm64"
|
||||
],
|
||||
},
|
||||
"group": "build",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
@@ -70,7 +93,10 @@
|
||||
"clean"
|
||||
],
|
||||
},
|
||||
"group": "build",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
|
||||
31
README.md
31
README.md
@@ -10,7 +10,7 @@ Once you have downloaded the template, rename it to your project name.
|
||||
|
||||
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
|
||||
```
|
||||
@@ -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.
|
||||
|
||||
## Microsoft Visual Studio
|
||||
## Microsoft Visual Studio 2026
|
||||
* Rename the folder to your game name
|
||||
* Run `build-VisualStudio2022.bat`
|
||||
* double click the `.sln` file that is generated
|
||||
* Run `build-VisualStudio2026.bat`
|
||||
* double click the `.slnx` file that is generated
|
||||
* develop your game
|
||||
* 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
|
||||
`--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
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
3
build-VisualStudio2026.bat
Normal file
3
build-VisualStudio2026.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
cd build
|
||||
premake5.exe vs2026 || pause
|
||||
cd ../
|
||||
@@ -101,7 +101,7 @@ function platform_defines()
|
||||
defines{"GRAPHICS_API_OPENGL_ES2"}
|
||||
|
||||
filter {"options:graphics=software"}
|
||||
defines{"GRAPHICS_API_OPENGL_11_SOFTWARE"}
|
||||
defines{"GRAPHICS_API_OPENGL_SOFTWARE"}
|
||||
|
||||
filter {"system:macosx"}
|
||||
disablewarnings {"deprecated-declarations"}
|
||||
@@ -170,7 +170,7 @@ if (downloadRaylib) then
|
||||
|
||||
project (workspaceName)
|
||||
kind "ConsoleApp"
|
||||
location "build_files/"
|
||||
location "../"
|
||||
targetdir "../bin/%{cfg.buildcfg}"
|
||||
|
||||
filter {"system:windows", "configurations:Release", "action:gmake*"}
|
||||
@@ -192,13 +192,15 @@ if (downloadRaylib) then
|
||||
{
|
||||
["Header Files/*"] = { "../include/**.h", "../include/**.hpp", "../src/**.h", "../src/**.hpp"},
|
||||
["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"}
|
||||
|
||||
filter {"system:windows", "action:vs*"}
|
||||
files {"../src/*.rc", "../src/*.ico"}
|
||||
files {"../resources/**"}
|
||||
|
||||
filter{}
|
||||
|
||||
@@ -247,7 +249,7 @@ if (downloadRaylib) then
|
||||
|
||||
platform_defines()
|
||||
|
||||
location "build_files/"
|
||||
location "../"
|
||||
|
||||
language "C"
|
||||
targetdir "../bin/%{cfg.buildcfg}"
|
||||
|
||||
BIN
raw/mrsh.ase
Normal file
BIN
raw/mrsh.ase
Normal file
Binary file not shown.
24
raw/mrsh.json
Normal file
24
raw/mrsh.json
Normal 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
BIN
raw/mrsh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 206 B |
213
raylib.make
Normal file
213
raylib.make
Normal 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
BIN
resources/emi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 233 KiB |
BIN
resources/mrsh.png
Normal file
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 |
56
src/main.c
56
src/main.c
@@ -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 "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 ()
|
||||
{
|
||||
@@ -17,13 +29,18 @@ int main ()
|
||||
SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
|
||||
|
||||
// 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
|
||||
SearchAndSetResourceDir("resources");
|
||||
|
||||
// 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
|
||||
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)
|
||||
ClearBackground(BLACK);
|
||||
|
||||
// draw some text using the default font
|
||||
DrawText("Hello Raylib", 200,200,20,WHITE);
|
||||
// DrawRectangle(HorizontalPosition, VerticalPosition, 10, 10, BLUE);
|
||||
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();
|
||||
}
|
||||
|
||||
// cleanup
|
||||
// unload our texture so it can be cleaned up
|
||||
UnloadTexture(wabbit);
|
||||
UnloadTexture(emi);
|
||||
|
||||
// destroy the window and cleanup the OpenGL context
|
||||
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
|
||||
};
|
||||
|
||||
}
|
||||
193
test-text.make
Normal file
193
test-text.make
Normal 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
|
||||
Reference in New Issue
Block a user