updated TSE, and testet tileMap funktionality
This commit is contained in:
2
TSE
2
TSE
Submodule TSE updated: 2f3fdf83ae...330d4b26dc
BIN
TSE-RTS/Resources/Iso64DirtGrassRails.aseprite
Executable file
BIN
TSE-RTS/Resources/Iso64DirtGrassRails.aseprite
Executable file
Binary file not shown.
BIN
TSE-RTS/Resources/tiles.png
Normal file
BIN
TSE-RTS/Resources/tiles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
32
TSE-RTS/src/game.cpp
Normal file
32
TSE-RTS/src/game.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "game.hpp"
|
||||
#include "elements/Transformable.hpp"
|
||||
#include "BehaviourScripts/TileMap.hpp"
|
||||
#include "BehaviourScripts/Renderable.hpp"
|
||||
#include "elements/ShaderRegistry.hpp"
|
||||
|
||||
void game::setup(TSE::Scene* s)
|
||||
{
|
||||
using namespace TSE;
|
||||
s->AddLayer(&gameLayer);
|
||||
|
||||
Transformable* tileMap = new Transformable("tileMap");
|
||||
gameLayer.AddTransformable(tileMap);
|
||||
Texture* setTexture = new Texture("tiles.png");
|
||||
TileSet* set = new TileSet(setTexture, 10, 10);
|
||||
TileMap* map = new TileMap();
|
||||
map->set = set;
|
||||
|
||||
for (int x = -64; x < 64; x++)
|
||||
{
|
||||
for (int y = -64; y < 64; y++)
|
||||
{
|
||||
map->SetTile(Vector2(x, y), {0,9});
|
||||
}
|
||||
}
|
||||
|
||||
Material* tileMapMaterial = new Material("tileSetMat", ShaderRegistry::GetShader("Basic Unlit TileMap Shader"));
|
||||
Renderable* rnd = new Renderable(tileMapMaterial);
|
||||
|
||||
tileMap->AddBehaviourScript(map);
|
||||
tileMap->AddBehaviourScript(rnd);
|
||||
}
|
||||
10
TSE-RTS/src/game.hpp
Normal file
10
TSE-RTS/src/game.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "elements/Scene.hpp"
|
||||
|
||||
class game
|
||||
{
|
||||
public:
|
||||
inline static TSE::Layer gameLayer = TSE::Layer("gameLayer");
|
||||
|
||||
static void setup(TSE::Scene* s);
|
||||
};
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "elements/Layer.hpp"
|
||||
#include "elements/Scene.hpp"
|
||||
#include "EditorSubsystem.hpp"
|
||||
#include "game.hpp"
|
||||
|
||||
#define USE_EDITOR
|
||||
|
||||
@@ -41,7 +42,7 @@ void SetupWindow()
|
||||
rend = new DefaultRendererOpenGL(*BasicShader::Instance());
|
||||
currentScene = new Scene();
|
||||
|
||||
|
||||
game::setup(currentScene);
|
||||
|
||||
#ifdef USE_EDITOR
|
||||
currentScene->AddLayer(&editor->editorLayer);
|
||||
|
||||
Reference in New Issue
Block a user