entity system!
This commit is contained in:
57
src/game/Level.cpp
Normal file
57
src/game/Level.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "Level.h"
|
||||
#include "Log.h"
|
||||
#include "Global.h"
|
||||
#include "Instance.h"
|
||||
#include <bx/math.h>
|
||||
#include <bgfx/bgfx.h>
|
||||
|
||||
namespace Game
|
||||
{
|
||||
void Level::Setup(GameData& data)
|
||||
{
|
||||
Log("Level setup");
|
||||
Cubes.Setup(data.EntityStorage);
|
||||
if (Cubes.Count == 0)
|
||||
{
|
||||
uint64_t state = 0
|
||||
| BGFX_STATE_WRITE_RGB
|
||||
| BGFX_STATE_WRITE_A
|
||||
| BGFX_STATE_WRITE_Z
|
||||
| BGFX_STATE_DEPTH_TEST_LESS
|
||||
| BGFX_STATE_CULL_CW
|
||||
| BGFX_STATE_MSAA;
|
||||
|
||||
for (uint32_t yy = 0; yy < 11; ++yy)
|
||||
{
|
||||
for (uint32_t xx = 0; xx < 11; ++xx)
|
||||
{
|
||||
Cube* c = Cubes.New();
|
||||
if (c)
|
||||
{
|
||||
c->TestX = xx;
|
||||
c->TestY = yy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Level::Update()
|
||||
{
|
||||
Cubes.Update();
|
||||
}
|
||||
|
||||
void Cube::Setup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Cube::Update()
|
||||
{
|
||||
double time = GetInstance().Now;
|
||||
bx::mtxRotateXY(Transform.M, time + TestX * 0.1f, time * 2 + TestY * .37f);
|
||||
Transform.M[12] = -15.0f + float(TestX) * 3.0f;
|
||||
Transform.M[13] = -15.0f + float(TestY) * 3.0f;
|
||||
Transform.M[14] = 0.0f;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user