/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ fun cbCloseEdit(p)= let p -> [ctrlplayer1 ctrlplayer2 ctrllevels ctrlnbrunes ctrlinitialspeed ctrlinit] in let getEdCtrlTextLineValue ctrlplayer1 -> objname1 in let getEdCtrlTextLineValue ctrlplayer2 -> objname2 in let ftoi getEdCtrlFloatValue ctrllevels -> nblevels in let ftoi getEdCtrlFloatValue ctrlnbrunes -> nbrunes in let getEdCtrlFloatValue ctrlinitialspeed -> initialspeed in let getEdCtrlCheckState ctrlinit -> init in ["player1" objname1]:: ["player2" objname2]:: ["nblevels" itoa nblevels]:: ["" itoa nbrunes]:: ["initialSpeed" ftoa initialspeed]:: ["init" itoa init]:: nil;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrlobjname] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in if (obj != nil) || (!strcmpi "Current camera" val) || (!strcmpi "Current camera shell" val) then ( setEdCtrlTextLineValue ctrlobjname val; ) else nil; 0;; fun cbCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr ctrlobjname objname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeEntity|iTypeNode|iTypeLight|iTypeBone|iTypeCamera|iTypeParticle|iTypeCubeMap objname mkfun3 @cbSelectObj [inst winstr viewstr ctrlobjname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [420 180] -> [iw ih] in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "player1") -> player1 in let (getPluginInstanceParam inst "player2") -> player2 in let atof (getPluginInstanceParam inst "nblevels") -> nblevels in let if nblevels == nil then 16.0 else nblevels -> nblevels in let atof (getPluginInstanceParam inst "nbRunes") -> nbrunes in let if nbrunes == nil then 4.0 else nbrunes -> nbrunes in let atof (getPluginInstanceParam inst "initialSpeed") -> initialSpeed in let if initialSpeed == nil then 5.0 else initialSpeed -> initialSpeed in let atoi (getPluginInstanceParam inst "init") -> init in let if init == nil then 1 else init -> init in let crEdCtrlLabel winstr 10 12 160 20 "Player 1" nil -> labelobj in let crEdCtrlTextLine winstr 180 10 140 20 player1 nil EDWIN_RESIZE_MW -> ctrlplayer1 in let crEdCtrlButton winstr 325 10 55 20 "..." nil -> pickbtn1 in let crEdCtrlButton winstr 385 10 35 20 "X" nil -> refreshobjname1 in let crEdCtrlLabel winstr 10 37 160 20 "Player 2" nil -> labelobj in let crEdCtrlTextLine winstr 180 35 140 20 player2 nil EDWIN_RESIZE_MW -> ctrlplayer2 in let crEdCtrlButton winstr 325 35 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 35 35 20 "X" nil -> refreshobjname2 in let crEdCtrlLabel winstr 10 62 160 20 "Number of mesh levels" nil -> labelnblevel in let crEdCtrlFloat winstr 180 60 110 20 nblevels 0.0 1000000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrllevels in let crEdCtrlLabel winstr 10 87 160 20 "Nb runes" nil -> labelrunes in let crEdCtrlFloat winstr 180 85 110 20 nbrunes 0.0 100000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlnbrunes in let crEdCtrlLabel winstr 10 112 160 20 "Initial game speed" nil -> labelspeed in let crEdCtrlFloat winstr 180 110 110 20 initialSpeed 0.0 100000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlinitialspeed in let crEdCtrlCheck winstr 10 135 280 20 "Enable on init" EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlButtonCb pickbtn1 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlplayer1 player1]; setEdCtrlTextLineEnable ctrlplayer1 0; setEdCtrlButtonCb refreshobjname1 mkfun2 @cbRefreshBtn [ctrlplayer1]; setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlplayer2 player2]; setEdCtrlTextLineEnable ctrlplayer2 0; setEdCtrlButtonCb refreshobjname2 mkfun2 @cbRefreshBtn [ctrlplayer2]; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlplayer1 ctrlplayer2 ctrllevels ctrlnbrunes ctrlinitialspeed ctrlinit] nil]; ); );;