├── .gitignore
├── .vscode
├── c_cpp_properties.json
├── launch.json
├── settings.json
└── tasks.json
├── README.md
├── build-MinGW-W64.bat
├── build-VisualStudio2022.bat
├── build
├── premake5
├── premake5.exe
├── premake5.lua
└── premake5.osx
├── include
└── resource_dir.h
├── resources
└── wabbit_alpha.png
└── src
├── application.rc
├── icon.ico
└── main.c
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.tlog
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
298 | *.vbp
299 |
300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
301 | *.dsw
302 | *.dsp
303 |
304 | # Visual Studio 6 technical files
305 | *.ncb
306 | *.aps
307 |
308 | # Visual Studio LightSwitch build output
309 | **/*.HTMLClient/GeneratedArtifacts
310 | **/*.DesktopClient/GeneratedArtifacts
311 | **/*.DesktopClient/ModelManifest.xml
312 | **/*.Server/GeneratedArtifacts
313 | **/*.Server/ModelManifest.xml
314 | _Pvt_Extensions
315 |
316 | # Paket dependency manager
317 | .paket/paket.exe
318 | paket-files/
319 |
320 | # FAKE - F# Make
321 | .fake/
322 |
323 | # CodeRush personal settings
324 | .cr/personal
325 |
326 | # Python Tools for Visual Studio (PTVS)
327 | __pycache__/
328 | *.pyc
329 |
330 | # Cake - Uncomment if you are using it
331 | # tools/**
332 | # !tools/packages.config
333 |
334 | # Tabs Studio
335 | *.tss
336 |
337 | # Telerik's JustMock configuration file
338 | *.jmconfig
339 |
340 | # BizTalk build output
341 | *.btp.cs
342 | *.btm.cs
343 | *.odx.cs
344 | *.xsd.cs
345 |
346 | # OpenCover UI analysis results
347 | OpenCover/
348 |
349 | # Azure Stream Analytics local run output
350 | ASALocalRun/
351 |
352 | # MSBuild Binary and Structured Log
353 | *.binlog
354 |
355 | # NVidia Nsight GPU debugger configuration file
356 | *.nvuser
357 |
358 | # MFractors (Xamarin productivity tool) working folder
359 | .mfractor/
360 |
361 | # Local History for Visual Studio
362 | .localhistory/
363 |
364 | # Visual Studio History (VSHistory) files
365 | .vshistory/
366 |
367 | # BeatPulse healthcheck temp database
368 | healthchecksdb
369 |
370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
371 | MigrationBackup/
372 |
373 | # Ionide (cross platform F# VS Code tools) working folder
374 | .ionide/
375 |
376 | # Fody - auto-generated XML schema
377 | FodyWeavers.xsd
378 |
379 | # VS Code files for those working on multiple tools
380 | .vscode/*
381 | !.vscode/settings.json
382 | !.vscode/tasks.json
383 | !.vscode/launch.json
384 | !.vscode/extensions.json
385 | *.code-workspace
386 |
387 | # Local History for Visual Studio Code
388 | .history/
389 |
390 | # Windows Installer files from build outputs
391 | *.cab
392 | *.msi
393 | *.msix
394 | *.msm
395 | *.msp
396 |
397 | # JetBrains Rider
398 | *.sln.iml
399 | build_files
400 | raylib-master
401 | Makefile
402 | /*.sln
403 |
--------------------------------------------------------------------------------
/.vscode/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Win32",
5 | "includePath": [
6 | "${workspaceFolder}/build/external/raylib-master/src/**",
7 | "${workspaceFolder}/include/**",
8 | "${workspaceFolder}/src/**"
9 | ],
10 | "defines": [
11 | "_DEBUG",
12 | "UNICODE",
13 | "_UNICODE",
14 | "GRAPHICS_API_OPENGL_33",
15 | "PLATFORM_DESKTOP"
16 | ],
17 | "cStandard": "c17",
18 | "cppStandard": "c++17",
19 | "intelliSenseMode": "gcc-x64"
20 | },
21 | {
22 | "name": "Mac",
23 | "includePath": [
24 | "${workspaceFolder}/build/external/raylib-master/src/**",
25 | "${workspaceFolder}/include/**",
26 | "${workspaceFolder}/src/**"
27 | ],
28 | "defines": [
29 | "_DEBUG",
30 | "UNICODE",
31 | "_UNICODE",
32 | "GRAPHICS_API_OPENGL_33",
33 | "PLATFORM_DESKTOP"
34 | ],
35 | "macFrameworkPath": [
36 | "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
37 | ],
38 | "compilerPath": "/usr/bin/clang",
39 | "cStandard": "c17",
40 | "cppStandard": "c++17",
41 | "intelliSenseMode": "clang-x64"
42 | },
43 | {
44 | "name": "Linux",
45 | "includePath": [
46 | "${workspaceFolder}/build/external/raylib-master/src/**",
47 | "${workspaceFolder}/include/**",
48 | "${workspaceFolder}/src/**"
49 | ],
50 | "defines": [
51 | "_DEBUG",
52 | "UNICODE",
53 | "_UNICODE",
54 | "GRAPHICS_API_OPENGL_33",
55 | "PLATFORM_DESKTOP"
56 | ],
57 | "compilerPath": "/usr/bin/clang",
58 | "cStandard": "c17",
59 | "cppStandard": "c++17",
60 | "intelliSenseMode": "clang-x64"
61 |
62 | }
63 | ],
64 | "version": 4
65 | }
66 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Debug",
9 | "type": "cppdbg",
10 | "request": "launch",
11 | "program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}.exe",
12 | "args": [],
13 | "stopAtEntry": false,
14 | "cwd": "${workspaceFolder}",
15 | "environment": [],
16 | "externalConsole": false,
17 | "MIMode": "gdb",
18 | "setupCommands": [
19 | {
20 | "description": "Enable pretty-printing for gdb",
21 | "text": "-enable-pretty-printing",
22 | "ignoreFailures": false
23 | }
24 | ],
25 | "windows": {
26 | "miDebuggerPath": "gdb.exe",
27 | },
28 | "osx": {
29 | "program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
30 | "MIMode": "lldb"
31 | },
32 | "linux": {
33 | "program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
34 | "miDebuggerPath": "/usr/bin/gdb",
35 | },
36 | "preLaunchTask": "build debug"
37 | },
38 | {
39 | "name": "Run",
40 | "type": "cppdbg",
41 | "request": "launch",
42 | "args": [],
43 | "stopAtEntry": false,
44 | "cwd": "${workspaceFolder}",
45 | "environment": [],
46 | "externalConsole": false,
47 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",
48 | "MIMode": "gdb",
49 | "windows": {
50 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",
51 | "miDebuggerPath": "gdb.exe"
52 | },
53 | "osx": {
54 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}",
55 | "MIMode": "lldb"
56 | },
57 | "linux": {
58 | "program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}",
59 | "miDebuggerPath": "/usr/bin/gdb"
60 | },
61 | "preLaunchTask": "build release",
62 | }
63 | ]
64 | }
65 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | "**/.git": true,
4 | "**/.svn": true,
5 | "**/.hg": true,
6 | "**/CVS": true,
7 | "**/.DS_Store": true,
8 | "**/*.o": true,
9 | "**/*.exe": true,
10 | }
11 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "label": "build debug",
8 | "type": "process",
9 | "command": "make",
10 | "windows": {
11 | "command": "mingw32-make.exe",
12 | },
13 | "osx": {
14 | "args": [
15 | "config=debug_arm64"
16 | ],
17 | },
18 | "group": {
19 | "kind": "build",
20 | "isDefault": true
21 | },
22 | "problemMatcher": [
23 | "$gcc"
24 | ],
25 | "dependsOn":["UpdateMake"]
26 | },
27 | {
28 | "label": "build release",
29 | "type": "process",
30 | "command": "make",
31 | "windows": {
32 | "command": "mingw32-make.exe",
33 | "args": [
34 | "config=release_x64"
35 | ],
36 | },
37 | "linux": {
38 | "args": [
39 | "config=release_x64"
40 | ],
41 | },
42 | "osx": {
43 | "args": [
44 | "config=release_arm64"
45 | ],
46 | },
47 | "group": "build",
48 | "problemMatcher": [
49 | "$gcc"
50 | ],
51 | "dependsOn":["UpdateMake"]
52 | },
53 | {
54 | "label": "Clean",
55 | "type": "process",
56 | "command": "make",
57 | "windows": {
58 | "command": "mingw32-make.exe",
59 | "args": [
60 | "clean"
61 | ],
62 | },
63 | "linux": {
64 | "args": [
65 | "clean"
66 | ],
67 | },
68 | "osx": {
69 | "args": [
70 | "clean"
71 | ],
72 | },
73 | "group": "build",
74 | "problemMatcher": [
75 | "$gcc"
76 | ],
77 | "dependsOn":["UpdateMake"]
78 | },
79 | {
80 | "label": "UpdateMake",
81 | "type": "process",
82 | "command": "./premake5",
83 | "options": {
84 | "cwd": "${workspaceFolder}/build/"
85 | },
86 | "args": [
87 | "gmake2"
88 | ],
89 | "windows": {
90 | "command": "./premake5.exe"
91 | },
92 | "linux": {
93 | "command": "./premake5"
94 | },
95 | "osx": {
96 | "command": "premake5.osx"
97 | },
98 | "group": "build"
99 | }
100 | ]
101 | }
102 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Raylib-Quickstart
2 | A simple cross platform template for setting up a project with the bleeding edge raylib code.
3 | Works with C or C++.
4 |
5 | ## Supported Platforms
6 | Quickstart supports the main 3 desktop platforms:
7 | * Windows
8 | * Linux
9 | * MacOS
10 |
11 | # Naming projects
12 | Do not name your game project 'raylib', it will conflict with the raylib library.
13 |
14 | # VSCode Users (all platforms)
15 | *Note* You must have a compiler toolchain installed in addition to vscode.
16 |
17 | * Download the quickstart
18 | * Rename the folder to your game name
19 | * Open the folder in VSCode
20 | * Run the build task ( CTRL+SHIFT+B or F5 )
21 | * You are good to go
22 |
23 | # Windows Users
24 | There are two compiler toolchains available for windows, MinGW-W64 (a free compiler using GCC), and Microsoft Visual Studio
25 | ## Using MinGW-W64
26 | * Double click the `build-MinGW-W64.bat` file
27 | * CD into the folder in your terminal
28 | * run `make`
29 | * You are good to go
30 |
31 | ### Note on MinGW-64 versions
32 | Make sure you have a modern version of MinGW-W64 (not mingw).
33 | The best place to get it is from the W64devkit from
34 | https://github.com/skeeto/w64devkit/releases
35 | or the version installed with the raylib installer
36 | #### If you have installed raylib from the installer
37 | Make sure you have added the path
38 |
39 | `C:\raylib\w64devkit\bin`
40 |
41 | To your path environment variable so that the compiler that came with raylib can be found.
42 |
43 | DO NOT INSTALL ANOTHER MinGW-W64 from another source such as msys2, you don't need it.
44 |
45 | ## Microsoft Visual Studio
46 | * Run `build-VisualStudio2022.bat`
47 | * double click the `.sln` file that is generated
48 | * develop your game
49 | * you are good to go
50 |
51 | # Linux Users
52 | * CD into the build folder
53 | * run `./premake5 gmake2`
54 | * CD back to the root
55 | * run `make`
56 | * you are good to go
57 |
58 | # MacOS Users
59 | * CD into the build folder
60 | * run `./premake5.osx gmake2`
61 | * CD back to the root
62 | * run `make`
63 | * you are good to go
64 |
65 | # Output files
66 | The built code will be in the bin dir
67 |
68 | # Working directories and the resources folder
69 | The example uses a utility function from `path_utils.h` that will find the resources dir and set it as the current working directory. This is very useful when starting out. If you wish to manage your own working directory you can simply remove the call to the function and the header.
70 |
71 | # Changing to C++
72 | Simply rename `src/main.c` to `src/main.cpp` and re-run the steps above and do a clean build.
73 |
74 | # Using your own code
75 | Simply remove `src/main.c` and replace it with your code, and re-run the steps above and do a clean build.
76 |
77 | # Building for other OpenGL targets
78 | If you need to build for a different OpenGL version than the default (OpenGL 3.3) you can specify an OpenGL version in your premake command line. Just modify the bat file or add the following to your command line
79 |
80 | ## For OpenGL 1.1
81 | `--graphics=opengl11`
82 |
83 | ## For OpenGL 2.1
84 | `--graphics=opengl21`
85 |
86 | ## For OpenGL 4.3
87 | `--graphics=opengl43`
88 |
89 | ## For OpenGLES 2.0
90 | `--graphics=opengles2`
91 |
92 | ## For OpenGLES 3.0
93 | `--graphics=opengles3`
94 |
95 | # License
96 | Copyright (c) 2020-2025 Jeffery Myers
97 |
98 | This software is provided "as-is", without any express or implied warranty. In no event
99 | will the authors be held liable for any damages arising from the use of this software.
100 |
101 | Permission is granted to anyone to use this software for any purpose, including commercial
102 | applications, and to alter it and redistribute it freely, subject to the following restrictions:
103 |
104 | 1. The origin of this software must not be misrepresented; you must not claim that you
105 | wrote the original software. If you use this software in a product, an acknowledgment
106 | in the product documentation would be appreciated but is not required.
107 |
108 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented
109 | as being the original software.
110 |
111 | 3. This notice may not be removed or altered from any source distribution.
112 |
--------------------------------------------------------------------------------
/build-MinGW-W64.bat:
--------------------------------------------------------------------------------
1 | cd build
2 | premake5.exe gmake2
3 | cd ..
4 | mingw32-make clean
5 | pause
6 |
--------------------------------------------------------------------------------
/build-VisualStudio2022.bat:
--------------------------------------------------------------------------------
1 | cd build
2 | premake5.exe vs2022 || pause
3 | cd ../
--------------------------------------------------------------------------------
/build/premake5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/raylib-quickstart/79e615523122bb322e3dfe901269023e61636b07/build/premake5
--------------------------------------------------------------------------------
/build/premake5.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/raylib-quickstart/79e615523122bb322e3dfe901269023e61636b07/build/premake5.exe
--------------------------------------------------------------------------------
/build/premake5.lua:
--------------------------------------------------------------------------------
1 | newoption
2 | {
3 | trigger = "graphics",
4 | value = "OPENGL_VERSION",
5 | description = "version of OpenGL to build raylib against",
6 | allowed = {
7 | { "opengl11", "OpenGL 1.1"},
8 | { "opengl21", "OpenGL 2.1"},
9 | { "opengl33", "OpenGL 3.3"},
10 | { "opengl43", "OpenGL 4.3"},
11 | { "openges2", "OpenGL ES2"},
12 | { "openges3", "OpenGL ES3"}
13 | },
14 | default = "opengl33"
15 | }
16 |
17 | function download_progress(total, current)
18 | local ratio = current / total;
19 | ratio = math.min(math.max(ratio, 0), 1);
20 | local percent = math.floor(ratio * 100);
21 | print("Download progress (" .. percent .. "%/100%)")
22 | end
23 |
24 | function check_raylib()
25 | os.chdir("external")
26 | if(os.isdir("raylib-master") == false) then
27 | if(not os.isfile("raylib-master.zip")) then
28 | print("Raylib not found, downloading from github")
29 | local result_str, response_code = http.download("https://github.com/raysan5/raylib/archive/refs/heads/master.zip", "raylib-master.zip", {
30 | progress = download_progress,
31 | headers = { "From: Premake", "Referer: Premake" }
32 | })
33 | end
34 | print("Unzipping to " .. os.getcwd())
35 | zip.extract("raylib-master.zip", os.getcwd())
36 | os.remove("raylib-master.zip")
37 | end
38 | os.chdir("../")
39 | end
40 |
41 | function build_externals()
42 | print("calling externals")
43 | check_raylib()
44 | end
45 |
46 | function platform_defines()
47 | filter {"configurations:Debug or Release"}
48 | defines{"PLATFORM_DESKTOP"}
49 |
50 | filter {"configurations:Debug_RGFW or Release_RGFW"}
51 | defines{"PLATFORM_DESKTOP_RGFW"}
52 |
53 | filter {"options:graphics=opengl43"}
54 | defines{"GRAPHICS_API_OPENGL_43"}
55 |
56 | filter {"options:graphics=opengl33"}
57 | defines{"GRAPHICS_API_OPENGL_33"}
58 |
59 | filter {"options:graphics=opengl21"}
60 | defines{"GRAPHICS_API_OPENGL_21"}
61 |
62 | filter {"options:graphics=opengl11"}
63 | defines{"GRAPHICS_API_OPENGL_11"}
64 |
65 | filter {"options:graphics=openges3"}
66 | defines{"GRAPHICS_API_OPENGL_ES3"}
67 |
68 | filter {"options:graphics=openges2"}
69 | defines{"GRAPHICS_API_OPENGL_ES2"}
70 |
71 | filter {"system:macosx"}
72 | disablewarnings {"deprecated-declarations"}
73 |
74 | filter {"system:linux"}
75 | defines {"_GLFW_X11"}
76 | defines {"_GNU_SOURCE"}
77 | -- This is necessary, otherwise compilation will fail since
78 | -- there is no CLOCK_MONOTOMIC. raylib claims to have a workaround
79 | -- to compile under c99 without -D_GNU_SOURCE, but it didn't seem
80 | -- to work. raylib's Makefile also adds this flag, probably why it went
81 | -- unnoticed for so long.
82 | -- It compiles under c11 without -D_GNU_SOURCE, because c11 requires
83 | -- to have CLOCK_MONOTOMIC
84 | -- See: https://github.com/raysan5/raylib/issues/2729
85 |
86 | filter{}
87 | end
88 |
89 | -- if you don't want to download raylib, then set this to false, and set the raylib dir to where you want raylib to be pulled from, must be full sources.
90 | downloadRaylib = true
91 | raylib_dir = "external/raylib-master"
92 |
93 | workspaceName = 'MyGame'
94 | baseName = path.getbasename(path.getdirectory(os.getcwd()));
95 |
96 | --if (baseName ~= 'raylib-quickstart') then
97 | workspaceName = baseName
98 | --end
99 |
100 | if (os.isdir('build_files') == false) then
101 | os.mkdir('build_files')
102 | end
103 |
104 | if (os.isdir('external') == false) then
105 | os.mkdir('external')
106 | end
107 |
108 |
109 | workspace (workspaceName)
110 | location "../"
111 | configurations { "Debug", "Release", "Debug_RGFW", "Release_RGFW"}
112 | platforms { "x64", "x86", "ARM64"}
113 |
114 | defaultplatform ("x64")
115 |
116 | filter "configurations:Debug or Debug_RGFW"
117 | defines { "DEBUG" }
118 | symbols "On"
119 |
120 | filter "configurations:Release or Release_RGFW"
121 | defines { "NDEBUG" }
122 | optimize "On"
123 |
124 | filter { "platforms:x64" }
125 | architecture "x86_64"
126 |
127 | filter { "platforms:Arm64" }
128 | architecture "ARM64"
129 |
130 | filter {}
131 |
132 | targetdir "bin/%{cfg.buildcfg}/"
133 |
134 | if (downloadRaylib) then
135 | build_externals()
136 | end
137 |
138 | startproject(workspaceName)
139 |
140 | project (workspaceName)
141 | kind "ConsoleApp"
142 | location "build_files/"
143 | targetdir "../bin/%{cfg.buildcfg}"
144 |
145 | filter {"system:windows", "configurations:Release or Release_RGFW", "action:gmake*"}
146 | kind "WindowedApp"
147 | buildoptions { "-Wl,--subsystem,windows" }
148 |
149 | filter {"system:windows", "configurations:Release or Release_RGFW", "action:vs*"}
150 | kind "WindowedApp"
151 | entrypoint "mainCRTStartup"
152 |
153 | filter "action:vs*"
154 | debugdir "$(SolutionDir)"
155 |
156 | filter{}
157 |
158 | vpaths
159 | {
160 | ["Header Files/*"] = { "../include/**.h", "../include/**.hpp", "../src/**.h", "../src/**.hpp"},
161 | ["Source Files/*"] = {"../src/**.c", "src/**.cpp"},
162 | ["Widows Resoruce Files/*"] = {"../src/**.rc", "src/**.ico"},
163 | }
164 |
165 | files {"../src/**.c", "../src/**.cpp", "../src/**.h", "../src/**.hpp", "../include/**.h", "../include/**.hpp"}
166 |
167 | filter {"system:windows", "action:vs*"}
168 | files {"../src/*.rc", "../src/*.ico"}
169 |
170 | filter{}
171 |
172 | includedirs { "../src" }
173 | includedirs { "../include" }
174 |
175 | links {"raylib"}
176 |
177 | cdialect "C17"
178 | cppdialect "C++17"
179 |
180 | includedirs {raylib_dir .. "/src" }
181 | includedirs {raylib_dir .."/src/external" }
182 | includedirs { raylib_dir .."/src/external/glfw/include" }
183 | flags { "ShadowedVariables"}
184 | platform_defines()
185 |
186 | filter "action:vs*"
187 | defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
188 | dependson {"raylib"}
189 | links {"raylib.lib"}
190 | characterset ("Unicode")
191 | buildoptions { "/Zc:__cplusplus" }
192 |
193 | filter "system:windows"
194 | defines{"_WIN32"}
195 | links {"winmm", "gdi32", "opengl32"}
196 | libdirs {"../bin/%{cfg.buildcfg}"}
197 |
198 | filter "system:linux"
199 | links {"pthread", "m", "dl", "rt", "X11"}
200 |
201 | filter "system:macosx"
202 | links {"OpenGL.framework", "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", "CoreAudio.framework", "CoreVideo.framework", "AudioToolbox.framework"}
203 |
204 | filter{}
205 |
206 |
207 | project "raylib"
208 | kind "StaticLib"
209 |
210 | platform_defines()
211 |
212 | location "build_files/"
213 |
214 | language "C"
215 | targetdir "../bin/%{cfg.buildcfg}"
216 |
217 | filter "action:vs*"
218 | defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
219 | characterset ("Unicode")
220 | buildoptions { "/Zc:__cplusplus" }
221 | filter{}
222 |
223 | includedirs {raylib_dir .. "/src", raylib_dir .. "/src/external/glfw/include" }
224 | vpaths
225 | {
226 | ["Header Files"] = { raylib_dir .. "/src/**.h"},
227 | ["Source Files/*"] = { raylib_dir .. "/src/**.c"},
228 | }
229 | files {raylib_dir .. "/src/*.h", raylib_dir .. "/src/*.c"}
230 |
231 | removefiles {raylib_dir .. "/src/rcore_*.c"}
232 |
233 | filter { "system:macosx", "files:" .. raylib_dir .. "/src/rglfw.c" }
234 | compileas "Objective-C"
235 |
236 | filter{}
237 |
--------------------------------------------------------------------------------
/build/premake5.osx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/raylib-quickstart/79e615523122bb322e3dfe901269023e61636b07/build/premake5.osx
--------------------------------------------------------------------------------
/include/resource_dir.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************************
2 | *
3 | * raylibExtras * Utilities and Shared Components for Raylib
4 | *
5 | * Resource Dir * function to help find resource dir in common locations
6 | *
7 | * LICENSE: MIT
8 | *
9 | * Copyright (c) 2022 Jeffery Myers
10 | *
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy
12 | * of this software and associated documentation files (the "Software"), to deal
13 | * in the Software without restriction, including without limitation the rights
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | * copies of the Software, and to permit persons to whom the Software is
16 | * furnished to do so, subject to the following conditions:
17 | *
18 | * The above copyright notice and this permission notice shall be included in all
19 | * copies or substantial portions of the Software.
20 | *
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | * SOFTWARE.
28 | *
29 | **********************************************************************************************/
30 |
31 | #pragma once
32 |
33 | #include "raylib.h"
34 |
35 | #if defined(__cplusplus)
36 | extern "C" { // Prevents name mangling of functions
37 | #endif
38 | ///
39 | /// Looks for the specified resource dir in several common locations
40 | /// The working dir
41 | /// The app dir
42 | /// Up to 3 levels above the app dir
43 | /// When found the dir will be set as the working dir so that assets can be loaded relative to that.
44 | ///
45 | /// The name of the resources dir to look for
46 | /// True if a dir with the name was found, false if no change was made to the working dir
47 | inline static bool SearchAndSetResourceDir(const char* folderName)
48 | {
49 | // check the working dir
50 | if (DirectoryExists(folderName))
51 | {
52 | ChangeDirectory(TextFormat("%s/%s", GetWorkingDirectory(), folderName));
53 | return true;
54 | }
55 |
56 | const char* appDir = GetApplicationDirectory();
57 |
58 | // check the applicationDir
59 | const char* dir = TextFormat("%s%s", appDir, folderName);
60 | if (DirectoryExists(dir))
61 | {
62 | ChangeDirectory(dir);
63 | return true;
64 | }
65 |
66 | // check one up from the app dir
67 | dir = TextFormat("%s../%s", appDir, folderName);
68 | if (DirectoryExists(dir))
69 | {
70 | ChangeDirectory(dir);
71 | return true;
72 | }
73 |
74 | // check two up from the app dir
75 | dir = TextFormat("%s../../%s", appDir, folderName);
76 | if (DirectoryExists(dir))
77 | {
78 | ChangeDirectory(dir);
79 | return true;
80 | }
81 |
82 | // check three up from the app dir
83 | dir = TextFormat("%s../../../%s", appDir, folderName);
84 | if (DirectoryExists(dir))
85 | {
86 | ChangeDirectory(dir);
87 | return true;
88 | }
89 |
90 | return false;
91 | }
92 |
93 | #if defined(__cplusplus)
94 | }
95 | #endif
--------------------------------------------------------------------------------
/resources/wabbit_alpha.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/raylib-quickstart/79e615523122bb322e3dfe901269023e61636b07/resources/wabbit_alpha.png
--------------------------------------------------------------------------------
/src/application.rc:
--------------------------------------------------------------------------------
1 | GLFW_ICON ICON "icon.ico"
2 |
3 | 1 VERSIONINFO
4 | FILEVERSION 1,0,0,0
5 | PRODUCTVERSION 1,0,0,0
6 | BEGIN
7 | BLOCK "StringFileInfo"
8 | BEGIN
9 | //BLOCK "080904E4" // English UK
10 | BLOCK "040904E4" // English US
11 | BEGIN
12 | //VALUE "CompanyName", "raylib technologies"
13 | VALUE "FileDescription", "A cool game made with raylib (www.raylib.com)"
14 | VALUE "FileVersion", "1.0.0"
15 | VALUE "InternalName", "cool game"
16 | VALUE "LegalCopyright", "(c) 2025 YOUR NAME"
17 | //VALUE "OriginalFilename", "raylib_app"
18 | VALUE "ProductName", "A cool game"
19 | VALUE "ProductVersion", "1.0.0"
20 | END
21 | END
22 | BLOCK "VarFileInfo"
23 | BEGIN
24 | //VALUE "Translation", 0x809, 1252 // English UK
25 | VALUE "Translation", 0x409, 1252 // English US
26 | END
27 | END
28 |
--------------------------------------------------------------------------------
/src/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/raylib-quickstart/79e615523122bb322e3dfe901269023e61636b07/src/icon.ico
--------------------------------------------------------------------------------
/src/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | Raylib example file.
3 | This is an example main file for a simple raylib project.
4 | Use this as a starting point or replace it with your code.
5 |
6 | by Jeffery Myers is marked with CC0 1.0. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/
7 |
8 | */
9 |
10 | #include "raylib.h"
11 |
12 | #include "resource_dir.h" // utility header for SearchAndSetResourceDir
13 |
14 | int main ()
15 | {
16 | // Tell the window to use vsync and work on high DPI displays
17 | SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
18 |
19 | // Create the window and OpenGL context
20 | InitWindow(1280, 800, "Hello Raylib");
21 |
22 | // 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
23 | SearchAndSetResourceDir("resources");
24 |
25 | // Load a texture from the resources directory
26 | Texture wabbit = LoadTexture("wabbit_alpha.png");
27 |
28 | // game loop
29 | while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window
30 | {
31 | // drawing
32 | BeginDrawing();
33 |
34 | // Setup the back buffer for drawing (clear color and depth buffers)
35 | ClearBackground(BLACK);
36 |
37 | // draw some text using the default font
38 | DrawText("Hello Raylib", 200,200,20,WHITE);
39 |
40 | // draw our texture to the screen
41 | DrawTexture(wabbit, 400, 200, WHITE);
42 |
43 | // end the frame and get ready for the next one (display frame, poll input, etc...)
44 | EndDrawing();
45 | }
46 |
47 | // cleanup
48 | // unload our texture so it can be cleaned up
49 | UnloadTexture(wabbit);
50 |
51 | // destroy the window and cleanup the OpenGL context
52 | CloseWindow();
53 | return 0;
54 | }
55 |
--------------------------------------------------------------------------------