demo update
This commit is contained in:
@@ -49,10 +49,12 @@ class Enemy {
|
||||
void animationCallback(const AnimationSequenceCallback& callback);
|
||||
void fight();
|
||||
void handlePlayerShoot(const PlayerShootAction& shootAction);
|
||||
void setMeshToSpawn();
|
||||
|
||||
bool isWalking = true;
|
||||
bool isFighting = false;
|
||||
Vec4 spawnPoint;
|
||||
Vec4 terrainLeftUp;
|
||||
Vec4 terrainRightDown;
|
||||
|
||||
Audio* audio;
|
||||
EnemyInfo info;
|
||||
|
||||
@@ -25,7 +25,8 @@ struct EnemyInfo {
|
||||
DynamicMesh* motherMesh;
|
||||
Texture* bodyTexture;
|
||||
Texture* clothTexture;
|
||||
Vec4 spawnPoint;
|
||||
Vec4 terrainLeftUp;
|
||||
Vec4 terrainRightDown;
|
||||
};
|
||||
|
||||
} // namespace Demo
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
#include "./terrain/terrain.hpp"
|
||||
#include "./skybox/skybox.hpp"
|
||||
#include "./ship/ship.hpp"
|
||||
#include "./hud/hud.hpp"
|
||||
#include "./enemy/enemy_manager.hpp"
|
||||
|
||||
using std::unique_ptr;
|
||||
|
||||
namespace Demo {
|
||||
|
||||
class GameState : public State<GlobalStateType> {
|
||||
@@ -44,11 +47,12 @@ class GameState : public State<GlobalStateType> {
|
||||
u8 fpsChecker;
|
||||
|
||||
GameRenderer renderer;
|
||||
Player* player;
|
||||
EnemyManager* enemyManager;
|
||||
Terrain* terrain;
|
||||
Skybox* skybox;
|
||||
Ship* ship;
|
||||
unique_ptr<Player> player;
|
||||
unique_ptr<EnemyManager> enemyManager;
|
||||
unique_ptr<Terrain> terrain;
|
||||
unique_ptr<Skybox> skybox;
|
||||
unique_ptr<Ship> ship;
|
||||
unique_ptr<Hud> hud;
|
||||
};
|
||||
|
||||
} // namespace Demo
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# 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 <memory>
|
||||
|
||||
using std::unique_ptr;
|
||||
using Tyra::Sprite;
|
||||
using Tyra::Texture;
|
||||
using Tyra::TextureRepository;
|
||||
|
||||
namespace Demo {
|
||||
|
||||
class Hud {
|
||||
public:
|
||||
Hud(TextureRepository* repo);
|
||||
~Hud();
|
||||
|
||||
TextureRepository* repo;
|
||||
Texture* hpTexture;
|
||||
unique_ptr<Sprite> hpSprite;
|
||||
Texture* crosshairTexture;
|
||||
unique_ptr<Sprite> crosshairSprite;
|
||||
};
|
||||
|
||||
} // namespace Demo
|
||||
@@ -14,8 +14,10 @@
|
||||
#include "./renderer_static_pair.hpp"
|
||||
#include "./renderer_dynamic_pair.hpp"
|
||||
|
||||
using Tyra::CoreBBox;
|
||||
using Tyra::DynamicPipeline;
|
||||
using Tyra::Renderer;
|
||||
using Tyra::Sprite;
|
||||
using Tyra::StaticPipeline;
|
||||
|
||||
namespace Demo {
|
||||
@@ -29,10 +31,10 @@ class GameRenderer {
|
||||
void add(std::vector<RendererDynamicPair*> dynamicPairs);
|
||||
void add(RendererStaticPair* staticPair);
|
||||
void add(RendererDynamicPair* dynamicPair);
|
||||
void add(Sprite* sprite);
|
||||
void add(const CoreBBox& bbox);
|
||||
|
||||
void clear();
|
||||
|
||||
void renderSkybox(const RendererStaticPair& pair);
|
||||
void render();
|
||||
|
||||
private:
|
||||
@@ -43,6 +45,8 @@ class GameRenderer {
|
||||
|
||||
std::vector<RendererStaticPair*> staticPairs;
|
||||
std::vector<RendererDynamicPair*> dynamicPairs;
|
||||
std::vector<Sprite*> sprites;
|
||||
std::vector<CoreBBox> bboxes;
|
||||
};
|
||||
|
||||
} // namespace Demo
|
||||
|
||||
Reference in New Issue
Block a user