Jump to content
TheConceptBoy

C++ oriented Project without destroying Lua Interpreter?

Recommended Posts

Good day, everyone. 

I've gotten a hang of setting up a fresh blank C++ project without much issues. But it is doe by completely wiping the all the code from the Main.cpp, importing the Leadwerks.h library and working my way up from there. When a project is created like this, "from a blank page", this destroys all the Lua connections to the engine and you are no longer able to use Lua in the engine, right? I think Lua has it's place, it's like blueprints in Unreal and I wanted to see how do you go about proceeding with the game development from that blank project? It seems as if this block here is where the app window should be created: 
        

	App* app = new App;
	if (app->Start())
	{

		Map::Load("Maps/city01.map");
		while (app->Loop()) {
		
		

and in the while loop, is where you game logic would go. But that seems to not be the case. The app starts, blanks the screen and closes immediately. I would like to see if I can get a C++ project running without destroying the initial Lua interpreter setup. Where am I to look for the clues?

Share this post


Link to post

Lua scripts still work, you just removed the entry point being the Main.lua script. You can execute any script using a function call. Check out App.cpp for more details.

Share this post


Link to post

I too have been mystified by this blank project problem. I replace all the default source files and substitute my own files but if I use the default files instead  where do I start to enter my own code?

Share this post


Link to post
On 6/13/2019 at 11:45 AM, cassius said:

I too have been mystified by this blank project problem. I replace all the default source files and substitute my own files but if I use the default files instead  where do I start to enter my own code?

Generally I've seen 2 schools of thought: delete all of App.cpp and put your code in here while leaving main.cpp alone, or delete all of main.cpp and leave App.cpp alone. 

I've had success by leaving App.cpp be and writing all my code in main.cpp. Delete all the code that's in that file, stick an include for Leadwerks.h and using namespace Leadwerks at the top, and then create a bool main() with a while (true) loop in there, and you're set to go.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...