libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moConsole.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moConsole.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 *******************************************************************************/
30 
31 //#define MO_DEBUG
32 
33 #ifndef __MOCONSOLE_H
34 #define __MOCONSOLE_H
35 
36 
37 //TYPES GENERALES
38 #include <moTypes.h>
39 #include <moText.h>
40 
41 //RESOURCES MANAGER
42 #include <moResourceManager.h>
43 
44 //EFFECTS MANAGER
45 #include <moEffectManager.h>
46 
47 //CONFIGURATIONS - STATES
48 #include <moConfig.h>
49 #include <moPresets.h>
50 #include <moConsoleState.h>
51 
52 //IO MANAGER - PLUGINS
53 #include <moIODevicePlugin.h>
54 #include <moIODeviceManager.h>
55 
56 #include <moTimeManager.h>
57 
58 #define MO_MAX_EFFECT 40
59 #define MO_MAX_PRESETS 9
60 #define MO_NO_EFFECT -1
61 
62 #define MO_CFG_EFFECT 0
63 #define MO_CFG_EFFECT_CONFIG 1
64 #define MO_CFG_EFFECT_LABEL 2
65 #define MO_CFG_EFFECT_PRE 3
66 #define MO_CFG_EFFECT_ON 4
67 #define MO_CFG_EFFECT_KEY 5
68 
69 #define MO_CFG_ACCION_STR 0
70 #define MO_CFG_ACCION_COD 1
71 #define MO_CFG_ACCION_CODDISP 2
72 
73 
74 #define MAX_SELECCIONADOS 255
75 
76 #define MO_DEF_SCREEN_WIDTH 800
77 #define MO_DEF_SCREEN_HEIGHT 600
78 #define MO_DEF_RENDER_WIDTH 800
79 #define MO_DEF_RENDER_HEIGHT 600
80 
81 #define MO_SCREEN_WIDTH 800
82 #define MO_SCREEN_HEIGHT 600
83 #define MO_SCREEN_DEPTH 32
84 
85 
86 
88 
89  public:
90 
93  virtual ~moPresetParamDefinition();
94 
96 
101 
102 
103 };
104 
106 
107 
112 
131 };
132 
134 
148 
149  public:
150 
154  moConsole();
155 
156 
160  virtual ~moConsole();
161 
162 
164 
167  virtual MOboolean Init();
168 
169 
171 
184  virtual MOboolean Init(
185  moText p_apppath,
186  moText p_datapath,
187  moText p_consoleconfig,
188  moIODeviceManager* p_pIODeviceManager = NULL,
189  moResourceManager *p_pResourceManager = NULL,
190  moRenderManagerMode p_render_to_texture_mode = RENDERMANAGER_MODE_NORMAL,
191  MOint p_screen_width = MO_DEF_SCREEN_WIDTH, MOint p_screen_height = MO_DEF_SCREEN_HEIGHT,
192  MOint p_render_width = MO_DEF_RENDER_WIDTH, MOint p_render_height = MO_DEF_RENDER_HEIGHT,
193  MO_HANDLE p_OpWindowHandle = 0,
194  MO_DISPLAY p_Display = NULL );
195 
196 
198 
203  virtual int Interaction();
204 
205 
207 
210  virtual void Update();
211 
212 
214 
217  virtual void Draw();
218  virtual void DrawMasterEffects( int interface_width=0, int interface_height=0 );
219 
221 
224  virtual MOboolean Finish();
225 
226 
228 
243  virtual void InitResources(moResourceManager *pResourceManager,
244  moText p_apppath,
245  moText p_datapath,
246  moConfig& p_consoleconfig,
247  MOint p_render_to_texture_mode = MO_RENDER_TO_TEXTURE_FBSCREEN,
248  MOint p_screen_width = MO_DEF_SCREEN_WIDTH, MOint p_screen_height = MO_DEF_SCREEN_HEIGHT,
249  MOint p_render_width = MO_DEF_RENDER_WIDTH, MOint p_render_height = MO_DEF_RENDER_HEIGHT,
250  MO_HANDLE p_OpWindowHandle = 0,
251  MO_DISPLAY p_Display = NULL);
252 
253 
254  virtual int Save( const moText& p_save_filename = moText("") );
255 
257 
263  void SetIODeviceManager( moIODeviceManager* p_IODeviceManager );
264 
266 
275  moConfigDefinition* GetDefinition( moConfigDefinition *p_configdefinition = NULL );
276 
278 
286  bool LabelNameExists( const moText& labelname );
287 
288  moMoldeoObjects& GetMoldeoObjects();
289  moEffectManager& GetEffectManager();
290 
291  int RelativeToGeneralIndex( int relativeindex, moMoldeoObjectType p_type );
292 
293 
294  int ProcessSessionKey( const moDataSessionKey & p_session_key );
295  int ProcessSessionEventKey( const moDataSessionEventKey & p_session_event_key );
296 
298 
302  void ConsolePlay();
303 
305 
308  void ConsolePlaySession();
309 
311 
314  void ConsoleRecordSession();
315 
317 
320  void ConsoleRenderSession( const moText& p_frame_quality=moText("JPGGOOD") );
321 
323 
326  void ConsoleSaveSessionAs();
327 
329 
333  void ConsolePause();
334 
336 
340  void ConsoleStop();
341 
343 
350  moTimerState GetConsoleState();
351 
353 
362  moConsoleMode GetConsoleMode();
363 
364  void ConsoleModeUpdate();
365 
366  int SetEffectState( int m_MoldeoObjectId, const moEffectState& p_effect_state );
367  int SetParam( int m_MoldeoObjectId, int m_ParamId, const moParamDefinition &p_param_definition );
368  int SetValue( int m_MoldeoObjectId, int m_ParamId, int m_ValueId, const moValue &p_value );
369  int RefreshValue( int m_MoldeoObjectId, int m_ParamId, int m_ValueId, bool p_Refresh=true );
370  int EffectPlay( int m_MoldeoObjectId );
371  int EffectPause( int m_MoldeoObjectId );
372  int EffectStop( int m_MoldeoObjectId );
373  int ObjectEnable( int m_MoldeoObjectId );
374  int ObjectDisable( int m_MoldeoObjectId );
375 
377 
387  int GetPreset();
388 
390 
400  void SetPreset( int presetid );
401 
403 
411  int GetPreconf( int objectid );
412 
414 
422  void SetPreconf( int objectid, int preconfid );
423 
424  void SetTicks( int ticksid );
425 
429  virtual moMoldeoObject* GetObjectByIdx( int p_object_id );
430 
434  int GetObjectId( const moText& p_objectlabelname );
435 
436 
437 
438  int GetDirectoryFileCount( const moText& p_path );
439 
440 
441  void ProcessConsoleMessage( moMessage* p_pMessage );
442 
443 
445 
448  int ProcessMoldeoAPIMessage( moDataMessage* p_pDataMessage );
449  int SendMoldeoAPIMessage( moDataMessage* p_pDataMessage );
450 
454  void ScriptExeDraw();
455  int ScriptCalling(moLuaVirtualMachine& vm, int iFunctionNumber);
456  void RegisterFunctions();
457 
458  const moText& ToJSON();
459 
460  int TestScreen( const moDisplay& p_display_info );
461 
462  int NewMob( const moMobDefinition &p_MobDef );
463  int AddChildMob( const moMobDefinition &p_MobDef, const moMobDefinition &p_MobDefFather );
464  int MoveMob( const moMobDefinition& p_MobDef, int position );
465  int DuplicateMob( const moMobDefinition& p_MobDef );
466  int DeleteMob( const moMobDefinition& p_MobDef );
467 
468  virtual void Error( const moText &p_message );
469 
470  protected:
471 
479  int luaPlay( moLuaVirtualMachine& vm );
480  int luaPause( moLuaVirtualMachine& vm );
481  int luaStop( moLuaVirtualMachine& vm );
482  int luaState( moLuaVirtualMachine& vm );
483 
484  int luaGetPreset(moLuaVirtualMachine& vm);
485  int luaSetPreset(moLuaVirtualMachine& vm);
486 
487  int luaGetTicks(moLuaVirtualMachine& vm);
488  int luaSetTicks(moLuaVirtualMachine& vm);
489 
494  int luaGetObjectId( moLuaVirtualMachine& vm );
495  int luaGetObjectPreconf(moLuaVirtualMachine& vm);
496  int luaSetObjectPreconf(moLuaVirtualMachine& vm);
497  int luaGetObjectParamIndex(moLuaVirtualMachine& vm);
498  int luaGetObjectParamValues(moLuaVirtualMachine& vm);
499  int luaSetObjectCurrentValue(moLuaVirtualMachine& vm);
500  int luaGetObjectCurrentValue(moLuaVirtualMachine& vm);
502  int luaGetObjectDataIndex(moLuaVirtualMachine& vm);
503  int luaGetObjectData(moLuaVirtualMachine& vm);
504  int luaSetObjectData(moLuaVirtualMachine& vm);
506  int luaObjectDisable(moLuaVirtualMachine& vm);
507  int luaObjectEnable(moLuaVirtualMachine& vm);
510  int luaSetEffectState(moLuaVirtualMachine& vm);
511  int luaGetEffectState(moLuaVirtualMachine& vm);
512 
517  int luaGetDeviceCode(moLuaVirtualMachine& vm);
518  int luaGetDeviceCodeId(moLuaVirtualMachine& vm);
519  int luaAddEvent(moLuaVirtualMachine& vm);
520 
531  int luaGetDirectoryFileCount(moLuaVirtualMachine& vm);
532  int luaScreenshot(moLuaVirtualMachine& vm);
533 
535  int luaGetTextureId(moLuaVirtualMachine& vm);
536 
537  int luaAddTexture(moLuaVirtualMachine& vm);
538  int luaGetTexture(moLuaVirtualMachine& vm);
539  int luaDeleteTexture(moLuaVirtualMachine& vm);
540 
541  int luaGet(moLuaVirtualMachine& vm);
542 
543 
545 
548  virtual MOulong GetTicks();
549  virtual void GLSwapBuffers();
550  virtual void GUIYield();
551 
553 
555 
558  moMoldeoObjects m_MoldeoObjects;
559  moMoldeoObjects m_MoldeoSceneObjects;
562 
563 
565 
566  int idebug,iligia,iborrado;
567 
571  MOuint ticks, ticksprevious, tickselapsed;
574 
575 
581 
583 
584  void UpdateMoldeoIds();
585  void LoadConnections();
586 
587  void LoadResources();
588  void UnloadResources();
589  void LoadIODevices();
590  void UnloadIODevices();
591  void AddMoldeoAPIDevices();
592  void LoadMasterEffects();
593  void UnloadMasterEffects();
594  void LoadPreEffects();
595  void UnloadPreEffects();
596  void LoadEffects();
597  void UnloadEffects();
598  void LoadPostEffects();
599  void UnloadPostEffects();
600 
601  void InitializeAllEffects();
602  void FinalizeAllEffects();
603 
604  void StartMasterEffects();
605  void StopMasterEffects();
606 
607  void InitPrevTexture();
608 
609  void SaveStatus(int);
610  void LoadStatus(int);
611 
612  MOint ConvertKeyNameToIdx(moText& name);
613 
614  void LoadObjects( moMoldeoObjectType fx_type = MO_OBJECT_UNDEFINED );
615 
616  moPresetParams m_PresetParams;
617 };
618 #endif
int iligia
Definition: moConsole.h:566
Valor de un Parámetro.
Definition: moValue.h:501
moEffectManager m_EffectManager
Definition: moConsole.h:560
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
virtual int Save(const moText &p_save_filename=moText(""))
moConsoleMode
#define MOulong
Definition: moTypes.h:392
moText m_LastScreenshot
Definition: moConsole.h:573
moRenderManagerMode
moPresetParams m_PresetParams
Definition: moConsole.h:616
moDatas moDataMessage
Definition: moValue.h:149
moText m_ScreenshotPath
Definition: moConsole.h:576
Estado de la consola.
#define MOboolean
Definition: moTypes.h:385
MOboolean m_bIODeviceManagerDefault
Definition: moConsole.h:556
virtual int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)
Objeto Consola.
Definition: moConsole.h:147
#define MO_RENDER_TO_TEXTURE_FBSCREEN
#define MO_DEF_SCREEN_HEIGHT
Definition: moConsole.h:77
Clase Mensaje.
Definition: moEventList.h:97
moText m_ScreenshotFormat
Definition: moConsole.h:579
#define LIBMOLDEO_API
Definition: moTypes.h:180
definición de todos los parámetros a encontrar o a crear dentro del moConfig
Definition: moConfig.h:57
long m_ScriptTimecodeOffset
Definition: moConsole.h:582
moText m_ConsoleScript
Definition: moConsole.h:564
MOboolean m_bExternalResources
Definition: moConsole.h:554
clase de para manejar textos
Definition: moText.h:75
moIODeviceManager * m_pIODeviceManager
Definition: moConsole.h:557
Clase Base Descriptiva de un Objeto Moldeo.
virtual moConfigDefinition * GetDefinition(moConfigDefinition *p_configdefinition=NULL)
moText0 moText
Definition: moText.h:291
moText fps_text
Definition: moConsole.h:572
#define MOint
Definition: moTypes.h:388
moTimerState
Estado del temporizador.
Definition: moTimer.h:75
MOuint ticksprevious
Definition: moConsole.h:571
moConsoleState m_ConsoleState
Definition: moConsole.h:552
moEffectState m_State
Definition: moConsole.h:100
Clase Base para Objetos Moldeo ( moEffect, moIODevice, moResource, moConsole )
MOdouble fps_current
Definition: moConsole.h:568
Administrador de recursos.
virtual void Update(moEventList *p_EventList)
moMoldeoObjects m_MoldeoSceneObjects
Definition: moConsole.h:559
#define MO_DEF_SCREEN_WIDTH
Definition: moConsole.h:76
#define MO_DEF_RENDER_HEIGHT
Definition: moConsole.h:79
moReactionListenerManager m_ReactionListenerManager
Definition: moConsole.h:561
virtual MOboolean RefreshValue(moParam &param, int value_index)
virtual void RegisterFunctions()
beware ! call only once or die!!!
MOdouble fps_mean
Definition: moConsole.h:569
#define MOdouble
Definition: moTypes.h:404
Clase para el control de un temporizador (relativo) con identificación
Definition: moTimer.h:321
#define MO_DEF_RENDER_WIDTH
Definition: moConsole.h:78
moMatrix3 & operator=(const moMatrix3 &rkM)
#define MOuint
Definition: moTypes.h:387
long m_ScreenshotInterval
Definition: moConsole.h:578
MOuint fps_count
Definition: moConsole.h:570
moText m_ScreenshotResolution
Definition: moConsole.h:580
virtual const moText & ToJSON()
moMoldeoObjects m_MoldeoObjects
Definition: moConsole.h:558
moTimer m_ScreenshotTimer
Definition: moConsole.h:577
virtual MOboolean Finish()
Administrador de efectos.
moDeclareExportedDynamicArray(moPresetParamDefinition, moPresetParams)
moConsoleParamIndex
Definition: moConsole.h:108
almacena la configuración de los parámetros de un objeto en un archivo XML
Definition: moConfig.h:193
virtual MOboolean Init()