-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSNIIS_C.cpp
39 lines (33 loc) · 1.05 KB
/
SNIIS_C.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
/** @file SNIIS.cpp
* Implementation of C interface using the CPP lib
*/
#include "SNIIS.h"
#include "SNIIS_C.h"
// Assigns the log callback to receive occasional log messages.
extern "C" void SNIIS_SetLogCallback(LogCallback callback)
{
SNIIS::gLogCallback = callback;
}
// Creates the global input instance. Returns zero if successful or non-zero on error
extern "C" int SNIIS_Initialize( void* pInitArgs)
{
bool success = SNIIS::InputSystem::Initialize( pInitArgs);
return success ? 1 : 0;
}
// Shuts down the global input instance
extern "C" void SNIIS_Shutdown()
{
SNIIS::InputSystem::Shutdown();
}
// Per-frame update cycle: does the input processing. To be called before the message loop
extern "C" void SNIIS_InputSystem_Update()
{
if( SNIIS::gInstance )
SNIIS::gInstance->Update();
}
// Notifies SNIIS about focus loss/gain. Non-Zero for focus gain, zero for focus loss
extern "C" void SNIIS_InputSystem_SetFocus( int pFocus)
{
if( SNIIS::gInstance )
SNIIS::gInstance->SetFocus( pFocus != 0);
}