Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
colleagues:
does the vm have a callback for changing tablet orientation? atm, if I load the scene in portrait mode, and then tip the screen to landscape mode, the an edmainwindow will rotate 90 degrees, but, for example, if it is full screen, it won't be full screen any longer. the converse happens if I load a screen in landscape mode and rotate it to portrait mode
Offline
arg the windows desktop turn ?
no this is not managed
yes that would be another way of saying it. I'll tag it as an issue/but on redmine.
on the upside the vm will then have a function that can be ported to all those other little gadgets that users rotate around....
Offline
the window turn but change it's size ?
if this is the case you can regularly check to desktop size and update the windows when values are modified.
Offline
the window turn but change it's size ?
if this is the case you can regularly check to desktop size and update the windows when values are modified.
with a timer?
Offline
thx arkeon, are the
_CBcontainerPostRender
and
_CBcontainerPreRender
called automatically by the vm, as in an so3 scene?
Offline
yes every time the scene is rendered
great. I think (?) I know what to do. thx. maybe this is a way i can get those misbehaving loading screen(s) to work.
Offline
thx for your help guys....I ended up using SO3CbBufferPostRender because there isn't always an objcontanier that exists in my modded player. (octoplayerstruct holds all the additional features of my modded player...or it's supposed to. I'm trying to move all global variables into this struct, I remember from one of Iri's posts that the less global variables, the better. That's still a work in progress.
so I added:
SO3CbBufferPostRender viewstr.V3D_buffer mkfun3 @buffercallback octoplayerstruct nil;
to my mod of fun initOs3dPlayer
here is the callback. I've tested it on my tablet, except I haven't added a code to handle the opening screens. And whether they will behave well is another issue as well.
I leave that for another day...the opening screens do rotate when the tablet rotates. whether they will listen to new position coordinates is another matter)
octoplayerstruct.OCTOPLAYER_screen_oldsize holds the mainWindow screensize at startup, and is reset if the screen changes shape, which happens when it is rotated.
as I've seen, once os3d is up and running, everything is predictable.
fun buffercallback(buffer, userparameter,octoplayerstruct)=
let _GETdesktopSize -> [dw dh] in
let octoplayerstruct.OCTOPLAYER_screen_oldsize -> [ow oh] in
(
if (dw!=ow) || (dh!=oh) then
(
setEdWindowSizeEx mainWindow dw dh;
set octoplayerstruct.OCTOPLAYER_screen_oldsize = [dw dh];
0;
) else
(
nil;
0;
);
Is there a cheaper way to do this? My tablet doesn't appear to need a cheaper way, but I was wondering.
Last edited by hebdemnobad (4-Nov-2014 16:27:41)
Offline
you should not redefine SO3CbBufferPostRender on V3Dbuffer. you should use the callback from V3DView struct, or you will break OS3D projects functionnalities.
Offline
override V3DsetCbPostRender viewstr @cbPlugView3dPostRender; call, add your own callback and then don't forget to call cbPlugView3dPostRender for plugits.
Offline
thx arkeon....do i do this:
V3DsetCbPostRender viewstr @cbPlugView3dPostRender;
V3DsetCbPostRender viewstr @my_extra_callback;
or do I create a new function in the v3lib.pkg, like
fun V3DsetCbPostRender_octo_tablet_rotate = //code here...will I be able to pass a struct defined in my mod of os3dplayer.pkg to this function? will i be able to pass the mainWindow global variable defined in os3dplayer.pkg to this function? i pass both to the postrender callback I wrote
Last edited by hebdemnobad (4-Nov-2014 16:43:04)
Offline
no
fun my_extra_callback(viewstr)=
//your code
cbPlugView3dPostRender viewstr;
0;;
V3DsetCbPostRender viewstr @my_extra_callback;
Offline
aha, ingenious, thx. hopefully this will help me further customize my project without throwing a monkey wrench into the os3d architecture.
Offline
what arguments are passed to @my_extra_callback with V3DsetCbScenePostRender? I couldn't find any documentation of the callback prototype on redmine.
thx
Offline
The session structure and the callback.
By example :
V3DsetCbScenePostRender sessionstr @my_extra_callback;
in "tools / os3dlib / v3dlib.pkg", you can read :
fun V3DsetCbScenePostRender(sessionstr, cbfun)=
set sessionstr.V3D_cbScenePostRender = cbfun;
0;;
The prototype of this callback is :
fun [V3Dsession I] I
To know that, read the session structure definition, in the same file.
So,
V3Dseesion : the current session
I : the elapsed time
The function must return an integer ( I ).
If you need more arguments, use mkfun3 function.
Offline
thx Iri, i used mkfun3 as you said and I had found the answer myself in the v3lib.pkg file too....I hope I am groing out of these types of questions:
modified postrender declaration:
V3DsetCbScenePostRender sessionstr mkfun3 @buffercallback [octoplayerstruct viewstr];
modfied callback as per arkeon
fun buffercallback (sessionstr, etime, extra_parameter)=
let extra_parameter -> [octoplayerstruct viewstr] in
let _GETdesktopSize -> [dw dh] in
let octoplayerstruct.OCTOPLAYER_screen_oldsize -> [ow oh] in
(
cbPlugView3dPostRender viewstr;
if (dw!=ow) || (dh!=oh) then
(
setEdWindowSizeEx mainWindow dw dh;
set octoplayerstruct.OCTOPLAYER_screen_oldsize = [dw dh];
//change here
0;
) else
(
nil;
0;
);
);
nil;
0;;
time to see if it works on the tablet....
Offline
and it works
Offline
It's taken a while to understand the mkfun command. coming from a javascript background, callbacks usually don't have preset arguments sent to them, you set them yourself (or you set none at all).
I started writing a tutorial about this....from the perspective of a coder who doesn't know much about computer science.
Last edited by hebdemnobad (4-Nov-2014 19:32:46)
Offline
For that, the Scol tutorial by Sylvain Huet provides also a very short explanation (make a search "mkfun").
Offline
For that, the Scol tutorial by Sylvain Huet provides also a very short explanation (make a search "mkfun").
I have, many times. last night most recently.
The only way I have come to understand it is in the sense of adding arguments to functions that have a preset quantity of arguments. So I look at the function body without the mkfun word, add one to the default (prototype) arguments, which gives me the number (2, 3, whatever) that I have to make the function pass to carry an extra argument. (usually a tuple since you can put as many objects as you want in it.)
Last edited by hebdemnobad (4-Nov-2014 20:48:38)
Offline
Yes, it is correct
A function takes one argument. You need two arguments. You use mkfun2.
A function takes two arguments. You need three arguments. You use mkfun3.
etc
Indeed, set a tuple is the easiest way.
You can add several mkfunX instead of a tuple.
From this example, you obtain the same result with :
typeof tmrMain = Timer;;
typeof iCount = I;;
fun cbTick(tmr, pri_param, tupleParams) =
let tupleParams -> ["secondary_param_3" "secondary_param_2" "secondary_param_1"] in
_fooS strcatn (itoa iCount)::" "::pri_param::" "::sec_param_1::" "::sec_param_2::" "::sec_param_3::nil;
set iCount = iCount + 1;
if (iCount == 10) then
_deltimer tmrMain
else
0;
0;;
fun main() =
_showconsole;
_fooS "***********************************";
set iCount = 0;
set tmrMain = _starttimer _channel 100;
_rfltimer tmrMain mkfun3 @cbTick "primary_param" ["secondary_param_3" "secondary_param_2" "secondary_param_1"];
_fooS "***********************************";
0;;
I think also this way is easier and more comprehensive.
A remark : if you use a mkfunX, the called function has a new prototype.
In this example, cbTick is normally fun [ Timer S ] I
but with mkfun3, its protype is fun [ Timer S [S S S] ] I
You can not call cbTick with its "normal" type from another part of code in a given environment.
{
An environment is the whole of Scol apis and all functions defined (loaded) in a channel, typically, an application. The minimal environment is the Scol APIs only, they are loaded in the startup, you can see them in any log head file.
A channel is a network connection with a given environment.
}
Offline