Advertisement

Question about class inheritance in AngelScript

Started by October 21, 2011 06:27 AM
-1 comments, last by Quillraven 13 years, 4 months ago
[font=arial, verdana, tahoma, sans-serif][size=2]hi,

i hope this is the right forum for this kind of questions. first of all i'm new to angelscript so pls don't blame me for not knowing everything.

i wanted to use angelscript for the following:
- in my c++ project i want to define interfaces like a unit in a game or a gamestate
- in .as files i want to define the specific implementations of the interfaces like a goblin unit or a mainmenu gamestate

however i couldn't find a good tutorial that is up to date to help me developing this idea.

i know how to initialize the scriptengine and how to execute a function of a script and how to execute a c++ function by a script. i also read something about registering classes and methods (f.e. here: http://www.angelcode..._hierarchy.html).

so what exactly do i need to get the following to work:
- i have one class that is used for rendering something to the screen
- i have an IGameState interface that defines four methods: init, exit, update and render
- i have a MainMenu.as file that defines the specific MainMenu gamestate that is inherited from IGameState

do i only need to register the render method of the renderclass if the mainmenu class only calls the render method?
do i need to register the entire IGameState interface althoug the methods aren't implemented?
how do i register the mainmenu class? i defined a register function in the mainmenu.as script that registers the mainmenu class but i'm not sure if this is the correct way.
how am i able to call the render method of the mainmenu class?

if anyone has a short tutorial code or sthg, that would be really helpful.

what i've got so far (some code snippets):
renderclass - http://codepad.org/TTXSdvu8
MainMenu.as - http://codepad.org/btqC79sk
IGameState - http://codepad.org/4nNp6Ew3


sorry for my bad english, i hope you understand what i mean.[/font]

This topic is closed to new replies.

Advertisement