mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 13:47:04 -04:00
New Scene class definition. Also fixed a compile error for some users involving the definition of IID_IXAudio2
This commit is contained in:
parent
8bb608d5ce
commit
2e7f3b24ca
9 changed files with 85 additions and 10 deletions
5
Client/Audio/windows/xaudio2.cpp
Normal file
5
Client/Audio/windows/xaudio2.cpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <initguid.h>
|
||||
|
||||
DEFINE_GUID(CLSID_XAudio2, 0xe21a7345, 0xeb21, 0x468e, 0xbe, 0x50, 0x80, 0x4d, 0xb9, 0x7c, 0xf7, 0x08);
|
||||
DEFINE_GUID(CLSID_XAudio2_Debug, 0xf7a76c21, 0x53d4, 0x46bb, 0xac, 0x53, 0x8b, 0x45, 0x9c, 0xae, 0x46, 0xbd);
|
||||
DEFINE_GUID(IID_IXAudio2, 0x8bcf1f58, 0x9fe7, 0x4583, 0x8a, 0xc6, 0xe2, 0xad, 0xc4, 0x65, 0xc8, 0xbb);
|
|
@ -9,7 +9,7 @@
|
|||
#undef NULL
|
||||
#define NULL 0
|
||||
|
||||
#include <initguid.h>
|
||||
#include <guiddef.h>
|
||||
#include <mmreg.h>
|
||||
|
||||
DEFINE_GUID(CLSID_XAudio2, 0xe21a7345, 0xeb21, 0x468e, 0xbe, 0x50, 0x80, 0x4d, 0xb9, 0x7c, 0xf7, 0x08);
|
||||
|
|
|
@ -6,6 +6,7 @@ if(WIN32)
|
|||
Client.cpp
|
||||
MessageHandler.cpp
|
||||
Audio/Startup.cpp
|
||||
Audio/windows/XAudio2.cpp
|
||||
Graphics/Startup.cpp
|
||||
Graphics/Viewport.cpp
|
||||
resources/Resource.rc
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace Window {
|
|||
int CreateWindowInvisible(HINSTANCE hInst, unsigned Width, unsigned Height, bool Fullscreen);
|
||||
void Shutdown();
|
||||
|
||||
Scene * CurrentScene;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
int result;
|
||||
|
@ -75,6 +77,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||
}
|
||||
}
|
||||
|
||||
CurrentScene = new LoginScreen();
|
||||
CurrentScene->Render();
|
||||
|
||||
MSG msg;
|
||||
while(GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
#include "version.h"
|
||||
#include "System/System.hpp"
|
||||
#include "Resources/Resource.h"
|
||||
#include "Graphics/Graphics.hpp"
|
||||
|
||||
#include "Audio/Audio.hpp"
|
||||
#include "Graphics/Graphics.hpp"
|
||||
#include "Scene/Scene.hpp"
|
||||
|
||||
//IsometricEngine.cpp
|
||||
namespace Window {
|
||||
|
|
58
Client/Scene/Scene.hpp
Normal file
58
Client/Scene/Scene.hpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
Niotso - Copyright (C) 2012 Fatbag <X-Fi6@phppoll.org>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class Scene {
|
||||
const float TickPeriod;
|
||||
float TimeDelta;
|
||||
virtual int Run(float TimeDelta) = 0;
|
||||
|
||||
protected:
|
||||
Scene(float c) : TickPeriod(c), TimeDelta(0) {}
|
||||
|
||||
public:
|
||||
int RunFor(float TimeDelta) {
|
||||
if(TickPeriod == 0){
|
||||
return Run(TimeDelta);
|
||||
}
|
||||
|
||||
bool Redraw = false;
|
||||
this->TimeDelta += TimeDelta;
|
||||
while(this->TimeDelta >= 0){
|
||||
int result = Run(TickPeriod);
|
||||
if(result == System::SHUTDOWN)
|
||||
return System::SHUTDOWN;
|
||||
if(result > 0) Redraw = true;
|
||||
this->TimeDelta -= TickPeriod;
|
||||
}
|
||||
return (Redraw) ? 1 : -1;
|
||||
}
|
||||
|
||||
virtual void Render() = 0;
|
||||
};
|
||||
|
||||
class LoginScreen : public Scene {
|
||||
public: LoginScreen() : Scene(1.0f/15) {}
|
||||
|
||||
private:
|
||||
int Run(float){
|
||||
return 0;
|
||||
}
|
||||
|
||||
public:
|
||||
void Render(){
|
||||
}
|
||||
};
|
|
@ -26,6 +26,10 @@ namespace System {
|
|||
//Event objects
|
||||
extern HANDLE Shutdown;
|
||||
extern HANDLE Initialized[2], Terminated[2];
|
||||
|
||||
enum {
|
||||
SHUTDOWN
|
||||
};
|
||||
}
|
||||
|
||||
enum {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue