updated TSE, and testet tileMap funktionality

This commit is contained in:
2026-02-08 18:11:47 +01:00
parent b6c623efbb
commit 8ec2a43187
6 changed files with 45 additions and 2 deletions

2
TSE

Submodule TSE updated: 2f3fdf83ae...330d4b26dc

Binary file not shown.

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
View 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
View 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);
};

View File

@@ -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);