Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
LazarBojanic committed Oct 20, 2023
1 parent 7bad65e commit 8eef6df
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"files.associations": {
"*.page-template": "vue",
"*.layout-template": "vue",
"*.vue": "vue",
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"filesystem": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
}
}
4 changes: 3 additions & 1 deletion src/GameObjectManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class GameObjectManager{
std::vector<GameObject*>* getGameObjectsByTag(std::string tag);
void removeGameObject(GameObject* gameObject);
void clear(bool reinitialize);

inline std::vector<GameObject*>* getGameObjectList() {
return this->gameObjectList;
}
};

13 changes: 13 additions & 0 deletions src/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ Renderer* Renderer::getInstance(){
return instance;
}

void Renderer::drawAll(bool scaled) {
std::vector<GameObject*>* gameObjectList = GameObjectManager::getInstance()->getGameObjectList();
for (int i = 0; i < gameObjectList->size(); i++) {
draw(*gameObjectList->at(i), scaled);
}
}
void Renderer::drawAllUntextured(bool scaled) {
std::vector<GameObject*>* gameObjectList = GameObjectManager::getInstance()->getGameObjectList();
for (int i = 0; i < gameObjectList->size(); i++) {
drawUntextured(*gameObjectList->at(i), scaled);
}
}

void Renderer::draw(GameObject& gameObject, bool scaled) {
glm::mat4 modelView = glm::mat4(1.0f);
modelView = glm::translate(modelView, glm::vec3(glm::vec2(gameObject.getPositionX(), gameObject.getPositionY()), 0.0f));
Expand Down
4 changes: 3 additions & 1 deletion src/Renderer.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "Util.hpp"
#include "GameObject.hpp"
#include "ResourceManager.hpp"
#include "GameObjectManager.hpp"

class Renderer {
private:
Expand All @@ -12,7 +12,9 @@ class Renderer {

public:
static Renderer* getInstance();
void drawAll(bool scaled);
void draw(GameObject& gameObject, bool scaled);
void drawAllUntextured(bool scaled);
void drawUntextured(GameObject& gameObject, bool scaled);
void colorBackground(glm::vec4 color);
};
Binary file modified x64/Release/LazarOpe.3ad642ad.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified x64/Release/LazarOpe.3ad642ad.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified x64/Release/LazarOpe.3ad642ad.tlog/CL.write.1.tlog
Binary file not shown.
Binary file modified x64/Release/LazarOpenGLEngine2D.exe
Binary file not shown.

0 comments on commit 8eef6df

Please sign in to comment.