Skip to content

Commit

Permalink
Actually no, don't create new batch every frame
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelOtter committed May 9, 2024
1 parent 7eac4c0 commit 1523685
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/test_app/src/test_app_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ Error TestAppGame::init() {
getAPI().system().setInputProcessor(input.get());
getAPI().system().setLogLevel(LogLevel::Debug);

batch = getAPI().graphics().createBatch();

return nullptr;
}

Expand Down Expand Up @@ -178,7 +180,6 @@ void TestAppGame::render() {
cats->setY(catY);
cats->setRotation(rotation);

auto batch = getAPI().graphics().createBatch();
batch->clear(0, 0, 0);
batch->begin();

Expand Down
2 changes: 2 additions & 0 deletions example/test_app/src/test_app_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "growl/core/assets/font_face.h"
#include "growl/core/error.h"
#include "growl/core/game/game.h"
#include "growl/core/graphics/batch.h"
#include "growl/core/graphics/font_texture_atlas.h"
#include "growl/core/graphics/texture.h"
#include "growl/core/graphics/texture_atlas.h"
Expand All @@ -26,6 +27,7 @@ class TestAppGame : public Game {
void resize(const int width, const int height) override;

private:
std::unique_ptr<Batch> batch;
std::unique_ptr<TextureAtlas> texture_atlas;
std::unique_ptr<Texture> grass_tiled;
std::unique_ptr<InputHandler> input;
Expand Down

0 comments on commit 1523685

Please sign in to comment.