Jump to content
  • Advertisement
Sign in to follow this  
Quillraven

Question about class inheritance in AngelScript

This topic is 2607 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[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]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!