summaryrefslogtreecommitdiffstats
path: root/tools/statepropbuilder/apps/spbuilder/code/sp/engine/platform.cpp
blob: c27a39efc362ae04c45dcce9bba4df2ca2290a4c (plain) (blame)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * sp/engine/platform.cpp
 */


#include <sp/interface/platform.hpp>

#include <radmemory.hpp>
#include <radplatform.hpp>
#include <radtime.hpp>
#include <radfile.hpp>
#include <radthread.hpp>

#include <p3d/utility.hpp>


extern HINSTANCE SPHInstance;

//---------------------------------------------------------------------------
// SPPlatform - DLL interface
//---------------------------------------------------------------------------

int SP_CALLCONV SPPlatformOpen(HWND hwnd)
{
	// ftt thread init
	radThreadInitialize();

    // ftt memory init
    radMemoryInitialize();

    // ftt platform init
    radPlatformInitialize(hwnd, SPHInstance);

    // ftt time init
    radTimeInitialize();

    // ftt file init
    radFileInitialize();

    // p3d platform init
    tPlatform* platform = tPlatform::Create(SPHInstance);
    if (platform == 0)
        return -1;

    // game project create
	/*
    if (g_SPProject == 0)
    {
        g_SPProject = SP_PROC_NEWPROJECT();
        P3DASSERT(g_SPProject != 0);
        if (g_SPProject == 0)
            return -1;
        g_SPProject->AddRef();
        g_SPProject->ProjectInit();
    }
	*/

    return 0;
}

int SP_CALLCONV SPPlatformClose()
{
    // destroy game project
    //tRefCounted::Release(g_SPProject);

    // destroy workspace
    //tRefCounted::Release(g_SPWorkspace);

    // p3d platform destroy
    if (p3d::platform != 0)
    {
        tPlatform::Destroy(p3d::platform);
    }

    // ftt file destroy
    radFileTerminate();

    // ftt time destroy
    radTimeTerminate();

    // ftt platform destroy
    radPlatformTerminate();

    // ftt memory destroy
    radMemoryTerminate();

	// ftt thread destroy
	radThreadTerminate();

    return 0;
}


// End of file.