split screen after using _IrrSetActiveCamera

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
kokoilie
Posts: 9
Joined: Sun Sep 02, 2012 3:47 pm

split screen after using _IrrSetActiveCamera

Post by kokoilie »

hello
i'm coding a game in autoit3 which is going to be split screen 2player game
but i can't figure out how to change from the menu camera (the main menu is in 3D and uses _IrrGetCollisionNodeFromCamera to read which menu button is pressed) to the player cameras in split screen

any help will be appreciated, thanks in advance
CuteAlien
Admin
Posts: 10045
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: split screen after using _IrrSetActiveCamera

Post by CuteAlien »

Use 2 cameras and change the active one when you are in menu/game.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kokoilie
Posts: 9
Joined: Sun Sep 02, 2012 3:47 pm

Re: split screen after using _IrrSetActiveCamera

Post by kokoilie »

the problem is that when i start it it sets the active camera to the one in the menu and then i can't set both player cameras as active
CuteAlien
Admin
Posts: 10045
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: split screen after using _IrrSetActiveCamera

Post by CuteAlien »

Sorry, not sure about what is the problem. Splitscreen already uses several cameras - one for each screen. Each one is set active before rendering it's part of the screen. You can also replace all those by a menu-camera. Or is the problem the input? I mean there is obviously only one mouse-cursor (as most computers these days have only one mouse), so moving that independent in 4 menues won't be easy to solve.

Try to describe your problem more detailed, so far I don't really get where you are stuck.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kokoilie
Posts: 9
Joined: Sun Sep 02, 2012 3:47 pm

Re: split screen after using _IrrSetActiveCamera

Post by kokoilie »

ok so first of all i create three cameras

Code: Select all

 
$camera[2] = -10    ;posx
$camera[3] = 0      ;posy
$camera[4] = 50     ;posz
$camera[5] = 0      ;tarposx
$camera[6] = 0      ;tarposy
$camera[7] = 0      ;tarposz
$p1cam[2] = -10     ;posx
$p1cam[3] = 100     ;posy
$p1cam[4] = 60      ;posz
$p1cam[5] = 0       ;tarposx
$p1cam[6] = 100     ;tarposy
$p1cam[7] = 0       ;tarposz
$p2cam[2] = -10     ;posx
$p2cam[3] = 100     ;posy
$p2cam[4] = 60      ;posz
$p2cam[5] = 0       ;tarposx
$p2cam[6] = 100     ;tarposy
$p2cam[7] = 0       ;tarposz
$Camera[0] = _IrrAddCamera($camera[2], $camera[3], $camera[4], $camera[5], $camera[6], $camera[7])
$p1cam[0] = _IrrAddCamera($p1cam[2], $p1cam[3], $p1cam[4], $p1cam[5], $p1cam[6], $p1cam[7])
$p2cam[0] = _IrrAddCamera($p2cam[2], $p2cam[3], $p2cam[4], $p2cam[5], $p2cam[6], $p2cam[7])
then i set the menu ($camrea[0]) as active

my question is how to make the other two work as split screen after i click "Play"

for now i'm using this row

Code: Select all

_IrrSetActiveCamera($p1cam[0]); & $p2cam[0])
but it sets player1's camera as active
CuteAlien
Admin
Posts: 10045
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: split screen after using _IrrSetActiveCamera

Post by CuteAlien »

Ow ... just seeing now you mentioned autoit3. I fear I can't be of much help there as I know neither that language nor did I knew about that Irrlicht wrapper.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kokoilie
Posts: 9
Joined: Sun Sep 02, 2012 3:47 pm

Re: split screen after using _IrrSetActiveCamera

Post by kokoilie »

so that means i have to improvise some creativity

anyway the autoit's language is (as my brother states, i never tryed to learn C++) similar to C++
also how come you didn't know about the wrapper? isn't it your creation?
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: split screen after using _IrrSetActiveCamera

Post by hybrid »

No, we don't provide any wrappers on our own. All the wrappers are community projects, and thus not necessarily known to us. Especially if the wrapped language is of the more exotic ones. So it might be that some support is simply lacking here.
kokoilie
Posts: 9
Joined: Sun Sep 02, 2012 3:47 pm

Re: split screen after using _IrrSetActiveCamera

Post by kokoilie »

ok i found where i'm doing it wrong
*i still don't understand how i didn't notice in the begining*
in the example it's calculating the frames like this

Code: Select all

_IrrBeginScene( 240, 255, 255 )
 
    ; draw the scene on the left
    _IrrSetActiveCamera( $FirstCamera )
    _IrrSetViewPort( 0,0,400,600 )
    _IrrDrawScene()
 
    ; draw the scene on the left
    _IrrSetActiveCamera( $SecondCamera )
    _IrrSetViewPort( 400,0,800,600 )
    _IrrDrawScene()
 
    ; set the viewport back to the whole screen
    _IrrSetViewPort( 0,0, 800,600 )
so that half the screen is shown by one camera and the other by the other
also sorry to bother you
kokoilie
Posts: 9
Joined: Sun Sep 02, 2012 3:47 pm

_IrrGetCameraOrientation

Post by kokoilie »

once more i'm saying sorry to bother and bring this thread back but i hope i can find some help here about the return values of IrrGetCameraOrientation.
if the autoit wrapper doesn't change it much you should be able to tell me what it returns and how to use it (hopefully display it as degrees)
thanks in advance
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: _IrrGetCameraOrientation

Post by serengeor »

I can't really help you, but I was wondering, why do you program something like this in a language like that?
Does it have any sort of advantage for you, over just using irrlicht with c++ ?
Working on game: Marrbles (Currently stopped).
kokoilie
Posts: 9
Joined: Sun Sep 02, 2012 3:47 pm

Re: _IrrGetCameraOrientation

Post by kokoilie »

the advantage (at least for me) is that autoit's help if complete and is easier for me to program in it than c++ (which i'm still trying to learn)

anyway can someone tell me how to use this function's return values or it's used only in the wrapper?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: _IrrGetCameraOrientation

Post by serengeor »

kokoilie wrote:anyway can someone tell me how to use this function's return values or it's used only in the wrapper?
Looking at the documentation:

Code: Select all

_IrrGetCameraOrientation($h_Camera, ByRef $a_Vector1, ByRef $a_Vector2, ByRef $a_Vector3)
you should probably use it something like:

Code: Select all

 
Dim $forward, $upward, $sideways, $ret
$ret = _IrrGetCameraOrientation($myCamera, $forward, $upward, $sideways)
 
Though I'm not sure, as I don't really know auto it.

EDIT:
There's example in documentation how to use this function ._.
Working on game: Marrbles (Currently stopped).
Post Reply