-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
51 lines (40 loc) · 1.37 KB
/
Copy pathmain.cpp
File metadata and controls
51 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-3.0-or-later OR ISC
// Shadow Engine - see LICENSE for details
#include "Engine/Core/SDLApp.h"
#include "Engine/Core/Helpers.h"
#include "Engine/Version.h"
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <string>
class TopDownTileGame : public Game
{
public:
TopDownTileGame(const char* windowTitle, int width, int height) : Game(windowTitle, width, height) {}
void onStart() override {}
void initializeComponents() override
{
auto scene = std::make_unique<Scene>();
auto assets = getAssetManager();
scene->setAssetManager(assets);
scene->addItem(assets->createAsset<TileMap>("tilemap"));
auto tilemap = getAssetManager()->getAsset<TileMap>("tilemap");
// Generate Perlin noise map using Helpers.h
std::vector<std::vector<float>> mapData = PerlinNoiseGenerator::generatePerlinNoiseMap(20, 20);
// Set the float tile map data
tilemap->setTileMapData(mapData);
scene->getSpriteById("tilemap")->setBounds(0, 0, 700, 700);
addScene(std::move(scene));
}
};
int main(int argc, char* args[])
{
(void)argc;
(void)args;
std::cout << "Shadow Engine v" << UMBRA_VERSION_STRING << std::endl;
TopDownTileGame app("Shadow Engine v" UMBRA_VERSION_STRING, 700, 700);
app.run();
return 0;
}