AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
00001 // 00002 // 00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine 00004 // 00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk 00006 // 00007 // For updates, tutorials and more details check out www.appeasymobile.com 00008 // 00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin. 00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support 00011 // 00012 // 00013 00014 #if !defined(_CZ_COMMANDS_BASE_H_) 00015 #define _CZ_COMMANDS_BASE_H_ 00016 00017 #include "CzProgram.h" 00018 #include "CzTime.h" 00019 00020 // 00021 // 00022 // 00023 // CzCommandNop - Nop command - This command does nothing and is used for commands with no method 00024 // 00025 // 00026 // 00027 class CzCommandNop : public CzCommand 00028 { 00029 public: 00030 void Init(); 00031 bool Execute(float dt); 00032 }; 00033 class CzCommandNopCreator : public CzCommandCreator 00034 { 00035 public: 00036 CzCommandNopCreator() 00037 { 00038 setCommandName("nop"); 00039 } 00040 CzCommand* CreateInstance() { return new CzCommandNop(); } 00041 }; 00042 00043 // 00044 // 00045 // 00046 // CzCommandChangeProgram - Change command - Changes a program 00047 // 00048 // 00049 // 00050 class CzCommandChangeProgram : public CzCommand 00051 { 00052 public: 00053 bool Execute(float dt); 00054 }; 00055 class CzCommandChangeProgramCreator : public CzCommandCreator 00056 { 00057 public: 00058 CzCommandChangeProgramCreator() 00059 { 00060 setCommandName("change"); 00061 } 00062 CzCommand* CreateInstance() { return new CzCommandChangeProgram(); } 00063 }; 00064 00065 // 00066 // 00067 // 00068 // CzCommandGoto - Goto command - This command changed execution from the current command to the spcific command 00069 // 00070 // 00071 // 00072 class CzCommandGoto : public CzCommand 00073 { 00074 public: 00075 bool Execute(float dt); 00076 }; 00077 class CzCommandGotoCreator : public CzCommandCreator 00078 { 00079 public: 00080 CzCommandGotoCreator() 00081 { 00082 setCommandName("goto"); 00083 } 00084 CzCommand* CreateInstance() { return new CzCommandGoto(); } 00085 }; 00086 00087 // 00088 // 00089 // 00090 // CzCommandStop - Stop command - This command stops execution of the program 00091 // 00092 // 00093 // 00094 class CzCommandStop : public CzCommand 00095 { 00096 public: 00097 bool Execute(float dt) 00098 { 00099 if (!IzCommandExecutor::Execute(dt)) 00100 return false; 00101 Program->stop(); 00102 return false; 00103 } 00104 }; 00105 class CzCommandStopCreator : public CzCommandCreator 00106 { 00107 public: 00108 CzCommandStopCreator() 00109 { 00110 setCommandName("stop"); 00111 } 00112 CzCommand* CreateInstance() { return new CzCommandStop(); } 00113 }; 00114 00115 // 00116 // 00117 // 00118 // CzCommandPriority - Priority command - This command changes the current program that has priority exection 00119 // 00120 // 00121 // 00122 class CzCommandPriority : public CzCommand 00123 { 00124 public: 00125 bool Execute(float dt); 00126 }; 00127 class CzCommandPriorityCreator : public CzCommandCreator 00128 { 00129 public: 00130 CzCommandPriorityCreator() 00131 { 00132 setCommandName("priority"); 00133 } 00134 CzCommand* CreateInstance() { return new CzCommandPriority(); } 00135 }; 00136 00137 // 00138 // 00139 // 00140 // CzCommandCall - Call command - Calls another program, pausing the current program 00141 // 00142 // 00143 // 00144 class CzCommandCall : public CzCommand 00145 { 00146 public: 00147 bool Execute(float dt); 00148 }; 00149 class CzCommandCallCreator : public CzCommandCreator 00150 { 00151 public: 00152 CzCommandCallCreator() 00153 { 00154 setCommandName("call"); 00155 } 00156 CzCommand* CreateInstance() { return new CzCommandCall(); } 00157 }; 00158 00159 // 00160 // 00161 // 00162 // CzCommanReturn - Return command - Returns another program, pausing the current program 00163 // 00164 // 00165 // 00166 class CzCommandReturn : public CzCommand 00167 { 00168 public: 00169 bool Execute(float dt) 00170 { 00171 if (!IzCommandExecutor::Execute(dt)) 00172 return false; 00173 00174 Program->returnToCaller(); 00175 00176 return false; 00177 } 00178 }; 00179 class CzCommandReturnCreator : public CzCommandCreator 00180 { 00181 public: 00182 CzCommandReturnCreator() 00183 { 00184 setCommandName("return"); 00185 } 00186 CzCommand* CreateInstance() { return new CzCommandReturn(); } 00187 }; 00188 00189 // 00190 // 00191 // 00192 // CzCommandRunActions - Run Actions - Applies an actions list to a scene or actor. Param 1 - action to execute, Param 2 - Actor or scene to apply actions, Param3 - Scene in which actor lives (optional) 00193 // 00194 // 00195 // 00196 class CzCommandRunActions : public CzCommand 00197 { 00198 public: 00199 bool Execute(float dt); 00200 }; 00201 class CzCommandRunActionsCreator : public CzCommandCreator 00202 { 00203 public: 00204 CzCommandRunActionsCreator() 00205 { 00206 setCommandName("run_actions"); 00207 } 00208 CzCommand* CreateInstance() { return new CzCommandRunActions(); } 00209 }; 00210 00211 // 00212 // 00213 // 00214 // CzCommandSetProperty - Set property - Sets a property of an actor/ scene. Param 1 - Property to set, Param2 - Property value, Param 3 - Actor whos property to change, Param4 - Scene in which actor lives (optional) or scene who's property to change 00215 // 00216 // 00217 // 00218 class CzCommandSetProperty : public CzCommand 00219 { 00220 public: 00221 bool Execute(float dt); 00222 }; 00223 class CzCommandSetPropertyCreator : public CzCommandCreator 00224 { 00225 public: 00226 CzCommandSetPropertyCreator() 00227 { 00228 setCommandName("set_property"); 00229 } 00230 CzCommand* CreateInstance() { return new CzCommandSetProperty(); } 00231 }; 00232 00233 // 00234 // 00235 // 00236 // CzCommandSetUserProp - Set property - Sets a user property of an actor / scene. Param 1 - User property to set, Param2 - Property value, Param 3 - Actor whos property to change, Param4 - Scene in which actor lives (optional) or scene who's user property to change 00237 // 00238 // 00239 // 00240 class CzCommandSetUserProp : public CzCommand 00241 { 00242 public: 00243 bool Execute(float dt); 00244 }; 00245 class CzCommandSetUserPropCreator : public CzCommandCreator 00246 { 00247 public: 00248 CzCommandSetUserPropCreator() 00249 { 00250 setCommandName("set_userprop"); 00251 } 00252 CzCommand* CreateInstance() { return new CzCommandSetUserProp(); } 00253 }; 00254 00255 // 00256 // 00257 // 00258 // CzCommandAddVariable - Add variable - Adds a value onto a variable. Param 1 - variable to modify, Param2 - Value to add, Param3 - Scene in which variable lives (optional) 00259 // 00260 // 00261 // 00262 class CzCommandAddVariable : public CzCommand 00263 { 00264 public: 00265 bool Execute(float dt); 00266 }; 00267 class CzCommandAddVariableCreator : public CzCommandCreator 00268 { 00269 public: 00270 CzCommandAddVariableCreator() 00271 { 00272 setCommandName("add_var"); 00273 } 00274 CzCommand* CreateInstance() { return new CzCommandAddVariable(); } 00275 }; 00276 00277 // 00278 // 00279 // 00280 // CzCommandSetVariable - Set variable - Sets a variables value. Param 1 - variable to set, Param2 - Variables value, Param3 - Scene in which variable lives (optional) 00281 // 00282 // 00283 // 00284 class CzCommandSetVariable : public CzCommand 00285 { 00286 public: 00287 bool Execute(float dt); 00288 }; 00289 class CzCommandSetVariableCreator : public CzCommandCreator 00290 { 00291 public: 00292 CzCommandSetVariableCreator() 00293 { 00294 setCommandName("set_var"); 00295 } 00296 CzCommand* CreateInstance() { return new CzCommandSetVariable(); } 00297 }; 00298 00299 // 00300 // 00301 // 00302 // CzCommandGetVariable - Get variable - Gets a variables value. Param 1 - variable to get, Param3 - Scene in which variable lives (optional) 00303 // 00304 // 00305 // 00306 class CzCommandGetVariable : public CzCommand 00307 { 00308 public: 00309 bool Execute(float dt); 00310 }; 00311 class CzCommandGetVariableCreator : public CzCommandCreator 00312 { 00313 public: 00314 CzCommandGetVariableCreator() 00315 { 00316 setCommandName("get_var"); 00317 } 00318 CzCommand* CreateInstance() { return new CzCommandGetVariable(); } 00319 }; 00320 00321 // 00322 // CzCommandIfVar - Checks variable against a value - Param1 - variable to check, Param2 - operator, Param3 - value, Param4 - Scene where variable is located (optional) 00323 // 00324 class CzCommandIfVar : public CzCommand 00325 { 00326 public: 00327 bool Execute(float dt); 00328 }; 00329 class CzCommandIfVarCreator : public CzCommandCreator 00330 { 00331 public: 00332 CzCommandIfVarCreator() 00333 { 00334 setCommandName("if_var"); 00335 } 00336 CzCommand* CreateInstance() { return new CzCommandIfVar(); } 00337 }; 00338 00339 // 00340 // CzCommandWaitVarIsValue - Wait for a variable to becoem a specific value - Param1 - variable to check, Param2 - Value that variable should be to continue, Param3 - Scene where variable is located (optional) 00341 // 00342 class CzCommandWaitVarIsValue : public CzCommand 00343 { 00344 public: 00345 bool Execute(float dt); 00346 }; 00347 class CzCommandWaitVarIsValueCreator : public CzCommandCreator 00348 { 00349 public: 00350 CzCommandWaitVarIsValueCreator() 00351 { 00352 setCommandName("wait_var_is_value"); 00353 } 00354 CzCommand* CreateInstance() { return new CzCommandWaitVarIsValue(); } 00355 }; 00356 00357 // 00358 // CzCommandCallScript - Calls a script - Param1 - script function to call, Param2 - scene to pass, Param3, Param4, Param5 - Params to pass to script function 00359 // 00360 class CzCommandCallScript : public CzCommand 00361 { 00362 public: 00363 bool Execute(float dt); 00364 }; 00365 class CzCommandCallScriptCreator : public CzCommandCreator 00366 { 00367 public: 00368 CzCommandCallScriptCreator() 00369 { 00370 setCommandName("call_script"); 00371 } 00372 CzCommand* CreateInstance() { return new CzCommandCallScript(); } 00373 }; 00374 00375 // 00376 // CzCommandCallGlobalScript - Calls a global script - Param1 - script function to call, Param2, Param3, Parm4 - Params to pass to script function 00377 // 00378 class CzCommandCallGlobalScript : public CzCommand 00379 { 00380 public: 00381 bool Execute(float dt); 00382 }; 00383 class CzCommandCallGlobalScriptCreator : public CzCommandCreator 00384 { 00385 public: 00386 CzCommandCallGlobalScriptCreator() 00387 { 00388 setCommandName("call_global_script"); 00389 } 00390 CzCommand* CreateInstance() { return new CzCommandCallGlobalScript(); } 00391 }; 00392 00393 // 00394 // CzCommandInline - Calls a script - Param1 - script to run, Param2 - scene to run script in, if not supplied then global script space is used 00395 // 00396 class CzCommandInline : public CzCommand 00397 { 00398 public: 00399 bool Execute(float dt); 00400 }; 00401 class CzCommandInlineCreator : public CzCommandCreator 00402 { 00403 public: 00404 CzCommandInlineCreator() 00405 { 00406 setCommandName("inline"); 00407 } 00408 CzCommand* CreateInstance() { return new CzCommandInline(); } 00409 }; 00410 00411 // 00412 // CzCommandFromTemplate - Instantiates a template - Param1 - template name, Param2 - Parameters to pass to template (separated by colon character), Param3 - Scene to instantiate template into (optional) 00413 // 00414 class CzCommandFromTemplate : public CzCommand 00415 { 00416 public: 00417 bool Execute(float dt); 00418 }; 00419 class CzCommandFromTemplateCreator : public CzCommandCreator 00420 { 00421 public: 00422 CzCommandFromTemplateCreator() 00423 { 00424 setCommandName("from_template"); 00425 } 00426 CzCommand* CreateInstance() { return new CzCommandFromTemplate(); } 00427 }; 00428 00429 // 00430 // CzCommandFromTemplate - Loads a XOMl file - Param1 - filename, Param2 - Name of scene to load XOML data into, if not supplied then XOML is loaded globally (default) 00431 // 00432 class CzCommandLoadXOML : public CzCommand 00433 { 00434 public: 00435 bool Execute(float dt); 00436 }; 00437 class CzCommandLoadXOMLCreator : public CzCommandCreator 00438 { 00439 public: 00440 CzCommandLoadXOMLCreator() 00441 { 00442 setCommandName("load_xoml"); 00443 } 00444 CzCommand* CreateInstance() { return new CzCommandLoadXOML(); } 00445 }; 00446 00447 // 00448 // CzCommandMusic - Play or stop music, Param1 - command (play or stop), Param2 - music file name to play, Param3 - Repeat count (0 play forever) 00449 // 00450 class CzCommandMusic : public CzCommand 00451 { 00452 public: 00453 bool Execute(float dt); 00454 }; 00455 class CzCommandMusicCreator : public CzCommandCreator 00456 { 00457 public: 00458 CzCommandMusicCreator() 00459 { 00460 setCommandName("music"); 00461 } 00462 CzCommand* CreateInstance() { return new CzCommandMusic(); } 00463 }; 00464 00465 // 00466 // CzCommandSound - Play sound effect, Param1 - Sound effect name to play, Param2 - volume, Param3 - pitch, Param4 - pan, Param5 - specific scene (optional) 00467 // 00468 class CzCommandSound : public CzCommand 00469 { 00470 public: 00471 bool Execute(float dt); 00472 }; 00473 class CzCommandSoundCreator : public CzCommandCreator 00474 { 00475 public: 00476 CzCommandSoundCreator() 00477 { 00478 setCommandName("sound"); 00479 } 00480 CzCommand* CreateInstance() { return new CzCommandSound(); } 00481 }; 00482 00483 // 00484 // CzCommandWait - Waits specified amount of time, Param1 - Time to wait in seconds 00485 // 00486 class CzCommandWait : public CzCommand 00487 { 00488 protected: 00489 CzTimer Timer; 00490 public: 00491 void Init(); 00492 bool Execute(float dt); 00493 }; 00494 class CzCommandWaitCreator : public CzCommandCreator 00495 { 00496 public: 00497 CzCommandWaitCreator() 00498 { 00499 setCommandName("wait"); 00500 } 00501 CzCommand* CreateInstance() { return new CzCommandWait(); } 00502 }; 00503 00504 // 00505 // CzCommandDebugText - Writes dbug text to the output, Param1 - text / var, Param2 = text / var 00506 // 00507 class CzCommandDebugText : public CzCommand 00508 { 00509 protected: 00510 public: 00511 bool Execute(float dt); 00512 }; 00513 class CzCommandDebugTextCreator : public CzCommandCreator 00514 { 00515 public: 00516 CzCommandDebugTextCreator() 00517 { 00518 setCommandName("debug_text"); 00519 } 00520 CzCommand* CreateInstance() { return new CzCommandDebugText(); } 00521 }; 00522 00523 // 00524 // CzCommandRemoteReq - Requests remote data, Param1 - RemoteReq resource name, Param2 = optional data to pass to request 00525 // 00526 class CzCommandRemoteReq : public CzCommand 00527 { 00528 protected: 00529 public: 00530 bool Execute(float dt); 00531 }; 00532 class CzCommandRemoteReqCreator : public CzCommandCreator 00533 { 00534 public: 00535 CzCommandRemoteReqCreator() 00536 { 00537 setCommandName("remote_req"); 00538 } 00539 CzCommand* CreateInstance() { return new CzCommandRemoteReq(); } 00540 }; 00541 00542 00543 #endif // _CZ_COMMANDS_BASE_H_