demo headers refactor

This commit is contained in:
h4570
2022-08-14 20:11:57 +02:00
parent 7ef0e73543
commit 5c2ae9770e
35 changed files with 57 additions and 87 deletions
+1 -2
View File
@@ -10,8 +10,7 @@
#pragma once #pragma once
#include <engine.hpp> #include <tyra>
#include <game.hpp>
#include "state/state_manager.hpp" #include "state/state_manager.hpp"
using Tyra::Engine; using Tyra::Engine;
+1 -3
View File
@@ -10,9 +10,7 @@
#pragma once #pragma once
#include <renderer/3d/mesh/static/static_mesh.hpp> #include <tyra>
#include <renderer/3d/pipeline/static/stapip_options.hpp>
#include <renderer/renderer.hpp>
#include "states/game/renderer/renderer_static_pair.hpp" #include "states/game/renderer/renderer_static_pair.hpp"
using Tyra::Renderer; using Tyra::Renderer;
+1 -5
View File
@@ -10,13 +10,9 @@
#pragma once #pragma once
#include <renderer/3d/mesh/dynamic/dynamic_mesh.hpp> #include <tyra>
#include <renderer/3d/pipeline/dynamic/dynpip_options.hpp>
#include <renderer/3d/mesh/dynamic/animation_sequence_callback.hpp>
#include "states/game/renderer/renderer_dynamic_pair.hpp" #include "states/game/renderer/renderer_dynamic_pair.hpp"
#include "states/game/terrain/heightmap.hpp" #include "states/game/terrain/heightmap.hpp"
#include <renderer/renderer.hpp>
#include <engine.hpp>
#include "./enemy_info.hpp" #include "./enemy_info.hpp"
using Tyra::AnimationSequenceCallback; using Tyra::AnimationSequenceCallback;
+2 -2
View File
@@ -10,10 +10,10 @@
#pragma once #pragma once
#include "states/game/terrain/heightmap.hpp"
#include "./enemy.hpp"
#include <tyra> #include <tyra>
#include <vector> #include <vector>
#include "states/game/terrain/heightmap.hpp"
#include "./enemy.hpp"
using Tyra::DynamicMesh; using Tyra::DynamicMesh;
using Tyra::Engine; using Tyra::Engine;
+1 -3
View File
@@ -10,9 +10,7 @@
#pragma once #pragma once
#include "math/vec4.hpp" #include <tyra>
#include "renderer/core/3d/camera_info_3d.hpp"
#include "pad/pad.hpp"
using Tyra::CameraInfo3D; using Tyra::CameraInfo3D;
using Tyra::Pad; using Tyra::Pad;
+6 -2
View File
@@ -15,7 +15,8 @@
#include "states/game/terrain/heightmap.hpp" #include "states/game/terrain/heightmap.hpp"
#include "./weapon.hpp" #include "./weapon.hpp"
#include "./camera.hpp" #include "./camera.hpp"
#include <engine.hpp> #include "./player_shoot_action.hpp"
#include <tyra>
using Tyra::Engine; using Tyra::Engine;
using Tyra::Pad; using Tyra::Pad;
@@ -35,8 +36,11 @@ class Player {
void update(const Heightmap& heightmap); void update(const Heightmap& heightmap);
PlayerShootAction getShootAction() const;
private: private:
void handlePlayerPosition(const Heightmap& heightmap,const float& terrainHeight); void handlePlayerPosition(const Heightmap& heightmap,
const float& terrainHeight);
float speed; float speed;
Pad* pad; Pad* pad;
@@ -0,0 +1,25 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <tyra>
#include <optional>
using Tyra::Ray;
namespace Demo {
struct PlayerShootAction {
bool isShooting = false;
std::optional<Ray> ray;
};
} // namespace Demo
+1 -7
View File
@@ -10,13 +10,7 @@
#pragma once #pragma once
#include <renderer/3d/mesh/static/static_mesh.hpp> #include <tyra>
#include <renderer/3d/pipeline/static/stapip_options.hpp>
#include <renderer/renderer.hpp>
#include <engine.hpp>
#include <pad/pad.hpp>
#include <audio/audio.hpp>
#include <time/timer.hpp>
using Tyra::Audio; using Tyra::Audio;
using Tyra::Engine; using Tyra::Engine;
@@ -10,11 +10,9 @@
#pragma once #pragma once
#include "renderer/renderer.hpp" #include <tyra>
#include "renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp"
#include "renderer/3d/pipeline/static/static_pipeline.hpp"
#include "./renderer_dynamic_pair.hpp"
#include "./renderer_static_pair.hpp" #include "./renderer_static_pair.hpp"
#include "./renderer_dynamic_pair.hpp"
using Tyra::DynamicPipeline; using Tyra::DynamicPipeline;
using Tyra::Renderer; using Tyra::Renderer;
@@ -10,8 +10,7 @@
#pragma once #pragma once
#include "renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp" #include <tyra>
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
using Tyra::DynamicMesh; using Tyra::DynamicMesh;
using Tyra::DynPipOptions; using Tyra::DynPipOptions;
@@ -10,8 +10,7 @@
#pragma once #pragma once
#include "renderer/3d/pipeline/static/static_pipeline.hpp" #include <tyra>
#include "renderer/3d/mesh/static/static_mesh.hpp"
using Tyra::StaPipOptions; using Tyra::StaPipOptions;
using Tyra::StaticMesh; using Tyra::StaticMesh;
+1 -3
View File
@@ -10,10 +10,8 @@
#pragma once #pragma once
#include <renderer/3d/mesh/static/static_mesh.hpp> #include <tyra>
#include <renderer/3d/pipeline/static/stapip_options.hpp>
#include "states/game/renderer/renderer_static_pair.hpp" #include "states/game/renderer/renderer_static_pair.hpp"
#include <renderer/renderer.hpp>
using Tyra::Renderer; using Tyra::Renderer;
using Tyra::StaPipOptions; using Tyra::StaPipOptions;
+1 -3
View File
@@ -10,10 +10,8 @@
#pragma once #pragma once
#include <renderer/3d/mesh/static/static_mesh.hpp> #include <tyra>
#include <renderer/3d/pipeline/static/stapip_options.hpp>
#include "states/game/renderer/renderer_static_pair.hpp" #include "states/game/renderer/renderer_static_pair.hpp"
#include <renderer/renderer.hpp>
using Tyra::Renderer; using Tyra::Renderer;
using Tyra::StaPipOptions; using Tyra::StaPipOptions;
+1 -2
View File
@@ -10,8 +10,7 @@
#pragma once #pragma once
#include "math/vec4.hpp" #include <tyra>
#include "loaders/texture/png_loader.hpp"
using Tyra::Vec4; using Tyra::Vec4;
+1 -3
View File
@@ -10,10 +10,8 @@
#pragma once #pragma once
#include <renderer/3d/mesh/static/static_mesh.hpp> #include <tyra>
#include <renderer/3d/pipeline/static/stapip_options.hpp>
#include "states/game/renderer/renderer_static_pair.hpp" #include "states/game/renderer/renderer_static_pair.hpp"
#include <renderer/renderer.hpp>
#include "./heightmap.hpp" #include "./heightmap.hpp"
using Tyra::StaPipOptions; using Tyra::StaPipOptions;
@@ -12,8 +12,7 @@
#include "state/state.hpp" #include "state/state.hpp"
#include "../intro_state_type.hpp" #include "../intro_state_type.hpp"
#include "renderer/core/2d/sprite/sprite.hpp" #include <tyra>
#include "time/timer.hpp"
using Tyra::Sprite; using Tyra::Sprite;
using Tyra::Texture; using Tyra::Texture;
@@ -12,8 +12,7 @@
#include "state/state.hpp" #include "state/state.hpp"
#include "../intro_state_type.hpp" #include "../intro_state_type.hpp"
#include "renderer/core/2d/sprite/sprite.hpp" #include <tyra>
#include "time/timer.hpp"
using Tyra::Sprite; using Tyra::Sprite;
using Tyra::Texture; using Tyra::Texture;
@@ -12,8 +12,7 @@
#include "state/state.hpp" #include "state/state.hpp"
#include "../intro_state_type.hpp" #include "../intro_state_type.hpp"
#include "renderer/core/2d/sprite/sprite.hpp" #include <tyra>
#include "time/timer.hpp"
using Tyra::Sprite; using Tyra::Sprite;
using Tyra::Texture; using Tyra::Texture;
+1 -1
View File
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com> # Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/ */
#include "engine.hpp" #include <tyra>
#include "demo_game.hpp" #include "demo_game.hpp"
int main() { int main() {
-2
View File
@@ -9,8 +9,6 @@
*/ */
#include "states/game/debug_object.hpp" #include "states/game/debug_object.hpp"
#include <loaders/3d/obj_loader/obj_loader.hpp>
#include <file/file_utils.hpp>
using Tyra::Color; using Tyra::Color;
using Tyra::FileUtils; using Tyra::FileUtils;
+1 -2
View File
@@ -10,7 +10,6 @@
#include "states/game/enemy/enemy.hpp" #include "states/game/enemy/enemy.hpp"
#include <functional> #include <functional>
#include "debug/debug.hpp"
using Tyra::Math; using Tyra::Math;
@@ -49,7 +48,7 @@ Enemy::Enemy(Engine* engine, const EnemyInfo& t_info) {
mesh->translation.translateY(-5.0F); mesh->translation.translateY(-5.0F);
audio = &engine->audio; audio = &engine->audio;
audio->adpcm.setVolume(50, info.adpcmChannel); audio->adpcm.setVolume(30, info.adpcmChannel);
allocateOptions(); allocateOptions();
@@ -9,10 +9,7 @@
*/ */
#include "states/game/enemy/enemy_manager.hpp" #include "states/game/enemy/enemy_manager.hpp"
#include "loaders/3d/obj_loader/obj_loader.hpp"
#include <file/file_utils.hpp>
#include <functional> #include <functional>
#include "debug/debug.hpp"
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::Math; using Tyra::Math;
-2
View File
@@ -9,8 +9,6 @@
*/ */
#include "states/game/game_state.hpp" #include "states/game/game_state.hpp"
#include "debug/debug.hpp"
#include "file/file_utils.hpp"
using Tyra::FileUtils; using Tyra::FileUtils;
-1
View File
@@ -9,7 +9,6 @@
*/ */
#include "states/game/player/camera.hpp" #include "states/game/player/camera.hpp"
#include "debug/debug.hpp"
namespace Demo { namespace Demo {
+6
View File
@@ -31,6 +31,12 @@ void Player::update(const Heightmap& heightmap) {
weapon.update(); weapon.update();
} }
PlayerShootAction Player::getShootAction() const {
PlayerShootAction action;
return action;
}
void Player::handlePlayerPosition(const Heightmap& heightmap, void Player::handlePlayerPosition(const Heightmap& heightmap,
const float& terrainHeight) { const float& terrainHeight) {
const auto& leftJoy = pad->getLeftJoyPad(); const auto& leftJoy = pad->getLeftJoyPad();
-2
View File
@@ -9,8 +9,6 @@
*/ */
#include "states/game/player/weapon.hpp" #include "states/game/player/weapon.hpp"
#include <loaders/3d/obj_loader/obj_loader.hpp>
#include <file/file_utils.hpp>
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::ObjLoader; using Tyra::ObjLoader;
@@ -9,7 +9,6 @@
*/ */
#include "states/game/renderer/game_renderer.hpp" #include "states/game/renderer/game_renderer.hpp"
#include "thread/threading.hpp"
using Tyra::Threading; using Tyra::Threading;
-2
View File
@@ -9,8 +9,6 @@
*/ */
#include "states/game/ship/ship.hpp" #include "states/game/ship/ship.hpp"
#include <loaders/3d/obj_loader/obj_loader.hpp>
#include <file/file_utils.hpp>
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::ObjLoader; using Tyra::ObjLoader;
-2
View File
@@ -9,8 +9,6 @@
*/ */
#include "states/game/skybox/skybox.hpp" #include "states/game/skybox/skybox.hpp"
#include <loaders/3d/obj_loader/obj_loader.hpp>
#include <file/file_utils.hpp>
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::ObjLoader; using Tyra::ObjLoader;
@@ -9,8 +9,6 @@
*/ */
#include "states/game/terrain/heightmap.hpp" #include "states/game/terrain/heightmap.hpp"
#include "file/file_utils.hpp"
#include "debug/debug.hpp"
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::PngLoader; using Tyra::PngLoader;
-2
View File
@@ -9,8 +9,6 @@
*/ */
#include "states/game/terrain/terrain.hpp" #include "states/game/terrain/terrain.hpp"
#include <loaders/3d/obj_loader/obj_loader.hpp>
#include <file/file_utils.hpp>
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::ObjLoader; using Tyra::ObjLoader;
-2
View File
@@ -9,8 +9,6 @@
*/ */
#include "states/intro/intro_state.hpp" #include "states/intro/intro_state.hpp"
#include "file/file_utils.hpp"
#include "debug/debug.hpp"
#include "states/intro/states/intro_ps2dev_state.hpp" #include "states/intro/states/intro_ps2dev_state.hpp"
#include "states/intro/states/intro_tyra_state.hpp" #include "states/intro/states/intro_tyra_state.hpp"
@@ -9,12 +9,7 @@
*/ */
#include "states/intro/states/intro_press_key_state.hpp" #include "states/intro/states/intro_press_key_state.hpp"
#include "loaders/texture/png_loader.hpp"
#include "file/file_utils.hpp"
#include "debug/debug.hpp"
#include <string> #include <string>
#include "thread/threading.hpp"
#include "math/math.hpp"
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::Math; using Tyra::Math;
@@ -9,10 +9,6 @@
*/ */
#include "states/intro/states/intro_ps2dev_state.hpp" #include "states/intro/states/intro_ps2dev_state.hpp"
#include "loaders/texture/png_loader.hpp"
#include "file/file_utils.hpp"
#include "debug/debug.hpp"
#include "thread/threading.hpp"
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::PngLoader; using Tyra::PngLoader;
@@ -9,11 +9,6 @@
*/ */
#include "states/intro/states/intro_tyra_state.hpp" #include "states/intro/states/intro_tyra_state.hpp"
#include "loaders/texture/png_loader.hpp"
#include "file/file_utils.hpp"
#include "debug/debug.hpp"
#include "thread/threading.hpp"
#include "math/math.hpp"
using Tyra::FileUtils; using Tyra::FileUtils;
using Tyra::Math; using Tyra::Math;