Change to init app in init()
This commit is contained in:
10
src/App.cpp
10
src/App.cpp
@@ -6,12 +6,13 @@
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
|
||||
App::App(int screenWidth, int screenHeight) : screenWidth(screenWidth), screenHeight(screenHeight), trees({Tree(screenWidth), Tree(screenWidth)})
|
||||
void App::init(int screenWidth, int screenHeight)
|
||||
{
|
||||
}
|
||||
this->screenWidth = screenWidth;
|
||||
this->screenHeight = screenHeight;
|
||||
trees.emplace_back(screenWidth);
|
||||
trees.emplace_back(screenWidth);
|
||||
|
||||
void App::init()
|
||||
{
|
||||
for (auto &&tree : trees)
|
||||
tree.newTree();
|
||||
|
||||
@@ -20,7 +21,6 @@ void App::init()
|
||||
destA = CalculateRect(center, rotation, screenWidth, screenWidth);
|
||||
destB = {destA.x, destA.y, (float)screenWidth, (float)screenWidth};
|
||||
}
|
||||
|
||||
void App::update()
|
||||
{
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
|
||||
|
||||
@@ -16,8 +16,8 @@ int main(void)
|
||||
#endif
|
||||
SetTargetFPS(60);
|
||||
|
||||
App app(screenWidth, screenHeight);
|
||||
app.init();
|
||||
App app;
|
||||
app.init(screenWidth, screenHeight);
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
app.update();
|
||||
|
||||
Reference in New Issue
Block a user