Skip to content

Commit

Permalink
Git Release bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianensis committed Sep 14, 2020
1 parent 3125ebd commit 88ba2b1
Show file tree
Hide file tree
Showing 14 changed files with 1,148 additions and 11,698 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endif(ENABLE_LOGS)
if(UNIX)
set(CMAKE_CXX_FLAGS_ALL "${CMAKE_CXX_FLAGS_ALL} -std=c++17") # this macro was invented by me
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_ALL} -D DE_DEBUG -ffast-math -mavx")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_ALL} -Ofast -ffast-math -mavx")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_ALL} -O3 -ffast-math -mavx")
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_ALL} -Ofast -ffast-math -mavx")
endif(UNIX)

Expand Down
7 changes: 7 additions & 0 deletions code/include/UI/UIBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class UIElementData: public DE_Class {
bool mIsAffectedByLayout;
f32 mSeparatorSize;
Vector4 mBackgroundColor;
Vector4 mBackgroundColor2;
Vector4 mBackgroundColor3;
Vector4 mBackgroundColor4;

void init(const Vector2 &position, const Vector2 &size, const std::string& text, u32 layer);

Expand All @@ -63,6 +66,9 @@ class UIElementData: public DE_Class {
mLayer = otherData.mLayer;
mIsAffectedByLayout = otherData.mIsAffectedByLayout;
mBackgroundColor = otherData.mBackgroundColor;
mBackgroundColor2 = otherData.mBackgroundColor2;
mBackgroundColor3 = otherData.mBackgroundColor3;
mBackgroundColor4 = otherData.mBackgroundColor4;

return *this;
}
Expand Down Expand Up @@ -98,6 +104,7 @@ class UIBuilder: public DE_Class, public Singleton<UIBuilder> {
UIBuilder* const setLayer(u32 layer);
UIBuilder* const setText(const std::string& text);
UIBuilder* const setBackgroundColor(Vector4 backgroundColor);
UIBuilder* const restoreColors();
UIBuilder* const setLayout(UILayout layout);
UIBuilder* const setIsAffectedByLayout(bool affectedByLayout);
UIBuilder* const setSeparatorSize(f32 separatorSize);
Expand Down
12 changes: 2 additions & 10 deletions code/source/Core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,9 @@ void Engine::init() {

void Engine::initSubsystems() {



//mRenderEngine = RenderEngine::getInstance();
//mScriptEngine = ScriptEngine::getInstance();
//mPhysicsEngine = PhysicsEngine::getInstance();

f32 sceneSize = ScenesManager::getInstance()->getCurrentScene()->getSize();

if (sceneSize == 0) {
sceneSize = Settings::getInstance()->getF32("scene.defaultSize");
}
// TODO : set default scene size if scene size is 0

RenderEngine::getInstance()->init(sceneSize);
ScriptEngine::getInstance()->init();
Expand Down Expand Up @@ -151,7 +143,7 @@ void Engine::run() {
}

Time::getInstance()->endFrame();
std::cout << " " << 1.0f/Time::getInstance()->getDeltaTimeSeconds() << std::endl;
//std::cout << " " << 1.0f/Time::getInstance()->getDeltaTimeSeconds() << std::endl;


}
Expand Down
2 changes: 0 additions & 2 deletions code/source/Input/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ void Input::mouseButtonCallback(GLFWwindow *window, int button, int action, int

if (action == GLFW_PRESS) {

bool pressedOnce = Input::getInstance()->isMouseButtonPressedOnce(button);

Input::getInstance()->smLastMouseButtonPressed = button;
Input::getInstance()->smButtonJustPressed = true;

Expand Down
17 changes: 14 additions & 3 deletions code/source/Scene/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ void Scene::init() {
cameraComponent->setOrtho(-720, 720, -720, 720, 1, -1);

setCameraGameObject(cameraGameObject);

// SET DEFAULT SIZE
mSize = Settings::getInstance()->getF32("scene.defaultSize");
}

// ---------------------------------------------------------------------------
Expand All @@ -104,6 +107,10 @@ void Scene::loadScene(const std::string &path) {

mSize = configMap->getF32("scene.size");

if (mSize == 0) {
mSize = Settings::getInstance()->getF32("scene.defaultSize");
}

u32 length = configMap->getU32("objects.length");

Material* material = MaterialManager::getInstance()->loadMaterial("resources/tiles.png");
Expand All @@ -112,6 +119,11 @@ void Scene::loadScene(const std::string &path) {
std::string indexStr = std::to_string(i);
std::string objectStr = "objects[" + indexStr + "]";

GameObject* gameObject = Memory::allocate<GameObject>();
gameObject->init();

gameObject->setTag(configMap->getString(objectStr + ".tag"));

Vector2 worldPosition(configMap->getF32(objectStr + ".worldPosition.x"),
configMap->getF32(objectStr + ".worldPosition.y"));

Expand All @@ -121,9 +133,6 @@ void Scene::loadScene(const std::string &path) {
Vector2 textureRegionSize(configMap->getF32(objectStr + ".texture.region.width"),
configMap->getF32(objectStr + ".texture.region.height"));

GameObject* gameObject = Memory::allocate<GameObject>();
gameObject->init();

gameObject->getTransform()->setLocalPosition(Vector3(worldPosition.x, worldPosition.y, 0));
gameObject->getTransform()->setScale(Vector3(size.x, size.y, 1));

Expand Down Expand Up @@ -172,6 +181,8 @@ void Scene::saveScene(const std::string &path) {
std::string indexStr = std::to_string(counter);
std::string objectStr = "objects[" + indexStr + "]";

configMap->setString(objectStr + ".tag", it.get()->getTag());

Transform* t = it.get()->getTransform();
Vector3 worldPosition = t->getWorldPosition();
Vector3 scale = t->getScale();
Expand Down
29 changes: 20 additions & 9 deletions code/source/UI/UIBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ void UIElementData::init(const Vector2 &position, const Vector2 &size, const std
mLayer = layer;
mIsAffectedByLayout = true;
mSeparatorSize = 0.01f;
mBackgroundColor = Vector4(0,0,0,1);
mBackgroundColor = Vector4(0.5,0.5,0.5,1);
mBackgroundColor2 = Vector4(0.6,0.6,0.6,1);
mBackgroundColor3 = Vector4(0.4,0.4,0.4,1);
mBackgroundColor4 = Vector4(0.5,0.5,0.5,0.7);
}

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -115,6 +118,14 @@ UIBuilder* const UIBuilder::setSeparatorSize(f32 separatorSize) {
return this;
}

UIBuilder* const UIBuilder::restoreColors() {
mData.mBackgroundColor = Vector4(0.5,0.5,0.5,1);
mData.mBackgroundColor2 = Vector4(0.6,0.6,0.6,1);
mData.mBackgroundColor3 = Vector4(0.4,0.4,0.4,1);
mData.mBackgroundColor4 = Vector4(0.5,0.5,0.5,0.7);
return this;
}

UIBuilder* const UIBuilder::restoreSeparatorSize() {
mData.mSeparatorSize = 0.01f;
return this;
Expand Down Expand Up @@ -181,9 +192,9 @@ UIElement* UIBuilder::createPanel() {
renderer->setMesh(Mesh::getRectangle());
//renderer->setMaterial(mButtonMaterial);
renderer->setMaterial(MaterialManager::getInstance()->loadNoTextureMaterial());
renderer->setColor(mData.mBackgroundColor);
renderer->setColor(mData.mBackgroundColor4);
renderer->setLayer(mData.mLayer);
renderer->setHasBorder(true);
//renderer->setHasBorder(true);

uiPanel->setComponentsCache();

Expand Down Expand Up @@ -220,8 +231,8 @@ UIButton* UIBuilder::createButton() {
renderer->setMesh(Mesh::getRectangle());
renderer->setMaterial(MaterialManager::getInstance()->loadNoTextureMaterial());
renderer->setLayer(mData.mLayer);
renderer->setColor(mData.mBackgroundColor);
renderer->setHasBorder(true);
renderer->setColor(mData.mBackgroundColor2);
//renderer->setHasBorder(true);

RigidBody* rigidBody = Memory::allocate<RigidBody>();
uiButton->addComponent<RigidBody>(rigidBody);
Expand Down Expand Up @@ -336,8 +347,8 @@ UITextEditable* UIBuilder::createTextEditable() {

renderer->setMesh(Mesh::getRectangle());
renderer->setMaterial(MaterialManager::getInstance()->loadNoTextureMaterial());
renderer->setColor(mData.mBackgroundColor);
renderer->setHasBorder(true);
renderer->setColor(mData.mBackgroundColor3);
//renderer->setHasBorder(true);

mScene->addGameObject(background);

Expand Down Expand Up @@ -371,9 +382,9 @@ UIDropdown* UIBuilder::createDropdown() {

renderer->setMesh(Mesh::getRectangle());
renderer->setMaterial(MaterialManager::getInstance()->loadNoTextureMaterial());
renderer->setColor(mData.mBackgroundColor);
renderer->setColor(mData.mBackgroundColor2);
renderer->setLayer(mData.mLayer);
renderer->setHasBorder(true);
//renderer->setHasBorder(true);

RigidBody* rigidBody = Memory::allocate<RigidBody>();
uiDropdown->addComponent<RigidBody>(rigidBody);
Expand Down
7 changes: 2 additions & 5 deletions config/engine.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ scene.sortByYCoordinate=true
line.renderers.count=1000
scene.maxLayers=10
#scenes.length=0
#scenes.length=1
#scenes[0]=config/sceneTmp.conf
scenes.length=2
scenes[0]=config/sceneTmp1.conf
scenes[1]=config/sceneTmp2.conf
scenes.length=1
scenes[0]=config/sceneTmp.conf
Loading

0 comments on commit 88ba2b1

Please sign in to comment.