Skip to main content
gamedev.net
🔒 Locked

Modules

Started by patrrr 0 replies 1.1k views
Original Post
patrrr
patrrr
Is it possible to call functions in other modules? I'm trying to setup a system where I have a "menu"-module, a "game"-module and a "init"-module, and the script should be able to move from one executing module to another, like menu -> game. They are basically game states. How can I do this? Any good solutions? Any better ideas of a system? Thanks in advance for any input. And thanks for a great script library!
WitchLord
WitchLord
Yes, you can call functions from other modules. To do that you need to import the function you want to call. The application must also be implemented to do the proper binding of the imported functions after building the modules.

The script will have something like this:

import void ImportedFunction(int param) from "module2";void Function(){  ImportedFunction(42);}


And the application will have something like this:

engine->Build("module1");engine->Build("module2");engine->BindAllImportedFunctions("module1");engine->BindAllImportedFunctions("module2");
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.