first commit
This commit is contained in:
commit
3dadf9b2fa
402
.gitignore
vendored
Normal file
402
.gitignore
vendored
Normal file
@ -0,0 +1,402 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
build_files
|
||||
raylib-master
|
||||
Makefile
|
||||
/*.sln
|
64
.vscode/launch.json
vendored
Normal file
64
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// 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}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": false
|
||||
}
|
||||
],
|
||||
"windows": {
|
||||
"miDebuggerPath": "gdb.exe",
|
||||
},
|
||||
"osx": {
|
||||
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
|
||||
"MIMode": "lldb"
|
||||
},
|
||||
"linux": {
|
||||
"program": "${workspaceFolder}/bin/Debug/${workspaceFolderBasename}",
|
||||
"miDebuggerPath": "/usr/bin/gdb",
|
||||
},
|
||||
"preLaunchTask": "build debug"
|
||||
},
|
||||
{
|
||||
"name": "Run",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",
|
||||
"MIMode": "gdb",
|
||||
"windows": {
|
||||
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}.exe",
|
||||
"miDebuggerPath": "gdb.exe"
|
||||
},
|
||||
"osx": {
|
||||
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}",
|
||||
"MIMode": "lldb"
|
||||
},
|
||||
"linux": {
|
||||
"program": "${workspaceFolder}/bin/Release/${workspaceFolderBasename}",
|
||||
"miDebuggerPath": "/usr/bin/gdb"
|
||||
},
|
||||
"preLaunchTask": "build release",
|
||||
}
|
||||
]
|
||||
}
|
14
.vscode/settings.json
vendored
Normal file
14
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
"**/.hg": true,
|
||||
"**/CVS": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/*.o": true,
|
||||
"**/*.exe": true,
|
||||
},
|
||||
"files.associations": {
|
||||
"resource_dir.h": "c"
|
||||
}
|
||||
}
|
101
.vscode/tasks.json
vendored
Normal file
101
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build debug",
|
||||
"type": "process",
|
||||
"command": "make",
|
||||
"windows": {
|
||||
"command": "mingw32-make.exe",
|
||||
},
|
||||
"osx": {
|
||||
"args": [
|
||||
"config=debug_arm64"
|
||||
],
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"dependsOn":["UpdateMake"]
|
||||
},
|
||||
{
|
||||
"label": "build release",
|
||||
"type": "process",
|
||||
"command": "make",
|
||||
"windows": {
|
||||
"command": "mingw32-make.exe",
|
||||
"args": [
|
||||
"config=release_x64"
|
||||
],
|
||||
},
|
||||
"linux": {
|
||||
"args": [
|
||||
"config=release_x64"
|
||||
],
|
||||
},
|
||||
"osx": {
|
||||
"args": [
|
||||
"config=release_arm64"
|
||||
],
|
||||
},
|
||||
"group": "build",
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"dependsOn":["UpdateMake"]
|
||||
},
|
||||
{
|
||||
"label": "Clean",
|
||||
"type": "process",
|
||||
"command": "make",
|
||||
"windows": {
|
||||
"command": "mingw32-make.exe",
|
||||
"args": [
|
||||
"clean"
|
||||
],
|
||||
},
|
||||
"linux": {
|
||||
"args": [
|
||||
"clean"
|
||||
],
|
||||
},
|
||||
"osx": {
|
||||
"args": [
|
||||
"clean"
|
||||
],
|
||||
},
|
||||
"group": "build",
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"dependsOn":["UpdateMake"]
|
||||
},
|
||||
{
|
||||
"label": "UpdateMake",
|
||||
"type": "process",
|
||||
"command": "./premake5",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/build/"
|
||||
},
|
||||
"args": [
|
||||
"gmake2"
|
||||
],
|
||||
"windows": {
|
||||
"command": "./premake5.exe"
|
||||
},
|
||||
"linux": {
|
||||
"command": "./premake5"
|
||||
},
|
||||
"osx": {
|
||||
"command": "premake5.osx"
|
||||
},
|
||||
"group": "build"
|
||||
}
|
||||
]
|
||||
}
|
108
README.md
Normal file
108
README.md
Normal file
@ -0,0 +1,108 @@
|
||||
# Raylib-Quickstart
|
||||
A simple cross platform template for setting up a project with the bleeding edge raylib code.
|
||||
Works with C or C++.
|
||||
|
||||
## Supported Platforms
|
||||
Quickstart supports the main 3 desktop platforms:
|
||||
* Windows
|
||||
* Linux
|
||||
* MacOS
|
||||
|
||||
# VSCode Users (all platforms)
|
||||
*Note* You must have a compiler toolchain installed in addition to vscode.
|
||||
|
||||
* Download the quickstart
|
||||
* Rename the folder to your game name
|
||||
* Open the folder in VSCode
|
||||
* Press F5 to build
|
||||
* You are good to go
|
||||
|
||||
# Windows Users
|
||||
There are two compiler toolchains available for windows, MinGW-W64 (a free compiler using GCC), and Microsoft Visual Studio
|
||||
## Using MinGW-W64
|
||||
* Double click the `build-MinGW-W64.bat` file
|
||||
* CD into the folder in your terminal
|
||||
* run `make`
|
||||
* You are good to go
|
||||
|
||||
### Note on MinGW-64 versions
|
||||
Make sure you have a modern version of MinGW-W64 (not mingw).
|
||||
The best place to get it is from the W64devkit from
|
||||
https://github.com/skeeto/w64devkit/releases
|
||||
or the version installed with the raylib installer
|
||||
#### If you have installed raylib from the installer
|
||||
Make sure you have added the path
|
||||
|
||||
`C:\raylib\w64devkit\bin`
|
||||
|
||||
To your path environment variable so that the compiler that came with raylib can be found.
|
||||
|
||||
DO NOT INSTALL ANOTHER MinGW-W64 from another source such as msys2, you don't need it.
|
||||
|
||||
## Microsoft Visual Studio
|
||||
* Run `build-VisualStudio2022.bat`
|
||||
* double click the `.sln` file that is generated
|
||||
* develop your game
|
||||
* you are good to go
|
||||
|
||||
# Linux Users
|
||||
* CD into the build folder
|
||||
* run `./premake5 gmake2`
|
||||
* CD back to the root
|
||||
* run `make`
|
||||
* you are good to go
|
||||
|
||||
# MacOS Users
|
||||
* CD into the build folder
|
||||
* run `./premake5.osx gmake2`
|
||||
* CD back to the root
|
||||
* run `make`
|
||||
* you are good to go
|
||||
|
||||
# Output files
|
||||
The built code will be in the bin dir
|
||||
|
||||
# Working directories and the resources folder
|
||||
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.
|
||||
|
||||
# Changing to C++
|
||||
Simply rename `src/main.c` to `src/main.cpp` and re-run the steps above and do a clean build.
|
||||
|
||||
# Using your own code
|
||||
Simply remove `src/main.c` and replace it with your code, and re-run the steps above and do a clean build.
|
||||
|
||||
# Building for other OpenGL targets
|
||||
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
|
||||
|
||||
## For OpenGL 1.1
|
||||
`--graphics=opengl11`
|
||||
|
||||
## For OpenGL 2.1
|
||||
`--graphics=opengl21`
|
||||
|
||||
## For OpenGL 4.3
|
||||
`--graphics=opengl43`
|
||||
|
||||
## For OpenGLES 2.0
|
||||
`--graphics=opengles2`
|
||||
|
||||
## For OpenGLES 3.0
|
||||
`--graphics=opengles3`
|
||||
|
||||
# License
|
||||
Copyright (c) 2020-2024 Jeffery Myers
|
||||
|
||||
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.
|
5
build-MinGW-W64.bat
Normal file
5
build-MinGW-W64.bat
Normal file
@ -0,0 +1,5 @@
|
||||
cd build
|
||||
premake5.exe gmake2
|
||||
cd ..
|
||||
mingw32-make clean
|
||||
pause
|
3
build-VisualStudio2022.bat
Normal file
3
build-VisualStudio2022.bat
Normal file
@ -0,0 +1,3 @@
|
||||
cd build
|
||||
premake5.exe vs2022 || pause
|
||||
cd ../
|
BIN
build/premake5
Executable file
BIN
build/premake5
Executable file
Binary file not shown.
BIN
build/premake5.exe
Normal file
BIN
build/premake5.exe
Normal file
Binary file not shown.
229
build/premake5.lua
Normal file
229
build/premake5.lua
Normal file
@ -0,0 +1,229 @@
|
||||
newoption
|
||||
{
|
||||
trigger = "graphics",
|
||||
value = "OPENGL_VERSION",
|
||||
description = "version of OpenGL to build raylib against",
|
||||
allowed = {
|
||||
{ "opengl11", "OpenGL 1.1"},
|
||||
{ "opengl21", "OpenGL 2.1"},
|
||||
{ "opengl33", "OpenGL 3.3"},
|
||||
{ "opengl43", "OpenGL 4.3"},
|
||||
{ "openges2", "OpenGL ES2"},
|
||||
{ "openges3", "OpenGL ES3"}
|
||||
},
|
||||
default = "opengl33"
|
||||
}
|
||||
|
||||
function download_progress(total, current)
|
||||
local ratio = current / total;
|
||||
ratio = math.min(math.max(ratio, 0), 1);
|
||||
local percent = math.floor(ratio * 100);
|
||||
print("Download progress (" .. percent .. "%/100%)")
|
||||
end
|
||||
|
||||
function check_raylib()
|
||||
os.chdir("external")
|
||||
if(os.isdir("raylib-master") == false) then
|
||||
if(not os.isfile("raylib-master.zip")) then
|
||||
print("Raylib not found, downloading from github")
|
||||
local result_str, response_code = http.download("https://github.com/raysan5/raylib/archive/refs/heads/master.zip", "raylib-master.zip", {
|
||||
progress = download_progress,
|
||||
headers = { "From: Premake", "Referer: Premake" }
|
||||
})
|
||||
end
|
||||
print("Unzipping to " .. os.getcwd())
|
||||
zip.extract("raylib-master.zip", os.getcwd())
|
||||
os.remove("raylib-master.zip")
|
||||
end
|
||||
os.chdir("../")
|
||||
end
|
||||
|
||||
function build_externals()
|
||||
print("calling externals")
|
||||
check_raylib()
|
||||
end
|
||||
|
||||
function platform_defines()
|
||||
filter {"configurations:Debug or Release"}
|
||||
defines{"PLATFORM_DESKTOP"}
|
||||
|
||||
filter {"configurations:Debug_RGFW or Release_RGFW"}
|
||||
defines{"PLATFORM_DESKTOP_RGFW"}
|
||||
|
||||
filter {"options:graphics=opengl43"}
|
||||
defines{"GRAPHICS_API_OPENGL_43"}
|
||||
|
||||
filter {"options:graphics=opengl33"}
|
||||
defines{"GRAPHICS_API_OPENGL_33"}
|
||||
|
||||
filter {"options:graphics=opengl21"}
|
||||
defines{"GRAPHICS_API_OPENGL_21"}
|
||||
|
||||
filter {"options:graphics=opengl11"}
|
||||
defines{"GRAPHICS_API_OPENGL_11"}
|
||||
|
||||
filter {"options:graphics=openges3"}
|
||||
defines{"GRAPHICS_API_OPENGL_ES3"}
|
||||
|
||||
filter {"options:graphics=openges2"}
|
||||
defines{"GRAPHICS_API_OPENGL_ES2"}
|
||||
|
||||
filter {"system:macosx"}
|
||||
disablewarnings {"deprecated-declarations"}
|
||||
|
||||
filter {"system:linux"}
|
||||
defines {"_GLFW_X11"}
|
||||
defines {"_GNU_SOURCE"}
|
||||
-- This is necessary, otherwise compilation will fail since
|
||||
-- there is no CLOCK_MONOTOMIC. raylib claims to have a workaround
|
||||
-- to compile under c99 without -D_GNU_SOURCE, but it didn't seem
|
||||
-- to work. raylib's Makefile also adds this flag, probably why it went
|
||||
-- unnoticed for so long.
|
||||
-- It compiles under c11 without -D_GNU_SOURCE, because c11 requires
|
||||
-- to have CLOCK_MONOTOMIC
|
||||
-- See: https://github.com/raysan5/raylib/issues/2729
|
||||
|
||||
filter{}
|
||||
end
|
||||
|
||||
-- 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.
|
||||
downloadRaylib = true
|
||||
raylib_dir = "external/raylib-master"
|
||||
|
||||
workspaceName = 'MyGame'
|
||||
baseName = path.getbasename(path.getdirectory(os.getcwd()));
|
||||
|
||||
--if (baseName ~= 'raylib-quickstart') then
|
||||
workspaceName = baseName
|
||||
--end
|
||||
|
||||
if (os.isdir('build_files') == false) then
|
||||
os.mkdir('build_files')
|
||||
end
|
||||
|
||||
if (os.isdir('external') == false) then
|
||||
os.mkdir('external')
|
||||
end
|
||||
|
||||
|
||||
workspace (workspaceName)
|
||||
location "../"
|
||||
configurations { "Debug", "Release", "Debug_RGFW", "Release_RGFW"}
|
||||
platforms { "x64", "x86", "ARM64"}
|
||||
|
||||
defaultplatform ("x64")
|
||||
|
||||
filter "configurations:Debug or Debug_RGFW"
|
||||
defines { "DEBUG" }
|
||||
symbols "On"
|
||||
|
||||
filter "configurations:Release or Release_RGFW"
|
||||
defines { "NDEBUG" }
|
||||
optimize "On"
|
||||
|
||||
filter { "platforms:x64" }
|
||||
architecture "x86_64"
|
||||
|
||||
filter { "platforms:Arm64" }
|
||||
architecture "ARM64"
|
||||
|
||||
filter {}
|
||||
|
||||
targetdir "bin/%{cfg.buildcfg}/"
|
||||
|
||||
if (downloadRaylib) then
|
||||
build_externals()
|
||||
end
|
||||
|
||||
startproject(workspaceName)
|
||||
|
||||
project (workspaceName)
|
||||
kind "ConsoleApp"
|
||||
location "build_files/"
|
||||
targetdir "../bin/%{cfg.buildcfg}"
|
||||
|
||||
filter {"system:windows", "configurations:Release or Release_RGFW", "action:gmake*"}
|
||||
kind "WindowedApp"
|
||||
buildoptions { "-Wl,--subsystem,windows" }
|
||||
|
||||
filter {"system:windows", "configurations:Release or Release_RGFW", "action:vs*"}
|
||||
kind "WindowedApp"
|
||||
entrypoint "mainCRTStartup"
|
||||
|
||||
filter "action:vs*"
|
||||
debugdir "$(SolutionDir)"
|
||||
|
||||
filter{}
|
||||
|
||||
vpaths
|
||||
{
|
||||
["Header Files/*"] = { "../include/**.h", "../include/**.hpp", "../src/**.h", "../src/**.hpp"},
|
||||
["Source Files/*"] = {"../src/**.c", "src/**.cpp"},
|
||||
}
|
||||
files {"../src/**.c", "../src/**.cpp", "../src/**.h", "../src/**.hpp", "../include/**.h", "../include/**.hpp"}
|
||||
|
||||
includedirs { "../src" }
|
||||
includedirs { "../include" }
|
||||
|
||||
links {"raylib"}
|
||||
|
||||
cdialect "C17"
|
||||
cppdialect "C++17"
|
||||
|
||||
includedirs {raylib_dir .. "/src" }
|
||||
includedirs {raylib_dir .."/src/external" }
|
||||
includedirs { raylib_dir .."/src/external/glfw/include" }
|
||||
flags { "ShadowedVariables"}
|
||||
platform_defines()
|
||||
|
||||
filter "action:vs*"
|
||||
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
|
||||
dependson {"raylib"}
|
||||
links {"raylib.lib"}
|
||||
characterset ("Unicode")
|
||||
buildoptions { "/Zc:__cplusplus" }
|
||||
|
||||
filter "system:windows"
|
||||
defines{"_WIN32"}
|
||||
links {"winmm", "gdi32", "opengl32"}
|
||||
libdirs {"../bin/%{cfg.buildcfg}"}
|
||||
|
||||
filter "system:linux"
|
||||
links {"pthread", "m", "dl", "rt", "X11"}
|
||||
|
||||
filter "system:macosx"
|
||||
links {"OpenGL.framework", "Cocoa.framework", "IOKit.framework", "CoreFoundation.framework", "CoreAudio.framework", "CoreVideo.framework", "AudioToolbox.framework"}
|
||||
|
||||
filter{}
|
||||
|
||||
|
||||
project "raylib"
|
||||
kind "StaticLib"
|
||||
|
||||
platform_defines()
|
||||
|
||||
location "build_files/"
|
||||
|
||||
language "C"
|
||||
targetdir "../bin/%{cfg.buildcfg}"
|
||||
|
||||
filter "action:vs*"
|
||||
defines{"_WINSOCK_DEPRECATED_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"}
|
||||
characterset ("Unicode")
|
||||
buildoptions { "/Zc:__cplusplus" }
|
||||
filter{}
|
||||
|
||||
includedirs {raylib_dir .. "/src", raylib_dir .. "/src/external/glfw/include" }
|
||||
vpaths
|
||||
{
|
||||
["Header Files"] = { raylib_dir .. "/src/**.h"},
|
||||
["Source Files/*"] = { raylib_dir .. "/src/**.c"},
|
||||
}
|
||||
files {raylib_dir .. "/src/*.h", raylib_dir .. "/src/*.c"}
|
||||
|
||||
removefiles {raylib_dir .. "/src/rcore_*.c"}
|
||||
|
||||
filter { "system:macosx", "files:" .. raylib_dir .. "/src/rglfw.c" }
|
||||
compileas "Objective-C"
|
||||
|
||||
filter{}
|
BIN
build/premake5.osx
Executable file
BIN
build/premake5.osx
Executable file
Binary file not shown.
95
include/resource_dir.h
Normal file
95
include/resource_dir.h
Normal file
@ -0,0 +1,95 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* raylibExtras * Utilities and Shared Components for Raylib
|
||||
*
|
||||
* Resource Dir * function to help find resource dir in common locations
|
||||
*
|
||||
* LICENSE: MIT
|
||||
*
|
||||
* Copyright (c) 2022 Jeffery Myers
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" { // Prevents name mangling of functions
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Looks for the specified resource dir in several common locations
|
||||
/// The working dir
|
||||
/// The app dir
|
||||
/// Up to 3 levels above the app dir
|
||||
/// When found the dir will be set as the working dir so that assets can be loaded relative to that.
|
||||
/// </summary>
|
||||
/// <param name="folderName">The name of the resources dir to look for</param>
|
||||
/// <returns>True if a dir with the name was found, false if no change was made to the working dir</returns>
|
||||
inline static bool SearchAndSetResourceDir(const char* folderName)
|
||||
{
|
||||
// check the working dir
|
||||
if (DirectoryExists(folderName))
|
||||
{
|
||||
ChangeDirectory(TextFormat("%s/%s", GetWorkingDirectory(), folderName));
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* appDir = GetApplicationDirectory();
|
||||
|
||||
// check the applicationDir
|
||||
const char* dir = TextFormat("%s%s", appDir, folderName);
|
||||
if (DirectoryExists(dir))
|
||||
{
|
||||
ChangeDirectory(dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
// check one up from the app dir
|
||||
dir = TextFormat("%s../%s", appDir, folderName);
|
||||
if (DirectoryExists(dir))
|
||||
{
|
||||
ChangeDirectory(dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
// check two up from the app dir
|
||||
dir = TextFormat("%s../../%s", appDir, folderName);
|
||||
if (DirectoryExists(dir))
|
||||
{
|
||||
ChangeDirectory(dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
// check three up from the app dir
|
||||
dir = TextFormat("%s../../../%s", appDir, folderName);
|
||||
if (DirectoryExists(dir))
|
||||
{
|
||||
ChangeDirectory(dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
BIN
resources/wabbit_alpha.png
Normal file
BIN
resources/wabbit_alpha.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 496 B |
69
src/main.c
Normal file
69
src/main.c
Normal file
@ -0,0 +1,69 @@
|
||||
#include "raylib.h"
|
||||
#include "menu.h"
|
||||
#include "resource_dir.h" // utility header for SearchAndSetResourceDir
|
||||
#include <stddef.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
struct MenuItem item[] = {
|
||||
{.x = 200, .y = 500, .label = "Play"},
|
||||
{.x = 200, .y = 550, .label = "Options"},
|
||||
{.x = 200, .y = 600, .label = "Exit"},
|
||||
};
|
||||
size_t current_item = 0;
|
||||
size_t items_len = sizeof(item) / sizeof(struct MenuItem);
|
||||
|
||||
// Tell the window to use vsync and work on high DPI displays
|
||||
SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
|
||||
|
||||
// Create the window and OpenGL context
|
||||
InitWindow(1280, 800, "Touhou Jikuusen ~ Apotheotic Heterochronicity");
|
||||
|
||||
// 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");
|
||||
|
||||
// game loop
|
||||
while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window
|
||||
{
|
||||
// drawing
|
||||
BeginDrawing();
|
||||
|
||||
// Setup the back buffer for drawing (clear color and depth buffers)
|
||||
ClearBackground(BLACK);
|
||||
|
||||
|
||||
for (int i = 0; i < items_len; i++) {
|
||||
DrawText(item[i].label, item[i].x, item[i].y, 20, i == current_item ? YELLOW : WHITE);
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KEY_DOWN)) {
|
||||
current_item = (current_item + 1) % items_len;
|
||||
}
|
||||
if (IsKeyPressed(KEY_UP)) {
|
||||
if (current_item == 0) {
|
||||
current_item = items_len - 1;
|
||||
} else {
|
||||
current_item--;
|
||||
}
|
||||
}
|
||||
// draw some text using the default font
|
||||
DrawText("TOUHOU!!!!", 200,200,20,WHITE);
|
||||
|
||||
// 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);
|
||||
|
||||
// destroy the window and cleanup the OpenGL context
|
||||
CloseWindow();
|
||||
return 0;
|
||||
}
|
5
src/menu.h
Normal file
5
src/menu.h
Normal file
@ -0,0 +1,5 @@
|
||||
struct MenuItem {
|
||||
int x;
|
||||
int y;
|
||||
const char* label;
|
||||
};
|
Loading…
Reference in New Issue
Block a user