Compare commits

..

No commits in common. "master" and "0.0.1" have entirely different histories.

217 changed files with 7906 additions and 19097 deletions

6
.gitignore vendored
View file

@ -32,7 +32,6 @@ bld/
[Oo]ut/ [Oo]ut/
[Ll]og/ [Ll]og/
[Ll]ogs/ [Ll]ogs/
[Bb]uild/
# Visual Studio 2015/2017 cache/options directory # Visual Studio 2015/2017 cache/options directory
.vs/ .vs/
@ -362,8 +361,3 @@ MigrationBackup/
# Fody - auto-generated XML schema # Fody - auto-generated XML schema
FodyWeavers.xsd FodyWeavers.xsd
/Resources/weapons/.bubblegun.xml.swp
*.swp
/Resources/scenes/.debugScene.xml.swp
compile_commands.json
compile_flags.txt

36
.vscode/launch.json vendored
View file

@ -1,36 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/out/build/x64-debug/YuppleMayham/YuppleMayham.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/out/build/x64-debug/YuppleMayham/",
"environment": [],
"console": "externalTerminal"
},
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/YuppleMayham.exe",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
]
}

16
.vscode/settings.json vendored
View file

@ -1,16 +0,0 @@
{
"files.associations": {
"memory": "cpp",
"execution": "cpp",
"algorithm": "cpp",
"iostream": "cpp",
"charconv": "cpp",
"format": "cpp",
"random": "cpp",
"sstream": "cpp",
"xhash": "cpp",
"xlocnum": "cpp",
"xmemory": "cpp",
"cassert": "cpp"
}
}

28
.vscode/tasks.json vendored
View file

@ -1,28 +0,0 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: cl.exe build active file",
"command": "cl.exe",
"args": [
"/Zi",
"/EHsc",
"/nologo",
"/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}

View file

@ -1,7 +1,7 @@
# CMakeList.txt : Top-level CMake project file, do global configuration # CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here. # and include sub-projects here.
# #
cmake_minimum_required (VERSION 3.11) cmake_minimum_required (VERSION 3.8)
# Enable Hot Reload for MSVC compilers if supported. # Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141) if (POLICY CMP0141)
@ -9,35 +9,6 @@ if (POLICY CMP0141)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>") set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif() endif()
include(FetchContent)
SET(CMAKE_EXPORT_COMPILE_COMMANDS 1)
#SET(SOL_LUAJIT 1)
#SET(TRACY_ENABLE 1)
#SET(TRACY_ON_DEMAND 1)
#SET(TRACY_ONLY_LOCALHOST 1)
SET(FT_DISABLE_BROTLI 1)
SET(FT_DISABLE_BZIP2 1)
SET(FT_DISABLE_HARFBUZZ 1)
SET(FT_DISABLE_PNG 1)
SET(FT_DISABLE_ZLIB 1)
option(GLM_ENABLE_FAST_MATH OFF)
# -fsanitize=address I will forget, renable this flag no more leaks allowed!
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -ffloat-store -fexcess-precision=standard -ffp-contract=off")
FetchContent_Declare(
tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG v0.11.1
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
project ("YuppleMayham") project ("YuppleMayham")
# Include sub-projects. # Include sub-projects.

View file

@ -1,4 +1,4 @@
{ {
"version": 3, "version": 3,
"configurePresets": [ "configurePresets": [
{ {
@ -97,13 +97,5 @@
} }
} }
} }
],
"buildPresets": [
{
"name": "x64-release",
"description": "",
"displayName": "",
"configurePreset": "x64-release"
}
] ]
} }

View file

@ -1,66 +0,0 @@
# Personal Game Engine
A modular, event driven 2D game engine, built from scratch to learn engine architecture and low-level graphics programming.
Supports sprite-based animation, Lua scripting, XML-driven definitions and Tiled map creation.
---
## Features
- Event-based animation and sound system
- Animation and tile-sets supported by texture atlases
- Map creation and collision map support in Tiled map editor
- Component-based entity structure
- Basic audio engine integration via OpenAL (XML definitions)
- Basic physics system
- Lua scripted enemy and weapon behavior
---
## Current Status
**Work in Progress** - This project is still under active development, I am currently cleaning up my resource management system for better ease of use for future users of this engine.
---
## Dependencies
- SDL2, SDL2_image
- OpenGL 3.3
- sol2 (Lua binding)
- TinyXML2
- OpenAL
- Freetype
- GLM
- pkg-config
- CMake
## Build Instructions
1. Clone the repo (git.wienermeister.net/snakert12345/yupplemayham.git)
2. Install list of dependencies. Ensure they're available via pkg-config
3. Build with CMake
```bash
git clone https://git.wienermeister.net/snakert12345/yupplemayham.git
cd yupplemayham
mkdir build && cd build
cmake ..
make
```
---
## Screenshot
![Screenshot](https://wienermeister.net/img/engine_screenshot.png)
---
## Roadmap
- Save/Load system
- Modular and scalable menu system
- In-game dialog and conversation systems
- Expanded combat system

View file

@ -1,8 +0,0 @@
<!--
<animations>
<animation name="bubble_idle_anim" type="idle">
<FPS>2</FPS>
<sprite path="sprites/bubbleoAtlas64.png" frameSize="64.0"/>
</animation>
</animations>
-->

View file

@ -1,22 +0,0 @@
<!-- Player Animations -->
<animation id="character/player/idle" directional="true" FPS="5" frameSize="64.0" atlas="sprites/player3AtlasIdle64.png"/>
<animation id="character/player/move" directional="true" FPS="7" frameSize="64.0" atlas="sprites/player3AtlasMove64.png"/>
<!-- Fallback animations -->
<animation id="character/tmp/move" directional="false" FPS="7" frameSize="128.0" atlas="sprites/player2Atlas.png"/>
<!--
<animations directional="true">
<animation name="player_move_anim" type="move">
<FPS>7</FPS>
<sprite path="sprites/player3AtlasMove64.png" frameSize="64.0"/>
</animation>
<animation name="player_idle_anim" type="idle">
<FPS>5</FPS>
<sprite path="sprites/player3AtlasIdle64.png" frameSize="64.0"/>
</animation>
</animations>
-->

View file

@ -1,12 +0,0 @@
<!--
<animations>
<animation name="machine_gun_idle_anim" type="idle">
<FPS>4</FPS>
<sprite path="sprites/machineGunAtlas256.png" frameSize="256.0"/>
</animation>
<animation name="machine_gun_reload_anim" type="reload">
<FPS>6</FPS>
<sprite path="sprites/machineGunAtlasReload256.png" frameSize="256.0"/>
</animation>
</animations>
-->

View file

@ -1,2 +0,0 @@
<!-- Bubble -->
<animation id="obj/bubble/idle" FPS="2" frameSize="64.0" atlas="sprites/bubbleoAtlas64.png"/>

View file

@ -1,12 +0,0 @@
<!--
<animations>
<animation name="pistol_idle_anim" type="idle">
<FPS>4</FPS>
<sprite path="sprites/pistolAtlas256.png" frameSize="256.0"/>
</animation>
<animation name="pistol_reload_anim" type="reload">
<FPS>8</FPS>
<sprite path="sprites/pistolAtlasReload256.png" frameSize="256.0"/>
</animation>
</animations>
-->

View file

@ -1,16 +0,0 @@
<!--
<animations>
<animation name="shot_gun_idle_anim" type="idle">
<FPS>4</FPS>
<sprite path="sprites/shotGunIdle128.png" frameSize="128.0"/>
</animation>
<animation name="shot_gun_fire_anim" type="fire">
<FPS>8</FPS>
<sprite path="sprites/shotGunFire128.png" frameSize="128.0"/>
</animation>
<animation name="shot_gun_reload_anim" type="reload">
<FPS>8</FPS>
<sprite path="sprites/shotGunReload128.png" frameSize="128.0"/>
</animation>
</animations>
-->

View file

@ -1,8 +0,0 @@
<!--
<animations>
<animation name="tmp_enemy_move_anim" type="move">
<FPS>7</FPS>
<sprite path="sprites/player2Atlas.png" frameSize="128.0"/>
</animation>
</animations>
-->

View file

@ -1,13 +0,0 @@
<!-- Machine Gun -->
<animation id="gun/machine/idle" FPS="4" frameSize="256.0" atlas="sprites/machineGunAtlas256.png"/>
<animation id="gun/machine/reload" FPS="6" frameSize="256.0" atlas="sprites/machineGunAtlasReload256.png"/>
<!-- Pistol -->
<animation id="gun/pistol/idle" FPS="4" frameSize="256.0" atlas="sprites/pistolAtlas256.png"/>
<animation id="gun/pistol/reload" FPS="8" frameSize="256.0" atlas="sprites/pistolAtlasReload256.png"/>
<!-- Shotgun -->
<animation id="gun/shotgun/idle" FPS="4" frameSize="128.0" atlas="sprites/shotGunIdle128.png"/>
<animation id="gun/shotgun/fire" FPS="8" frameSize="128.0" atlas="sprites/shotGunFire128.png"/>
<animation id="gun/shotgun/reload" FPS="8" frameSize="128.0" atlas="sprites/shotGunReload128.png"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

View file

@ -1,95 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="62" tileheight="62" infinite="0" nextlayerid="5" nextobjectid="20">
<tileset firstgid="1" source="tilesets/shooterWorldOne.tsx"/>
<tileset firstgid="65" source="tilesets/wOne.tsx"/>
<layer id="2" name="Tile Layer 2" width="30" height="20">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,28,28,29,25,28,28,29,27,31,28,28,31,28,32,26,29,30,27,25,27,32,28,31,26,29,25,29,32,0,
0,32,27,22,16,16,23,31,26,30,31,31,29,28,30,25,28,26,26,25,29,26,25,32,28,28,31,32,25,0,
0,30,24,11,4,8,14,26,28,31,26,24,16,16,16,16,23,27,25,25,30,26,29,29,30,29,25,29,27,0,
0,25,15,6,1,2,14,28,32,30,24,11,0,0,0,8,12,23,28,27,25,32,30,32,30,28,27,27,26,0,
0,28,20,13,13,13,19,32,28,29,15,0,0,0,0,0,0,14,25,32,91,32,24,16,16,16,23,29,27,0,
0,31,29,31,27,26,27,30,29,27,0,0,0,0,0,0,0,0,27,32,32,29,15,8,4,2,14,26,27,0,
0,30,30,30,25,32,29,30,27,28,32,32,30,0,0,0,0,0,27,25,29,31,20,13,13,13,19,31,26,0,
0,28,30,30,28,31,26,29,31,29,26,20,31,0,0,0,0,31,31,28,27,26,29,26,32,25,31,25,32,0,
0,26,26,31,29,20,29,31,25,32,28,25,25,28,30,27,28,25,31,30,27,26,26,28,25,29,25,32,31,0,
0,30,32,29,29,32,31,28,25,31,31,31,26,30,31,27,29,25,29,32,0,0,0,0,30,26,31,0,0,0,
0,30,27,31,31,28,25,32,28,26,30,27,26,28,30,29,30,25,30,32,0,0,0,0,0,0,0,0,0,0,
0,27,29,22,21,30,29,29,32,0,0,0,0,32,30,30,31,32,26,28,0,0,0,0,0,0,0,0,0,0,
0,27,25,18,17,30,28,30,0,0,0,0,0,26,31,26,25,30,27,29,26,0,0,0,0,0,0,0,0,0,
0,32,30,31,30,30,28,0,0,0,0,0,0,32,27,31,30,28,26,31,26,0,0,0,0,0,0,0,0,0,
0,32,31,27,31,31,25,28,25,27,27,32,27,30,32,26,31,28,25,30,31,31,0,0,0,0,0,0,0,0,
0,32,26,26,26,31,29,27,26,27,30,26,29,29,28,25,32,28,29,28,32,25,0,0,0,0,0,0,0,0,
0,25,26,28,30,32,28,25,27,29,30,30,28,28,28,26,25,30,26,27,29,27,0,0,0,0,0,0,0,0,
0,29,26,31,29,30,26,25,32,29,31,28,26,32,32,27,28,26,27,28,29,30,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="3" name="Object Layer 1">
<object id="2" gid="57" x="452" y="516" width="64" height="64"/>
<object id="3" gid="61" x="896" y="444" width="64" height="64"/>
<object id="4" gid="61" x="956" y="314" width="64" height="64"/>
<object id="6" gid="63" x="1152" y="768" width="64" height="64"/>
<object id="8" gid="64" x="1214" y="256" width="64" height="64"/>
<object id="9" gid="62" x="1022" y="640" width="64" height="64"/>
<object id="10" gid="58" x="894" y="772" width="64" height="64"/>
<object id="11" gid="58" x="314" y="832" width="64" height="64"/>
<object id="12" gid="59" x="768" y="1152" width="64" height="64"/>
<object id="13" gid="64" x="320" y="254" width="64" height="64"/>
<object id="14" gid="62" x="190" y="1090" width="64" height="64"/>
<object id="15" gid="62" x="576" y="194" width="64" height="64"/>
<object id="16" gid="60" x="580" y="638" width="64" height="64"/>
<object id="17" gid="60" x="516" y="1152" width="64" height="64"/>
<object id="18" gid="57" x="126" y="894" width="64" height="64"/>
<object id="19" gid="58" x="1536" y="260" width="64" height="64"/>
</objectgroup>
<layer id="4" name="Tile Layer 3" width="30" height="20">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,56,156,155,156,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<layer id="1" name="Tile Layer 1" width="30" height="20">
<data encoding="csv">
35,36,34,35,33,38,38,34,35,34,34,39,38,39,35,39,38,37,39,39,33,33,38,34,34,34,33,37,34,40,
37,41,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,42,34,
38,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,33,
36,46,0,0,0,0,0,0,0,0,0,31,32,27,31,30,29,0,0,0,0,0,0,0,0,0,0,0,47,39,
37,46,0,0,0,0,0,0,0,0,25,25,28,27,25,27,32,27,0,126,127,128,0,0,0,0,0,0,47,36,
35,46,0,176,149,150,150,144,0,0,30,28,31,30,32,29,31,32,0,117,141,131,0,0,0,0,0,0,47,34,
37,46,0,177,182,181,180,169,0,0,27,29,28,30,27,26,26,30,0,124,125,132,0,0,0,0,0,0,47,39,
34,46,0,153,180,146,156,175,149,164,176,149,144,25,27,25,31,32,0,0,0,0,0,0,0,0,0,0,47,34,
40,46,0,151,180,167,164,177,161,145,177,166,145,27,25,31,32,0,0,0,0,0,0,0,0,0,0,0,47,35,
33,46,0,153,180,181,145,151,180,167,165,159,169,0,0,0,0,0,0,56,48,48,48,48,55,0,56,48,43,33,
35,46,0,151,152,146,147,177,166,161,180,161,169,0,0,0,0,0,0,47,34,36,34,39,44,48,43,34,36,40,
40,46,0,154,155,157,0,178,155,48,48,48,48,55,0,0,0,0,0,47,36,36,34,39,38,36,36,38,36,37,
35,46,0,0,0,0,0,56,43,36,38,38,39,46,0,0,0,0,0,47,40,39,38,36,38,40,40,34,38,37,
38,46,0,0,0,0,56,43,37,39,36,36,33,46,0,0,0,0,0,0,42,39,35,36,33,34,33,38,40,39,
34,46,0,0,0,0,47,35,34,40,39,38,36,46,0,0,0,0,0,0,47,38,36,34,34,33,36,40,35,40,
38,46,0,0,0,0,52,45,45,45,45,45,45,51,0,0,0,0,0,0,52,42,37,34,40,37,33,38,37,37,
37,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,35,33,33,39,35,40,34,37,
39,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,34,37,36,34,34,39,40,33,
38,44,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,43,39,35,34,35,38,38,37,39,
38,38,40,37,38,35,36,37,36,39,36,39,36,36,34,39,40,36,40,37,37,33,40,37,38,38,33,38,39,38
</data>
</layer>
</map>

View file

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="62" tileheight="62" infinite="0" nextlayerid="5" nextobjectid="1">
<tileset firstgid="1" source="tilesets/wOne.tsx"/>
<layer id="2" name="Tile Layer 2" width="30" height="20" visible="0">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,34,31,31,30,70,72,30,34,29,34,73,33,29,71,72,30,33,31,71,29,70,34,0,0,0,0,0,0,0,
0,31,29,54,33,27,29,32,31,28,29,71,54,72,27,71,71,31,33,70,70,73,31,0,0,0,0,0,0,0,
0,72,70,34,73,31,0,0,30,31,33,32,29,34,70,71,33,27,32,30,31,30,29,0,0,0,0,0,0,0,
0,27,28,31,29,0,0,0,0,34,32,30,28,32,31,27,34,31,54,33,27,27,29,0,0,0,0,0,0,0,
0,54,27,54,28,0,0,0,0,54,31,72,71,34,27,72,70,29,71,73,30,30,71,70,0,0,0,0,0,0,
0,32,27,29,54,70,0,0,71,32,54,70,71,72,34,70,54,70,32,34,72,33,72,32,34,0,0,0,0,0,
0,70,27,54,34,31,27,33,31,28,31,33,54,71,29,33,73,28,34,34,34,71,32,33,30,73,0,0,0,0,
0,29,71,27,31,34,30,71,70,32,72,54,29,31,29,29,54,28,73,33,72,30,30,31,72,31,32,0,0,0,
0,34,72,29,72,29,71,34,31,33,27,70,70,29,71,27,33,28,34,73,54,72,70,73,71,31,54,0,0,0,
0,31,73,27,27,33,34,29,54,73,54,54,70,73,30,73,73,54,34,30,54,34,30,29,34,70,54,0,0,0,
0,28,72,28,28,33,33,29,31,32,30,27,73,27,31,34,73,54,31,32,28,34,70,73,72,33,28,0,0,0,
0,0,73,34,54,32,33,34,33,54,30,29,70,72,73,70,70,54,29,29,34,27,70,71,72,28,70,0,0,0,
0,0,0,29,30,32,27,32,31,28,73,27,72,28,73,71,31,28,71,30,28,34,72,73,54,27,32,0,0,0,
0,0,0,32,27,31,33,33,27,27,30,31,71,28,29,32,31,27,34,34,31,32,27,30,72,54,31,0,0,0,
0,0,0,0,0,34,32,31,29,70,33,32,0,34,34,33,72,70,70,28,30,70,29,30,30,30,34,0,0,0,
0,0,0,0,0,0,0,28,30,27,73,0,0,0,0,70,28,30,34,54,33,32,34,54,27,71,28,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,54,32,32,27,31,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<layer id="3" name="Tile Layer 3" width="30" height="20" visible="0">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,14,16,16,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,50,51,22,20,43,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,21,20,38,38,19,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,21,1,3,19,22,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,40,37,6,2,39,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,36,41,41,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<layer id="4" name="Tile Layer 4" width="30" height="20" visible="0">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,77,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,78,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<layer id="1" name="Tile Layer 1" width="30" height="20">
<data encoding="csv">
88,94,102,97,116,102,96,102,117,88,116,116,118,118,117,95,117,96,115,116,115,116,115,115,97,116,115,116,96,102,
88,106,91,92,92,91,91,92,92,92,91,92,92,91,91,92,92,92,92,91,91,92,108,116,115,97,117,94,94,115,
95,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,113,88,118,95,117,116,116,95,
118,105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,88,116,94,96,95,102,102,
88,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,113,115,95,115,94,115,88,118,
94,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,108,96,96,88,116,97,102,
117,105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,108,117,115,117,94,95,
116,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,108,118,95,118,118,
88,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,108,102,115,94,
118,105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,97,118,117,
115,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,115,88,95,
97,103,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,116,96,88,
97,116,103,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,95,96,96,
88,96,97,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,97,102,88,
118,94,115,103,86,100,0,0,0,0,0,112,86,100,0,0,0,0,0,0,0,0,0,0,0,0,89,88,117,118,
95,97,96,97,118,103,85,100,0,0,112,101,88,103,86,100,0,0,0,0,0,0,0,0,0,0,87,102,94,88,
115,94,97,115,115,96,96,103,86,86,101,94,96,116,96,103,85,86,100,0,0,0,0,84,85,86,101,97,116,97,
95,88,116,96,115,116,97,97,96,115,97,117,115,102,102,97,115,118,103,85,86,85,86,101,94,115,97,118,117,115,
102,116,118,88,102,97,102,102,88,97,117,116,88,102,95,94,117,97,117,116,88,96,116,94,115,96,94,97,115,117,
88,95,96,115,94,97,117,116,96,94,94,94,116,96,88,102,97,115,94,94,117,97,116,88,88,88,96,118,118,116
</data>
</layer>
</map>

View file

@ -1,367 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.11.0" name="worldOne" class="shooter" tilewidth="62" tileheight="62" spacing="2" tilecount="64" columns="8">
<grid orientation="orthogonal" width="64" height="64"/>
<image source="shooterWorldOneAtlas64.png" width="512" height="512"/>
<tile id="0" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="1" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="2" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="3" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="4" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="5" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="6" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="7" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="8" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="9" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="10" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="11" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="12" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="13" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="14" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="15" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="16" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="17" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="18" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="19" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="20" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="21" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="22" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="23" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="24" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="25" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="26" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="27" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="28" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="29" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="30" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="31" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="32" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="33" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="34" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="35" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="36" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="37" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="38" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="39" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="40" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="41" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="42" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="43" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="44" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="45" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="46" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="47" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="48" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="49" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="50" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="51" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="52" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="53" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="54" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="55" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="56" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="flower" type="object" x="15.5" y="14" width="14" height="26.5">
<properties>
<property name="collidable" type="bool" value="false"/>
</properties>
</object>
<object id="2" name="flower" type="object" x="34.25" y="26.5" width="13.25" height="24">
<properties>
<property name="collidable" type="bool" value="false"/>
</properties>
</object>
</objectgroup>
</tile>
<tile id="57" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="flower" type="object" x="11.5" y="17.75" width="15" height="29.25">
<properties>
<property name="collidable" type="bool" value="false"/>
</properties>
</object>
<object id="2" name="flower" type="object" x="41.5" y="5.75" width="13" height="22.75">
<properties>
<property name="collidable" type="bool" value="false"/>
</properties>
</object>
</objectgroup>
</tile>
<tile id="58" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="duck" type="object" x="6.25" y="12" width="47" height="41.75">
<properties>
<property name="collidable" type="bool" value="true"/>
</properties>
</object>
</objectgroup>
</tile>
<tile id="59" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="pebbles" type="object" x="11.25" y="21.25" width="23.75" height="22.25">
<properties>
<property name="collidable" type="bool" value="false"/>
</properties>
</object>
</objectgroup>
</tile>
<tile id="60" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="rock" type="object" x="7" y="28.75" width="50.5" height="26.5">
<properties>
<property name="collidable" type="bool" value="true"/>
</properties>
</object>
</objectgroup>
</tile>
<tile id="61" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="shrub" type="object" x="6.75" y="3.75" width="50.75" height="54.75">
<properties>
<property name="collidable" type="bool" value="true"/>
</properties>
</object>
</objectgroup>
</tile>
<tile id="62" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="pebbles" type="object" x="23" y="34" width="30.5" height="22.75">
<properties>
<property name="collidable" type="bool" value="false"/>
</properties>
</object>
</objectgroup>
</tile>
<tile id="63" type="object">
<objectgroup draworder="index" id="2">
<object id="1" name="pebbles" type="object" x="33.5" y="4.25" width="24" height="28">
<properties>
<property name="collidable" type="bool" value="false"/>
</properties>
</object>
</objectgroup>
</tile>
</tileset>

View file

@ -1,570 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.11.0" name="wOne" class="shooter" tilewidth="62" tileheight="62" spacing="2" tilecount="484" columns="11">
<grid orientation="orthogonal" width="30" height="30"/>
<image source="worldOne.png" width="704" height="704"/>
<tile id="0" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="1" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="2" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="3" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="4" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="5" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="6" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="7" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="8" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="9" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="10" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="11" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="12" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="13" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="14" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="15" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="16" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="17" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="18" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="19" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="20" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="21" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="22" type="grass"/>
<tile id="23" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="24" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="25" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="26" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="27" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="28" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="29" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="30" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="31" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="32" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="33" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="34" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="35" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="36" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="37" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="38" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="39" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="40" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="41" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="42" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="43" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="44" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="45" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="46" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="47" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="48" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="49" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="50" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="51" type="grass">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="52" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="53" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="54" type="dirt"/>
<tile id="55" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="56" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="57" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="58" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="59" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="60" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="61" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="62" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="63" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="64" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="65" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="66" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="67" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="68" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="69" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="70" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="71" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="72" type="dirt">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="73" type="bush"/>
<tile id="74" type="bush"/>
<tile id="75" type="bush"/>
<tile id="76" type="bush"/>
<tile id="77" type="bush"/>
<tile id="78" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="79" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="80" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="81" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="82" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="83" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="84" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="85" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="86" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="87" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="88" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="89" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="90" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="91" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="92" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="93" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="94" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="95" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="96" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="97" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="98" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="99" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="100" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="101" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="102" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="103" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="104" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="105" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="106" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="107" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="108" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="109" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="110" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="111" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="112" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="113" type="water">
<properties>
<property name="walkable" type="bool" value="true"/>
</properties>
</tile>
<tile id="114" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="115" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="116" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="117" type="water">
<properties>
<property name="walkable" type="bool" value="false"/>
</properties>
</tile>
<tile id="118" type="water"/>
<tile id="119" type="water"/>
<tile id="120" type="water"/>
</tileset>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,14 +0,0 @@
{
"automappingRulesFile": "",
"commands": [
],
"compatibilityVersion": 1100,
"extensionsPath": "extensions",
"folders": [
"../"
],
"properties": [
],
"propertyTypes": [
]
}

View file

@ -1,104 +0,0 @@
{
"Map/SizeTest": {
"height": 4300,
"width": 2
},
"activeFile": "newmap.tmx",
"expandedProjectPaths": [
"tilesets",
".",
"C:/Users/Ethan/source/repos/YuppleMayham/Resources"
],
"fileStates": {
"": {
"scaleInDock": 1
},
":/automap-tiles.tsx": {
"scaleInDock": 1
},
"C:/Users/Ethan/Documents/yupplemayham/debugmap.tmx": {
"scale": 0.5472395833333333,
"selectedLayer": 0,
"viewCenter": {
"x": 959.3604263824117,
"y": 639.5736175882744
}
},
"C:/Users/Ethan/Documents/yupplemayham/shooterWorldOneAtlas.tsx": {
"scaleInDock": 0.5,
"scaleInEditor": 1
},
"debugmap.tmx": {
"scale": 0.75,
"selectedLayer": 2,
"viewCenter": {
"x": 1440,
"y": 872
}
},
"newmap.tmx": {
"scale": 0.5,
"selectedLayer": 1,
"viewCenter": {
"x": 930,
"y": 620
}
},
"shooterWorldOneAtlas.tsx": {
"scaleInDock": 0.5,
"scaleInEditor": 1
},
"tilesets/shooterWorldOne.tsx": {
"scaleInDock": 0.5,
"scaleInEditor": 1
},
"tilesets/shooterWorldOneAtlas.tsx": {
"scaleInDock": 0.5,
"scaleInEditor": 1
},
"tilesets/wOne.tsx": {
"scaleInDock": 0.33,
"scaleInEditor": 1
},
"tilesets/was.tsx": {
"scaleInDock": 1,
"scaleInEditor": 1
},
"tilesets/wsa.tsx": {
"dynamicWrapping": false,
"scaleInDock": 0.5,
"scaleInEditor": 1
}
},
"last.externalTilesetPath": "C:/Users/Ethan/source/repos/YuppleMayham/Resources/maps/tilesets",
"last.imagePath": "C:/Users/Ethan/source/repos/YuppleMayham/Resources/maps/tilesets",
"map.lastUsedFormat": "tmx",
"openFiles": [
"debugmap.tmx",
"tilesets/shooterWorldOne.tsx",
"newmap.tmx",
"tilesets/wOne.tsx"
],
"project": "yupple.tiled-project",
"property.type": "bool",
"recentFiles": [
"debugmap.tmx",
"tilesets/shooterWorldOne.tsx",
"tilesets/wOne.tsx",
"newmap.tmx",
"tilesets/wsa.tsx",
"tilesets/was.tsx",
"tilesets/shooterWorldOneAtlas.tsx",
"shooterWorldOneAtlas.tsx",
"C:/Users/Ethan/Documents/yupplemayham/shooterWorldOneAtlas.tsx",
"C:/Users/Ethan/Documents/yupplemayham/debugmap.tmx"
],
"tileset.lastUsedFilter": "Tiled tileset files (*.tsx *.xml)",
"tileset.lastUsedFormat": "tsx",
"tileset.margin": 0,
"tileset.spacing": 2,
"tileset.tileSize": {
"height": 62,
"width": 62
}
}

View file

@ -1,3 +0,0 @@
<monster id="monster/shooty/bighead" anim="character/tmp" weapon="gun/pistol" aggressive="true" behaviour="script/behaviour/grunt" hp="10.0"/>
<monster id="monster/shooty/clone" anim="character/player" weapon="gun/shotgun" aggressive="true" behaviour="script/behaviour/grunt" hp="15.0"/>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,19 +1,53 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<scene type="shooter" id="000" bg="backgrounds/blue_sky.png"> <scene type="shooter" id="000">
<map name="newmap"/> <map name="debugShooterMap" file="sprites/shooterWorldOneAtlas64.png" width="100" height="100" tilesize="64.0">
<tiledata>
<row data="66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,66,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,1,1,1,1,1,1,1,1,1,1,1,1,1,66,66,66,66,66"/>
<row data="66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66"/>
</tiledata>
<spriteids>
<row data="32,33,34,35,36,32,33,34,35,36,32,33,34,35,36,37,33,34,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,35,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,24,25,26,27,28,29,30,25,24,26,27,28,14,32,33,34,35,36"/>
<row data="32,33,34,35,36,32,33,34,35,36,32,33,34,35,36,37,33,34,32,33,34,35,36"/>
</spriteids>
</map>
<entities> <entities>
<player x="7" y="5" weapon="gun/shotgun"> <player x="7" y="5" weapon="machineGun">
<animation id="character/player"/> <sprite file="sprites/player3Atlas.png" framesize="64.0" directional="true"/>
</player> </player>
<entity x="10" y="3" weapon="gun/pistol"> <entity x="10" y="3" weapon="pistolGun">
<animation id="character/player"/> <sprite file="sprites/player3Atlas.png" frameSize="64.0" directional="true"/>
<script id="script/behaviour/grunt"/> <script file="scripts/grunt_behaviour.lua"/>
</entity> </entity>
<entity x="6" y="3" weapon="gun/pistol"> <entity x="6" y="3" weapon="pistolGun">
<animation id="character/tmp"/> <sprite file="sprites/player2Atlas.png" frameSize="128.0"/>
<script id="script/behaviour/grunt"/> <script file="scripts/grunt_behaviour.lua"/>
</entity>
<entity x="5" y="3" weapon="pistolGun">
<sprite file="sprites/player2Atlas.png" frameSize="128.0"/>
<script file="scripts/grunt_behaviour.lua"/>
</entity> </entity>
<entity x="5" y="3" weapon="gun/pistol" monster_id="monster/shooty/bighead"/>
</entities> </entities>
</scene> </scene>

Binary file not shown.

View file

@ -1,75 +0,0 @@
-- global vars
MoveLeft = true
-- helper functions
local function watchPosition(actor, pos)
local y = pos.y - actor.position.y
local x = pos.x - actor.position.x
local rotation = math.atan2(y, x)
actor.rotation = math.deg(rotation)
end
local function distance(a, b)
local dx = a.x - b.x
local dy = a.y - b.y
return math.sqrt(dx * dx + dy * dy)
end
-- Behaviour Functions called on AI
-- These functions are ai behaviour functions called in the game
-- The AI will be spawned in idle mode, so if you want to put the bot into patrol mode
-- It's on you to do that in this function.
function idle(actor, target)
local a = actor
local t = target
if t ~= nil then
-- print("target is at " .. target.position.x)
-- watchPosition(actor, target.position)
ai.state = AIState.Patrol
a.rotation = 180
end
a:shoot()
--print("actor is idling at " .. actor.position.x)
end
-- It is most appropriate to put any patrolling behaviour into this function of course
function patrol(actor, target)
local a = actor
local t = target
if raycaster:bresenhamRaycast(a.position, a.rotation, t.position) == true then
--target hit!
ai.state = AIState.Alert
end
if raycaster:distFromWall() < 3 then
local upOrDown = math.random(2)
if moveLeft == true then
if upOrDown == 1 then
a.rotation = 180
else
a.rotation = 270
end
moveLeft = false
else
if upOrDown == 1 then
a.rotation = 0
else
a.rotation = 90
end
moveLeft = true
end
end
a:moveForward()
end
-- the ai has found the player, this is what function is called
function alert(actor, target)
local a = actor
local t = target
if target ~= nil then
watchPosition(a, t.position)
end
if distance(a.position, t.position) > 300 then
a:moveForward()
end
a:shoot()
end

View file

@ -1,4 +0,0 @@
<!-- Shooter Scripts -->
<script id="script/behaviour/grunt" file="scripts/ai/grunt_behaviour.lua"/>
<script id="script/behaviour/scared" file="scripts/ai/scared_behaviour.lua"/>

View file

@ -0,0 +1,91 @@
-- global vars
patrolDestination = { x=500.0, y=500.0, z=0.0 }
moveLeft = true
-- helper functions
function watchPosition(actor, pos)
y = pos.y - actor.position.y
x = pos.x - actor.position.x
rotation = math.atan(y, x)
actor.rotation = math.deg(rotation)
end
function distance(a, b)
return math.sqrt((math.abs(a.x - b.x)^2) + (math.abs(a.y - b.y)^2))
end
function moveTo(actor, pos)
watchPosition(actor, pos)
if distance(actor.position, pos) < 50 then
return true
end
actor:moveForward()
return false
end
-- Behaviour Functions called on AI
-- These functions are ai behaviour functions called in the game
-- The AI will be spawned in idle mode, so if you want to put the bot into patrol mode
-- It's on you to do that in this function.
function idle(actor, target)
if target ~= nil then
-- print("target is at " .. target.position.x)
-- watchPosition(actor, target.position)
ai.state = AIState.Patrol
actor.rotation = 180
end
actor:shoot()
--print("actor is idling at " .. actor.position.x)
end
-- It is most appropriate to put any patrolling behaviour into this function of course
function patrol(actor, target)
if target ~= nil then
-- print("target is at " .. target.position.x)
end
--if moveTo(actor, patrolDestination) == true then
-- patrolDestination = { x=math.random(400.0, 750.0), y=math.random(400.0, 750.0), z=0.0 }
--end
-- performRaycast returns if true if the raycast hits the target position it also sets the getter function
-- distFromWall, at bot creation distFromWall is and infinite float value.
-- This performRaycast function is highly discourage due to slow down
--if raycaster:performRaycast(actor.position, actor.rotation, target.position) == true then
--ai.state = AIState.Alert
--end
if raycaster:bresenhamRaycast(actor.position, actor.rotation, target.position) == true then
--target hit!
ai.state = AIState.Alert
end
if raycaster:distFromWall() < 3 then
upOrDown = math.random(2)
if moveLeft == true then
if upOrDown == 1 then
actor.rotation = 180
else
actor.rotation = 270
end
moveLeft = false
else
if upOrDown == 1 then
actor.rotation = 0
else
actor.rotation = 90
end
moveLeft = true
end
end
actor:moveForward()
end
-- the ai has found the player, this is what function is called
function alert(actor, target)
if target ~= nil then
-- print("target is at " .. target.position.x)
watchPosition(actor, target.position)
end
--print("actor is alert at " .. actor.position.x)
if distance(actor.position, target.position) > 300 then
actor:moveForward()
end
actor:shoot()
end

View file

@ -1,13 +1,13 @@
-- helper functions -- helper functions
local function lookAway(actor, pos) function lookAway(actor, pos)
local y = actor.position.y - pos.y y = actor.position.y - pos.y
local x = actor.position.x - pos.x x = actor.position.x - pos.x
local rotation = math.atan(y, x) rotation = math.atan(y, x)
actor.rotation = math.deg(rotation) actor.rotation = math.deg(rotation)
end end
local function distance(a, b) function distance(a, b)
return math.sqrt((math.abs(a.x - b.x)^2) + (math.abs(a.y - b.y)^2)) return math.sqrt((math.abs(a.x - b.x)^2) + (math.abs(a.y - b.y)^2))
end end

View file

@ -1,3 +0,0 @@
<!-- Ranged weapon scripts -->
<script id="script/weapon/shotgun" file="scripts/weapons/shotgun_script.lua"/>

View file

@ -1,21 +0,0 @@
function length(vec)
return math.sqrt(vec.x^2 + vec.y^2)
end
-- How bullets are produced make sure to generate bullet data, then pass it through createBullet
function onShoot()
rot = weapon.wielder.rotation
data = weapon:genBulletData()
for i=-20, 20, 10 do
spread = i
data.direction.x = math.cos(math.rad(rot + spread))
data.direction.y = math.sin(math.rad(rot + spread))
weapon:createBullet(data)
end
end
-- How the bullet, target or wielder respond when the bullet hits a target.
function onHit(target, bullet, normal)
target.physics.rigidBody:applyForce(normal, 5000.0);
end

View file

@ -7,5 +7,5 @@ uniform sampler2D sprite;
void main() void main()
{ {
FragColor = texture(sprite, texCoord); FragColor = texture(sprite, texCoord) * vec4(1.0, 0.8, 1.0, 1.0);
} }

View file

@ -1,18 +1,13 @@
#version 330 core #version 330 core
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord; layout (location = 1) in vec2 aTexCoord;
layout (std140) uniform Matrices
{
mat4 projection;
mat4 view;
};
out vec2 texCoord; out vec2 texCoord;
uniform mat4 model; uniform mat4 MVP;
void main() void main()
{ {
texCoord = aTexCoord; texCoord = aTexCoord;
gl_Position = projection * view * model * vec4(aPos, 1.0); gl_Position = MVP * vec4(aPos, 1.0);
} }

View file

@ -1,11 +0,0 @@
#version 330 core
in vec2 texCoord;
out vec4 FragColor;
uniform sampler2D sprite;
void main()
{
FragColor = texture(sprite, texCoord) * vec4(1.0, 0.8, 1.0, 1.0);
}

View file

@ -1,17 +0,0 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
layout (std140) uniform Matrices
{
mat4 projection;
mat4 view;
};
out vec2 texCoord;
void main()
{
texCoord = aTexCoord;
gl_Position = projection * vec4(aPos.xyz, 1.0);
}

View file

@ -1,21 +1,16 @@
#version 330 core #version 330 core
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord; layout (location = 1) in vec2 aTexCoord;
layout (std140) uniform Matrices
{
mat4 projection;
mat4 view;
};
out vec2 texCoord; out vec2 texCoord;
uniform mat4 model; uniform mat4 MVP;
uniform bool flip; uniform bool flip;
void main() void main()
{ {
texCoord = aTexCoord; texCoord = aTexCoord;
gl_Position = projection * view * model * vec4(aPos, 1.0); gl_Position = MVP * vec4(aPos, 1.0);
if (flip) if (flip)
{ {
texCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y); texCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y);

View file

@ -1,20 +1,15 @@
#version 330 core #version 330 core
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexPos; layout (location = 1) in vec2 aTexPos;
layout (std140) uniform Matrices
{
mat4 projection;
mat4 view;
};
out vec3 pos; out vec3 pos;
out vec2 texPos; out vec2 texPos;
uniform mat4 model; uniform mat4 MVP;
void main() void main()
{ {
pos = aPos; pos = aPos;
texPos = aTexPos; texPos = aTexPos;
gl_Position = projection * view * model * vec4(aPos, 1.0); gl_Position = MVP * vec4(aPos, 1.0);
} }

View file

@ -1,67 +0,0 @@
#version 330 core
layout (std140) uniform uPostProcess {
int curTime;
int dt;
vec3 colorMod;
float blurIntensity;
float blurDuration;
float shakeIntensity;
float shakeDuration;
int effects;
vec3 colorMod_hud;
float blurIntensity_hud;
float blurDuration_hud;
float shakeIntensity_hud;
float shakeDuration_hud;
int effects_hud;
};
out vec4 FragColor;
in vec2 texCoord;
uniform int edge_kernel[9];
uniform float blur_kernel[9];
const float offset = 1.0 / 300.0;
uniform sampler2D screenTexture;
uniform bool worldOrHud;
void main()
{
if (worldOrHud == false)
{
if ((effects & 1) != 0) // BLUR
{
vec4 result = vec4(0.0);
vec2 offsets[9] = vec2[](
vec2(-offset, offset), // top-left
vec2( 0.0f, offset), // top-center
vec2( offset, offset), // top-right
vec2(-offset, 0.0f), // center-left
vec2( 0.0f, 0.0f), // center-center
vec2( offset, 0.0f), // center-right
vec2(-offset, -offset), // bottom-left
vec2( 0.0f, -offset), // bottom-center
vec2( offset, -offset) // bottom-right
);
vec4 sampleTex[9];
for (int i = 0; i < 9; i++)
{
sampleTex[i] = vec4(texture(screenTexture, texCoord.st + offsets[i]));
}
for (int i = 0; i < 9; i++)
result += sampleTex[i] * blur_kernel[i];
//FragColor = mix(texture(screenTexture, texCoord), vec4(1.0, 0.8, 0.0, 1.0), 0.3 - (1.0 / shakeTime) * shakeIntensity);
//FragColor = vec4(1.0 / blurDuration, 1.0, 0.0, 1.0);
FragColor = vec4(result);
}
else
{
//FragColor = vec4(1.0, 0.0, 1.0 / blurDuration, 1.0);
FragColor = texture(screenTexture, texCoord);
}
}
}

View file

@ -1,57 +0,0 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
layout (std140) uniform uPostProcess {
int curTime;
int dt;
vec3 colorMod;
float blurIntensity;
float blurDuration;
float shakeIntensity;
float shakeDuration;
int effects;
vec3 colorMod_hud;
float blurIntensity_hud;
float blurDuration_hud;
float shakeIntensity_hud;
float shakeDuration_hud;
int effects_hud;
};
/*
BLUR: 0001
SHAKE: 0010
NEGATIVE: 0100
COLORMOD: 1000
GREYSCALE:1 0000
*/
uniform bool worldOrHud;
out vec2 texCoord;
void main()
{
texCoord = aTexCoord;
gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
if (worldOrHud == false)
{
// SHAKE
if ((effects & (1 << 1)) != 0)
{
gl_Position.x += cos(dt * 10) * shakeIntensity;
gl_Position.y += cos(dt * 15) * shakeIntensity;
}
}
else
{
//SHAKE
if ((effects_hud & (1 << 1)) != 0)
{
gl_Position.x += cos(dt - 90) * shakeIntensity_hud;
gl_Position.y += cos(dt - 80) * shakeIntensity_hud;
}
}
}

View file

@ -1,19 +1,11 @@
#version 330 core #version 330 core
out vec4 FragColor; out vec4 FragColor;
in vec2 texCoord; in vec2 texCoord;
flat in int textureIndex;
uniform sampler2DArray tileTexture; uniform sampler2D tileTexture;
void main() void main()
{ {
if (texCoord.x == 0.0 && texCoord.y == 0.0) FragColor = texture(tileTexture, texCoord);
{
FragColor = vec4(0.0, 0.0, 0.0, 0.0);
}
else
{
FragColor = texture(tileTexture, vec3(texCoord.xy, textureIndex));
}
//FragColor = vec4(mod(tileindex / float(tilesperrow), 1.0), mod(tileindex / float(tilesperrow), 1.0), 0.0, 1.0); //FragColor = vec4(mod(tileindex / float(tilesperrow), 1.0), mod(tileindex / float(tilesperrow), 1.0), 0.0, 1.0);
} }

View file

@ -1,49 +1,27 @@
#version 330 core #version 330 core
layout (location = 0) in vec3 aPos; layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord; layout (location = 1) in vec2 aTexCoord;
layout (location = 2) in int aTileIndex; layout (location = 2) in int tileIndex;
layout (location = 3) in int aTextureIndex; layout (location = 3) in mat4 aModel;
layout (location = 4) in int aTilesPerRow;
layout (location = 5) in int aStartIndex;
layout (location = 6) in vec2 aOriginalSize;
layout (location = 7) in mat4 aModel;
layout (std140) uniform Matrices
{
mat4 projection;
mat4 view;
};
uniform vec2 uCanvasSize; uniform int tilesPerRow;
uniform mat4 proj;
uniform mat4 view;
out vec2 texCoord; out vec2 texCoord;
flat out int textureIndex;
void main() void main()
{ {
int tilesPerRow = aTilesPerRow; float tileSize = 1.0 / float(tilesPerRow);
float tileSize = 1.0 / aTilesPerRow;
// Slightly stretch the vertices to cover slight gaps
vec2 expansion = normalize(aPos.xy) * 0.001 * (1.0 / aTilesPerRow);
vec2 adjusted = aPos.xy + expansion;
gl_Position = projection * view * aModel * vec4(adjusted, aPos.z, 1.0); gl_Position = proj * view * aModel * vec4(aPos, 1.0);
textureIndex = aTextureIndex;
if (aTileIndex != 0)
{
vec2 scale = vec2(aOriginalSize.x / uCanvasSize.x, aOriginalSize.y / uCanvasSize.y);
int index = aTileIndex - aStartIndex; int row = tileIndex / tilesPerRow;
int col = tileIndex % tilesPerRow;
int row = index / tilesPerRow; float offsetX = float(col) * tileSize;
int col = index % tilesPerRow; float offsetY = float(row) * tileSize;
texCoord.x = (aTexCoord.x + col) * tileSize; texCoord.x = (aTexCoord.x + col) * tileSize;
texCoord.y = (aTexCoord.y + row) * tileSize; texCoord.y = (aTexCoord.y + row) * tileSize;
texCoord = texCoord * scale;
}
else
{
texCoord.x = 0.0;
texCoord.y = 0.0;
}
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Shotgun Sounds -->
<sound id="gun/shotgun/shoot" spatial="true" path="sounds/gun/big_boom.ogg"/>
<!-- Pistol Sounds -->
<sound id="gun/pistol/shoot" spatial="true" path="sounds/gun/small_pew.ogg"/>
<!-- Machine Gun Sounds -->
<sound id="gun/machine/shoot" spatial="true" path="sounds/gun/mach_pew.ogg"/>
<!-- Generic Sounds -->
<sound id="gun/generic/shoot" spatial="true" path="sounds/gun/small_pew.ogg"/>
<sound id="gun/generic/reload" spatial="true" path="sounds/gun/reload.ogg"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<weapons>
<weapon name="bubbleGun" fireSpeed="100.0">
<bullet sprite="sprites/bubbleoAtlas64.png" animated="true" frameSize="64.0">
<spread>60</spread>
<speed>20.0</speed>
<drop>250.0</drop>
<size x="50.0" y="50.0"/>
<modifier min="0.5" max="1.0"/>
</bullet>
</weapon>
<weapon name="machineGun" fireSpeed="50.0">
<sprite file="sprites/machineGunAtlas256.png" animated="true" frameSize="256.0">
<size x="55.0" y="55.0"/>
<offset x="-30.0" y="0.0"/>
</sprite>
<bullet sprite="sprites/bullet.png" animated="false" frameSize="64.0">
<spread>20</spread>
<speed>60.0</speed>
<drop>950.0</drop>
<size x="10.0" y="10.0"/>
<modifier min="1.0" max="1.0"/>
</bullet>
</weapon>
<weapon name="pistolGun" fireSpeed="750.0">
<sprite file="sprites/pistolAtlas256.png" animated="true" frameSize="256.0">
<size x="30.0" y="30.0"/>
<offset x="0.0" y="0.0"/>
</sprite>
<bullet sprite="sprites/bullet.png" animated="false" frameSize="64.0">
<spread>5.0</spread>
<speed>50.0</speed>
<drop>500.0</drop>
<size x="25.0" y="25.0"/>
<modifier min="1.0" max="1.0"/>
</bullet>
</weapon>
</weapons>

View file

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<weapons>
<weapon id="gun/machine" fireSpeed="100.0" maxAmmo="40000" clipSize="1000">
<bullet anim="obj/bubble">
<spread>60</spread>
<speed>20.0</speed>
<drop>250.0</drop>
<size x="50.0" y="50.0"/>
<modifier min="0.5" max="1.0"/>
</bullet>
</weapon>
<weapon id="gun/shotgun" fireSpeed="1750.0" maxAmmo="64" clipSize="4">
<script id="script/weapon/shotgun"/>
<animation>
<size x="55.0" y="55.0"/>
<offset x="-30.0" y="0.0"/>
</animation>
<bullet sprite="sprites/bullet.png">
<spread>50</spread>
<speed>60.0</speed>
<drop>550.0</drop>
<size x="10.0" y="10.0"/>
<modifier min="0.3" max="1.0"/>
</bullet>
</weapon>
<weapon id="gun/machine" fireSpeed="50.0" maxAmmo="512" clipSize="64">
<animation>
<size x="55.0" y="55.0"/>
<offset x="-30.0" y="0.0"/>
</animation>
<bullet sprite="sprites/bullet.png">
<spread>20</spread>
<speed>60.0</speed>
<drop>950.0</drop>
<size x="10.0" y="10.0"/>
<modifier min="1.0" max="1.0"/>
</bullet>
</weapon>
<weapon id="gun/pistol" fireSpeed="750.0" maxAmmo="512" clipSize="21">
<animation>
<size x="55.0" y="55.0"/>
<offset x="-30.0" y="0.0"/>
</animation>
<bullet sprite="sprites/bullet.png">
<spread>5.0</spread>
<speed>50.0</speed>
<drop>500.0</drop>
<size x="25.0" y="25.0"/>
<modifier min="1.0" max="1.0"/>
</bullet>
</weapon>
</weapons>

View file

@ -2,109 +2,33 @@
# project specific logic here. # project specific logic here.
# #
find_package(SDL2 2.30.2 REQUIRED) find_package(SDL2 REQUIRED)
find_package(SDL2_image 2.8.2 REQUIRED) find_package(SDL2_IMAGE REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LuaJIT REQUIRED IMPORTED_TARGET GLOBAL luajit)
find_package(sol2 REQUIRED)
find_package(tinyxml2 REQUIRED)
find_package(Freetype REQUIRED)
find_package(OpenAL REQUIRED)
find_package(glm CONFIG REQUIRED)
include_directories(SYSTEM "c:/sdks/glad/include")
include_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/include")
include_directories(SYSTEM "c:/sdks/glm")
include_directories(SYSTEM "C:/sdks/sol2-3.3.0/single/single/include")
include_directories(SYSTEM "c:/sdks/lua-5.4.6/include")
include_directories(SYSTEM "C:/sdks/freetype-2.13.2/include")
link_directories(SYSTEM "C:/sdks/freetype-2.13.2/objs")
link_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/lib")
link_directories(SYSTEM "c:/sdks/lua-5.4.6/lib")
#include_directories(SYSTEM "c:/sdks/glad/include") include_directories(${PROJECT_SOURCE_DIR}/YupplyMayham/gameplay)
#include_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/debug/include") include_directories(${PROJECT_SOURCE_DIR}/YupplyMayham/graphics)
#include_directories(SYSTEM "c:/sdks/glm") include_directories(${PROJECT_SOURCE_DIR}/YupplyMayham/gameplay/weapons)
#include_directories(SYSTEM "C:/sdks/sol2-3.3.0/single/single/include") include_directories(${PROJECT_SOURCE_DIR}/YupplyMayham)
#include_directories(SYSTEM "c:/sdks/lua-5.4.6/include")
#include_directories(SYSTEM "C:/sdks/freetype-2.13.2/include")
#link_directories(SYSTEM "C:/sdks/freetype-2.13.2/objs")
#if (CMAKE_BUILD_TYPE STREQUAL "Debug")
# link_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/debug/lib")
#else()
# link_directories(SYSTEM "c:/sdks/tinyxml2-10.0.0/release/lib")
#endif()
#link_directories(SYSTEM "c:/sdks/lua-5.4.6/lib")
#include_directories("${PROJECT_SOURCE_DIR}/YuppleMayham/include")
# Add source to this project's executable. # Add source to this project's executable.
add_executable (YuppleMayham add_executable (YuppleMayham "src/main.cpp" "c:/sdks/glad/src/glad.c" "graphics/glwindow.h" "src/graphics/sprite.cpp" "src/graphics/mesh.cpp" "src/gameplay/entity.cpp" "src/gameplay/gameactor.cpp" "src/graphics/shader.cpp" "src/util.cpp" "gameplay/camera.h" "src/gameplay/camera.cpp" "src/utility/command.cpp" "src/gameplay/input.cpp" "gameplay/mousestate.h" "src/gameplay/weapons/bullet.cpp" "gameplay/weapons/bulletmanager.h" "src/gameplay/weapons/bulletmanager.cpp" "src/gameplay/scene.cpp" "gameplay/scene.h" "graphics/tile.h" "graphics/texture.h" "src/graphics/texture.cpp" "src/graphics/tile.cpp" "graphics/tiletype.h" "utility/resourcemanager.h" "src/utility/resourcemanager.cpp" "utility/xmlloader.h" "src/utility/xmlloader.cpp" "gameplay/game.h" "src/gameplay/game.cpp" "src/graphics/instancedraw.cpp" "gameplay/map.h" "src/gameplay/map.cpp" "src/gameplay/weapons/weapon.cpp" "gameplay/physics.h" "src/gameplay/physics.cpp" "utility/events.h" "utility/debugdraw.h" "src/utility/debugdraw.cpp" "utility/script.h" "src/utility/script.cpp" "gameplay/ai.h" "utility/raycaster.h" "src/gameplay/ai.cpp" "utility/ftfont.h" "src/utility/ftfont.cpp" "utility/direction.h")
"src/main.cpp"
"src/thirdparty/glad.c"
"src/sound/engine.cpp"
"src/sound/audiostream.cpp"
"src/sound/soundeffect.cpp"
"src/sound/soundmanager.cpp"
"include/thirdparty/stb_vorbis.c"
"src/utility/data/font_data.c"
"src/utility/ftfont.cpp"
"src/graphics/sprite.cpp"
"src/graphics/mesh.cpp"
"src/graphics/glwindow.cpp"
"src/gameplay/entity.cpp"
"src/gameplay/gameactor.cpp"
"src/graphics/shader.cpp"
"src/util.cpp"
"src/gameplay/camera.cpp"
"src/utility/command.cpp"
"src/gameplay/input.cpp"
"src/gameplay/weapons/bullet.cpp"
"src/gameplay/weapons/bulletmanager.cpp"
"src/gameplay/scene.cpp"
"src/graphics/texture.cpp"
"src/graphics/background.cpp"
"src/utility/resourcemanager.cpp"
"src/utility/xmlloader.cpp"
"src/gameplay/game.cpp"
"src/graphics/instancedraw.cpp"
"src/gameplay/map.cpp"
"src/gameplay/weapons/weapon.cpp"
"src/gameplay/physics.cpp"
"src/utility/debugdraw.cpp"
"src/utility/script.cpp"
"src/gameplay/ai.cpp"
"include/graphics/glwindow.h"
"include/gameplay/camera.h"
"include/utility/mousestate.h"
"include/gameplay/weapons/bulletmanager.h"
"include/gameplay/scene.h"
"include/graphics/texture.h"
"src/graphics/quad.cpp"
"include/utility/resourcemanager.h"
"include/utility/xmlloader.h"
"include/gameplay/game.h"
"include/gameplay/map.h"
"include/gameplay/physics.h"
"include/utility/events.h"
"include/utility/debugdraw.h"
"include/utility/script.h"
"include/gameplay/ai.h"
"include/utility/raycaster.h"
"include/utility/ftfont.h"
"include/utility/direction.h"
"include/graphics/animation.h"
"src/graphics/animation.cpp"
"include/utility/logger.h"
"src/utility/logger.cpp"
"include/graphics/renderer.h"
"src/graphics/renderer.cpp"
"src/graphics/postprocess.cpp"
)
add_custom_command(TARGET YuppleMayham PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Resources/ $<TARGET_FILE_DIR:YuppleMayham>) add_custom_command(TARGET YuppleMayham PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Resources/ $<TARGET_FILE_DIR:YuppleMayham>)
if (CMAKE_VERSION VERSION_GREATER 3.12) if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET YuppleMayham PROPERTY CXX_STANDARD 20) set_property(TARGET YuppleMayham PROPERTY CXX_STANDARD 20)
message("this is freetype include dirs: ${FREETYPE_INCLUDE_DIR_ft2build}")
endif() endif()
target_include_directories(YuppleMayham PRIVATE "${PROJECT_SOURCE_DIR}/YuppleMayham/include" ${LuaJIT_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIR_ft2build}) target_link_libraries(YuppleMayham SDL2::SDL2main SDL2::SDL2 SDL2_image::SDL2_image tinyxml2 lua_static freetype)
target_link_libraries(YuppleMayham SDL2::SDL2main SDL2::SDL2 SDL2_image::SDL2_image openal glm::glm tinyxml2 freetype ${LuaJIT_LINK_LIBRARIES})
# TODO: Add tests and install targets if needed. # TODO: Add tests and install targets if needed.

View file

@ -0,0 +1,38 @@
#ifndef _H_AI_H
#define _H_AI_H
#include <memory>
#include <string>
class GameActor;
class Raycaster;
class Script;
enum class AIState {
Idle,
Alert,
Patrol
};
class AI {
public:
AI(const std::shared_ptr<GameActor>& actor, const std::shared_ptr<Raycaster>& raycaster);
void update();
void setTarget(const std::shared_ptr<GameActor>& target) { this->target = target; }
void attachBehaviourScript(const std::shared_ptr<Script>& behaviour);
AIState getState() const { return state; }
void setState(AIState state) { this->state = state; }
~AI() {}
private:
AIState state;
std::shared_ptr<Raycaster> raycaster;
std::shared_ptr<Script> behaviour;
std::shared_ptr<GameActor> actor;
std::shared_ptr<GameActor> target;
};
#endif

View file

@ -0,0 +1,44 @@
#ifndef _H_CAMERA_H
#define _H_CAMERA_H
#include "entity.h"
class Camera
{
public:
Camera(float viewPortW, float viewPortH) :
position(glm::vec3(0.0f, 0.0f, 1.0f)),
front(glm::vec3(0.0f, 0.0f, -1.0f)),
up(glm::vec3(0.0f, 1.0f, 0.0f)),
viewPortW(viewPortW),
viewPortH(viewPortH)
{};
void setPosition(const glm::vec3& position) { this->position = position; }
const Entity* getTarget() const { return target; }
const glm::vec3 getCenterPos() const { return glm::vec3(position.x + (viewPortW / 2.f), position.y + (viewPortH / 2.f), 0.0f); }
void setTarget(Entity* target) { this->target = target; }
void unsetTarget() { target = nullptr; }
bool isTargeting() { return (target != nullptr); }
void update(float deltaTime);
const glm::vec3 worldToLocal(const glm::vec3& worldCoordinates) const;
glm::mat4 getViewMatrix();
glm::mat4 getProjectionMatrix();
const glm::vec3 getPosition() const { return position; }
private:
Entity* target = nullptr;
glm::vec3 position;
glm::vec3 front;
glm::vec3 up;
float viewPortW, viewPortH;
float speed = 300.0f;
};
#endif // _H_CAMERA_H

View file

@ -4,25 +4,21 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
#include <SDL_timer.h>
#include "graphics/renderer.h" #include "../graphics/shader.h"
#include "util.h"
class Camera; class Camera;
struct PhysicsComponent; struct PhysicsComponent;
// TODO: Allow speed to be changed and add speed as creation value in XML File!
// TODO: Create Entity System that loads entity types and creates them in scene according to name. class Entity
class Entity : public Drawable
{ {
public: public:
Entity(unsigned shaderID) : Entity(const std::shared_ptr<Shader>& shader) :
shader(shader),
position(glm::vec3(0.0f)), position(glm::vec3(0.0f)),
scale(glm::vec3(1.0f)), scale(glm::vec3(1.0f)),
rotation(0.0f), rotation(0.0f),
speed(20.0f), speed(5.0f) {};
entityid(SDL_GetTicks())
{ this->shaderID = shaderID; };
virtual ~Entity() {}; virtual ~Entity() {};
void setPosition(const glm::vec3& position); void setPosition(const glm::vec3& position);
@ -40,16 +36,13 @@ public:
const float getRotation() const { return this->rotation; } const float getRotation() const { return this->rotation; }
const bool isFlipped() const { return flipped; } const bool isFlipped() const { return flipped; }
const glm::vec2 getFacingDir() const { return glm::vec2(cos(glm::radians(rotation)), sin(glm::radians(rotation))); } const glm::vec2 getFacingDir() const { return glm::vec2(cos(glm::radians(rotation)), sin(glm::radians(rotation))); }
const glm::vec3 getCenter() const { return glm::vec3(position.x, position.y, 0.0f); } const glm::vec3 getCenter() const { return glm::vec3(position.x + (0.5f * scale.x), position.y + (0.5f * scale.y), 0.0f); }
//const glm::vec3 getCenter() const { return glm::vec3(position.x + (0.5f * scale.x), position.y + (0.5f * scale.y), 0.0f); }
const bool getIsMoving() const { return isMoving; } const bool getIsMoving() const { return isMoving; }
const int getEntityID() const { return entityid; }
const std::shared_ptr<PhysicsComponent> getPhysicsComponent() const { return physics; } const std::shared_ptr<PhysicsComponent> getPhysicsComponent() const { return physics; }
const unsigned getShaderID() const { return shaderID; }
// TODO: right now there is no default behavior, but eventually the Entity class will be expanded to handle physics // TODO: right now there is no default behavior, but eventually the Entity class will be expanded to handle physics
virtual void update(double deltaTime) = 0; virtual void update(float deltaTime) = 0;
virtual void draw() = 0; virtual void render(const std::shared_ptr<Camera>& camera) = 0;
protected: protected:
glm::vec3 localPosition; glm::vec3 localPosition;
@ -59,19 +52,17 @@ protected:
float rotation; float rotation;
float speed; float speed;
int entityid;
// Should consider move to using unique pointers for this.
std::shared_ptr<PhysicsComponent> physics; std::shared_ptr<PhysicsComponent> physics;
bool isMoving = false; bool isMoving = false;
bool wasMoving = false;
bool isRotatable = true; bool isRotatable = true;
bool flipped = false; bool flipped = false;
glm::mat4 modelMatrix; glm::mat4 modelMatrix;
void updateModelMatrix(); void updateModelMatrix();
std::shared_ptr<Shader> shader;
}; };

View file

@ -0,0 +1,51 @@
#ifndef _H_GAME_H
#define _H_GAME_H
#include <memory>
#include <SDL_events.h>
class InputHandler;
class Scene;
class Text;
class ResourceManager;
class GLWindow;
enum {
GAME_QUITTING = 0,
GAME_RUNNING = 1,
GAME_MENU = 2,
GAME_PLAYING = 4
};
class Game
{
public:
Game() {}
bool init();
bool loadDebugScene();
void handleInput(SDL_Event& e);
void update(float deltaTime);
void render();
const unsigned getGameState() const { return game_state; }
const unsigned getWindowWidth() const;
const unsigned getWindowHeight() const;
void quit() { game_state = GAME_QUITTING; }
private:
unsigned game_state = GAME_QUITTING;
std::shared_ptr<GLWindow> window;
std::shared_ptr<Scene> currentScene;
std::shared_ptr<InputHandler> inputHandler;
std::shared_ptr<ResourceManager> resourceManager;
std::shared_ptr<Text> textHandler;
};
#endif

View file

@ -0,0 +1,52 @@
#ifndef _H_GAMEACTOR_H
#define _H_GAMEACTOR_H
#include <unordered_map>
#include <SDL_timer.h>
#include "entity.h"
#include "mousestate.h"
class Component;
class AI;
class Weapon;
class EventManager;
class GameActor : public Entity
{
public:
GameActor(const std::shared_ptr<Shader>& shader) : Entity(shader) { actorid = SDL_GetTicks(); }
~GameActor();
void addComponent(std::shared_ptr<Component> component);
void equipWeapon(std::shared_ptr<Weapon> weapon);
void attachEventManager(std::shared_ptr<EventManager> eventManager);
void update(float deltaTime) override;
void render(const std::shared_ptr<Camera>& camera) override;
const std::shared_ptr<Weapon>& getHeldWeapon() const;
const int getActorID() const { return actorid; }
void setRotation(const float& rotation) override;
void moveUp();
void moveDown();
void moveLeft();
void moveRight();
// Top down shooter controls, mostly for the player to use in top down shooting sections
void moveForward();
void moveBackward();
void strafeLeft();
void strafeRight();
void fireWeapon();
void followMouse(const MouseState&);
private:
int actorid;
std::vector<std::shared_ptr<Component>> components;
std::shared_ptr<AI> ai;
std::shared_ptr<Weapon> currentWeapon = nullptr;
std::shared_ptr<EventManager> eventManager;
};
#endif //_H_GAMEACTOR_H

View file

@ -1,13 +1,11 @@
#ifndef _H_INPUT_H #ifndef _H_INPUT_H
#define _H_INPUT_H #define _H_INPUT_H
#include "utility/logger.h"
#include <SDL_mouse.h>
#include <unordered_map> #include <unordered_map>
#include <SDL_keycode.h> #include <SDL_keycode.h>
#include <SDL_events.h> #include <SDL_events.h>
#include "utility/mousestate.h" #include "mousestate.h"
class Command; class Command;
class MouseCommand; class MouseCommand;
@ -17,8 +15,7 @@ enum {
MOUSE_BUTTON_LEFT = 1, MOUSE_BUTTON_LEFT = 1,
MOUSE_BUTTON_RIGHT = 2, MOUSE_BUTTON_RIGHT = 2,
MOUSE_BUTTON_MIDDLE = 4, MOUSE_BUTTON_MIDDLE = 4,
MOUSE_MOTION = 8, MOUSE_MOTION = 8
MOUSE_SCROLL = 16
}; };
class Keyboard class Keyboard
@ -47,9 +44,8 @@ protected:
mouseButtons[MOUSE_BUTTON_LEFT] = true; mouseButtons[MOUSE_BUTTON_LEFT] = true;
if (e.type == SDL_MOUSEBUTTONUP) if (e.type == SDL_MOUSEBUTTONUP)
mouseButtons[MOUSE_BUTTON_LEFT] = false; mouseButtons[MOUSE_BUTTON_LEFT] = false;
if (e.type == SDL_MOUSEWHEEL) if (e.type == SDL_MOUSEMOTION)
mouse_state.scroll = e.wheel.preciseY; {
if (e.type == SDL_MOUSEMOTION) {
mouse_state.x = static_cast<float>(e.motion.x); mouse_state.x = static_cast<float>(e.motion.x);
mouse_state.y = static_cast<float>(e.motion.y); mouse_state.y = static_cast<float>(e.motion.y);
} }
@ -62,12 +58,12 @@ class InputHandler : public Keyboard, public Mouse
{ {
private: private:
struct CommandWithDelay{ struct CommandWithDelay{
std::unique_ptr<Command> cmd; Command* cmd;
Uint32 lastExecution; Uint32 lastExecution;
Uint32 delay; Uint32 delay;
}; };
struct MouseCommandWithDelay{ struct MouseCommandWithDelay{
std::unique_ptr<MouseCommand> cmd; MouseCommand* cmd;
Uint32 lastExecution; Uint32 lastExecution;
Uint32 delay; Uint32 delay;
}; };
@ -80,31 +76,23 @@ public:
this->actor = actor; this->actor = actor;
} }
void bindKeyCommand(SDL_Keycode key, Uint32 delay, std::unique_ptr<Command> command) { void bindKeyCommand(SDL_Keycode key, Uint32 delay, Command* command) {
keyCommands[key] = { std::move(command), 0, delay }; keyCommands[key] = { command, 0, delay };
} }
void bindMouseCommand(Uint8 mouse, Uint32 delay, std::unique_ptr<MouseCommand> command) { void bindMouseCommand(Uint8 mouse, Uint32 delay, MouseCommand* command) {
mouseCommands[mouse] = { std::move(command), 0, delay }; mouseCommands[mouse] = { command, 0, delay };
} }
void bindMouseMotion(std::unique_ptr<MouseCommand> command) { void bindMouseMotion(MouseCommand* command) {
mouseMotionCommand = std::move(command); mouseMotionCommand = command;
}
void bindMouseScroll(std::unique_ptr<MouseCommand> command) {
mouseScrollCommand = std::move(command);
} }
void handleInput(); void handleInput();
void executeCommands();
~InputHandler();
private: private:
GameActor* actor = nullptr; GameActor* actor = nullptr;
// final int is delay
std::unordered_map<SDL_Keycode, CommandWithDelay> keyCommands; std::unordered_map<SDL_Keycode, CommandWithDelay> keyCommands;
std::unordered_map<Uint8, MouseCommandWithDelay> mouseCommands; std::unordered_map<Uint8, MouseCommandWithDelay> mouseCommands;
std::vector<Command*> commandQueue; MouseCommand* mouseMotionCommand = nullptr;
std::vector<MouseCommand*> mouseQueue;
std::unique_ptr<MouseCommand> mouseMotionCommand = nullptr;
std::unique_ptr<MouseCommand> mouseScrollCommand = nullptr;
}; };
#endif // _H_INPUT_H #endif // _H_INPUT_H

View file

@ -0,0 +1,38 @@
#ifndef _H_MAP_H
#define _H_MAP_H
#include <vector>
#include <memory>
#include "../graphics/instancedraw.h"
//class TileTextureInstance;
class Shader;
class Camera;
struct MapData;
//struct InstanceData;
struct Tile;
class Map
{
public:
Map(const std::shared_ptr<MapData>& mapData, const std::shared_ptr<Shader>& shader);
const std::vector<std::vector<int>> getCollisionMap() const { return collisionMap; }
void render(const std::shared_ptr<Camera>& camera);
private:
void loadMap();
void createCollisionMap();
const std::shared_ptr<MapData> mapData;
std::shared_ptr<TileTextureInstance> instanceHandle;
std::shared_ptr<Shader> shader;
std::vector<std::vector<std::shared_ptr<Tile>>> tileIds;
std::vector<std::vector<int>> collisionMap;
std::vector<InstanceData> tileData;
};
#endif

View file

@ -4,8 +4,6 @@
struct MouseState { struct MouseState {
float x = 0.0f; float x = 0.0f;
float y = 0.0f; float y = 0.0f;
float scroll = 0.0f;
}; };
#endif #endif

View file

@ -9,34 +9,31 @@ class EventManager;
struct PhysicsComponent { struct PhysicsComponent {
bool isBullet = false; bool isBullet = false;
// This ID holds the ID of the gameactor that owns this object, that being themselves or a bullet.
unsigned int ID = 0; // If the ID stays 0 then that object has no owner and will be uncollidable
struct RigidBody { struct RigidBody {
glm::vec2 position; glm::vec3 position;
glm::vec2 velocity = glm::vec2(0.f); glm::vec3 velocity;
glm::vec2 acceleration = glm::vec2(0.f); glm::vec3 acceleration;
float elasticity = 0.7f; float elasticity = 0.7f;
float mass = 1.0f; float mass = 1.0f;
void applyForce(glm::vec2 dir, float mag) { void applyForce(glm::vec3 dir, float mag) {
acceleration += ((dir * mag) / mass); acceleration += ((dir * mag) / mass);
} }
}rigidBody; }rigidBody;
struct Collider { struct Collider {
enum class Shape { Square, Circle } shape = Shape::Circle; enum class Shape { Square, Circle } shape = Shape::Circle;
glm::vec2 offset = glm::vec2(0.f); glm::vec3 offset = glm::vec3(0.f);
glm::vec2 dimensions; glm::vec3 dimensions;
}collider; }collider;
}; };
class PhysicsComponentFactory { class PhysicsComponentFactory {
public: public:
static PhysicsComponent makeBullet(const unsigned int ID, const glm::vec3& pos, float mass, float radius) { static PhysicsComponent makeBullet(const glm::vec3& pos, float mass, float radius) {
PhysicsComponent p; PhysicsComponent p;
p.ID = ID;
p.rigidBody.position = pos; p.rigidBody.position = pos;
p.rigidBody.mass = mass; p.rigidBody.mass = mass;
p.collider = { PhysicsComponent::Collider::Shape::Circle, glm::vec2(0.f, 0.f), glm::vec2(radius) }; p.collider = { PhysicsComponent::Collider::Shape::Circle, glm::vec3(radius, radius, 0.f), glm::vec3(radius) };
p.isBullet = true; p.isBullet = true;
return p; return p;
} }
@ -46,22 +43,20 @@ class PhysicsEngine {
public: public:
PhysicsEngine() {} PhysicsEngine() {}
using CollisionPair = std::pair<PhysicsComponent*, PhysicsComponent*>;
void hookEventManager(const std::shared_ptr<EventManager>& eventManager); void hookEventManager(const std::shared_ptr<EventManager>& eventManager);
std::shared_ptr<PhysicsComponent> createObject(const unsigned int ID, const glm::vec3& pos, float mass, PhysicsComponent::Collider::Shape shape, glm::vec3 dimensions, glm::vec3 offset = glm::vec3(0.f)); std::shared_ptr<PhysicsComponent> createObject(const glm::vec3& pos, float mass, PhysicsComponent::Collider::Shape shape, glm::vec3 dimensions, glm::vec3 offset = glm::vec3(0.f));
void loadCollisionMap(const std::vector<std::vector<int>>&, float tileSize); void loadCollisionMap(const std::vector<std::vector<int>>&, float tileSize);
void addObject(const std::shared_ptr<PhysicsComponent>&); void addObject(const std::shared_ptr<PhysicsComponent>&);
void removeObject(const std::shared_ptr<PhysicsComponent>&); void removeObject(const std::shared_ptr<PhysicsComponent>&);
void update(double deltaTime); void update(float deltaTime);
private: private:
void resolveWorldCollision(const std::shared_ptr<PhysicsComponent>&); void resolveWorldCollision(const std::shared_ptr<PhysicsComponent>&);
void resolvePossibleCollisions(); void resolvePossibleCollisions();
void getPossibleCollisions(); void getPossibleCollisions();
int getTileCollider(const glm::vec2& position); int getTileCollider(const glm::vec3& position);
std::vector<std::shared_ptr<PhysicsComponent>> objects; std::vector<std::shared_ptr<PhysicsComponent>> objects;
std::vector<CollisionPair> objCollisions; std::vector<std::pair<PhysicsComponent*, PhysicsComponent*>> objCollisions;
std::vector<std::vector<int>> collisionMap; std::vector<std::vector<int>> collisionMap;
float tileSize = 32.f; float tileSize = 32.f;
std::shared_ptr<EventManager> eventManager; std::shared_ptr<EventManager> eventManager;

View file

@ -0,0 +1,55 @@
#ifndef _H_SCENE_H
#define _H_SCENE_H
#include <string>
#include <unordered_map>
#include <memory>
class Entity;
class Camera;
class Map;
class ResourceManager;
class EventManager;
class GameActor;
class Line;
class PhysicsEngine;
struct SceneData;
enum SceneType {
SCENE_STORY,
SCENE_SHOOTER
};
class Scene
{
public:
Scene(SceneType type, std::shared_ptr<ResourceManager> resources);
void update(float deltaTime);
void render();
std::shared_ptr<GameActor> getPlayer() const;
void unloadScene();
protected:
void loadDebugShooterScene();
void loadDebugStoryScene() { /*not implemented yet*/ }
private:
SceneType type;
std::shared_ptr<Map> map;
//std::shared_ptr<TileSet> tileSet;
std::shared_ptr<GameActor> player;
std::vector<std::shared_ptr<Entity>> entities;
std::shared_ptr<Camera> camera;
std::shared_ptr<PhysicsEngine> physicsEngine;
std::shared_ptr<Line> debugLine;
std::shared_ptr<ResourceManager> resourceManager;
std::shared_ptr<EventManager> eventManager;
std::shared_ptr<SceneData> sceneData;
};
#endif //_H_SCENE_H

View file

@ -1,43 +1,30 @@
#ifndef _H_BULLET_H #ifndef _H_BULLET_H
#define _H_BULLET_H #define _H_BULLET_H
#include "gameplay/entity.h" #include "../entity.h"
#include <memory>
#include <utility/component.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <vector> #include <vector>
class AnimationSet; class Component;
class Camera; class Camera;
class Bullet : public Entity class Bullet : public Entity
{ {
public: public:
Bullet Bullet(std::shared_ptr<Shader> shader, glm::vec3 fireFrom, glm::vec2 direction, float bulletSpeed, float bulletDrop, glm::vec2 bulletSize) :
( Entity(shader),
const unsigned int owner,
unsigned shaderID,
glm::vec3 fireFrom,
glm::vec2 direction,
float bulletSpeed,
float bulletDrop,
glm::vec2 bulletSize
) :
Entity(shaderID),
origin(fireFrom), origin(fireFrom),
direction(direction), direction(direction),
bulletSpeed(bulletSpeed), bulletSpeed(bulletSpeed),
bulletDrop(bulletDrop), bulletDrop(bulletDrop),
bulletSize(bulletSize) bulletSize(bulletSize) {
{
this->setPosition(origin); this->setPosition(origin);
this->setScale(glm::vec3(bulletSize, 1.0f)); this->setScale(glm::vec3(bulletSize, 1.0f));
ownerid = owner;
}; };
void addComponent(Component* component); void addComponent(std::shared_ptr<Component> component);
void update(double deltaTime) override; void update(float deltaTime) override;
void draw() override; void render(const std::shared_ptr<Camera>& camera) override;
float getBulletDrop() const { return bulletDrop; } float getBulletDrop() const { return bulletDrop; }
glm::vec3 getBulletOrigin() const { return origin; } glm::vec3 getBulletOrigin() const { return origin; }
@ -45,13 +32,12 @@ public:
~Bullet(); ~Bullet();
private: private:
unsigned int ownerid;
glm::vec3 origin; glm::vec3 origin;
glm::vec2 direction; glm::vec2 direction;
float bulletSpeed; float bulletSpeed;
float bulletDrop; float bulletDrop;
glm::vec2 bulletSize; glm::vec2 bulletSize;
std::vector<Component*> components; std::vector<std::shared_ptr<Component>> components;
}; };
#endif // _H_BULLET_H #endif // _H_BULLET_H

View file

@ -0,0 +1,37 @@
#ifndef _H_BULLETMANAGER_H
#define _H_BULLETMANAGER_H
#include <glm/glm.hpp>
#include <vector>
#include <memory>
class Bullet;
class Sprite;
class Shader;
class Component;
class Camera;
class EventManager;
class BulletManager
{
public:
void addBullet(const std::shared_ptr<Bullet>& bullet);
void addBullet(const glm::vec3& fireFrom,
const glm::vec2& direction,
float bulletSpeed,
float bulletDrop,
glm::vec2 bulletSize,
const std::shared_ptr<Shader>& shader,
const std::shared_ptr<Component>& sprite);
void update(float deltaTime);
void render(const std::shared_ptr<Camera>& camera);
void hookEventManager(const std::shared_ptr<EventManager>& eventManager);
private:
std::vector<std::shared_ptr<Bullet>> bullets;
std::shared_ptr<EventManager> eventManager;
};
#endif

View file

@ -0,0 +1,61 @@
#ifndef _H_WEAPON_H
#define _H_WEAPON_H
#include <memory>
#include <glm/glm.hpp>
#include <functional>
#include "../../util.h"
#include "../../gameplay/entity.h"
#include "../../utility/direction.h"
// TODO: Put all weapons inside of this base, we don't need a class for every weapon, we only need one class!
class Shader;
class Component;
class Camera;
class BulletManager;
class EventManager;
class ResourceManager;
struct WeaponData;
class Weapon : public Entity
{
public:
Weapon(const WeaponData* data, const std::shared_ptr<Shader>& weaponShader, const std::shared_ptr<Shader>& bulletShader, ResourceManager* resourceManager);
void setWielder(Entity* wielder) { this->wielder = wielder; }
void addComponent(const std::shared_ptr<Component>& component);
void hookEventManager(const std::shared_ptr<EventManager>& eventManager);
void shoot();
void update(float deltaTime);
void render(const std::shared_ptr<Camera>& camera);
private:
glm::vec2 weaponSize;
glm::vec2 weaponOffset;
float bulletSpeed;
float bulletDrop;
// in ms
float fireSpeed;
glm::vec2 bulletSize;
std::shared_ptr<Shader> bulletShader;
std::shared_ptr<Component> bulletSprite;
std::shared_ptr<BulletManager> bulletManager;
std::shared_ptr<EventManager> eventManager;
std::shared_ptr<UTIL::RandomGenerator> bulletSpread;
std::shared_ptr<UTIL::RandomGenerator> bulletModifer;
Entity* wielder = nullptr;
int lastFireTime = 0;
Direction lastDir;
std::vector <std::shared_ptr<Component>> components;
};
#endif // _H_WEAPON_H

View file

@ -0,0 +1,53 @@
#ifndef _H_GLWINDOW_H
#define _H_GLWINDOW_H
#include <SDL_video.h>
//#include <SDL_opengl.h>
#include <glad/glad.h>
class GLWindow
{
public:
GLWindow(const char* windowName, int width, int height) :
name(windowName),
w(width),
h(height) {};
~GLWindow();
bool Init();
void swap() { SDL_GL_SwapWindow(window); }
void makeCurrent() { SDL_GL_MakeCurrent(window, glContext); }
unsigned width() const { return w; }
unsigned height() const { return h; }
SDL_Window* getWindow() const { return window; }
const SDL_GLContext& getContext() const { return glContext; }
private:
SDL_Window* window = nullptr;
SDL_GLContext glContext = NULL;
unsigned w, h;
const char* name;
};
bool GLWindow::Init()
{
window = SDL_CreateWindow(name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_OPENGL);
if (!window)
return false;
glContext = SDL_GL_CreateContext(window);
if (!glContext)
return false;
return true;
}
GLWindow::~GLWindow()
{
SDL_GL_DeleteContext(glContext);
SDL_DestroyWindow(window);
}
#endif // _H_GLWINDOW_H

View file

@ -3,22 +3,14 @@
#include <vector> #include <vector>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <thirdparty/glad/glad.h>
#include <cstring>
#define MAX_INSTANCES 1000 #define MAX_INSTANCES 1000
#define MAX_TEXTURES 31
class Texture; class Texture;
class TextureArray;
struct InstanceData { struct InstanceData {
glm::mat4 modelMatrix; glm::mat4 modelMatrix;
glm::vec2 originalSize; int tileIndex;
int tileIndex = 0;
int textureIndex = 0;
int tilesPerRow = 0;
int startID = 0;
}; };
class BaseInstanceDraw class BaseInstanceDraw
@ -44,25 +36,18 @@ class TileTextureInstance : public BaseInstanceDraw
{ {
public: public:
TileTextureInstance(const char* texturePath); TileTextureInstance(const char* texturePath);
TileTextureInstance(const std::vector<const char*> texturePaths);
void updateInstanceData(const std::vector<InstanceData>&) override; void updateInstanceData(const std::vector<InstanceData>&) override;
void draw() override; void draw() override;
const TextureArray* getTextureArray() { return textures; }
const Texture* getTexture() { return texture; }
~TileTextureInstance();
private: private:
void setup() override; void setup() override;
TextureArray* textures = nullptr;
float vertices[20] = { float vertices[20] = {
// vertex // vertex
-0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom left
0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom right
0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top right
-0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left 0.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left
}; };
}; };

View file

@ -3,7 +3,7 @@
#include <vector> #include <vector>
#include <thirdparty/glad/glad.h> #include <glad/glad.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
typedef struct { typedef struct {

View file

@ -0,0 +1,26 @@
#ifndef _H_SHADER_H
#define _H_SHADER_H
#include <glad/glad.h>
#include <fstream>
#include <iostream>
#include <sstream>
class Shader
{
private:
public:
unsigned int ID;
Shader(const char* vertexPath, const char* fragmentPath);
void use() { glUseProgram(ID); }
void setFloat(const std::string& name, float value);
void setInt(const std::string& name, int value);
void setBool(const std::string& name, bool value);
void setMatrix4f(const std::string& name, const float* value);
~Shader();
};
#endif // _H_SHADER_H

View file

@ -0,0 +1,138 @@
#ifndef _H_SPRITE_H
#define _H_SPRITE_H
#include <SDL_image.h>
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <vector>
#include <unordered_map>
#include <memory>
#include "../utility/direction.h"
enum class TileType;
class Texture;
class EventManager;
class Sprite
{
public:
virtual ~Sprite() {}
void bind();
virtual void draw() = 0;
virtual void play() = 0;
virtual void idle() = 0;
virtual std::shared_ptr<Sprite> clone() const = 0;
protected:
Texture* texture = nullptr;
unsigned indices[6] = {
0, 1, 2,
3, 2, 0
};
};
class SpriteStatic : public Sprite
{
public:
SpriteStatic(const char* texturePath);
~SpriteStatic();
void draw() override;
void play() override { /*unused*/ }
void idle() override { /*unused*/ }
std::shared_ptr<Sprite> clone() const override {
return std::make_shared<SpriteStatic>(*this);
}
private:
void setupSprite();
// Vertex Array, Vertex Buffer, Element Buffer
unsigned VAO, VBO, EBO;
// simple rectangle. Most scales will be done based on this generic vertex data.
float vertices[20] = {
// vertex texturecoords
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom left
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom right
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top right
0.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left
};
};
class SpriteAnimated : public Sprite
{
public:
// let's keep texture grids squares, saves everyone time...
SpriteAnimated(const char* textureAtlasPath, float frameSize);
~SpriteAnimated();
void draw() override;
void play() override;
void idle() override;
std::shared_ptr<Sprite> clone() const override {
return std::make_shared<SpriteAnimated>(*this);
}
bool isPlaying = false;
private:
void SetupAnimated(float frameSize);
struct VertexIDs {
unsigned VAO, VBO;
};
unsigned EBO;
// Vertex array buffer IDs
std::vector<VertexIDs> ids;
int currentFrame = 0;
float FPS = 7.5f;
Uint32 lastFrameTick = 0;
};
class SpriteDirectionalAnimated : public Sprite
{
public:
SpriteDirectionalAnimated(const char* textureAtlasPath, float frameSize);
~SpriteDirectionalAnimated();
void draw() override;
void play() override;
void idle() override;
std::shared_ptr<Sprite> clone() const override {
return std::make_shared<SpriteDirectionalAnimated>(*this);
}
Direction direction = Direction::Down;
void setDirection(Direction& dir) { direction = dir; }
bool isPlaying = false;
private:
void Setup(float frameSize);
struct VertexIDs {
unsigned VAO, VBO;
};
unsigned EBO;
std::unordered_map<Direction, VertexIDs> idleIDs;
std::unordered_map<Direction, std::vector<VertexIDs>> walkingIDs;
int currentFrame = 0;
float FPS = 7.5f;
Uint32 lastFrameTick = 0;
};
#endif // _H_SPRITE_H

View file

@ -0,0 +1,22 @@
#ifndef _H_TEXTURE_H
#define _H_TEXTURE_H
class Texture
{
public:
Texture() {}
bool loadTexture(const char* imagePath);
void bind();
const int getWidth() const { return textureWidth; }
const int getHeight() const { return textureHeight; }
~Texture();
private:
unsigned ID = 0;
int textureWidth = 0;
int textureHeight = 0;
};
#endif

View file

@ -0,0 +1,37 @@
#ifndef _H_TILE_H
#define _H_TILE_H
#include <vector>
#include <unordered_map>
#include <memory>
#include <glad/glad.h>
enum class TileType;
class Texture;
// TODO: Decide how this struct will be used.
// This holds only the texture data of the tile, this texture data will be held in
// a further struct called Tile
struct TileTexture {
Texture* texture = nullptr;
unsigned VAO, VBO, EBO;
};
// TODO: Finished replacing the Sprite version of tile set with this one
// This class is NOT for game logic, only for the storage of the tile pointers that point to the TileTexture
class TileSet
{
public:
TileSet(const char* tileSetImage, float frameSize);
void setupTiles(float frameSize);
~TileSet();
const std::shared_ptr<TileTexture>& getTileTexture(TileType tileType) const;
private:
Texture* texture;
std::unordered_map<TileType, std::shared_ptr<TileTexture>> tiles;
};
#endif

View file

@ -0,0 +1,78 @@
#ifndef _H_TILETYPE_H
#define _H_TILETYPE_H
struct Tile {
enum class SpriteID {
TILE_SOLID_GRASS_1,
TILE_SOLID_GRASS_2,
TILE_SOLID_GRASS_3,
TILE_SOLID_GRASS_4,
TILE_SOLID_GRASS_5,
TILE_SOLID_GRASS_6,
TILE_SOLID_GRASS_7,
TILE_SOLID_GRASS_8,
TILE_LSHAPE_GRASS_TL,
TILE_LSHAPE_GRASS_TR,
TILE_LSHAPE_GRASS_BR,
TILE_LSHAPE_GRASS_BL,
TILE_LINE_GRASS_T,
TILE_LINE_GRASS_L,
TILE_LINE_GRASS_R,
TILE_LINE_GRASS_B,
TILE_VSEG_GRASS_TL,
TILE_VSEG_GRASS_TR,
TILE_HSEG_GRASS_TL,
TILE_HSEG_GRASS_TR,
TILE_VSEG_GRASS_BL,
TILE_VSEG_GRASS_BR,
TILE_HSEG_GRASS_BL,
TILE_HSEG_GRASS_BR,
TILE_SOLID_DIRT_1,
TILE_SOLID_DIRT_2,
TILE_SOLID_DIRT_3,
TILE_SOLID_DIRT_4,
TILE_SOLID_DIRT_5,
TILE_SOLID_DIRT_6,
TILE_SOLID_DIRT_7,
TILE_SOLID_DIRT_8,
TILE_SOLID_WATER_1,
TILE_SOLID_WATER_2,
TILE_SOLID_WATER_3,
TILE_SOLID_WATER_4,
TILE_SOLID_WATER_5,
TILE_SOLID_WATER_6,
TILE_SOLID_WATER_7,
TILE_SOLID_WATER_8,
TILE_LSHAPE_WATER_TL,
TILE_LSHAPE_WATER_TR,
TILE_LSHAPE_WATER_BR,
TILE_LSHAPE_WATER_BL,
TILE_LINE_WATER_T,
TILE_LINE_WATER_L,
TILE_LINE_WATER_R,
TILE_LINE_WATER_B,
TILE_VSEG_WATER_TL,
TILE_VSEG_WATER_TR,
TILE_HSEG_WATER_TL,
TILE_HSEG_WATER_TR,
TILE_VSEG_WATER_BL,
TILE_VSEG_WATER_BR,
TILE_HSEG_WATER_BL,
TILE_HSEG_WATER_BR,
TILE_MISC_FLOWERS_1,
TILE_MISC_FLOWERS_2,
TILE_MISC_DUCK,
TILE_MISC_PEBBLE_1,
TILE_MISC_ROCK,
TILE_MISC_SHRUB,
TILE_MISC_PEBBLE_2,
TILE_MISC_PEBBLE_3
}spriteID;
enum class TileData {
TILE_WALKABLE = 1,
TILE_WATER = 2,
TILE_UNWALKABLE = 64
}tileData;
};
#endif // _H_TILETYPE_H

View file

@ -1,49 +0,0 @@
#ifndef _H_AI_H
#define _H_AI_H
#include <memory>
#include <thread>
#include <mutex>
#include <string>
#include <sol/sol.hpp>
class GameActor;
class Raycaster;
class AIScript;
enum class AIState {
Idle,
Alert,
Patrol
};
class AI {
public:
AI(GameActor* actor, std::unique_ptr<Raycaster> raycaster);
void update();
void setTarget(GameActor* target) { this->target = target; }
void attachBehaviourScript(std::unique_ptr<AIScript> behaviour);
AIState getState() const { return state; }
void setState(AIState state) { this->state = state; }
~AI();
private:
AIState state;
std::unique_ptr<Raycaster> raycaster;
std::unique_ptr<AIScript> behaviour;
GameActor* actor;
GameActor* target;
// cache our lua function calls
sol::function idleFunc;
sol::function patrolFunc;
sol::function alertFunc;
std::chrono::high_resolution_clock::time_point lastGCTime;
std::chrono::minutes GCTimeout;
};
#endif

View file

@ -1,45 +0,0 @@
#ifndef _H_CAMERA_H
#define _H_CAMERA_H
#include "gameplay/entity.h"
class Camera {
public:
Camera(float viewPortW, float viewPortH)
: position(glm::vec3(0.0f, 0.0f, 0.0f)),
front(glm::vec3(0.0f, 0.0f, -1.0f)), up(glm::vec3(0.0f, 1.0f, 0.0f)),
viewPortW(viewPortW), viewPortH(viewPortH) {};
void setPosition(const glm::vec3 &position) { this->position = position; }
const Entity *getTarget() const { return target; }
const glm::vec3 getCenterPos() const {
return glm::vec3(position.x + (viewPortW / 2.f),
position.y + (viewPortH / 2.f), 0.0f);
}
void setTarget(Entity *target) { this->target = target; }
void unsetTarget() { target = nullptr; }
bool isTargeting() { return (target != nullptr); }
void update(double deltaTime);
void setViewportSize(float width, float height);
const glm::vec3 worldToLocal(const glm::vec3 &worldCoordinates);
glm::mat4 getViewMatrix();
glm::mat4 getProjectionMatrix();
const glm::vec3 getPosition() const { return position; }
private:
Entity *target = nullptr;
glm::vec3 position;
glm::vec3 front;
glm::vec3 up;
float viewPortW, viewPortH;
float speed = 300.0f;
};
#endif // _H_CAMERA_H

View file

@ -1,56 +0,0 @@
#ifndef _H_GAME_H
#define _H_GAME_H
#include <SDL_events.h>
#include <memory>
#include <utility/events.h>
#include "gameplay/camera.h"
class InputHandler;
class Scene;
class Text;
class ResourceManager;
class Renderer;
class AudioEngine;
class GLWindow;
enum { GAME_QUITTING = 0, GAME_RUNNING = 1, GAME_MENU = 2, GAME_PLAYING = 4 };
class Game {
public:
Game() {}
bool init();
bool loadDebugScene();
void captureInput(SDL_Event &e);
void executeInputs();
void update(double deltaTime);
void render();
const unsigned getGameState() const { return game_state; }
const unsigned getWindowWidth() const;
const unsigned getWindowHeight() const;
void quit();
~Game();
private:
unsigned game_state = GAME_QUITTING;
std::shared_ptr<GLWindow> window;
std::unique_ptr<Camera> camera;
std::shared_ptr<Scene> currentScene;
std::shared_ptr<InputHandler> inputHandler;
std::shared_ptr<ResourceManager> resourceManager;
std::shared_ptr<Renderer> renderer;
std::shared_ptr<Text> textHandler;
std::shared_ptr<AudioEngine> audioEngine;
std::shared_ptr<EventManager> globalEventManager;
};
#endif

View file

@ -1,61 +0,0 @@
#ifndef _H_GAMEACTOR_H
#define _H_GAMEACTOR_H
#include <memory>
#include <unordered_map>
#include <SDL_timer.h>
#include <optional>
#include <span>
#include "gameplay/entity.h"
#include "gameplay/weapons/weapon.h"
#include "utility/mousestate.h"
#include <utility/component.h>
class AI;
class ISceneContext;
// TODO: Add ammo system, then work on some basic UI design
class GameActor : public Entity
{
public:
GameActor(ISceneContext* scene, const unsigned shaderID) : Entity(shaderID), sceneContext(scene) {}
~GameActor();
void addComponent(std::unique_ptr<Component> component);
void pickupWeapon(std::unique_ptr<Weapon> weapon);
void update(double deltaTime) override;
void draw() override;
Weapon* getHeldWeapon() const;
std::span<Weapon*> getAllWeapons();
void setRotation(const float& rotation) override;
void moveUp();
void moveDown();
void moveLeft();
void moveRight();
// Top down shooter controls, mostly for the player to use in top down shooting sections
void moveForward();
void moveBackward();
void strafeLeft();
void strafeRight();
void fireWeapon() const;
void cycleUpWeapons();
void cycleDownWeapons();
void cycleWeapons(const MouseState&);
void followMouse(const MouseState&);
private:
std::vector<std::unique_ptr<Component>> components;
std::vector<std::unique_ptr<Weapon>> weapons;
std::vector<Weapon*> weaponCache;
size_t currentWeaponIndex = 0;
ISceneContext* sceneContext;
};
#endif //_H_GAMEACTOR_H

View file

@ -1,40 +0,0 @@
#ifndef _H_MAP_H
#define _H_MAP_H
#include <vector>
#include <memory>
#include "graphics/instancedraw.h"
#include "graphics/renderer.h"
class Shader;
class Camera;
class ResourceManager;
struct MapData;
struct TileSetData;
class Map : public Drawable
{
public:
Map(const MapData* mapData, const unsigned shaderID, std::shared_ptr<ResourceManager> resourceManager);
const std::vector<std::vector<int>> getCollisionMap() const { return collisionMap; }
void draw() override;
private:
void loadMap();
void createCollisionMap();
size_t getTileSetIndex(int id) const;
const MapData* mapData;
std::vector<const TileSetData*> tileSetData;
std::vector<std::shared_ptr<TileTextureInstance>> instanceHandles;
std::vector<std::vector<std::vector<int>>> tileIds;
std::vector<std::vector<int>> collisionMap;
std::vector<std::vector<InstanceData>> tileData;
};
#endif

View file

@ -1,84 +0,0 @@
#ifndef _H_SCENE_H
#define _H_SCENE_H
#include <span>
#include <unordered_map>
#include <memory>
#include <gameplay/gameactor.h>
class Background;
class Entity;
class Camera;
class Map;
class ResourceManager;
class Renderer;
class EventManager;
class Line;
class PhysicsEngine;
class Sprite;
class Shader;
struct SceneData;
enum SceneType {
SCENE_STORY,
SCENE_SHOOTER
};
class ISceneContext {
public:
virtual std::weak_ptr<EventManager> getEventManager() = 0;
virtual std::weak_ptr<EventManager> getGlobalEventManager() = 0;
virtual std::span<std::weak_ptr<GameActor>> getAllEntities() const = 0;
virtual unsigned int getPlayerID() const = 0;
};
class Scene : public ISceneContext, public std::enable_shared_from_this<Scene>
{
public:
Scene(SceneType type, std::shared_ptr<ResourceManager> resources, std::weak_ptr<EventManager> globalEvents);
void init();
void update(double deltaTime);
void render(std::shared_ptr<Renderer> renderer);
std::shared_ptr<GameActor> getPlayer() const;
unsigned int getPlayerID() const override { return player->getEntityID(); }
std::weak_ptr<EventManager> getEventManager() override { return eventManager; }
std::weak_ptr<EventManager> getGlobalEventManager() override { return globalEventManager; }
std::span<std::weak_ptr<GameActor>> getAllEntities() const override;
void unloadScene();
protected:
void loadDebugShooterScene();
void loadDebugStoryScene() { /*not implemented yet*/ }
private:
void hookSceneEvents();
GameActor* getGameActorByID(const unsigned int ID);
// Non-owning pointer DO NOT DELETE, resource manager will handle that!
Background *background;
SceneType type;
std::shared_ptr<Map> map;
//std::shared_ptr<TileSet> tileSet;
std::shared_ptr<GameActor> player;
std::unordered_map<unsigned int, std::shared_ptr<GameActor>> entities;
mutable std::vector<std::weak_ptr<GameActor>> entityCache;
std::shared_ptr<Camera> camera;
std::shared_ptr<PhysicsEngine> physicsEngine;
std::shared_ptr<Line> debugLine;
std::shared_ptr<ResourceManager> resourceManager;
std::weak_ptr<EventManager> globalEventManager;
std::shared_ptr<EventManager> eventManager;
const SceneData* sceneData;
};
#endif //_H_SCENE_H

View file

@ -1,42 +0,0 @@
#ifndef _H_BULLETMANAGER_H
#define _H_BULLETMANAGER_H
#include <glm/glm.hpp>
#include <vector>
#include <memory>
#include <utility/component.h>
class Bullet;
class Sprite;
class Shader;
class Camera;
class EventManager;
class BulletManager : public std::enable_shared_from_this<BulletManager>
{
public:
BulletManager() {}
void addBullet(const std::shared_ptr<Bullet>& bullet);
void addBullet(const unsigned int owner,
const glm::vec3& fireFrom,
const glm::vec2& direction,
float bulletSpeed,
float bulletDrop,
glm::vec2 bulletSize,
const unsigned& shaderID,
std::unique_ptr<Component> sprite);
void update(double deltaTime);
void draw();
void hookEventManager(std::weak_ptr<EventManager> eventManager);
const std::vector<std::shared_ptr<Bullet>> getBullets() const { return bullets; }
private:
std::vector<std::shared_ptr<Bullet>> bullets;
std::weak_ptr<EventManager> eventManager;
};
#endif

View file

@ -1,113 +0,0 @@
#ifndef _H_WEAPON_H
#define _H_WEAPON_H
#include <memory>
#include <glm/glm.hpp>
#include <functional>
#include "util.h"
#include "gameplay/entity.h"
#include "utility/direction.h"
#include <utility/component.h>
#include <gameplay/weapons/bulletmanager.h>
// TODO: Put all weapons inside of this base, we don't need a class for every weapon, we only need one class!
class Shader;
class Camera;
class EventManager;
class ResourceManager;
class GameActor;
class WeaponScript;
struct PhysicsComponent;
struct WeaponData;
class Weapon : public Entity
{
public:
Weapon(const WeaponData* data, const unsigned weaponShaderID, const unsigned bulletShaderID, ResourceManager* resourceManager);
void setWielder(GameActor* wielder) { this->wielder = wielder; }
void toggleInfiniteAmmo() { infiniteAmmo = !infiniteAmmo; }
void wield() { wielded = true; }
void putaway() { wielded = false; }
void addComponent(std::unique_ptr<Component> component);
void attachScript(std::unique_ptr<WeaponScript> script);
void hookEventManager(std::weak_ptr<EventManager> eventManager);
bool shoot();
void reload();
void update(double deltaTime);
void draw();
const std::string getType() const { return weaponType; }
struct BulletData {
glm::vec3 origin;
glm::vec2 direction;
float mass = 1.f;
float sizeMod = 1.f;
float speedMod = 1.f;
float dropMod = 1.f;
};
void onHitCallback(GameActor* target, PhysicsComponent* bullet, const glm::vec2& normal);
glm::vec2 getWeaponSize() const { return weaponSize; }
// This is the offset from the center right point of the weapon to the barrel of the gun defined in
// the XML file for the weapon
glm::vec2 getWeaponOffset() const { return weaponOffset; }
float getBulletSpeed() const { return bulletSpeed; }
glm::vec2 getBulletSize() const { return bulletSize; }
GameActor* getWielder() const { return wielder; }
const Uint32 getMagazine() const { return weaponMag; }
const Uint32 getAmmo() const { return weaponAmmo; }
Weapon::BulletData genBulletData ();
void createBullet (const BulletData& data);
const BulletManager* getBulletManager() { return bulletManager.get(); }
~Weapon();
private:
void adjustWeapon();
std::string weaponType;
glm::vec2 weaponSize;
glm::vec2 weaponOffset;
// TODO: Add reloading
// weaponMag will be unused for now, but we will do a reload animation and reload the weapon eventually
Uint16 weaponMag, weaponMagSize, weaponAmmo;
bool reloading = false;
bool wasReloading = false;
bool infiniteAmmo = false;
float bulletSpeed;
float bulletDrop;
// in ms
float fireSpeed;
glm::vec2 bulletSize;
unsigned bulletShaderID;
std::unique_ptr<Component> bulletSprite;
std::shared_ptr<BulletManager> bulletManager;
std::weak_ptr<EventManager> eventManager;
std::unique_ptr<UTIL::RandomGenerator> bulletSpread;
std::unique_ptr<UTIL::RandomGenerator> bulletModifer;
GameActor* wielder;
// is the weapon currently active
bool wielded = false;
int lastFireTime = 0;
Direction lastDir;
std::vector <std::unique_ptr<Component>> components;
std::unique_ptr<WeaponScript> weaponScript;
};
#endif // _H_WEAPON_H

View file

@ -1,107 +0,0 @@
#ifndef _H_ANIMATION_H
#define _H_ANIMATION_H
#include <memory>
#include <SDL_timer.h>
#include <vector>
#include <string>
#include <unordered_map>
#include "utility/direction.h"
class SpriteAtlas;
class ResourceManager;
class EventManager;
// Each entity will contain animation data,
// this data will hold:
// name of the animation,
// type of animation ie. idle animation, directional, etc.
// directory of the animation atlas containing the frames
struct AnimationData;
class Animation
{
public:
Animation(const AnimationData* animData, ResourceManager* resourceManager);
std::string getPrefix() const { return prefix; }
std::string getType() const { return type; }
std::string getID() const { return prefix + "/" + type; }
void bind();
void draw();
void draw(Direction dir);
void play() { isPlaying = true; }
void stop() { isPlaying = false; }
void reset() { currentFrame = 0; lastFrameTick = 0; elapsedTime = 0; }
const bool getPlaying() const { return isPlaying; }
const bool getDirectional() const { return isDirectional; }
const int getCycles() const { return cycles; }
void setFPS(const float fps) { FPS = fps; }
private:
std::string prefix;
std::string type;
SpriteAtlas* spriteAtlas;
Uint32 elapsedTime = 0;
Uint32 lastFrameTick = 0;
float FPS;
int currentFrame;
int cycles;
bool isDirectional;
bool isPlaying;
// this ticks our frame forward according to ticks passed
void frameTick();
void singleDraw();
void directionalDraw(Direction dir);
};
// We will load our animation component with every loaded animation,
// this will be the handler for every animation an entity uses
class AnimationSet : public std::enable_shared_from_this<AnimationSet>
{
public:
AnimationSet(const int& entityid);
AnimationSet(const int& entityid, ResourceManager* resourceManager, std::vector<AnimationData*> animSet);
AnimationSet(const int& entityid, std::unordered_map<std::string, std::unique_ptr<Animation>> animations);
Animation* operator [](std::string animType) { return anims[animType].get(); }
void addAnimation(std::unique_ptr<Animation> anim) { std::string type = anim->getType(); anims.try_emplace(type, std::move(anim)); }
void setAnimation(const std::string& animType) { curAnim = anims[animType].get(); }
const int getEntityID() const { return entityid; }
const bool getDirectional() const { return isDirectional; }
void bind();
void draw();
void play() { curAnim->play(); }
void stop() { curAnim->stop(); }
void setFacingDir(Direction& dir) { facing = dir; }
void attachEventManager(std::weak_ptr<EventManager> e);
private:
int entityid;
bool isDirectional;
Direction facing = Direction::Down;
std::unordered_map<std::string, std::unique_ptr<Animation>> anims;
Animation* curAnim;
std::weak_ptr<EventManager> eventManager;
};
#endif // _H_ANIMATION_H

View file

@ -1,24 +0,0 @@
#ifndef _H_BACKGROUND_H
#define _H_BACKGROUND_H
#include "graphics/quad.h"
#include "graphics/drawable.h"
#include "graphics/texture.h"
#include "utility/logger.h"
class Background : public Drawable
{
public:
Background(const std::string& fileName);
void draw() override;
~Background();
private:
ScreenQuad *quad;
Texture *texture;
};
#endif // _H_BACKGROUND_H

View file

@ -1,50 +0,0 @@
#ifndef _H_DRAWABLE_H
#define _H_DRAWABLE_H
#include <vector>
#include <variant>
#include <glm/glm.hpp>
#include <string>
using UniformValue = std::variant<
int,
bool,
float,
double,
glm::mat4,
glm::vec2
>;
struct Uniform {
std::string name;
UniformValue value;
};
class Drawable
{
public:
virtual void draw() = 0;
const unsigned getShaderID() const { return shaderID; }
const std::vector<Uniform>& getUniforms() { return uniforms; }
const std::vector<Uniform>& getOneShotUniforms() { return oneShotUniforms; }
void clearOneShot() { oneShotUniforms.clear(); }
void clearUniforms() { uniforms.clear(); }
protected:
unsigned shaderID;
template <typename T>
void editUniform(const std::string& name, T value)
{
uniforms.emplace_back(Uniform {name, value});
}
template <typename T>
void editUniformOnce(const std::string& name, T value)
{
oneShotUniforms.emplace_back(Uniform {name, value});
}
private:
std::vector<Uniform> uniforms;
std::vector<Uniform> oneShotUniforms;
};
#endif // _H_DRAWABLE_H

View file

@ -1,36 +0,0 @@
#ifndef _H_GLWINDOW_H
#define _H_GLWINDOW_H
#include <SDL_video.h>
#include <thirdparty/glad/glad.h>
#include "utility/logger.h"
class GLWindow {
public:
GLWindow(const char *windowName, int width, int height)
: w(width), h(height), name(windowName) {};
~GLWindow();
bool Init();
void swap() { SDL_GL_SwapWindow(window); }
void makeCurrent() { SDL_GL_MakeCurrent(window, glContext); }
unsigned Width() const { return w; }
unsigned Height() const { return h; }
void resizeWindow(size_t w, size_t h);
SDL_Window *getWindow() const { return window; }
const SDL_GLContext &getContext() const { return glContext; }
private:
SDL_Window *window = nullptr;
SDL_GLContext glContext = NULL;
unsigned w, h;
const char *name;
};
#endif // _H_GLWINDOW_H

View file

@ -1,73 +0,0 @@
#ifndef _H_POSTPROCESS_H
#define _H_POSTPROCESS_H
#include <SDL_timer.h>
#include <thirdparty/glad/glad.h>
#include <glm/glm.hpp>
#include <limits>
#include <memory>
#include <utility/resourcemanager.h>
#include <graphics/shader.h>
#include <utility/logger.h>
#include <util.h>
class Postprocessor
{
public:
Postprocessor(const std::shared_ptr<ResourceManager>&);
enum EFFECT {
BLUR = 1 << 0,
SHAKE = 1 << 1,
NEGATIVE = 1 << 2,
COLORMOD = 1 << 3,
GREYSCALE = 1 << 4
};
void ApplyEffect(EFFECT effect, float intensity=0.f, float effectDuration=UTIL::INF_TIME, glm::vec3 colorModifer=glm::vec3(0.0f));
void RemoveEffects(EFFECT effect);
void RemoveAllEffects();
void applyPostProcess(bool worldOrHud=0);
private:
int edge_kernel[9] = {
-1, -1, -1,
-1, 8, -1,
-1, -1, -1
};
float blur_kernel[9] = {
1.0f / 16.0f, 2.0f / 16.0f, 1.0f / 16.0f,
2.0f / 16.0f, 4.0f / 16.0f, 2.0f / 16.0f,
1.0f / 16.0f, 2.0f / 16.0f, 1.0f / 16.0f
};
unsigned int UBO;
struct PostProcessData_t {
alignas(4) int curTime;
// world
alignas(4) int dt;
alignas(16) glm::vec3 colorMod;
alignas(4) float blurIntensity;
alignas(4) float blurDuration;
alignas(4) float shakeIntensity;
alignas(4) float shakeDuration;
alignas(4) int curEffects;
// hud
alignas(16) glm::vec3 colorMod_hud;
alignas(4) float blurIntensity_hud;
alignas(4) float blurDuration_hud;
alignas(4) float shakeIntensity_hud;
alignas(4) float shakeDuration_hud;
alignas(4) int curEffects_hud;
}postProcessData;
void tickEffectTime(bool worldOrHud);
unsigned int lastTime;
Shader* postProcessShader;
};
#endif // _H_POSTPROCESS_H

Some files were not shown because too many files have changed in this diff Show more