-
Notifications
You must be signed in to change notification settings - Fork 1
/
Loading.cpp
79 lines (67 loc) · 1.58 KB
/
Loading.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "Loading.h"
#include <MAPIL/IO/Archiver.h>
#include "ResourceHandler.h"
namespace RTG
{
Loading::Loading() : MAPIL::WinAPIThread(),
m_LoadingState( LOADING_STATE_IDLE ),
m_Scene( -1 ),
m_ppScriptCmd( NULL ),
m_pStageVCPU( NULL ),
m_pStageInfo( NULL )
{
}
Loading::~Loading()
{
m_LoadingState = LOADING_STATE_TERM;
m_Scene = -1;
}
void Loading::Create()
{
Reset();
WinAPIThread::Create();
}
void Loading::Start()
{
m_LoadingState = LOADING_STATE_LOAD;
}
void Loading::Stop()
{
m_LoadingState = LOADING_STATE_STOP;
}
void Loading::Reset()
{
m_LoadingState = LOADING_STATE_IDLE;
}
bool Loading::IsFinished() const
{
return m_LoadingState == LOADING_STATE_COMP ? true : false;
}
int Loading::ThreadFunc()
{
while( m_LoadingState != LOADING_STATE_TERM ){
if( m_LoadingState == LOADING_STATE_STOP ||
m_LoadingState == LOADING_STATE_COMP ||
m_LoadingState == LOADING_STATE_IDLE ){
Sleep( 1 );
}
else if( m_LoadingState == LOADING_STATE_LOAD ){
ResourceHandler* p = ResourceHandler::GetInst();
//p->m_pCompiler->Compile( m_Scene );
p->m_pCompiler->Load( p->m_Archiver, m_Scene );
p->SetupHandle();
*m_ppScriptCmd = p->m_pCompiler->GetStageScript();
m_pStageVCPU->Init( *m_ppScriptCmd, m_pStageInfo );
m_LoadingState = LOADING_STATE_COMP;
}
}
return 0;
}
void Loading::SetScene( int scene, StageVCPU* pStageVCPU, VM::Data** ppScriptCmd, StageInfo* pStageInfo )
{
m_Scene = scene;
m_pStageVCPU = pStageVCPU;
m_ppScriptCmd = ppScriptCmd;
m_pStageInfo = pStageInfo;
}
}