mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-01 01:38:14 +00:00
fixing issues qith 3D/2D Renderer systems
This commit is contained in:
+17
-30
@@ -13,11 +13,11 @@
|
||||
#include "Drawables/Image.hpp"
|
||||
#include "Drawables/3D/Grid.hpp"
|
||||
#include "Drawables/Texture.hpp"
|
||||
#include "Drawables/2D/Circle.hpp"
|
||||
#include "Drawables/3D/Circle.hpp"
|
||||
#include "Model/Model.hpp"
|
||||
#include "Model/ModelAnimations.hpp"
|
||||
#include "System/Renderer/Renderer2DSystem.hpp"
|
||||
#include "Component/Drawable/Drawable2DComponent.hpp"
|
||||
#include "System/Renderer/Renderer3DSystem.hpp"
|
||||
#include "Component/Drawable/Drawable3DComponent.hpp"
|
||||
#include "Vector/Vector3.hpp"
|
||||
#include "Window.hpp"
|
||||
#include "TraceLog.hpp"
|
||||
@@ -37,11 +37,10 @@ std::string get_full_path(const std::string &color)
|
||||
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
WAL::Wal wal;
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
std::vector<std::string>::const_iterator iterator = textures.begin();
|
||||
auto iterator = textures.begin();
|
||||
const std::string modelPath = "assets/player/player.obj";
|
||||
const std::string texturePath = "assets/player/blue.png";
|
||||
//const std::string animationPath = "assets/guy.iqm";
|
||||
@@ -55,6 +54,15 @@ int main()
|
||||
RAY::Vector3(0.0f, 1.0f, 0.0f),
|
||||
45.0f, CAMERA_PERSPECTIVE
|
||||
);
|
||||
WAL::Entity entityPlayer("roger");
|
||||
RAY::Drawables::Drawables3D::Circle circle({300, 300, 300}, 50, 0XFFFFFFF, {0, 0, 0}, 0);
|
||||
BBM::Drawable3DComponent<RAY::Drawables::Drawables3D::Circle> circleComponent(entityPlayer, circle);
|
||||
|
||||
BBM::Renderer3DSystem<RAY::Drawables::Drawables3D::Circle> circleSystem(window);
|
||||
|
||||
wal.addSystem(circleSystem);
|
||||
entityPlayer.addComponent(circleComponent);
|
||||
|
||||
RAY::Texture texture(get_full_path(*iterator));
|
||||
//RAY::ModelAnimations animations(modelPath);
|
||||
RAY::Drawables::Drawables3D::Grid grid(10, 1.0f);
|
||||
@@ -66,17 +74,12 @@ int main()
|
||||
camera.setMode(CAMERA_FREE); // Set free camera mode
|
||||
|
||||
float y_rotation = 0;
|
||||
window.setFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
window.setFPS(60);
|
||||
|
||||
// Main game loop
|
||||
while (!window.shouldClose()) // Detect window close button or ESC key
|
||||
while (!window.shouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
camera.update();
|
||||
|
||||
// Play animation when spacebar is held down
|
||||
if (RAY::Controller::Keyboard::isReleased(KEY_SPACE))
|
||||
{
|
||||
++iterator;
|
||||
@@ -88,33 +91,17 @@ int main()
|
||||
//animations[0].incrementFrameCounter();
|
||||
//model.setAnimation(animations[0]);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
window.setDrawingState(RAY::Window::DRAWING);
|
||||
|
||||
window.clear();
|
||||
|
||||
window.useCamera(camera);
|
||||
|
||||
window.draw(model, position, RAY::Vector3(1.0f, 20, 0.0f), -180.0f, RAY::Vector3( 5.0f, 5.0f, 5.0f ));
|
||||
|
||||
window.draw(grid);
|
||||
|
||||
window.unuseCamera();
|
||||
|
||||
window.draw(instructionText);
|
||||
|
||||
window.setDrawingState(RAY::Window::IDLE);
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
window.close(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
window.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user