Skip to content

Commit

Permalink
fixes :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kade-github committed Apr 17, 2024
1 parent c073374 commit 80ea1d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Engine/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void Game::Render()
swappedScenes = true;
}

glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport(0, 0, _camera->width, _camera->height);

Expand Down
32 changes: 19 additions & 13 deletions src/Game/Scenes/BlockTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@

BlockTest::BlockTest()
{
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
glGenBuffers(1, &EBO);

t = Texture::createWithImage("Assets/Textures/block.png");

}

void BlockTest::ChangeBlock()
Expand Down Expand Up @@ -106,12 +100,6 @@ void BlockTest::ChangeBlock()

void BlockTest::Draw()
{
Shader* s = Game::instance->shader;

s->Bind();

t->Bind();

Camera* cam = Game::instance->GetCamera();

glm::vec2 mousePos = Game::instance->GetCursorPos(false);
Expand Down Expand Up @@ -161,6 +149,12 @@ void BlockTest::Draw()

cam->SetDirection();

Shader* s = Game::instance->shader;

s->Bind();

t->Bind();

glBindVertexArray(VAO);

glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0);
Expand All @@ -176,4 +170,16 @@ void BlockTest::Draw()

void BlockTest::KeyPress(int key)
{
}
}

void BlockTest::Create() {
Game::instance->SetLockedCursor(true);

glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
glGenBuffers(1, &EBO);

t = Texture::createWithImage("Assets/Textures/block.png");

ChangeBlock();
}
2 changes: 1 addition & 1 deletion src/Game/Scenes/BlockTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BlockTest : public Scene
BlockTest();

void ChangeBlock();

void Create() override;
void Draw() override;
void KeyPress(int key) override;
};
Expand Down

0 comments on commit 80ea1d2

Please sign in to comment.