Josh Posted January 30, 2017 Share Posted January 30, 2017 I want to get rid of the C++ App class and modify all examples to work in the main function like this: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Window::Create(); Context* context = Context::Create(window); World* world = World::Create(); Camera* camera = Camera::Create(); camera->SetRotation(35, 0, 0); camera->Move(0, 0, -4); Light* light = DirectionalLight::Create(); light->SetRotation(35, 35, 0); //Create a model Model* model = Model::Box(); while (true) { if (window->Closed() || window->KeyDown(Key::Escape)) return false; model->SetPosition(Math::Sin(Time::GetCurrent() / 10.0), 0, 0); Leadwerks::Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); context->DrawText(model->GetPosition().ToString(), 2, 2); context->Sync(); } return 0; } Your existing projects that use App.cpp will still work and don't have to be changed. 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
f13rce Posted January 30, 2017 Share Posted January 30, 2017 I think that is better than we have right now. Whenever I start a new project I have to get rid of the Start and Loop function and write it from scratch which looks similar to that. Removing the App class does make you assume that there's only one application per run, which is a perfectly fine standpoint. I don't see anyone making two games in one executable. It's also good that there's less (perhaps unnecessary) overhead now, makes it easier to understand what's going on. In case people do want multiple applications in one executable then they can create their own App class. I'd say do it. Quote Using Leadwerks Professional Edition (Beta), mainly using C++. Windows 10 / Linux Mint, Visual Studio 2017. GPU: NVidia GeForce GTX970, CPU: Intel i7 7700K @ 4.20 GHz Previously known as Evayr. Link to comment Share on other sites More sharing options...
Josh Posted January 30, 2017 Author Share Posted January 30, 2017 The reason this was originally implemented is mobile, which is no longer relevant. If this is ever again pursued, threads can be used to control the program execution so that the Main loop still runs as expected. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted January 30, 2017 Share Posted January 30, 2017 As long as the stock code after creating a new project is still set up to run the main script, I'm fine with the App Class going. Like Evar, I usually delete it anyway, Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.