bkornienko Posted October 20, 2016 Share Posted October 20, 2016 Hello guys! I am newbie in this Engine. I would like to ask you for help. I set up small scene with editor where I put a camera and crawler. I have already done couple of tutorials of changing it run-time (and creating it actually runtime). But what if I want to manipulate with objects which I put on editor? How do I do it? And if you provide some links to resources where I can learn it deeply I would really appreciate it. Quote Link to comment Share on other sites More sharing options...
bkornienko Posted October 20, 2016 Author Share Posted October 20, 2016 And yeah. Also I discovered that there is Main.lua started. And what if I want to run my C++ code when push "Play" button in editor? Quote Link to comment Share on other sites More sharing options...
Roland Posted October 21, 2016 Share Posted October 21, 2016 To use C++ you should open Projects\Windows\<your projectname>.sln in Visual Studio and compile. If you don't want Main.Lua to be executed you can go for a more clean approach and replace main.cpp with something like this #include "Leadwerks.h" #include <sstream> using namespace Leadwerks; int main(int argc, const char *argv[]) { // Initialize Steamworks (optional) // Steamworks::Initialize(); // Create the app window Window* window = Window::Create("My Game", 0, 0, 1024, 768, Window::Titlebar); // and some context to draw on Context* context = Context::Create(window, 0); if (context == nullptr) { return 1; } // The world containg all objects World* world = World::Create(); // Load a map into the world if (!Map::Load( "Maps/start.map" ) { return 2; } // Loop until window is closed or user presses ESCAPE bool showstats = false; while (!window->KeyDown(Key::Escape) && !window->Closed()) { Time::Update(); world->Update(); world->Render(); context->SetBlendMode(Blend::Alpha); showstats = window->KeyHit(Key::F11) ? !showstats : showstats; if (showstats) { ostringstream fps; fps << "FPS: " << Math::Round(Time::UPS()); context->SetColor(1, 0, 0, 1); context->DrawText("Debug Mode", 2, 2); context->SetColor(1, 1, 1, 1); context->DrawText(fps.str(), 2, 2); context->DrawStats(2, 22); context->SetBlendMode(Blend::Solid); } context->Sync(true); } return 0; } Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Charrua Posted October 21, 2016 Share Posted October 21, 2016 hi, here there are some notes i wrote about c++ lua bindings http://www.leadwerks.com/werkspace/blog/183/entry-1612-lua-cpp-bindings-how-to-tutorial-17/ once yo compile your c++ code, that one is used from the Leadwearks editor when you press paly/debug on the editor. Quote Paren el mundo!, me quiero bajar. 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.