0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 22:23:43 +00:00

Compare commits

...

52 Commits

Author SHA1 Message Date
freezarite
136196f6a5 Merge remote-tracking branch 'origin/textureManagerChanges' into textureManagerChanges
# Conflicts:
#	.gitmodules
#	CMakeLists.txt
#	include/AssetManager.h
#	include/Map.h
#	include/TileComponent.h
#	src/AssetManager.cpp
#	src/Map.cpp
#	src/TileComponent.cpp
2024-11-19 19:14:20 +01:00
freezarite
27a80d9766 added new Constructor for SpriteComponent as Tiles wont work with enums 2024-11-17 17:05:26 +01:00
freezarite
ac217e931b added new Map for tile-textures as they wont work with our current enum-class maps. 2024-11-17 16:59:46 +01:00
freezarite
1a8a196e95 merged dev into textureManagerChanges 2024-11-17 16:26:05 +01:00
freezarite
494ff8aa0a magic_enum library stuff and refactored TextureEnum to Textures due to bad naming 2024-11-17 16:00:47 +01:00
a8052b4bbb Merge branch 'tmxlite' into dev 2024-11-17 14:07:42 +01:00
92dfbacd9b Fixed templates and const char* for texture 2024-11-17 13:07:33 +01:00
1fbbb39843 Merge branch 'v0-2-0' into dev 2024-11-17 12:50:32 +01:00
70260c01bb structural improvements & code comments 2024-11-17 12:39:14 +01:00
7f4b1df833 Restructured code 2024-11-16 20:02:35 +01:00
9e346a719d Reimplemented collision
still missing documentation
2024-11-15 22:25:43 +01:00
6751b3e12c Merge branch 'dev' 2024-11-13 13:12:09 +01:00
Benedikt Galbavy
c19171328d
Merge pull request #84 from VEGO-Engine/tmxlite
Added support for .tmx maps
2024-11-05 19:50:56 +01:00
Benedikt Galbavy
21f970cb19
Merge pull request #85 from VEGO-Engine/remove-assets
Removed assets and startscreen from engine
2024-11-05 19:47:22 +01:00
23c750c409 Implemented requested changes 2024-11-05 19:45:24 +01:00
7c82ee5beb Removed all assets* from Engine 2024-11-05 19:35:31 +01:00
d7f11e7ebd Readded animations 2024-11-05 16:14:35 +01:00
476d24e930 Code clean-up 2024-11-05 16:14:22 +01:00
ba8dca8abc added loading of tmx files 2024-11-04 23:27:26 +01:00
Benedikt Galbavy
0179a27aaf
Merge pull request #77 from VEGO-Engine/#69-delete-gameobject
refactor: remove obsolete code
2024-10-17 19:21:21 +02:00
Freezarite
a5c3ec3683
Merge pull request #82 from VEGO-Engine/#81-zindex
Added z-Index based render order
2024-10-16 13:59:55 +02:00
074d285aff Adjusted for loop 2024-10-16 13:57:23 +02:00
686ebbb97f Added documentation 2024-10-16 13:38:20 +02:00
b48d5d7183 Added z-Index base render order 2024-10-15 23:42:32 +02:00
d3a1daf383 refactor: remove obsolete code 2024-10-14 20:47:11 +02:00
Nanogamer7
bfa5054755
Updated README.md
Some checks failed
/ deploy (push) Has been cancelled
2024-06-25 15:23:21 +02:00
92283e41ba Hotfix: gh-actions changed Doxyfile path
Some checks failed
/ deploy (push) Has been cancelled
2024-05-19 21:34:44 +02:00
113b55e625 Merge pull request #43 from 'documentation' 2024-05-19 21:27:07 +02:00
d8e1182499 extended vscode and sublime text project files 2024-05-01 20:05:58 +02:00
52daf5c5b6 Added vscode config files 2024-04-30 18:26:52 +02:00
69bf328851 Added docker build file for generating documentation 2024-04-30 15:30:57 +02:00
5a21f9125b modified Doxyfile to better work with sed (git hook) 2024-04-17 18:52:24 +02:00
cd42b4df3e removed workflow triggers intended for testing purposes 2024-04-17 16:45:02 +02:00
51968ec9ca adjusted name and title of Doxygen docs 2024-04-17 16:42:02 +02:00
01ab55acb0 re-iincluded some docs files
Some checks failed
/ deploy (push) Has been cancelled
2024-04-17 10:21:56 +02:00
9733a21530 Switched to different action 2024-04-17 10:19:19 +02:00
Nanogamer7
6f22ffd013
Update doxygen.yaml
Some checks are pending
/ deploy (push) Waiting to run
2024-04-17 09:42:31 +02:00
Nanogamer7
b80d6ef8b8
Update doxygen.yaml 2024-04-17 09:34:36 +02:00
3ff964c93a doxygen deploy action 2024-04-17 09:25:54 +02:00
c570c6038d ignored docs folder 2024-04-17 09:09:39 +02:00
df6a7ded33 modified Doxyfile to generate less unfinished docu 2024-02-03 17:43:34 +01:00
162645ed1c added documentation for manager 2024-02-03 17:30:33 +01:00
63644b4759 Amend: depricated note for Entity:ENEMIES 2024-02-03 16:55:52 +01:00
75189645d0 Documented entity
see todos
2024-02-03 16:53:40 +01:00
fcb79bc2a3 fixed redundant references 2024-02-02 22:30:09 +01:00
705fe069cf fixes to enums 2024-02-02 22:29:28 +01:00
57a0bead6a refactored labels to be within Entity class 2024-02-02 22:17:21 +01:00
66a59d9666 adjusted theme 2024-02-02 21:49:24 +01:00
f2d7601480 Updated doxygen file to 1.10 2024-02-02 20:03:49 +01:00
cebe343e4c extended collision handler docs 2024-02-02 15:12:51 +01:00
680f66270f Merged duplicate Direction enums 2024-02-02 15:10:38 +01:00
b2a001e24d first draft collision handler get any 2024-01-31 02:32:21 +01:00
97 changed files with 1041 additions and 566 deletions

24
.github/workflows/doxygen.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
on:
push:
branches: [ main ]
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true' # might need recursive, tbd
- name: Doxygen Action
uses: mattnotmitt/doxygen-action@v1.1.0
with:
doxyfile-path: 'docs/Doxyfile'
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/html

22
.gitignore vendored
View File

@ -26,7 +26,6 @@ cmake-build-debug/
*.app *.app
# Generated by Visual Studio # Generated by Visual Studio
.vscode/
.vs/ .vs/
*.suo *.suo
*.user *.user
@ -58,7 +57,22 @@ cmake-build-debug/
# Sublime Text # Sublime Text
*.sublime-workspace *.sublime-workspace
*.sublime-project
# Created by https://www.gitignore.io/api/visualstudiocode
# Edit at https://www.gitignore.io/?templates=visualstudiocode
### VisualStudioCode ###
.vscode/* # Maybe .vscode/**/* instead - see comments
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### VisualStudioCode Patch ###
# Ignore all local history of files
**/.history
# End of https://www.gitignore.io/api/visualstudiocode
# macOS # macOS
.DS_Store .DS_Store
@ -77,3 +91,7 @@ Desktop.ini
compile_commands.json compile_commands.json
*.puml *.puml
docs/latex/
docs/html/
docs/diagrams/

6
.gitmodules vendored
View File

@ -14,6 +14,12 @@
path = extern/SDL_ttf path = extern/SDL_ttf
url = https://github.com/libsdl-org/SDL_ttf.git url = https://github.com/libsdl-org/SDL_ttf.git
branch = release-2.22.x branch = release-2.22.x
[submodule "extern/tmxlite"]
path = extern/tmxlite
url = https://github.com/fallahn/tmxlite.git
[submodule "docs/doxygen-awesome-css"]
path = docs/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
[submodule "extern/magic_enum"] [submodule "extern/magic_enum"]
path = extern/magic_enum path = extern/magic_enum
url = https://github.com/Neargye/magic_enum.git url = https://github.com/Neargye/magic_enum.git

17
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
// 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",
"miDebuggerPath": "c:\\mingw64\\bin\\gdb.exe",
"request": "launch",
"program": "${workspaceFolder}/build/SDL_Minigame.exe",
"cwd": "${workspaceFolder}",
"preLaunchTask": "build-debug"
}
]
}

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"cmake.configureOnOpen": true,
"editor.tabSize": 4,
"editor.insertSpaces": true,
}

67
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,67 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "build-engine-debug",
"command": "cd build; cmake -DCMAKE_BUILD_TYPE=Debug; cmake --build .",
"problemMatcher": [],
"group": "build"
},
{
"type": "shell",
"label": "build-engine",
"command": "cd build; cmake -DCMAKE_BUILD_TYPE=Release; cmake --build .",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "docker-build",
"label": "build-doxygen",
"dockerBuild": {
"context": "${workspaceRoot}/docs/docker",
"tag": "vego_doxygen-docker",
},
"problemMatcher": [],
},
{
"type": "docker-run",
"label": "gen-doxygen",
"dockerRun": {
"image": "vego_doxygen-docker",
"remove": true,
"volumes": [
{
"localPath": "${workspaceFolder}",
"containerPath": "/source"
},
{
"localPath": "${workspaceFolder}/docs",
"containerPath": "/output"
},
{
"localPath": "${workspaceFolder}/docs/Doxyfile",
"containerPath": "/Doxyfile"
},
]
},
"problemMatcher": [],
},
{
"type": "process",
"label": "open-doxygen",
"command": "explorer",
"windows": {
"command": "explorer.exe"
},
"args": ["${workspaceFolder}\\docs\\html\\index.html"],
"problemMatcher": [],
"dependsOn": "gen-doxygen",
}
]
}

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
project(engine) project(engine)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(ENGINE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(ENGINE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
@ -17,10 +17,13 @@ set(SDL2TTF_VENDORED ON)
set(SDL2_SOURCE_DIR ${ENGINE_SOURCE_DIR}/extern/SDL”) set(SDL2_SOURCE_DIR ${ENGINE_SOURCE_DIR}/extern/SDL”)
set(TMXLITE_STATIC_LIB TRUE)
add_subdirectory(extern/SDL EXCLUDE_FROM_ALL) add_subdirectory(extern/SDL EXCLUDE_FROM_ALL)
add_subdirectory(extern/SDL_image EXCLUDE_FROM_ALL) add_subdirectory(extern/SDL_image EXCLUDE_FROM_ALL)
add_subdirectory(extern/SDL_mixer EXCLUDE_FROM_ALL) add_subdirectory(extern/SDL_mixer EXCLUDE_FROM_ALL)
add_subdirectory(extern/SDL_ttf EXCLUDE_FROM_ALL) add_subdirectory(extern/SDL_ttf EXCLUDE_FROM_ALL)
add_subdirectory(extern/tmxlite/tmxlite EXCLUDE_FROM_ALL)
add_subdirectory(extern/magic_enum EXCLUDE_FROM_ALL) add_subdirectory(extern/magic_enum EXCLUDE_FROM_ALL)
file(GLOB_RECURSE SOURCES ${ENGINE_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE SOURCES ${ENGINE_SOURCE_DIR}/src/*.cpp)
@ -35,10 +38,12 @@ target_link_libraries(${PROJECT_NAME} PUBLIC # should be private when all SDL fu
SDL2_mixer::SDL2_mixer-static SDL2_mixer::SDL2_mixer-static
SDL2_ttf::SDL2_ttf-static SDL2_ttf::SDL2_ttf-static
magic_enum::magic_enum magic_enum::magic_enum
tmxlite
) )
if(CMAKE_BUILD_TYPE MATCHES "Debug") if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") # -fsanitize=address -fno-omit-frame-pointer")
#target_link_libraries(${PROJECT_NAME} PRIVATE "-fsanitize=address")
endif() endif()
# link/copy compile commands to root dir # link/copy compile commands to root dir

View File

@ -1,10 +1,35 @@
##### Compiling: # VEGO-Engine
A **VE**ry **GO**od engine, to develop small, lightweight minigames without calling all those SDL functions yourself. This project orginates as a university project at UAS Technikum Wien.
## Getting started
### Compiling
To compile this projects the following prerequisites need to be met:
- A C++ compiler, for example GCC
- On Windows you can use GCC via [MinGW](https://www.mingw-w64.org/)
- CMake
The project can be cloned and compiled with the following commands:
```sh ```sh
git submodule update --init --recursive # only needed once git clone --recurse-submodules -j8 https://github.com/VEGO-Engine/Engine.git
cmake -S . -B build cmake -S . -B build
cmake --build build cmake --build build
``` ```
For Windows systems using MinGW the flag `-G "MinGW Makefiles"` has to be specified
The executable can be found as `build/SDL_Minigame` after building Depending on the system, you might need to specify which generator to use, for example on a Windows system using MinGW:
```sh
git clone --recurse-submodules -j8 https://github.com/VEGO-Engine/Engine.git
cmake -S . -B build -G "MinGW Makefiles"
cmake --build build
```
Compiling the whole project might take a while, but the Engine by itself will not build to an executable. To do that you can compile the [project template](https://github.com/VEGO-Engine/Project_Template). If the template compiles without any errors, you can use the project template to start working on your own game.
### Usage
As mentioned above, we provide a [project template](https://github.com/VEGO-Engine/Project_Template). To use the template, simply clone it and start working. You can change the name for your project freely, see the documentation on the template for further information. To push to your own remote, create a new repository on the platform of your choice, and edit origin in the local git repository.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,106 +0,0 @@
{ "frames": [
{
"filename": "MapNew.aseprite",
"frame": { "x": 0, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 32, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 64, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 96, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 128, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 160, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 192, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 224, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 256, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
},
{
"filename": "MapNew.aseprite",
"frame": { "x": 288, "y": 0, "w": 32, "h": 32 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 },
"sourceSize": { "w": 32, "h": 32 },
"duration": 100
}
],
"meta": {
"app": "https://www.aseprite.org/",
"version": "1.3.2-x64",
"format": "RGBA8888",
"size": { "w": 320, "h": 32 },
"scale": "1",
"frameTags": [
],
"layers": [
],
"slices": [
]
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -1,20 +0,0 @@
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,2,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,2,2,2,3
3,3,3,2,3,3,3,3,2,3,7,1,1,1,9,3,3,3,3,3,3,3,2,2,3
3,3,2,2,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,2,2,2,3,3,3,3,3,7,1,1,1,9,3,3,2,3,3,3,3,3,3,3
3,3,2,2,2,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,3,2,2,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,3,3,2,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,2,3,3,3,3
3,3,3,2,2,3,3,3,3,3,7,1,1,1,9,3,3,3,3,2,2,3,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,2,2,2,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,2,2,3,3,3,3
3,3,3,3,3,3,3,2,3,3,7,1,1,1,9,3,2,3,3,2,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,2,3,3,3,3,3,3,3,3
2,2,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,2,2,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,7,1,1,1,9,3,3,3,3,3,3,3,3,3,3

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -42,13 +42,13 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places. # title of most generated pages and in a few other places.
# The default value is: My Project. # The default value is: My Project.
PROJECT_NAME = "My Project" PROJECT_NAME = "VEGO-Engine"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = PROJECT_NUMBER = 0.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
@ -67,14 +67,14 @@ PROJECT_LOGO =
# when the HTML document is shown. Doxygen will copy the logo to the output # when the HTML document is shown. Doxygen will copy the logo to the output
# directory. # directory.
PROJECT_ICON = PROJECT_ICON = assets/chicken_neutral_knight.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If # entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used. # left blank the current directory will be used.
OUTPUT_DIRECTORY = OUTPUT_DIRECTORY = docs
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 # If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
# sub-directories (in 2 levels) under the output directory of each output format # sub-directories (in 2 levels) under the output directory of each output format
@ -396,7 +396,7 @@ AUTOLINK_SUPPORT = YES
# diagrams that involve STL classes more complete and accurate. # diagrams that involve STL classes more complete and accurate.
# The default value is: NO. # The default value is: NO.
BUILTIN_STL_SUPPORT = NO BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to # If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support. # enable parsing support.
@ -842,7 +842,7 @@ CITE_BIB_FILES =
# messages are off. # messages are off.
# The default value is: NO. # The default value is: NO.
QUIET = NO QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are # The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
@ -949,7 +949,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = INPUT = ./include ./src
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -989,63 +989,15 @@ INPUT_FILE_ENCODING =
# be provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, # be provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. # *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.c \ FILE_PATTERNS = *.cpp \
*.cc \
*.cxx \
*.cxxm \
*.cpp \
*.cppm \
*.ccm \
*.c++ \
*.c++m \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.idl \
*.ddl \
*.odl \
*.h \ *.h \
*.hh \ *.hpp
*.hxx \
*.hpp \
*.h++ \
*.ixx \
*.l \
*.cs \
*.d \
*.php \
*.php4 \
*.php5 \
*.phtml \
*.inc \
*.m \
*.markdown \
*.md \
*.mm \
*.dox \
*.py \
*.pyw \
*.f90 \
*.f95 \
*.f03 \
*.f08 \
*.f18 \
*.f \
*.for \
*.vhd \
*.vhdl \
*.ucf \
*.qsf \
*.ice
# The RECURSIVE tag can be used to specify whether or not subdirectories should # The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well. # be searched for input files as well.
# The default value is: NO. # The default value is: NO.
RECURSIVE = NO RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should be # The EXCLUDE tag can be used to specify files and/or directories that should be
# excluded from the INPUT source files. This way you can easily exclude a # excluded from the INPUT source files. This way you can easily exclude a
@ -1084,14 +1036,17 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include # that contain example code fragments that are included (see the \include
# command). # command).
EXAMPLE_PATH = EXAMPLE_PATH = ./include \
./src
# If the value of the EXAMPLE_PATH tag contains directories, you can use the # If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank all # *.h) to filter out the source-files in the directories. If left blank all
# files are included. # files are included.
EXAMPLE_PATTERNS = * EXAMPLE_PATTERNS = *.cpp \
*.h \
*.hpp
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude commands # searched for input files to be used with the \include or \dontinclude commands
@ -1325,7 +1280,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation. # of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER = HTML_HEADER = docs/header.html
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard # generated HTML page. If the tag is left blank doxygen will generate a standard
@ -1365,7 +1320,10 @@ HTML_STYLESHEET =
# documentation. # documentation.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = HTML_EXTRA_STYLESHEET = docs/doxygen-awesome-css/doxygen-awesome.css \
docs/doxygen-awesome-css/doxygen-awesome-sidebar-only.css \
docs/doxygen-awesome-css/doxygen-awesome-sidebar-only-darkmode-toggle.css \
docs/custom.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note # other source files which should be copied to the HTML output directory. Note
@ -1375,7 +1333,10 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available. # files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = HTML_EXTRA_FILES = docs/doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js \
docs/doxygen-awesome-css/doxygen-awesome-fragment-copy-button.js \
docs/doxygen-awesome-css/doxygen-awesome-paragraph-link.js \
docs/doxygen-awesome-css/doxygen-awesome-interactive-toc.js
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output # The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
# should be rendered with a dark or light theme. # should be rendered with a dark or light theme.
@ -1388,7 +1349,7 @@ HTML_EXTRA_FILES =
# The default value is: AUTO_LIGHT. # The default value is: AUTO_LIGHT.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE = AUTO_LIGHT HTML_COLORSTYLE = LIGHT
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to # will adjust the colors in the style sheet and background images according to
@ -1716,7 +1677,7 @@ DISABLE_INDEX = NO
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = NO GENERATE_TREEVIEW = YES
# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the # When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
# FULL_SIDEBAR option determines if the side bar is limited to only the treeview # FULL_SIDEBAR option determines if the side bar is limited to only the treeview
@ -2502,7 +2463,7 @@ HIDE_UNDOC_RELATIONS = YES
# set to NO # set to NO
# The default value is: NO. # The default value is: NO.
HAVE_DOT = NO HAVE_DOT = YES
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
# to run in parallel. When set to 0 doxygen will base this on the number of # to run in parallel. When set to 0 doxygen will base this on the number of
@ -2639,7 +2600,7 @@ DOT_WRAP_THRESHOLD = 17
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
TEMPLATE_RELATIONS = NO TEMPLATE_RELATIONS = YES
# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
# YES then doxygen will generate a graph for each documented file showing the # YES then doxygen will generate a graph for each documented file showing the
@ -2727,7 +2688,7 @@ DIR_GRAPH_MAX_DEPTH = 1
# The default value is: png. # The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
DOT_IMAGE_FORMAT = png DOT_IMAGE_FORMAT = SVG
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning. # enable generation of interactive SVG images that allow zooming and panning.
@ -2739,13 +2700,13 @@ DOT_IMAGE_FORMAT = png
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
INTERACTIVE_SVG = NO INTERACTIVE_SVG = YES
# The DOT_PATH tag can be used to specify the path where the dot tool can be # The DOT_PATH tag can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path. # found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES. # This tag requires that the tag HAVE_DOT is set to YES.
DOT_PATH = DOT_PATH = /usr/bin/dot
# The DOTFILE_DIRS tag can be used to specify one or more directories that # The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile # contain dot files that are included in the documentation (see the \dotfile

63
docs/Doxyfile.bak Normal file
View File

@ -0,0 +1,63 @@
# Doxyfile
# Project information
PROJECT_NAME = "SDL Minigame"
PROJECT_NUMBER = "1.0"
PROJECT_ICON = assets/chicken_neutral_knight.png
OUTPUT_DIRECTORY = docs
OPTIMIZE_OUTPUT_FOR_C = YES
EXTRACT_ALL = NO
EXTRACT_LOCAL_CLASSES = YES
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_PATH = /usr/bin/dot
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = YES
UML_LIMIT_NUM_FIELDS = 50
TEMPLATE_RELATIONS = YES
DOT_TRANSPARENT = YES
# Source files
INPUT = ./include ./src
FILE_PATTERNS = *.cpp *.h *.hpp
EXAMPLE_PATH = ./include ./src
EXAMPLE_PATTERNS = *.cpp *.h *.hpp
# Output formats
GENERATE_XML = YES
GENERATE_HTML = YES
DOT_IMAGE_FORMAT = SVG
COLLABORATION_GRAPH = YES
GENERATE_LATEX = NO
# Extra settings
USE_MATHJAX = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
SHOW_FILES = YES
SHOW_INCLUDE_FILES = YES
SHOW_USED_FILES = YES
RECURSIVE = YES
# Class diagram options
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DISABLE_INDEX = YES
GENERATE_TREEVIEW = YES
HTML_COLLABORATION = YES
# idk everything else
TAB_SIZE = 4

54
docs/custom.css Normal file
View File

@ -0,0 +1,54 @@
html {
/* primary theme color. This will affect the entire websites color scheme: links, arrows, labels, ... */
--primary-color: #bd93f9;
--primary-dark-color: #9270e4;
--primary-light-color: #9270e4;
/* page base colors */
--page-background-color: #ffffff;
--page-foreground-color: #2f4153;
--page-secondary-foreground-color: #6f7e8e;
/* color for all separators on the website: hr, borders, ... */
--separator-color: #bd93f965;
/* border radius for all rounded components. Will affect many components, like dropdowns, memitems, codeblocks, ... */
--border-radius-large: 22px;
--border-radius-small: 9px;
--border-radius-medium: 14px;
/* default spacings. Most components reference these values for spacing, to provide uniform spacing on the page. */
--spacing-small: 8px;
--spacing-medium: 14px;
--spacing-large: 19px;
--top-height: 125px;
...
}
html.dark-mode {
color-scheme: dark;
--primary-color: #bd93f9;
--primary-dark-color: #9270e4;
--primary-light-color: #9270e4;
--primary-lighter-color: #191e21;
--primary-lightest-color: #191a1c;
--page-background-color: #21222c;
--page-foreground-color: #d2dbde;
--page-secondary-foreground-color: #859399;
--separator-color: #3a3246;
--side-nav-background: #282a36;
--side-nav-foreground: #f8f8f2;
--toc-background: #282A36;
--searchbar-background: var(--page-background-color);
...
}
.paramname em {
font-weight: 600;
color: var(--primary-dark-color);
}

View File

@ -1,62 +0,0 @@
compilation_database_dir: ../..
output_directory: .
diagrams:
includes:
type: include
relative_to: ../..
glob:
- src/*.cpp
- include/*.h
generate_system_headers: true
include:
paths:
- src
- include
plantuml:
before:
- 'skinparam linetype ortho'
includes_no_external:
type: include
relative_to: ../..
glob:
- src/*.cpp
- include/*.h
include:
paths:
- src
- include
plantuml:
before:
- 'skinparam linetype ortho'
classes:
type: class
relative_to: ../..
glob:
- src/*.cpp
- include/*.h
include:
paths:
- src
- include
plantuml:
before:
- 'skinparam linetype ortho'
load_map_example_sequence:
type: sequence
relative_to: ../..
glob:
- src/*.cpp
- include/*.h
include:
paths:
- src
- include
start_from:
- function: "Map::loadMap(const char *,int,int)"
plantuml:
before:
- 'skinparam linetype ortho'

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 149 KiB

View File

@ -1,12 +0,0 @@
Need [clang-uml](https://clang-uml.github.io/index.html)
```sh
clang-uml
clang-uml --add-compile-flag -I/usr/lib/clang/16/include # might need additional flags, example for my machine
clang-uml --print-from -n load_map_example_sequence # to get availabel commands for sequence diagram
```
then use plant uml to generate an actual `.svg` vector graphic
```sh
plantuml -tsvg *.puml
```

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 183 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 119 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 257 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.3 MiB

13
docs/docker/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM alpine:latest
RUN apk --update --no-cache add doxygen graphviz git
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
WORKDIR /source
ENTRYPOINT ["/entrypoint.sh"]
CMD ["doxygen", "/Doxyfile_copy"]

View File

@ -0,0 +1,6 @@
#!/bin/sh
cp /Doxyfile /Doxyfile_copy
echo "OUTPUT_DIRECTORY = /output" >> /Doxyfile_copy
exec "$@"

@ -0,0 +1 @@
Subproject commit df88fe4fdd97714fadfd3ef17de0b4401f804052

110
docs/header.html Normal file
View File

@ -0,0 +1,110 @@
<!-- HTML header for doxygen 1.10.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="$langISO">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<meta name="generator" content="Doxygen $doxygenversion" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--BEGIN PROJECT_NAME-->
<title>$projectname: $title</title>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<title>$title</title>
<!--END !PROJECT_NAME-->
<!--BEGIN PROJECT_ICON-->
<link rel="icon" href="$relpath^$projecticon" type="image/x-icon" />
<!--END PROJECT_ICON-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css" />
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN FULL_SIDEBAR-->
<script type="text/javascript">
var page_layout = 1;
</script>
<!--END FULL_SIDEBAR-->
<!--END DISABLE_INDEX-->
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
<!--BEGIN COPY_CLIPBOARD-->
<script type="text/javascript" src="$relpath^clipboard.js"></script>
<!--END COPY_CLIPBOARD-->
<script type="text/javascript" src="$relpath^doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
<script type="text/javascript" src="$relpath^doxygen-awesome-fragment-copy-button.js"></script>
<script type="text/javascript">
DoxygenAwesomeFragmentCopyButton.init()
</script>
<script type="text/javascript" src="$relpath^doxygen-awesome-paragraph-link.js"></script>
<script type="text/javascript">
DoxygenAwesomeParagraphLink.init()
</script>
<script type="text/javascript" src="$relpath^doxygen-awesome-interactive-toc.js"></script>
<script type="text/javascript">
DoxygenAwesomeInteractiveToc.init()
</script>
$treeview
$search
$mathjax
$darkmode
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
<body>
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN FULL_SIDEBAR-->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<!-- do not remove this div, it is closed by doxygen! -->
<!--END FULL_SIDEBAR-->
<!--END DISABLE_INDEX-->
<div id="top">
<!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo" $logosize /></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td id="projectalign">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER--><span id="projectnumber">&#160;$projectnumber</span>
<!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF-->
<div id="projectbrief">$projectbrief</div>
<!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td>
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<!--BEGIN !FULL_SIDEBAR-->
<td>$searchbox</td>
<!--END !FULL_SIDEBAR-->
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
<!--BEGIN SEARCHENGINE-->
<!--BEGIN FULL_SIDEBAR-->
<tr>
<td colspan="2">$searchbox</td>
</tr>
<!--END FULL_SIDEBAR-->
<!--END SEARCHENGINE-->
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

49
engine.sublime-project Normal file
View File

@ -0,0 +1,49 @@
{
"folders":
[
{
"path": "."
}
],
"settings":
{
"tab_size": 4
},
"build_systems": [
{
"name": "Build engine",
"shell_cmd": "cmake --build build",
"working_dir": "$project_path",
"variants": [
{
"name": "Debug",
"shell_cmd": "cmake -DCMAKE_BUILD_TYPE=Debug build && cmake --build build",
},
{
"name": "Release",
"shell_cmd": "cmake -DCMAKE_BUILD_TYPE=Release build && cmake --build build",
},
]
},
{
"name": "Generate CMake",
"shell_cmd": "cmake -S . -B build",
"working_dir": "$project_path",
},
{
"name": "Doxygen",
"shell_cmd": "xdg-open $project_path/docs/html/index.html",
"working_dir": "$project_path",
"variants": [
{
"name": "Build image",
"shell_cmd": "docker build -t vego_engine-docker $project_path/docs/docker",
},
{
"name": "Generate documentation",
"shell_cmd": "docker run --rm -v \"$project_path:/source\" -v \"$project_path/docs:/output\" -v \"$project_path/docs/Doxyfile:/Doxyfile\" vego_engine-docker",
},
]
}
]
}

1
extern/tmxlite vendored Submodule

@ -0,0 +1 @@
Subproject commit fcef1a28ade8406e290d5fd168a8950e6996844f

View File

@ -24,14 +24,12 @@ public:
AssetManager(Manager* manager); AssetManager(Manager* manager);
~AssetManager(); ~AssetManager();
void createProjectile(Vector2D pos, Vector2D velocity, int scale, int range, int speed, TexturesEnum textureEnum, Entity* owner); void createProjectile(Vector2D pos, Vector2D velocity, int scale, int range, int speed, Textures textureEnum, Entity* owner);
void createPowerup(Vector2D pos, std::function<void (Entity*)> pickupFunc, TexturesEnum texture); void createPowerup(Vector2D pos, std::function<void (Entity*)> pickupFunc, Textures texture);
Vector2D calculateSpawnPosition(); Vector2D calculateSpawnPosition();
PowerupType calculateType(); PowerupType calculateType();
//texture management
void addTexture(std::string id, const char* path);
// sound management // sound management
void addSoundEffect(std::string id, const char* path); void addSoundEffect(std::string id, const char* path);

View File

@ -1,5 +1,9 @@
#pragma once #pragma once
//! \file CollisionHandler.h
//! \file CollisionHandler.cpp
//! \file TransformComponent.cpp
#include "ColliderComponent.h" #include "ColliderComponent.h"
#include "Constants.h" #include "Constants.h"
#include "Entity.h" #include "Entity.h"
@ -17,9 +21,11 @@
class ColliderComponent; class ColliderComponent;
class Entity; class Entity;
// [IntersectionBitSet]
constexpr uint8_t DIRECTION_C = 4; constexpr uint8_t DIRECTION_C = 4;
using IntersectionBitSet = std::bitset<DIRECTION_C>; using IntersectionBitSet = std::bitset<DIRECTION_C>;
// [IntersectionBitSet]
class CollisionHandler class CollisionHandler
{ {
@ -46,6 +52,20 @@ public:
std::initializer_list<Entity::GroupLabel> const& groupLabels, std::initializer_list<Entity::GroupLabel> const& groupLabels,
std::initializer_list<Entity*> const& excludedEntities = {}); std::initializer_list<Entity*> const& excludedEntities = {});
/*!
*
* \brief Tests entity against all entities with the specified labels for a collision
* \details Tests the given entity against every other entity with the specified labels for intersections between their collison boxes.
* If the primary entity has no ColliderComponent, the equivalent of no collision is returned immediately, other entities are skipped
* if they don't have a ColliderComponent
* \param entity The primary entity to check against. Return values will be relative to this entity
* \param posMod Modifier to apply toposition before checking collisions.
* \param groupLabels Entities need to have at least one listed GroupLabels to get checked against
* \param teamLabels Entities need to have one of the specified TeamLabels to get checked against
* \param negateTeam If set to true, entities will only be checked against if they **don't** have one of the specified TeamLabels
* \see ColliderComponent
*
*/
template<typename T> template<typename T>
T getAnyIntersection( T getAnyIntersection(
Entity* entity, Entity* entity,

View File

@ -9,7 +9,6 @@ public:
virtual void init() {} virtual void init() {}
virtual void update() {} virtual void update() {}
virtual void draw() {}
virtual ~Component() = default; virtual ~Component() = default;
}; };

View File

@ -22,29 +22,48 @@ using ComponentBitSet = std::bitset<MAX_COMPONENTS>;
using GroupBitSet = std::bitset<MAX_GROUPS>; using GroupBitSet = std::bitset<MAX_GROUPS>;
using ComponentArray = std::array<Component*, MAX_COMPONENTS>; using ComponentArray = std::array<Component*, MAX_COMPONENTS>;
/*!
*
* \brief Main class for any object in game, stores associations, labeling and components
* \details The entity class is the primary class each object in the game needs to use. Add components to assign functionality.
*
* \todo More detailed description
* \todo Some functions in entity class are only supposed to be called in specific context, which might be valid uses for `friend` keyword. Example: Entity() should only be called from Manager::addEntity(). Verify each functions intended use/scope.
*
*/
class Entity class Entity
{ {
public: public:
/*! TODO */ /*!
* \brief Used for rendering order (last is highest) or retrieving entities of group
* \todo Label used in singular entity shouldn't use plural
* \todo HEARTS are rendered above POWERUPS, missleading order
* \todo PROJECTILE are rendered above POWERUPS, missleading order
* \todo Generalize HEARTS as UI or similar
*/
enum class GroupLabel enum class GroupLabel
{ {
MAPTILES, MAPTILES, //!< Entity using TileComponent
PLAYERS, PLAYERS, //!< Primary entity in player controll
ENEMIES, ENEMIES, //!< \deprecated All players now grouped as Entity::PLAYERS
COLLIDERS, COLLIDERS, //!< Fixed collider entity, e.g. a wall
PROJECTILE, PROJECTILE, //!< \todo Document
HEARTS, HEARTS, //!< \todo Document
POWERUPS POWERUPS //!< \todo Document
}; };
/*!
* \todo Document
*/
explicit Entity(Manager& mManager) : explicit Entity(Manager& mManager) :
manager(mManager) { }; manager(mManager) { };
void update() const; void update() const; //!< Call each frame to update all components
void draw() const;
bool isActive() const { return this->active; } bool isActive() const { return this->active; } //!< \sa destroy()
//! Mark for destruction for Manager::refresh() and disables collision
//! \sa ColliderComponent
void destroy() { void destroy() {
this->active = false; this->active = false;
if (this->hasComponent<ColliderComponent>()) { if (this->hasComponent<ColliderComponent>()) {
@ -52,18 +71,23 @@ public:
} }
} }
bool hasGroup(Group mGroup); bool hasGroup(Group mGroup); //!< \sa GroupLabel
void addGroup(Group mGroup); void addGroup(Group mGroup); //!< \sa GroupLabel
void delGroup(Group mGroup); void delGroup(Group mGroup); //!< \sa GroupLabel
//! \returns bitset with true on position GroupLabel if the entity belongs to group
//! \sa GroupLabel
std::bitset<MAX_GROUPS> getGroupBitSet(); std::bitset<MAX_GROUPS> getGroupBitSet();
//! \sa Manager
Manager& getManager() { return manager; }; Manager& getManager() { return manager; };
template <typename T> bool hasComponent() const template <typename T> bool hasComponent() const //! \sa Component
{ {
return componentBitSet[getComponentTypeID<T>()]; return componentBitSet[getComponentTypeID<T>()];
} }
//! \brief Adds specified type as component and calls Component::init()
//! \param mArgs Constructor arguments of component
template <typename T, typename...TArgs> T& addComponent(TArgs&&...mArgs) template <typename T, typename...TArgs> T& addComponent(TArgs&&...mArgs)
{ {
T* c(new T(std::forward<TArgs>(mArgs)...)); T* c(new T(std::forward<TArgs>(mArgs)...));
@ -78,7 +102,7 @@ public:
return *c; return *c;
}; };
template <typename T> T& getComponent() const template <typename T> T& getComponent() const //! \returns Component of type T
{ {
auto ptr(componentArray[getComponentTypeID<T>()]); auto ptr(componentArray[getComponentTypeID<T>()]);
return *static_cast<T*>(ptr); return *static_cast<T*>(ptr);

View File

@ -9,6 +9,7 @@
#include "Manager.h" #include "Manager.h"
#include "Vector2D.h" #include "Vector2D.h"
#include "Entity.h" #include "Entity.h"
#include "RenderManager.h"
typedef std::function<void()> gamefunction; typedef std::function<void()> gamefunction;
@ -42,8 +43,8 @@ public:
/* static */ TextureManager* textureManager; /* static */ TextureManager* textureManager;
/* static */ SoundManager* soundManager; /* static */ SoundManager* soundManager;
// moved globals
Manager manager; Manager manager;
RenderManager renderManager;
Map* map; // game specific, might not be needed for all types of games Map* map; // game specific, might not be needed for all types of games
std::vector<Entity*>& tiles; std::vector<Entity*>& tiles;

View File

@ -1,21 +0,0 @@
#pragma once
#include <SDL.h>
class GameObject
{
public:
GameObject(const char* texturesheet, int x, int y);
~GameObject() = default;
void update();
void render();
private:
int xPos;
int yPos;
SDL_Texture* objTexture;
SDL_Rect srcRect;
SDL_Rect destRect;
};

View File

@ -10,21 +10,31 @@
#include "Entity.h" #include "Entity.h"
class GameInternal; class GameInternal;
/*!
*
* \brief Is responsible for managing all entities
* \details The manager class handles update and draw calls collectively for all entities, and provides functionality to get all or a subset of all entities
* \sa Entity
* \sa Entity::GroupLabel
* \sa Entity::TeamLabel
*
*/
class Manager class Manager
{ {
public: public:
Manager(GameInternal* game) : game(game) {}; Manager(GameInternal* game) : game(game) {};
void update(); void update(); //!< \sa Entity::update()
void draw(); //! Disables all functionality of entities marked for destruction
//! \sa Entity::destroy()
void refresh(); void refresh();
void addToGroup(Entity* mEntity, Group mGroup); void addToGroup(Entity* mEntity, Group mGroup); //!< \todo `friend` to Entity
std::vector<Entity*>& getGroup(Group mGroup); std::vector<Entity*>& getGroup(Group mGroup); //!< \returns std::vector containing all entities in group Entity::GroupLabel
std::vector<Entity*> getAll(); std::vector<Entity*> getAll(); //!< \returns std::vector containing all entities
Entity& addEntity(); Entity& addEntity(); //!< Creates and returns a new, empty entity
GameInternal* getGame() { return this->game; }; GameInternal* getGame() { return this->game; };

View File

@ -1,27 +1,52 @@
#pragma once #pragma once
#include <map> #include <functional>
#include <optional>
#include <string> #include <string>
#include <TextureEnumBase.h> #include <vector>
#include <tmxlite/Map.hpp>
#include <tmxlite/Property.hpp>
#include <tmxlite/TileLayer.hpp>
#include <tmxlite/Types.hpp>
class GameInternal; class GameInternal;
class Map class Map
{ {
public: public:
Map() = default;
~Map() = default;
// code comment below is a test for doxygen - do not remove
/*! /*!
* * \brief Loads a .tmx map
* \brief * \details Loads a `.tmx` file and extracts all relevant data. Any entities (including tiles) are only spawned once
* This loads a map * \param path Path to the `.tmx` map file
* * \sa Map::generateTiles()
* \param path The path to the map file
* \return Boolean for success
*
*/ */
static void loadMap(const char* path, int sizeX, int sizeY, GameInternal* game, const std::map<int, std::pair<TexturesEnum, bool>>* textureDict /* backreference */); Map(const char* path);
static void addTile(unsigned long id, int x, int y, GameInternal* game, const std::map<int, std::pair<TexturesEnum, bool>>* textureDict); void generateTiles(); //!< Generates the map based on the loaded definition
private:
// struct required for initialisation
struct MapData {
const std::vector<tmx::Tileset>* tileSets;
const std::vector<tmx::Layer::Ptr>* mapLayers;
const tmx::Vector2u* mapSize;
const tmx::Vector2u* mapTileSize;
const std::vector<std::string>* texturePaths;
};
struct TileSetData {
std::string texturePath{};
tmx::Vector2i textureSize;
uint32_t tileCount{};
tmx::Vector2u tileCount2D;
uint32_t firstGID{};
};
tmx::Map map;
Map::MapData mapData;
std::vector<std::function<void()>> tileConstructors;
void loadTileLayer(const tmx::TileLayer& layer);
static void addTile(float x, float y, const tmx::Vector2u& mapTileSize, int u, int v, int zIndex, std::string texturePath, bool hasCollision);
template<typename T>
static std::optional<T> getLayerProperty(const std::vector<tmx::Property>& properties, std::string propertyName) { return std::nullopt; };
}; };

29
include/RenderManager.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#include <vector>
#include "RenderObject.h"
class RenderManager {
public:
RenderManager() {};
/*
* Remove an object from the list of objects to be rendered
* \param renderObject The object to be removed
* \sa RenderObject
*/
void remove(RenderObject* obj);
/*
* Add an object to be rendered
* \param renderObject The object to be rendered
* \sa RenderObject
*/
void add(RenderObject* obj);
void renderAll(); //!< Render all objects. If the list has been modified, sorts it based on z-index first
private:
std::vector<RenderObject*> renderObjects;
bool isSorted;
};

27
include/RenderObject.h Normal file
View File

@ -0,0 +1,27 @@
#pragma once
class RenderManager;
class RenderObject
{
public:
virtual void draw() = 0;
RenderObject(int zIndex, RenderManager& renderManager);
~RenderObject();
int getZIndex() { return this->zIndex; };
//! Comparitor to compare two ptr based on z-index
struct ZIndexComparator {
bool operator()(RenderObject const *lhs, RenderObject const *rhs ) const {
return lhs->zIndex < rhs->zIndex;
}
};
private:
int zIndex = 0;
protected:
RenderManager& renderManager;
};

View File

@ -4,16 +4,16 @@
#include <SDL_render.h> #include <SDL_render.h>
#include <memory> #include <memory>
#include <string> #include <string>
#include <TextureEnumBase.h>
#include "TextureEnumBase.h"
#include "AnimationHandler.h" #include "AnimationHandler.h"
#include "Component.h" #include "Component.h"
#include "Direction.h" #include "Direction.h"
#include "TextureEnumBase.h" #include "RenderObject.h"
class TransformComponent; class TransformComponent;
class SpriteComponent : public Component class SpriteComponent : public Component, public RenderObject
{ {
public: public:
int animationIndex = 0; int animationIndex = 0;
@ -25,24 +25,32 @@ private:
SDL_Texture* texture; SDL_Texture* texture;
SDL_Rect srcRect, destRect; SDL_Rect srcRect, destRect;
TexturesEnum textureEnum; Textures textureEnum;
bool animated = false; bool animated = false;
uint8_t frames = 0; uint8_t frames = 0;
uint8_t speed = 100; uint8_t speed = 100;
bool flipped = false; bool flipped = false;
int textureXOffset;
int textureYOffset;
//should be changed in the future as this is only for the tiles
const char* path;
public: public:
SpriteComponent() = default; SpriteComponent(Textures texture, int zIndex);
SpriteComponent(TexturesEnum textureEnum); SpriteComponent(Textures texture, int xOffset, int yOffset, int zIndex);
SpriteComponent(const char* path, int xOffset, int yOffset, int zIndex);
SpriteComponent( SpriteComponent(
TexturesEnum textureEnum, Textures texture,
bool isAnimated, bool isAnimated,
std::map<std::string, std::unique_ptr<Animation>>* animationList, std::map<std::string, std::unique_ptr<Animation>>* animationList,
std::string defaultAnimation); std::string defaultAnimation,
int zIndex);
~SpriteComponent(); ~SpriteComponent();
void setTexture(TexturesEnum texture); void setTexture(Textures texture);
void init() override; void init() override;
void update() override; void update() override;

View File

@ -1,3 +1,3 @@
#pragma once #pragma once
enum class TexturesEnum; enum class Textures;

View File

@ -18,12 +18,16 @@ class TextureManager
} }
} }
void addSingleTexture(TexturesEnum texture, const char* filePath); void addSingleTexture(Textures texture, const char* filePath);
void addTextures(const std::map<TexturesEnum, const char*>& textures); void addTextures(const std::map<Textures, const char*>& textures);
SDL_Texture* loadTexture(TexturesEnum texture); SDL_Texture* loadTexture(Textures texture);
static std::vector<SDL_Rect> splitSpriteSheet(SDL_Texture* spriteSheet, int width, int height, int spritesOnSheet); static std::vector<SDL_Rect> splitSpriteSheet(SDL_Texture* spriteSheet, int width, int height, int spritesOnSheet);
static void draw(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Rect src, SDL_Rect dest, bool flipped = false); static void draw(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Rect src, SDL_Rect dest, bool flipped = false);
SDL_Texture* loadMapTileTexture(const char* path);
private: private:
Manager* manager; Manager* manager;
std::map<TexturesEnum, SDL_Texture*> texture_cache; std::map<Textures, SDL_Texture*> texture_cache;
std::map<std::string, SDL_Texture*> mapTile_texture_cache;
}; };

View File

@ -19,10 +19,10 @@ public:
SDL_Rect tileRect; SDL_Rect tileRect;
int tileID; int tileID;
TexturesEnum texture; Textures texture;
TileComponent() = default; TileComponent() = default;
TileComponent(int x, int y, int w, int h, int id, const std::map<int, std::pair<TexturesEnum, bool>>* textureDict); TileComponent(int x, int y, int w, int h, int id, const std::map<int, std::pair<Textures, bool>>* textureDict);
~TileComponent() = default; ~TileComponent() = default;
void init() override; void init() override;

View File

@ -24,6 +24,7 @@ public:
TransformComponent(float x, float y, int w, int h, int scale); TransformComponent(float x, float y, int w, int h, int scale);
void init() override; void init() override;
/*! TODO: document usage of collision handler */
void update() override; void update() override;
void setPositionAfterCollision(Vector2D& positionChange); void setPositionAfterCollision(Vector2D& positionChange);
void modifySpeed(int8_t modifier); void modifySpeed(int8_t modifier);

9
include/VEGO.h Normal file
View File

@ -0,0 +1,9 @@
#include "GameInternal.h"
namespace vego {
extern GameInternal* game;
}
inline GameInternal& VEGO_Game() {
return *vego::game;
};

View File

@ -21,11 +21,6 @@ AssetManager::AssetManager(Manager* manager) : man(manager) {}
AssetManager::~AssetManager() {} AssetManager::~AssetManager() {}
//seems to not be used anymore
void AssetManager::addTexture(std::string id, const char* path) {
//textures.emplace(id, this->man->getGame()->textureManager->loadTexture(path));
}
void AssetManager::addSoundEffect(std::string id, const char* path) void AssetManager::addSoundEffect(std::string id, const char* path)
{ {
soundEffects.emplace(id, this->man->getGame()->soundManager->loadSound(path)); soundEffects.emplace(id, this->man->getGame()->soundManager->loadSound(path));
@ -49,23 +44,23 @@ Mix_Music* AssetManager::getMusic(std::string id)
return music.at(id); return music.at(id);
} }
void AssetManager::createProjectile(Vector2D pos, Vector2D velocity, int scale, int range, int speed, TexturesEnum textureEnum, Entity* owner) { void AssetManager::createProjectile(Vector2D pos, Vector2D velocity, int scale, int range, int speed, Textures textureEnum, Entity* owner) {
auto& projectile(man->addEntity()); auto& projectile(man->addEntity());
projectile.addComponent<TransformComponent>(pos.x, pos.y, 32, 32, scale); //32x32 is standard size for objects projectile.addComponent<TransformComponent>(pos.x, pos.y, 32, 32, scale); //32x32 is standard size for objects
projectile.addComponent<SpriteComponent>(textureEnum); projectile.addComponent<SpriteComponent>(textureEnum, 4);
projectile.addComponent<ProjectileComponent>(range, speed, velocity, owner); projectile.addComponent<ProjectileComponent>(range, speed, velocity, owner);
projectile.addComponent<ColliderComponent>("projectile", 0.6f); projectile.addComponent<ColliderComponent>("projectile", 0.6f);
projectile.addGroup((size_t)Entity::GroupLabel::PROJECTILE); projectile.addGroup((size_t)Entity::GroupLabel::PROJECTILE);
} }
void AssetManager::createPowerup(Vector2D pos, std::function<void (Entity*)> pickupFunc, TexturesEnum texture) { void AssetManager::createPowerup(Vector2D pos, std::function<void (Entity*)> pickupFunc, Textures texture) {
auto& powerups(man->addEntity()); auto& powerups(man->addEntity());
powerups.addComponent<TransformComponent>(pos.x, pos.y, 32, 32, 1); //32x32 is standard size for objects powerups.addComponent<TransformComponent>(pos.x, pos.y, 32, 32, 1); //32x32 is standard size for objects
try { try {
powerups.addComponent<SpriteComponent>(texture); powerups.addComponent<SpriteComponent>(texture, 3);
} }
catch (std::runtime_error e) { catch (std::runtime_error e) {
std::cout << e.what() << std::endl; std::cout << e.what() << std::endl;

View File

@ -109,6 +109,17 @@ std::vector<ColliderComponent*> CollisionHandler::getColliders(
return colliders; return colliders;
} }
/*!
*
* \details Refer to getAnyIntersection() for more details
* \return A bitset of intersections, describing the directions of intersection. Position `Direction` in bitset true if edge in that direction collides
* \see Direction
* \see IntersectionBitSet
* \snippet CollisionHandler.h IntersectionBitSet
* \details Example usage for IntersectionBitSet (TransformComponent::update()):
* \snippet{trimleft} TransformComponent.cpp getAnyIntersection example code
*
*/
template<> template<>
IntersectionBitSet CollisionHandler::getAnyIntersection<IntersectionBitSet>( IntersectionBitSet CollisionHandler::getAnyIntersection<IntersectionBitSet>(
Entity* entity, Entity* entity,
@ -116,6 +127,7 @@ IntersectionBitSet CollisionHandler::getAnyIntersection<IntersectionBitSet>(
std::initializer_list<Entity::GroupLabel> const& groupLabels, std::initializer_list<Entity::GroupLabel> const& groupLabels,
std::initializer_list<Entity*> const& excludedEntities) std::initializer_list<Entity*> const& excludedEntities)
{ {
if (!entity->hasComponent<ColliderComponent>()) return std::bitset<DIRECTION_C>();
IntersectionBitSet intersections; IntersectionBitSet intersections;
for (auto& collider : getColliders(groupLabels, excludedEntities)) { for (auto& collider : getColliders(groupLabels, excludedEntities)) {
intersections |= getIntersection(entity, collider->entity, posMod); intersections |= getIntersection(entity, collider->entity, posMod);
@ -123,6 +135,13 @@ IntersectionBitSet CollisionHandler::getAnyIntersection<IntersectionBitSet>(
return intersections; return intersections;
}; };
/*!
*
* \details Refer to getAnyIntersection() for more details
* \return The first entity with collision found
* \see Entity
*
*/
template<> template<>
Entity* CollisionHandler::getAnyIntersection<Entity*>( Entity* CollisionHandler::getAnyIntersection<Entity*>(
Entity* entity, Entity* entity,
@ -130,6 +149,7 @@ Entity* CollisionHandler::getAnyIntersection<Entity*>(
std::initializer_list<Entity::GroupLabel> const& groupLabels, std::initializer_list<Entity::GroupLabel> const& groupLabels,
std::initializer_list<Entity*> const& excludedEntities) std::initializer_list<Entity*> const& excludedEntities)
{ {
if (!entity->hasComponent<ColliderComponent>()) return nullptr;
for (auto& collider : getColliders(groupLabels, excludedEntities)) { for (auto& collider : getColliders(groupLabels, excludedEntities)) {
SDL_Rect rect = entity->getComponent<ColliderComponent>().collider + posMod; SDL_Rect rect = entity->getComponent<ColliderComponent>().collider + posMod;
if (SDL_HasIntersection(&rect, &collider->collider)) { if (SDL_HasIntersection(&rect, &collider->collider)) {
@ -138,3 +158,26 @@ Entity* CollisionHandler::getAnyIntersection<Entity*>(
} }
return nullptr; return nullptr;
}; };
/*!
*
* \details Refer to getAnyIntersection() for more details
* \return True if any collision was found, otherwise false
*
*/
template<>
bool CollisionHandler::getAnyIntersection<bool>(
Entity* entity,
Vector2D posMod,
std::initializer_list<Entity::GroupLabel> const& groupLabels,
std::initializer_list<Entity*> const& excludedEntities)
{
if (!entity->hasComponent<ColliderComponent>()) return false;
for (auto& collider : getColliders(groupLabels, excludedEntities)) {
SDL_Rect rect = entity->getComponent<ColliderComponent>().collider + posMod;
if (SDL_HasIntersection(&rect, &collider->collider)) {
return true;
}
}
return false;
};

View File

@ -9,11 +9,6 @@ void Entity::update() const
for (auto const& c : components) c->update(); for (auto const& c : components) c->update();
} }
void Entity::draw() const
{
for (auto const& c : components) c->draw();
}
bool Entity::hasGroup(Group mGroup) bool Entity::hasGroup(Group mGroup)
{ {
return groupBitSet[mGroup]; return groupBitSet[mGroup];

View File

@ -4,6 +4,8 @@
#include "CollisionHandler.h" #include "CollisionHandler.h"
#include "AssetManager.h" #include "AssetManager.h"
#include "RenderManager.h"
#include "SDL_mixer.h"
#include "SoundManager.h" #include "SoundManager.h"
#include "TileComponent.h" #include "TileComponent.h"
#include "Direction.h" #include "Direction.h"
@ -18,6 +20,7 @@
GameInternal::GameInternal() : GameInternal::GameInternal() :
manager(this), manager(this),
renderManager(),
tiles(manager.getGroup((size_t)Entity::GroupLabel::MAPTILES)), tiles(manager.getGroup((size_t)Entity::GroupLabel::MAPTILES)),
players(manager.getGroup((size_t)Entity::GroupLabel::PLAYERS)), players(manager.getGroup((size_t)Entity::GroupLabel::PLAYERS)),
projectiles(manager.getGroup((size_t)Entity::GroupLabel::PROJECTILE)), projectiles(manager.getGroup((size_t)Entity::GroupLabel::PROJECTILE)),
@ -60,11 +63,11 @@ void GameInternal::init(const char* title, int xpos, int ypos, int width, int he
return; return;
} }
SDL_Surface* icon = SDL_LoadBMP("assets/iconImage.bmp"); // bad
if(!icon) SDL_Surface* icon;
if((icon = SDL_LoadBMP("assets/iconImage.bmp")))
{ {
std::cout << "ERROR: Couldn't create icon!" << std::endl; SDL_SetWindowIcon(window, icon);
return;
} }
SDL_SetWindowIcon(window, icon); SDL_SetWindowIcon(window, icon);
@ -78,13 +81,6 @@ void GameInternal::init(const char* title, int xpos, int ypos, int width, int he
} }
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
//SDL_Texture* backgroundTexture = GameInternal::textureManager->loadTexture("assets/startscreen.png");
SDL_RenderClear(renderer);
//SDL_RenderCopy(renderer, backgroundTexture, NULL, NULL);
SDL_RenderPresent(renderer);
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0)
{ {
std::cout << "ERROR: Mixer couldnt be initialized! " << SDL_GetError() << std::endl; std::cout << "ERROR: Mixer couldnt be initialized! " << SDL_GetError() << std::endl;
@ -95,45 +91,6 @@ void GameInternal::init(const char* title, int xpos, int ypos, int width, int he
Mix_Volume(-1, MIX_MAX_VOLUME); Mix_Volume(-1, MIX_MAX_VOLUME);
Mix_AllocateChannels(16); Mix_AllocateChannels(16);
//SDL_Event event;
bool hasQuit = false;
while (!hasQuit)
{
SDL_PollEvent(&event);
if (event.type == SDL_QUIT)
{
hasQuit = true;
break;
}
if (event.type == SDL_KEYDOWN)
{
if (event.key.keysym.scancode == SDL_SCANCODE_RETURN)
{
std::cout << "Enter pressed > Game start..." << std::endl;
break;
}
if (event.key.keysym.scancode == SDL_SCANCODE_ESCAPE)
{
std::cout << "Escape pressed > Game quit..." << std::endl;
hasQuit = true;
}
}
}
if (hasQuit)
{
this->setRunning(false);
return;
}
if (this->isRunning() == false) return;
map = new Map();
// loading sounds // loading sounds
// assets->addSoundEffect("throw_egg", "assets/sound/throw_egg.wav"); // assets->addSoundEffect("throw_egg", "assets/sound/throw_egg.wav");
// assets->addSoundEffect("steps", "assets/sound/steps.wav"); // assets->addSoundEffect("steps", "assets/sound/steps.wav");
@ -172,21 +129,7 @@ void GameInternal::update()
void GameInternal::render() void GameInternal::render()
{ {
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
for (auto& t : tiles) this->renderManager.renderAll();
t->draw();
for (auto& p : powerups)
p->draw();
for (auto& p : players)
p->draw();
for (auto& p : projectiles)
p->draw();
for (auto& h : hearts)
h->draw();
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);
} }

View File

@ -1,36 +0,0 @@
#include "GameObject.h"
#include "SDL_error.h"
#include "TextureManager.h"
#include "GameInternal.h"
GameObject::GameObject(const char* texturesheet, int x, int y)
{
// seems not to be used, and was using deprecated functionality
SDL_SetError("GameObject not implemented");
this->xPos = x;
this->yPos = y;
}
void GameObject::update()
{
xPos++;
yPos++;
srcRect.h = 32;
srcRect.w = 32;
srcRect.x = 0;
srcRect.y = 0;
destRect.h = srcRect.h *2;
destRect.w = srcRect.w *2;
destRect.x = xPos;
destRect.y = yPos;
}
void GameObject::render()
{
SDL_SetError("GameObject not implemented");
// SDL_RenderCopy(Game::renderer, objTexture, &srcRect, &destRect);
}

View File

@ -6,11 +6,6 @@
#include "Constants.h" #include "Constants.h"
#include "Entity.h" #include "Entity.h"
void Manager::draw()
{
for (auto& e : entities) e->draw();
}
void Manager::refresh() void Manager::refresh()
{ {
for (auto i(0u); i < MAX_GROUPS; i++) for (auto i(0u); i < MAX_GROUPS; i++)

View File

@ -1,68 +1,187 @@
#include "Map.h" #include "Map.h"
#include <algorithm>
#include <cctype> #include <cctype>
#include <iostream> #include <cstdint>
#include <fstream> #include <cstdio>
#include <utility> #include <functional>
#include <optional>
#include <ranges>
#include <vector>
#include "Constants.h" #include <SDL_error.h>
#include <SDL_render.h>
#include <tmxlite/Layer.hpp>
#include <tmxlite/Map.hpp>
#include <tmxlite/Tileset.hpp>
#include <tmxlite/Property.hpp>
#include <tmxlite/TileLayer.hpp>
#include <tmxlite/Types.hpp>
#include "ColliderComponent.h"
#include "GameInternal.h" #include "GameInternal.h"
#include "SDL_error.h" #include "SpriteComponent.h"
#include "TextureManager.h"
#include "TileComponent.h" #include "TileComponent.h"
#include "VEGO.h"
void Map::loadMap(const char* path, int sizeX, int sizeY, GameInternal* game, const std::map<int, std::pair<TexturesEnum, bool>>* textureDict /* backreference */)
{
std::string tileIDstr;
char singleChar = 0;
std::ifstream mapFile;
mapFile.open(path);
if (!mapFile.is_open()) { template<> std::optional<bool> Map::getLayerProperty(const std::vector<tmx::Property>& properties, std::string propertyName) {
SDL_SetError("Error loading map: Couldn't open map file!"); auto zIndexIterator = std::ranges::find_if(properties, [propertyName](const tmx::Property& property) {
std::cout << "ERROR: Map couldnt be loaded! " << SDL_GetError() << std::endl; return property.getName().compare(propertyName) == 0;
SDL_ClearError(); });
if (zIndexIterator != properties.end() && zIndexIterator->getType() == tmx::Property::Type::Boolean) {
return zIndexIterator->getBoolValue();
} }
int x = 0, y = 0; // needed outside for-loop for error handling return std::nullopt;
for (; !mapFile.eof(); mapFile.get(singleChar))
{
if (singleChar == ',' || singleChar == '\n') {
if (tileIDstr.empty())
continue;
Map::addTile(std::stoi(tileIDstr), x * TILE_SIZE, y * TILE_SIZE, game, textureDict);
tileIDstr.clear();
x++;
if (singleChar == '\n') {
if (x != sizeX) {
SDL_SetError("Error loading map: specified x size doesn't match map file!");
std::cout << "ERROR: Map couldnt be loaded! " << SDL_GetError() << std::endl;
SDL_ClearError();
}
x = 0;
y++;
continue;
}
continue;
}
if (!std::isdigit(singleChar)) continue;
tileIDstr += singleChar;
}
if (y != sizeY) {
SDL_SetError("Error loading map: specified y size doesn't match map file!");
std::cout << "ERROR: Map couldnt be loaded! " << SDL_GetError() << std::endl;
SDL_ClearError();
}
mapFile.close();
} }
void Map::addTile(unsigned long id, int x, int y, GameInternal* game, const std::map<int, std::pair<TexturesEnum, bool>>* textureDict) // tile entity template<> std::optional<int> Map::getLayerProperty(const std::vector<tmx::Property>& properties, std::string propertyName)
{ {
auto& tile(game->manager.addEntity()); auto zIndexIterator = std::ranges::find_if(properties, [propertyName](const tmx::Property& property) {
tile.addComponent<TileComponent>(x, y, TILE_SIZE, TILE_SIZE, id, textureDict); return property.getName().compare(propertyName) == 0;
});
if(tile.getComponent<TileComponent>().hasCollision()) if (zIndexIterator != properties.end() && zIndexIterator->getType() == tmx::Property::Type::Int) {
tile.addComponent<ColliderComponent>(tile.getComponent<TileComponent>().getName().data()); return zIndexIterator->getIntValue();
}
return std::nullopt;
}
Map::Map(const char* path)
{
if (!this->map.load(path)) {
// TODO: log to console
// TODO: error handling
}
std::vector<std::string> texturePaths = {};
for (const auto& tileSet : map.getTilesets()) {
texturePaths.emplace_back(tileSet.getImagePath());
}
this->mapData = {
&map.getTilesets(),
&map.getLayers(),
&map.getTileCount(),
&map.getTileSize(),
&texturePaths
};
for (auto& layer : *this->mapData.mapLayers) {
if (layer->getType() == tmx::Layer::Type::Tile) {
loadTileLayer(layer->getLayerAs<tmx::TileLayer>());
continue;
}
if (layer->getType() == tmx::Layer::Type::Object) {
// spawn objects
continue;
}
}
}
void Map::loadTileLayer(const tmx::TileLayer& layer)
{
const std::vector<tmx::Property>& properties = layer.getProperties();
int zIndex = getLayerProperty<int>(properties, "zIndex").value_or(0);
bool collision = getLayerProperty<bool>(properties, "collision").value_or(false);
const auto& tiles = layer.getTiles();
// for each tile set
auto tileConstructorRange = std::views::iota(0)
| std::views::take(this->mapData.tileSets->size())
// return the tile set metadata
| std::views::transform([&](uint16_t i) {
const char* texturePath = this->mapData.texturePaths->at(i).c_str();
tmx::Vector2i textureSize;
SDL_QueryTexture(
VEGO_Game().textureManager->loadMapTileTexture(texturePath),
nullptr,
nullptr,
&(textureSize.x),
&(textureSize.y)
);
tmx::Vector2u tileCount2D = { textureSize.x / this->mapData.mapTileSize->x, textureSize.y / this->mapData.mapTileSize->y };
uint32_t tileCount = this->mapData.tileSets->at(i).getTileCount();
uint32_t firstGID = this->mapData.tileSets->at(i).getFirstGID();
return TileSetData { texturePath, textureSize, tileCount, tileCount2D, firstGID };
})
| std::views::transform([=, this](const TileSetData& data) {
// for each tile on the tile set
return std::views::iota(0)
| std::views::take(this->mapData.mapSize->x * this->mapData.mapSize->y)
// only take tiles that are on the ID range of the tile set
| std::views::filter([=](uint16_t idx) {
return
idx < tiles.size()
&& tiles[idx].ID >= data.firstGID
&& tiles[idx].ID < (data.firstGID + data.tileCount);
})
// extract tile data
| std::views::transform([=, this](uint16_t idx) {
const auto x = idx % this->mapData.mapSize->x;
const auto y = idx / this->mapData.mapSize->x;
const auto idIndex = (tiles[idx].ID - data.firstGID);
uint32_t u = idIndex % data.tileCount2D.x;
uint32_t v = idIndex / data.tileCount2D.y;
u *= this->mapData.mapTileSize->x; // TODO: we should be using the tile set size, as this may be different from the map's grid size
v *= this->mapData.mapTileSize->y;
// normalise the UV
u /= data.textureSize.x;
v /= data.textureSize.y;
// vert pos
const float tilePosX = static_cast<float>(x) * this->mapData.mapTileSize->x;
const float tilePosY = (static_cast<float>(y) * this->mapData.mapTileSize->y);
// return tile data as a function to spawn said tile
return std::function<void()>(
[tilePosX, tilePosY, capture0 = *this->mapData.mapTileSize, u, v, zIndex, capture1 = data.texturePath, collision] {
Map::addTile(tilePosX, tilePosY, capture0, u, v, zIndex, capture1, collision);
}
);
});
})
// 2D view to 1D vector; might be better keep as view with scene management
| std::views::join
| std::ranges::to<std::vector>();
this->tileConstructors.insert(this->tileConstructors.end(), tileConstructorRange.begin(), tileConstructorRange.end());
}
void Map::addTile(float x, float y, const tmx::Vector2u& mapTileSize, int u, int v, int zIndex, std::string texturePath, bool hasCollision)
{
auto& tile(VEGO_Game().manager.addEntity());
tile.addComponent<TransformComponent>(x, y, mapTileSize.x, mapTileSize.y, 1);
tile.addComponent<SpriteComponent>(texturePath.c_str(), v, u, zIndex); // why does uv need to be reversed?
//TODO: also implement updated map stuff for this
if (hasCollision) {
// tag currently does not have a clear purposes, TODO: figure out appropriate tag name
tile.addComponent<ColliderComponent>("hello I am a collider of a tile!");
tile.addGroup((size_t)Entity::GroupLabel::MAPTILES); tile.addGroup((size_t)Entity::GroupLabel::MAPTILES);
}
}
void Map::generateTiles()
{
std::ranges::for_each(this->tileConstructors, [](auto& function) {
function();
});
} }

24
src/RenderManager.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "RenderManager.h"
#include "RenderObject.h"
#include <algorithm>
void RenderManager::renderAll()
{
if (!this->isSorted) {
std::ranges::sort(this->renderObjects, RenderObject::ZIndexComparator());
}
for (RenderObject* obj : this->renderObjects) {
obj->draw();
}
}
void RenderManager::add(RenderObject* renderObject) {
this->renderObjects.emplace_back(renderObject);
this->isSorted = false;
}
void RenderManager::remove(RenderObject* renderObject)
{
this->renderObjects.erase(std::remove(this->renderObjects.begin(), this->renderObjects.end(), renderObject), this->renderObjects.end());
this->isSorted = false;
}

10
src/RenderObject.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "RenderObject.h"
#include "RenderManager.h"
RenderObject::RenderObject(int zIndex, RenderManager& renderManager) : zIndex(zIndex), renderManager(renderManager) {
renderManager.add(this);
}
RenderObject::~RenderObject() {
this->renderManager.remove(this);
}

View File

@ -6,22 +6,36 @@
#include "AnimationHandler.h" #include "AnimationHandler.h"
#include "Direction.h" #include "Direction.h"
#include "ProjectileComponent.h"
#include "RenderObject.h"
#include "TextureManager.h" #include "TextureManager.h"
#include "Entity.h" #include "Entity.h"
#include "TransformComponent.h" #include "TransformComponent.h"
#include "GameInternal.h" #include "GameInternal.h"
#include "Manager.h" #include "Manager.h"
#include "VEGO.h"
SpriteComponent::SpriteComponent(TexturesEnum textureEnum) SpriteComponent::SpriteComponent(Textures texture, int zIndex) : RenderObject(zIndex, VEGO_Game().renderManager), textureXOffset(0), textureYOffset(0)
{ {
this->textureEnum = textureEnum; this->textureEnum = texture;
}
SpriteComponent::SpriteComponent(Textures texture, int xOffset, int yOffset, int zIndex) : RenderObject(zIndex, VEGO_Game().renderManager), textureXOffset(xOffset), textureYOffset(yOffset)
{
this->textureEnum = texture;
}
SpriteComponent::SpriteComponent(const char* path, int xOffset, int yOffset, int zIndex) : RenderObject(zIndex, VEGO_Game().renderManager), textureXOffset(xOffset), textureYOffset(yOffset) {
this->path = path;
} }
SpriteComponent::SpriteComponent( SpriteComponent::SpriteComponent(
TexturesEnum textureEnum, Textures texture,
bool isAnimated, bool isAnimated,
std::map<std::string, std::unique_ptr<Animation>>* animationMap, std::map<std::string, std::unique_ptr<Animation>>* animationMap,
std::string defaultAnimation) std::string defaultAnimation,
int zIndex) : RenderObject(zIndex, VEGO_Game().renderManager), textureXOffset(0), textureYOffset(0)
{ {
animated = isAnimated; animated = isAnimated;
@ -29,14 +43,14 @@ SpriteComponent::SpriteComponent(
playAnimation(defaultAnimation); playAnimation(defaultAnimation);
this->textureEnum = textureEnum; this->textureEnum = texture;
} }
SpriteComponent::~SpriteComponent() {} SpriteComponent::~SpriteComponent() {}
void SpriteComponent::setTexture(TexturesEnum texture) void SpriteComponent::setTexture(Textures texture)
{ {
this->texture = this->entity->getManager().getGame()->textureManager->loadTexture(texture); this->texture = VEGO_Game().textureManager->loadTexture(texture);
} }
void SpriteComponent::init() void SpriteComponent::init()
@ -45,20 +59,22 @@ void SpriteComponent::init()
this->transform = &entity->getComponent<TransformComponent>(); this->transform = &entity->getComponent<TransformComponent>();
this->srcRect.x = this->srcRect.y = 0;
this->srcRect.w = transform->width; this->srcRect.w = transform->width;
this->srcRect.h = transform->height; this->srcRect.h = transform->height;
this->srcRect.x = this->textureXOffset * this->srcRect.w;
this->srcRect.y = this->textureYOffset * this->srcRect.h;;
this->update(); this->update();
} }
void SpriteComponent::update() void SpriteComponent::update()
{ {
// This code is not compatible for animated tiles
if (animated) { if (animated) {
srcRect.x = srcRect.w * static_cast<int>((SDL_GetTicks() / speed) % frames); srcRect.x = srcRect.w * static_cast<int>((SDL_GetTicks() / speed) % frames);
}
srcRect.y = animationIndex * transform->height; srcRect.y = animationIndex * transform->height;
}
this->destRect.x = this->transform->position.x; this->destRect.x = this->transform->position.x;
this->destRect.y = this->transform->position.y; this->destRect.y = this->transform->position.y;
@ -68,7 +84,7 @@ void SpriteComponent::update()
void SpriteComponent::draw() void SpriteComponent::draw()
{ {
this->entity->getManager().getGame()->textureManager->draw(this->entity->getManager().getGame()->renderer, this->texture, this->srcRect, this->destRect, this->animated && this->flipped); this->entity->getManager().getGame()->textureManager->draw(VEGO_Game().renderer, this->texture, this->srcRect, this->destRect, this->animated && this->flipped);
} }
void SpriteComponent::playAnimation(std::string type) void SpriteComponent::playAnimation(std::string type)

View File

@ -3,12 +3,14 @@
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include <VEGO.h>
#include <linux/soundcard.h>
#include "GameInternal.h" #include "GameInternal.h"
void TextureManager::addSingleTexture(TexturesEnum texture, const char* filePath) { void TextureManager::addSingleTexture(Textures texture, const char* filePath) {
auto sdlTexture = IMG_LoadTexture(this->manager->getGame()->renderer, filePath); auto sdlTexture = IMG_LoadTexture(VEGO_Game().renderer, filePath);
if (sdlTexture == nullptr) if (sdlTexture == nullptr)
throw std::runtime_error(std::string("Couldn't load texture '") + filePath + "'"); throw std::runtime_error(std::string("Couldn't load texture '") + filePath + "'");
@ -17,14 +19,14 @@ void TextureManager::addSingleTexture(TexturesEnum texture, const char* filePath
std::cout << "Loaded texture at " << filePath << std::endl; std::cout << "Loaded texture at " << filePath << std::endl;
} }
void TextureManager::addTextures(const std::map<TexturesEnum, const char*> &textures) { void TextureManager::addTextures(const std::map<Textures, const char*> &textures) {
for (auto texture : textures) { for (auto texture : textures) {
addSingleTexture(texture.first, texture.second); addSingleTexture(texture.first, texture.second);
} }
} }
SDL_Texture* TextureManager::loadTexture(TexturesEnum texture) { SDL_Texture* TextureManager::loadTexture(Textures texture) {
auto it = this->texture_cache.find(texture); auto it = this->texture_cache.find(texture);
if (it != this->texture_cache.end()) if (it != this->texture_cache.end())
@ -39,3 +41,16 @@ void TextureManager::draw(SDL_Renderer* renderer, SDL_Texture* texture, SDL_Rect
SDL_RendererFlip flip = flipped ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE; SDL_RendererFlip flip = flipped ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
SDL_RenderCopyEx(renderer, texture, &src, &dest, 0, NULL, flip); SDL_RenderCopyEx(renderer, texture, &src, &dest, 0, NULL, flip);
} }
SDL_Texture* TextureManager::loadMapTileTexture(const char *path) {
//returns tile if it exists already
if(mapTile_texture_cache.contains(std::string(path)))
return mapTile_texture_cache.at(std::string(path));
auto newTexture = IMG_LoadTexture(VEGO_Game().renderer, path);
this->mapTile_texture_cache.emplace(std::string(path), newTexture);
return newTexture;
}

View File

@ -9,8 +9,7 @@
#include "TextureEnumBase.h" #include "TextureEnumBase.h"
TileComponent::TileComponent(int x, int y, int w, int h, int id, const std::map<int, std::pair<Textures, bool>>* textureDict)
TileComponent::TileComponent(int x, int y, int w, int h, int id, const std::map<int, std::pair<TexturesEnum, bool>>* textureDict)
{ {
this->tileRect.x = x; this->tileRect.x = x;
this->tileRect.y = y; this->tileRect.y = y;
@ -33,7 +32,7 @@ void TileComponent::init()
this->entity->addComponent<TransformComponent>(this->tileRect.x, this->tileRect.y, this->tileRect.w, this->tileRect.h, 1); this->entity->addComponent<TransformComponent>(this->tileRect.x, this->tileRect.y, this->tileRect.w, this->tileRect.h, 1);
this->transform = &entity->getComponent<TransformComponent>(); this->transform = &entity->getComponent<TransformComponent>();
this->entity->addComponent<SpriteComponent>(this->texture); this->entity->addComponent<SpriteComponent>(this->texture, 0);
this->sprite = &entity->getComponent<SpriteComponent>(); this->sprite = &entity->getComponent<SpriteComponent>();
} }

View File

@ -72,7 +72,8 @@ void TransformComponent::modifySpeed(int8_t modifier)
void TransformComponent::setPositionAfterCollision(Vector2D& positionChange) void TransformComponent::setPositionAfterCollision(Vector2D& positionChange)
{ {
std::initializer_list colliders = { Entity::GroupLabel::MAPTILES, Entity::GroupLabel::COLLIDERS }; std::initializer_list<Entity::GroupLabel> colliders = { Entity::GroupLabel::MAPTILES, Entity::GroupLabel::COLLIDERS };
// [getAnyIntersection example code]
IntersectionBitSet intersections = IntersectionBitSet intersections =
(CollisionHandler::getIntersectionWithBounds(entity, Vector2D(positionChange.x, 0)) | (CollisionHandler::getIntersectionWithBounds(entity, Vector2D(positionChange.x, 0)) |
(this->entity->getManager() (this->entity->getManager()
@ -88,4 +89,5 @@ void TransformComponent::setPositionAfterCollision(Vector2D& positionChange)
if (intersections.test((size_t)Direction::UP) || intersections.test((size_t)Direction::DOWN)) if (intersections.test((size_t)Direction::UP) || intersections.test((size_t)Direction::DOWN))
positionChange.y = 0; positionChange.y = 0;
// [getAnyIntersection example code]
} }

View File

@ -1,11 +1,12 @@
#include <iostream> #include <iostream>
#include <ctime> #include <ctime>
#include "VEGO.h"
#include "Entity.h" #include "Entity.h"
#include "GameInternal.h" #include "GameInternal.h"
#include "Constants.h" #include "Constants.h"
GameInternal* game = nullptr; GameInternal* vego::game = nullptr;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
@ -17,15 +18,15 @@ int main(int argc, char* argv[])
Uint32 frameStart; Uint32 frameStart;
int frameTime; int frameTime;
game = new GameInternal(); vego::game = new GameInternal();
game->init("No_Name_Chicken_Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_SIZE_WIDTH, SCREEN_SIZE_HEIGHT, false); vego::game->init("No_Name_Chicken_Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_SIZE_WIDTH, SCREEN_SIZE_HEIGHT, false);
while (game->isRunning()) { while (vego::game->isRunning()) {
frameStart = SDL_GetTicks(); frameStart = SDL_GetTicks();
game->handleEvents(); vego::game->handleEvents();
game->update(); vego::game->update();
game->render(); vego::game->render();
frameTime = SDL_GetTicks() - frameStart; frameTime = SDL_GetTicks() - frameStart;
@ -34,7 +35,7 @@ int main(int argc, char* argv[])
} }
} }
game->clean(); vego::game->clean();
return 0; return 0;
} }