Successful compilation & running
- temporarily mocked CSoundInterface and CPluginInterface - added CRobotMain to application - successfully compiles & runs, but doesn't display correctly at the momentdev-ui colobot-dev-1st_compile
parent
2847aad51f
commit
af9af56bb0
|
@ -174,7 +174,7 @@ ui/map.cpp
|
||||||
ui/scroll.cpp
|
ui/scroll.cpp
|
||||||
ui/shortcut.cpp
|
ui/shortcut.cpp
|
||||||
ui/slider.cpp
|
ui/slider.cpp
|
||||||
# ui/studio.cpp
|
ui/studio.cpp
|
||||||
ui/target.cpp
|
ui/target.cpp
|
||||||
ui/window.cpp
|
ui/window.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "common/iman.h"
|
#include "common/iman.h"
|
||||||
#include "common/image.h"
|
#include "common/image.h"
|
||||||
#include "graphics/opengl/gldevice.h"
|
#include "graphics/opengl/gldevice.h"
|
||||||
|
#include "object/robotmain.h"
|
||||||
|
|
||||||
|
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
|
@ -290,11 +291,8 @@ bool CApplication::Create()
|
||||||
// Temporarily -- only in windowed mode
|
// Temporarily -- only in windowed mode
|
||||||
m_deviceConfig.fullScreen = false;
|
m_deviceConfig.fullScreen = false;
|
||||||
|
|
||||||
/* // Create the sound instance.
|
// Create the sound instance.
|
||||||
m_sound = new CSound(m_iMan);
|
m_sound = new CSoundInterface();
|
||||||
|
|
||||||
// Create the robot application.
|
|
||||||
m_robotMain = new CRobotMain(m_iMan); */
|
|
||||||
|
|
||||||
|
|
||||||
std::string standardInfoMessage =
|
std::string standardInfoMessage =
|
||||||
|
@ -370,6 +368,9 @@ bool CApplication::Create()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the robot application.
|
||||||
|
m_robotMain = new CRobotMain(m_iMan, this);
|
||||||
|
|
||||||
GetLogger()->Info("CApplication created successfully\n");
|
GetLogger()->Info("CApplication created successfully\n");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -430,7 +431,7 @@ bool CApplication::CreateVideoSurface()
|
||||||
|
|
||||||
void CApplication::Destroy()
|
void CApplication::Destroy()
|
||||||
{
|
{
|
||||||
/*if (m_robotMain != nullptr)
|
if (m_robotMain != nullptr)
|
||||||
{
|
{
|
||||||
delete m_robotMain;
|
delete m_robotMain;
|
||||||
m_robotMain = nullptr;
|
m_robotMain = nullptr;
|
||||||
|
@ -440,7 +441,7 @@ void CApplication::Destroy()
|
||||||
{
|
{
|
||||||
delete m_sound;
|
delete m_sound;
|
||||||
m_sound = nullptr;
|
m_sound = nullptr;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (m_engine != nullptr)
|
if (m_engine != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -719,8 +720,8 @@ int CApplication::Run()
|
||||||
passOn = m_engine->ProcessEvent(event);
|
passOn = m_engine->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (passOn && m_robotMain != nullptr)
|
if (passOn && m_robotMain != nullptr)
|
||||||
m_robotMain->ProcessEvent(event); */
|
m_robotMain->EventProcess(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update mouse position explicitly right before rendering
|
/* Update mouse position explicitly right before rendering
|
||||||
|
@ -1035,7 +1036,7 @@ void CApplication::StepSimulation()
|
||||||
|
|
||||||
|
|
||||||
m_engine->FrameUpdate();
|
m_engine->FrameUpdate();
|
||||||
//m_sound->FrameMove(m_relTime);
|
m_sound->FrameMove(m_relTime);
|
||||||
|
|
||||||
|
|
||||||
Event frameEvent(EVENT_FRAME);
|
Event frameEvent(EVENT_FRAME);
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
class CInstanceManager;
|
class CInstanceManager;
|
||||||
class CEvent;
|
class CEvent;
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class CSound;
|
class CSoundInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct JoystickDevice
|
* \struct JoystickDevice
|
||||||
|
@ -366,7 +366,7 @@ protected:
|
||||||
//! Graphics device
|
//! Graphics device
|
||||||
Gfx::CDevice* m_device;
|
Gfx::CDevice* m_device;
|
||||||
//! Sound subsystem
|
//! Sound subsystem
|
||||||
CSound* m_sound;
|
CSoundInterface* m_sound;
|
||||||
//! Main class of the proper game engine
|
//! Main class of the proper game engine
|
||||||
CRobotMain* m_robotMain;
|
CRobotMain* m_robotMain;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ enum ResType
|
||||||
// TODO: move to CRobotMain
|
// TODO: move to CRobotMain
|
||||||
|
|
||||||
extern void SetGlobalGamerName(char *name);
|
extern void SetGlobalGamerName(char *name);
|
||||||
extern bool SearchKey(char *cmd, KeyRank &key);
|
extern bool SearchKey(const char *cmd, KeyRank &key);
|
||||||
extern bool GetResource(ResType type, int num, char* text);
|
extern bool GetResource(ResType type, int num, char* text);
|
||||||
|
|
||||||
extern const char * const strings_text[];
|
extern const char * const strings_text[];
|
||||||
|
|
|
@ -47,19 +47,19 @@ class CPluginInterface {
|
||||||
/** Function to get plugin name or description
|
/** Function to get plugin name or description
|
||||||
* @return returns plugin name
|
* @return returns plugin name
|
||||||
*/
|
*/
|
||||||
virtual std::string PluginName() = 0;
|
inline std::string PluginName() { return "abc"; };
|
||||||
|
|
||||||
/** Function to get plugin version. 1 means version 0.01, 2 means 0.02 etc.
|
/** Function to get plugin version. 1 means version 0.01, 2 means 0.02 etc.
|
||||||
* @return number indicating plugin version
|
* @return number indicating plugin version
|
||||||
*/
|
*/
|
||||||
virtual int PluginVersion() = 0;
|
inline int PluginVersion() { return 0; };
|
||||||
|
|
||||||
/** Function to initialize plugin
|
/** Function to initialize plugin
|
||||||
*/
|
*/
|
||||||
virtual void InstallPlugin() = 0;
|
inline void InstallPlugin() {};
|
||||||
|
|
||||||
/** Function called before removing plugin
|
/** Function called before removing plugin
|
||||||
*/
|
*/
|
||||||
virtual bool UninstallPlugin(std::string &) = 0;
|
inline bool UninstallPlugin(std::string &) { return true; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -151,21 +151,21 @@ enum SoundNext
|
||||||
class CSoundInterface : public CPluginInterface
|
class CSoundInterface : public CPluginInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSoundInterface() {
|
inline CSoundInterface() {
|
||||||
//CInstanceManager::getInstance().AddInstance(CLASS_SOUND, this);
|
//CInstanceManager::getInstance().AddInstance(CLASS_SOUND, this);
|
||||||
//m_iMan->AddInstance(CLASS_SOUND, this);
|
//m_iMan->AddInstance(CLASS_SOUND, this);
|
||||||
};
|
};
|
||||||
virtual ~CSoundInterface() = 0;
|
inline ~CSoundInterface() {};
|
||||||
|
|
||||||
/** Function to initialize sound device
|
/** Function to initialize sound device
|
||||||
* @param bool b3D - enable support for 3D sound
|
* @param bool b3D - enable support for 3D sound
|
||||||
*/
|
*/
|
||||||
virtual bool Create(bool b3D) = 0;
|
inline bool Create(bool b3D) { return true; };
|
||||||
|
|
||||||
/** Function called to cache all sound effect files.
|
/** Function called to cache all sound effect files.
|
||||||
* Function calls \link CSoundInterface::Cache() \endlink for each file
|
* Function calls \link CSoundInterface::Cache() \endlink for each file
|
||||||
*/
|
*/
|
||||||
virtual void CacheAll() = 0;
|
inline void CacheAll() {};
|
||||||
|
|
||||||
/** Function called to cache sound effect file.
|
/** Function called to cache sound effect file.
|
||||||
* This function is called by plugin interface for each file.
|
* This function is called by plugin interface for each file.
|
||||||
|
@ -173,58 +173,58 @@ class CSoundInterface : public CPluginInterface
|
||||||
* @param std::string bFile - file to load
|
* @param std::string bFile - file to load
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool Cache(Sound bSound, std::string bFile) = 0;
|
inline bool Cache(Sound bSound, std::string bFile) { return true; };
|
||||||
|
|
||||||
/** Geturn if plugin is enabled
|
/** Geturn if plugin is enabled
|
||||||
* @return return true if plugin is enabled
|
* @return return true if plugin is enabled
|
||||||
*/
|
*/
|
||||||
virtual bool GetEnable() = 0;
|
inline bool GetEnable() {return true;};
|
||||||
|
|
||||||
/** Change sound mode to 2D/3D
|
/** Change sound mode to 2D/3D
|
||||||
* @param bool bMode - true to enable 3D sound
|
* @param bool bMode - true to enable 3D sound
|
||||||
*/
|
*/
|
||||||
virtual void SetSound3D(bool bMode) = 0;
|
inline void SetSound3D(bool bMode) {};
|
||||||
|
|
||||||
/** Geturn if we use 3D sound
|
/** Geturn if we use 3D sound
|
||||||
* @return true if we have 3D sound enabled
|
* @return true if we have 3D sound enabled
|
||||||
*/
|
*/
|
||||||
virtual bool GetSound3D() = 0;
|
inline bool GetSound3D() {return true;};
|
||||||
|
|
||||||
/** Geturn if we have 3D sound capable card
|
/** Geturn if we have 3D sound capable card
|
||||||
* @return true for 3D sound support
|
* @return true for 3D sound support
|
||||||
*/
|
*/
|
||||||
virtual bool GetSound3DCap() = 0;
|
inline bool GetSound3DCap() {return true;};
|
||||||
|
|
||||||
/** Change global sound volume
|
/** Change global sound volume
|
||||||
* @param int volume - range from 0 to MAXVOLUME
|
* @param int volume - range from 0 to MAXVOLUME
|
||||||
*/
|
*/
|
||||||
virtual void SetAudioVolume(int volume) = 0;
|
inline void SetAudioVolume(int volume) {};
|
||||||
|
|
||||||
/** Geturn global sound volume
|
/** Geturn global sound volume
|
||||||
* @return global volume as int in range from 0 to MAXVOLUME
|
* @return global volume as int in range from 0 to MAXVOLUME
|
||||||
*/
|
*/
|
||||||
virtual int GetAudioVolume() = 0;
|
inline int GetAudioVolume() {return 0;};
|
||||||
|
|
||||||
/** Set music volume
|
/** Set music volume
|
||||||
* @param int volume - range from 0 to MAXVOLUME
|
* @param int volume - range from 0 to MAXVOLUME
|
||||||
*/
|
*/
|
||||||
virtual void SetMusicVolume(int volume) = 0;
|
inline void SetMusicVolume(int volume) {};
|
||||||
|
|
||||||
/** Geturn music volume
|
/** Geturn music volume
|
||||||
* @return music volume as int in range from 0 to MAXVOLUME
|
* @return music volume as int in range from 0 to MAXVOLUME
|
||||||
*/
|
*/
|
||||||
virtual int GetMusicVolume() = 0;
|
inline int GetMusicVolume() {return 0;};
|
||||||
|
|
||||||
/** Set listener position
|
/** Set listener position
|
||||||
* @param Math::Vector eye - position of listener
|
* @param Math::Vector eye - position of listener
|
||||||
* @param Math::Vector lookat - direction listener is looking at
|
* @param Math::Vector lookat - direction listener is looking at
|
||||||
*/
|
*/
|
||||||
virtual void SetListener(Math::Vector eye, Math::Vector lookat) = 0;
|
inline void SetListener(Math::Vector eye, Math::Vector lookat) {};
|
||||||
|
|
||||||
/** Update data each frame
|
/** Update data each frame
|
||||||
* @param float rTime - time since last update
|
* @param float rTime - time since last update
|
||||||
*/
|
*/
|
||||||
virtual void FrameMove(float rTime) = 0;
|
inline void FrameMove(float rTime) {};
|
||||||
|
|
||||||
/** Play specific sound
|
/** Play specific sound
|
||||||
* @param Sound sound - sound to play
|
* @param Sound sound - sound to play
|
||||||
|
@ -233,7 +233,7 @@ class CSoundInterface : public CPluginInterface
|
||||||
* @param bool bLoop - loop sound
|
* @param bool bLoop - loop sound
|
||||||
* @return identifier of channel that sound will be played on
|
* @return identifier of channel that sound will be played on
|
||||||
*/
|
*/
|
||||||
virtual int Play(Sound sound, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) = 0;
|
inline int Play(Sound sound, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) {return 0;};
|
||||||
|
|
||||||
/** Play specific sound
|
/** Play specific sound
|
||||||
* @param Sound sound - sound to play
|
* @param Sound sound - sound to play
|
||||||
|
@ -243,13 +243,13 @@ class CSoundInterface : public CPluginInterface
|
||||||
* @param bool bLoop - loop sound
|
* @param bool bLoop - loop sound
|
||||||
* @return identifier of channel that sound will be played on
|
* @return identifier of channel that sound will be played on
|
||||||
*/
|
*/
|
||||||
virtual int Play(Sound sound, Math::Vector pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) = 0;
|
inline int Play(Sound sound, Math::Vector pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) {return 0;};
|
||||||
|
|
||||||
/** Remove all operations that would be made on sound in channel.
|
/** Remove all operations that would be made on sound in channel.
|
||||||
* @param int channel - channel to work on
|
* @param int channel - channel to work on
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool FlushEnvelope(int channel) = 0;
|
inline bool FlushEnvelope(int channel) {return true;};
|
||||||
|
|
||||||
/** Add envelope to sound. Envelope is a operatino that will be performend on sound in future like changing frequency
|
/** Add envelope to sound. Envelope is a operatino that will be performend on sound in future like changing frequency
|
||||||
* @param int channel - channel to work on
|
* @param int channel - channel to work on
|
||||||
|
@ -259,64 +259,64 @@ class CSoundInterface : public CPluginInterface
|
||||||
* @param SoundNext oper - operation to perform
|
* @param SoundNext oper - operation to perform
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper) = 0;
|
inline bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper) {return true;};
|
||||||
|
|
||||||
/** Set sound position in space
|
/** Set sound position in space
|
||||||
* @param int channel - channel to work on
|
* @param int channel - channel to work on
|
||||||
* @param Math::Vector pos - new positino of a sound
|
* @param Math::Vector pos - new positino of a sound
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool Position(int channel, Math::Vector pos) = 0;
|
inline bool Position(int channel, Math::Vector pos) {return true;};
|
||||||
|
|
||||||
/** Set sound frequency
|
/** Set sound frequency
|
||||||
* @param int channel - channel to work on
|
* @param int channel - channel to work on
|
||||||
* @param float frequency - change sound frequency
|
* @param float frequency - change sound frequency
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool Frequency(int channel, float frequency) = 0;
|
inline bool Frequency(int channel, float frequency) {return true;};
|
||||||
|
|
||||||
/** Stop playing sound
|
/** Stop playing sound
|
||||||
* @param int channel - channel to work on
|
* @param int channel - channel to work on
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool Stop(int channel) = 0;
|
inline bool Stop(int channel) {return true;};
|
||||||
|
|
||||||
/** Stop playing all sounds
|
/** Stop playing all sounds
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool StopAll() = 0;
|
inline bool StopAll() {return true;};
|
||||||
|
|
||||||
/** Mute/unmute all sounds
|
/** Mute/unmute all sounds
|
||||||
* @param bool bMute
|
* @param bool bMute
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool MuteAll(bool bMute) = 0;
|
inline bool MuteAll(bool bMute) {return true;};
|
||||||
|
|
||||||
/** Start playing music
|
/** Start playing music
|
||||||
* @param int rank - track number
|
* @param int rank - track number
|
||||||
* @param bool bRepeat - repeat playing
|
* @param bool bRepeat - repeat playing
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool PlayMusic(int rank, bool bRepeat) = 0;
|
inline bool PlayMusic(int rank, bool bRepeat) {return true;};
|
||||||
|
|
||||||
/** Restart music
|
/** Restart music
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual bool RestartMusic() = 0;
|
inline bool RestartMusic() {return true;};
|
||||||
|
|
||||||
/** Susspend paying music
|
/** Susspend paying music
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual void SuspendMusic() = 0;
|
inline void SuspendMusic() {};
|
||||||
|
|
||||||
/** Stop playing music
|
/** Stop playing music
|
||||||
* @return return true on success
|
* @return return true on success
|
||||||
*/
|
*/
|
||||||
virtual void StopMusic() = 0;
|
inline void StopMusic() {};
|
||||||
|
|
||||||
/** Check if music if playing
|
/** Check if music if playing
|
||||||
* @return return true if music is playing
|
* @return return true if music is playing
|
||||||
*/
|
*/
|
||||||
virtual bool IsPlayingMusic() = 0;
|
inline bool IsPlayingMusic() {return true;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue