Пример #1
0
bool ExampleUpdate()
{
    if(0){
        if (g_UseMultiTouch)
        {
            //g_MultiTouchButton = NewButton("Enable Multitouch");
            s3ePointerUnRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB);
            s3ePointerUnRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB);
            //Register for standard pointer events
            s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB, NULL);
            s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB, NULL);
        }
        else
        {
           // g_MultiTouchButton = NewButton("Disable Multitouch");
            s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB);
            s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB);
            //Register for multi touch events.
            s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB, NULL);
            s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB, NULL);
        }
        
        g_UseMultiTouch = !g_UseMultiTouch;
    }
    return true;
}
Пример #2
0
//--------------------------------------------------------------------------
bool ExampleUpdate()
{
	s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB, NULL);
	s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB, NULL);

	return true;
}
Пример #3
0
//--------------------------------------------------------------------------
void ExampleInit()
{
	//Register for standard pointer events
	s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB, NULL);
	s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB, NULL);
    
	// Init buttons.
	startBtn = NewButton("Start MAT SDK");
	showParmsBtn = NewButton("Show SDK Parameters");
	sendInstallBtn = NewButton("Send Install");
    sendEventRefBtn = NewButton("Send Event With Ref");
	sendEventBtn = NewButton("Send Event Items");
    setDebugBtn = NewButton("Set Debug on/off");
	
    int32 osInt = s3eDeviceGetInt(S3E_DEVICE_OS);
    if (osInt == S3E_OS_ID_ANDROID)
    {
        strcpy(g_package_name, "com.marmaladeandroidtest");
        strcpy(g_site_id, "7488");
    }
    else
    {
        strcpy(g_package_name, "2GLFC47AY5.com.hasoffers.marmaladeTestApp");
        strcpy(g_site_id, "6864");
    }
	SetButtonScale(2);
    
}
Пример #4
0
CCEGLView::CCEGLView()
: m_bCaptured(false)
, m_bAccelState(false)
, m_Key(s3eKeyFirst)
{
	IW_CALLSTACK("CCEGLView::CCEGLView");
	
	IwGLInit();

	setFrameSize((float)IwGLGetInt(IW_GL_WIDTH), (float)IwGLGetInt(IW_GL_HEIGHT));

    // Determine if the device supports multi-touch
    m_isMultiTouch = s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) ? true : false;
    
	// For multi-touch devices we handle touch and motion events using different callbacks
    if (m_isMultiTouch)
    {
        s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &MultiTouchEventHandler, this);
        s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &MultiMotionEventHandler, this);
    }
    else
    {        
        // Register pointer touch button event handler
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &TouchEventHandler, this);
        
        // Register pointer motion button event handler
        s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler, this);
    }
    
    // Register keyboard event handler
//	s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, this);
//	s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, &CharEventHandler, this);
}
CCEGLView::CCEGLView()
    : m_pDelegate(NULL)
    , m_fScreenScaleFactor(1.0)
    , m_bNotHVGA(false)

    , m_bCaptured(false)
    , m_bAccelState(false)
    , m_Key(s3eKeyFirst)
{
    IW_CALLSTACK("CCEGLView::CCEGLView");


    IwGLInit();

    m_sSizeInPixel.width = IwGLGetInt(IW_GL_WIDTH);
    m_sSizeInPixel.height = IwGLGetInt(IW_GL_HEIGHT);

    m_pSet      = new CCSet;
    m_pTouch    = new CCTouch;

    // Register pointer touch button event handler
    s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &TouchEventHandler, this);

    // Register pointer motion button event handler
    s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler, this);

    // Register keyboard event handler
    s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, this);
}
Пример #6
0
bool CIwGameInput::Init()
{
	Tapped = false;
	Dragging = false;
	PreviousNumTouches = 0;
	BackPressed = false;
	MenuPressed = false;

	// Check to see if the device that we are running on supports the pointer
    PointerAvailable = s3ePointerGetInt(S3E_POINTER_AVAILABLE) ? true : false;

	if (PointerAvailable)
	{
		// Clear out the touches array
		for (int t = 0; t < MAX_TOUCHES; t++)
		{
			Touches[t].active = false;
			Touches[t].id = 0;
		}

		// Determine if the device supports multi-touch
		IsMultiTouch = s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) ? true : false;

		// For multi-touch devices we handle touch and motion events using different callbacks
		if (IsMultiTouch)
		{
			s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)HandleMultiTouchButtonCB, NULL);
			s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)HandleMultiTouchMotionCB, NULL);
		}
		else
		{
			s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)HandleSingleTouchButtonCB, NULL);
			s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)HandleSingleTouchMotionCB, NULL);
		}
	}

	// Check to see if the device that we are running on supports the keyboard
    KeysAvailable = ((s3eKeyboardGetInt(S3E_KEYBOARD_HAS_KEYPAD) || s3eKeyboardGetInt(S3E_KEYBOARD_HAS_ALPHA))) ? true : false;

	// Check to see if the device that we are running on supports the on screen keyboard
	OSKeyboardAvailable = s3eOSReadStringAvailable() == S3E_TRUE; 

	// Check accelerometer availability
	if (s3eAccelerometerGetInt(S3E_ACCELEROMETER_AVAILABLE))
		AccelerometerAvailable = true;
	else
		AccelerometerAvailable = false;

	// Check compass availability
	if (s3eCompassAvailable())
		CompassAvailable = true;
	else
		CompassAvailable = false;

	return true; // Pointer support
}
Пример #7
0
// Example showing how to use the s3eWwise extension
int main()
{
    IW_CALLSTACK("main");

    s3eDebugOutputString("Booting s3eWwise example");

    initWwise();

    s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent, NULL);
    s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent, NULL);

    IwGxInit();

    IwGxSetColClear(0, 0, 0, 0xff);

    while(!s3eDeviceCheckQuitRequest())
    {
        std::stringstream str;

        s3eWwiseSoundEngineRenderAudio();

        IwGxClear();

        IwGxPrintString(100, 100, "s3eWwise");

        IwGxPrintString(100, 300, "Touch to fire event");

        str << "RPM = " << rpm;
        IwGxPrintString(100, 400, str.str().c_str());
        str.str(std::string());

        str << "TH = " << touchHeight;
        IwGxPrintString(100, 500, str.str().c_str());
        str.str(std::string());

        str << "Height = " << height;
        IwGxPrintString(100, 600, str.str().c_str());
        str.str(std::string());

        IwGxFlush();
        IwGxSwapBuffers();
        s3eDeviceYield(0);
    }

    IwGxTerminate();

    s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent);
    s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent);

    shutdownWwise();

    return 0;
}
Пример #8
0
Input::Input() : m_Touched(false), m_PrevTouched(false)
{
    // Set touch event callback handlers, single and multi-touch devices have different callbacks assigned
    if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) != 0)
    {
        s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB, NULL);
    }
    else
    {
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)TouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)TouchMotionCB, NULL);
    }
}
Пример #9
0
Input::Input() 
	: pointerIsTouched(0),
	  pointerPrevWasTouched(0)
{
	if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) != 0)
	{
		s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)multiTouchCB, 0);
		s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)multiTouchMotionCB, 0);
	} 
	else
	{
		s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)touchCB, 0);
		s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)touchMotionCB, 0);
	}
}
Пример #10
0
		CMarmaladeCursor(CIrrDeviceMarmalade *owner)
			: owner(owner), buttons(0)
		{
			mMTStatus.clear();

			if(!s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
			{
				s3ePointerRegister(S3E_POINTER_MOTION_EVENT, do_motionEvent, this);
				s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, do_buttonEvent, this);
			}
			else
			{
				s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, do_touchEvent, this);
				s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, do_touchMotionEvent, this);
			}
		}
Пример #11
0
int main()
{
	IwGxInit();
	Iw2DInit();

	AppWarp::Client* WarpClientRef;
	AppWarp::Client::initialize("b29f4030aba3b2bc7002c4eae6815a4130c862c386e43ae2a0a092b27de1c5af","bf45f27e826039754f8dda659166d59ffb7b9dce830ac51d6e6b576ae4b26f7e");
	WarpClientRef = AppWarp::Client::getInstance();

	MenuScreen *menu = new MenuScreen;
	GameScreen *game = new GameScreen(WarpClientRef);

	Game *gm = new Game;
	gm->AddScene("game",game);
	gm->AddScene("menu",menu);

	menu->game = game;
	menu->app = gm;

	Listener listener(WarpClientRef,game);
	WarpClientRef->setConnectionRequestListener(&listener);
	WarpClientRef->setRoomRequestListener(&listener);
	WarpClientRef->setNotificationListener(&listener);

	s3ePointerRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB,gm);

	while(!s3eDeviceCheckQuitRequest())
	{
		s3eKeyboardUpdate();
		if(s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN)
			break;

		WarpClientRef->update();
		s3ePointerUpdate();
		IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);

		IwGxPrintSetScale(2);
		IwGxPrintString(0,0,game->msg.c_str());

		gm->Move();
		gm->Render();

		Iw2DSurfaceShow();
		s3eDeviceYield();
	}

	s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT,(s3eCallback)HandleSingleTouchButtonCB);

	gm->CleanUp();
	delete menu;
	delete game;
	delete gm;

	WarpClientRef->terminate();

	Iw2DTerminate();
	IwGxTerminate();
}
Пример #12
0
CCEGLView::CCEGLView()
: m_pDelegate(NULL)
, m_fScreenScaleFactor(1.0)
, m_bNotHVGA(false)
, m_bCaptured(false)
, m_bAccelState(false)
, m_Key(s3eKeyFirst)
{
	IW_CALLSTACK("CCEGLView::CCEGLView");
	

	IwGLInit();

	m_sSizeInPixel.width = IwGLGetInt(IW_GL_WIDTH);
	m_sSizeInPixel.height = IwGLGetInt(IW_GL_HEIGHT);

    m_pSet      = new CCSet;
	m_pTouch    = new CCTouch;

    // Determine if the device supports multi-touch
    m_isMultiTouch = s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) ? true : false;
    
	// For multi-touch devices we handle touch and motion events using different callbacks
    if (m_isMultiTouch)
    {
        s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &MultiTouchEventHandler, this);
        s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &MultiMotionEventHandler, this);
        
        for (int i = 0; i < S3E_POINTER_TOUCH_MAX; i++) {
            touchSet[i] = NULL;
        }
    }
    else
    {        
        // Register pointer touch button event handler
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &TouchEventHandler, this);
        
        // Register pointer motion button event handler
        s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler, this);
    }
    
    // Register keyboard event handler
//	s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, this);
//	s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, &CharEventHandler, this);
}
void registerInput()
{
	// Register pointer event handler
    s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &ButtonEventHandler, NULL);

    // Register keyboard event handler
    s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler, NULL);

	// Register motion event handler
	s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler, NULL);

	// Register touch event handler
	s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &TouchEventHandler, NULL);

	// Register touch motion event handler
	s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &TouchMotionEventHandler, NULL);

	
}
Пример #14
0
void ExampleInit()
{
    // An OS which supports multi-touch will return TOUCH_EVENTs if they are registered for.
    // An OS which does not will only raise standard pointer events.
    g_UseMultiTouch = s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) ? true : false;
    
    if (g_UseMultiTouch)
    {
        //Register for multi touch events on platforms where the functionality is available.
        s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB, NULL);
        //g_MultiTouchButton = NewButton("Disable Multitouch");
    }
    else
    {
        //Register for standard pointer events
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB, NULL);
    }
}
Пример #15
0
Файл: input.cpp Проект: dblo/XTD
bool CInput::Init()
{
	// Check to see if the device that we are running on supports the pointer
    PointerAvailable = s3ePointerGetInt(S3E_POINTER_AVAILABLE) ? true : false;
	if (!PointerAvailable)
		return false;	// No pointer support

	if (PointerAvailable)
	{
		// Clear out the touches array
		for (int t = 0; t < MAX_TOUCHES; t++)
		{
			Touches[t].active = false;
			Touches[t].id = 0;
		}

		// Determine if the device supports multi-touch
		IsMultiTouch = s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) ? true : false;

		// For multi-touch devices we handle touch and motion events using different callbacks
		if (IsMultiTouch)
		{
			s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)HandleMultiTouchButtonCB, NULL);
			s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)HandleMultiTouchMotionCB, NULL);
		}
		else
		{
			s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)HandleSingleTouchButtonCB, NULL);
			s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)HandleSingleTouchMotionCB, NULL);
		}
	}

	// Check to see if the device that we are running on supports the keyboard
    KeysAvailable = (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_KEYPAD) || s3eKeyboardGetInt(S3E_KEYBOARD_HAS_ALPHA));

	// Check to see if the device that we are running on supports the on screen keyboard
	OSKeyboardAvailable = s3eOSReadStringAvailable() == S3E_TRUE; 

	return true; // Pointer support
}
Пример #16
0
MapBackground::MapBackground()
{
	g_tempZoom = g_newZoom = g_actualZoom = g_curZoom = 17;// - 1;

	if (NULL == g_pNotFoundTexture)
	{
		g_pNotFoundTexture = (CIwTexture*)IwGetResManager()->GetResNamed("notfound", IW_GX_RESTYPE_TEXTURE);
	}
	if (NULL == g_pLoadingTexture)
	{
		g_pLoadingTexture = (CIwTexture*)IwGetResManager()->GetResNamed("loading", IW_GX_RESTYPE_TEXTURE);
	}
	g_bMouseDown = false;
	g_bLocationChanged = false;
	g_dAlpha = 0xFF;

	if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
    {
        //Register for multi touch events on platforms where the functionality is available.
        s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB, NULL);
    }
}
Пример #17
0
Input_Engine::Input_Engine()
{
    input_controller = NULL;
    ref_count = 0;
    if( s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE) )
    {
        //Register for multi touch events on platforms where the functionality is available.
        s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB, NULL);
    }
    else
    {
        //Register for standard pointer events
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB, NULL);
    }
    //s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, keyboardHandler, NULL);

    int screenWidth = s3eSurfaceGetInt(S3E_SURFACE_WIDTH);
    int screenHeight = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT);
    m_widthFactor = 320.0f/screenWidth;
    m_heightFactor = 480.0f/screenHeight;
}
Пример #18
0
int main()
{

    Iw2DInit();
    game = new Game();
	game->Initialize();
	game->NewGame();
	int currentUpdate = GetUpdateFrame();
    int nextUpdate = currentUpdate;
	s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback) MouseEventCallback, NULL);
    while(!s3eDeviceCheckQuitRequest())
    {
		 while(!s3eDeviceCheckQuitRequest())
        {
            nextUpdate = GetUpdateFrame();
            if( nextUpdate != currentUpdate )
                break;
            s3eDeviceYield(1);
        }

		// execute update steps
        int frames = nextUpdate - currentUpdate;
        frames = MIN(MAX_UPDATES, frames);
        while(frames--)
        {
            game->Update();
        }

		Iw2DSurfaceClear(0xffffffff);
		game->Render();
		Iw2DSurfaceShow();
        s3ePointerUpdate();
        s3eKeyboardUpdate();
        s3eDeviceYield();
    }

    delete game;

    Iw2DTerminate();

    return 0;
}
Пример #19
0
bool    ImGui_Marmalade_Init(bool install_callbacks)
{
    IwGxInit();

    ImGuiIO& io = ImGui::GetIO();
    io.KeyMap[ImGuiKey_Tab] = s3eKeyTab;                     // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
    io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
    io.KeyMap[ImGuiKey_RightArrow] = s3eKeyRight;
    io.KeyMap[ImGuiKey_UpArrow] = s3eKeyUp;
    io.KeyMap[ImGuiKey_DownArrow] = s3eKeyDown;
    io.KeyMap[ImGuiKey_PageUp] = s3eKeyPageUp;
    io.KeyMap[ImGuiKey_PageDown] = s3eKeyPageDown;
    io.KeyMap[ImGuiKey_Home] = s3eKeyHome;
    io.KeyMap[ImGuiKey_End] = s3eKeyEnd;
    io.KeyMap[ImGuiKey_Delete] = s3eKeyDelete;
    io.KeyMap[ImGuiKey_Backspace] = s3eKeyBackspace;
    io.KeyMap[ImGuiKey_Enter] = s3eKeyEnter;
    io.KeyMap[ImGuiKey_Escape] = s3eKeyEsc;
    io.KeyMap[ImGuiKey_A] = s3eKeyA;
    io.KeyMap[ImGuiKey_C] = s3eKeyC;
    io.KeyMap[ImGuiKey_V] = s3eKeyV;
    io.KeyMap[ImGuiKey_X] = s3eKeyX;
    io.KeyMap[ImGuiKey_Y] = s3eKeyY;
    io.KeyMap[ImGuiKey_Z] = s3eKeyZ;

    io.RenderDrawListsFn = ImGui_Marmalade_RenderDrawLists;      // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
    io.SetClipboardTextFn = ImGui_Marmalade_SetClipboardText;
    io.GetClipboardTextFn = ImGui_Marmalade_GetClipboardText;

    if (install_callbacks)
    {
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, ImGui_Marmalade_PointerButtonEventCallback, 0);
        s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, ImGui_Marmalade_KeyCallback, 0);
        s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, ImGui_Marmalade_CharCallback, 0);
    }

    return true;
}
Пример #20
0
bool    ImGui_Marmalade_Init(bool install_callbacks)
{
    ImGuiIO& io = ImGui::GetIO();
    io.KeyMap[ImGuiKey_Tab] = s3eKeyTab;                     // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
    io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
    io.KeyMap[ImGuiKey_RightArrow] = s3eKeyRight;
    io.KeyMap[ImGuiKey_UpArrow] = s3eKeyUp;
    io.KeyMap[ImGuiKey_DownArrow] = s3eKeyDown;
    io.KeyMap[ImGuiKey_PageUp] = s3eKeyPageUp;
    io.KeyMap[ImGuiKey_PageDown] = s3eKeyPageDown;
    io.KeyMap[ImGuiKey_Home] = s3eKeyHome;
    io.KeyMap[ImGuiKey_End] = s3eKeyEnd;
    io.KeyMap[ImGuiKey_Insert] = s3eKeyInsert;
    io.KeyMap[ImGuiKey_Delete] = s3eKeyDelete;
    io.KeyMap[ImGuiKey_Backspace] = s3eKeyBackspace;
    io.KeyMap[ImGuiKey_Space] = s3eKeySpace;
    io.KeyMap[ImGuiKey_Enter] = s3eKeyEnter;
    io.KeyMap[ImGuiKey_Escape] = s3eKeyEsc;
    io.KeyMap[ImGuiKey_A] = s3eKeyA;
    io.KeyMap[ImGuiKey_C] = s3eKeyC;
    io.KeyMap[ImGuiKey_V] = s3eKeyV;
    io.KeyMap[ImGuiKey_X] = s3eKeyX;
    io.KeyMap[ImGuiKey_Y] = s3eKeyY;
    io.KeyMap[ImGuiKey_Z] = s3eKeyZ;

    io.SetClipboardTextFn = ImGui_Marmalade_SetClipboardText;
    io.GetClipboardTextFn = ImGui_Marmalade_GetClipboardText;

    if (install_callbacks)
    {
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, ImGui_Marmalade_PointerButtonEventCallback, 0);
        s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, ImGui_Marmalade_KeyCallback, 0);
        s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, ImGui_Marmalade_CharCallback, 0);
    }

    return true;
}
Пример #21
0
        void init(init_desc* desc_ptr)
        {
            Input::instance.__removeFromDebugList();

            log::messageln("initialize oxygine");
            if (desc_ptr)
                desc = *desc_ptr;

#ifdef __S3E__
            log::messageln("S3E build");
            if (!IwGLInit())
            {
                s3eDebugErrorShow(S3E_MESSAGE_CONTINUE, "IwGLInit failed");
                return;
            }
            //init_ext();

            int width = IwGLGetInt(IW_GL_WIDTH);
            int height = IwGLGetInt(IW_GL_HEIGHT);

            log::messageln("Screen BPP  : %d", s3eSurfaceGetInt(S3E_SURFACE_PIXEL_TYPE) & S3E_SURFACE_PIXEL_SIZE_MASK);
            log::messageln("Screen Size : %dx%d", width, height);
            log::messageln("Vendor      : %s", (const char*)glGetString(GL_VENDOR));
            log::messageln("Renderer    : %s", (const char*)glGetString(GL_RENDERER));

            const char* version = (const char*)glGetString(GL_VERSION);
            log::messageln("Version    : %s", version);

            s3ePointerUpdate();
            if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
            {
                s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &pointerTouchEvent, 0);
                s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &pointerTouchMotionEvent, 0);
            }
            else
            {
                s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &pointerEvent, 0);
                s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &pointerMotionEvent, 0);
            }

            s3eDeviceRegister(S3E_DEVICE_UNPAUSE, applicationUnPause, 0);
            s3eDeviceRegister(S3E_DEVICE_PAUSE, applicationPause, 0);

#elif EMSCRIPTEN
            log::messageln("EMSCRIPTEN build");

            if (desc.w == -1 && desc.h == -1)
            {
                int fs = 0;
                emscripten_get_canvas_size(&desc.w, &desc.h, &fs);
            }

            if (SDL_Init(SDL_INIT_VIDEO) != 0)
            {
                log::error("Unable to initialize SDL: %s\n", SDL_GetError());
            }

            SDL_Surface* screen;
            screen = SDL_SetVideoMode(desc.w, desc.h, 32, SDL_OPENGL);
            _displaySize = Point(desc.w, desc.h);

            emscripten_SDL_SetEventHandler(SDL_eventsHandler, 0);

            int v = EM_ASM_INT(
            {
                var p = navigator.platform;
                if (p == 'iPad' || p == 'iPhone' || p == 'iPod')
                    return 1;
                return 0;
            }, 0);
Пример #22
0
void doMain() {
    if(s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE)){
        s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, (s3eCallback)MultiTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, (s3eCallback)MultiTouchMotionCB, NULL);
    } else {
        s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)SingleTouchButtonCB, NULL);
        s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)SingleTouchMotionCB, NULL);
    }


    IwGetResManager()->LoadGroup("resource_groups/palate.group");
    
    palateGroup = IwGetResManager()->GetGroupNamed("Palate");

    std::vector<int> ui_texture_hashes;
	uint background_hash = IwHashString("background_clean");
	CIwResList* resources = palateGroup->GetListHashed(IwHashString("CIwTexture"));
	for(CIwManaged** itr = resources->m_Resources.GetBegin(); itr != resources->m_Resources.GetEnd(); ++itr) {
		if(background_hash != (*itr)->m_Hash) {
			ui_texture_hashes.push_back((*itr)->m_Hash);
		}
	}
    
    CIwMaterial* background = new CIwMaterial();
    background->SetTexture((CIwTexture*)palateGroup->GetResNamed("background_clean", IW_GX_RESTYPE_TEXTURE));
    background->SetModulateMode(CIwMaterial::MODULATE_NONE);
    background->SetAlphaMode(CIwMaterial::ALPHA_DEFAULT);

	unit_ui = new CIwMaterial();
    unit_ui->SetModulateMode(CIwMaterial::MODULATE_NONE);
    unit_ui->SetAlphaMode(CIwMaterial::ALPHA_DEFAULT);
    unit_ui->SetTexture((CIwTexture*)palateGroup->GetResNamed("TAKE2", IW_GX_RESTYPE_TEXTURE));
    
    CIwSVec2 bg_wh(320, 480);
	CIwSVec2 ui_wh(80, 480);
	CIwSVec2 ui_offset(240, 0);
	CIwSVec2 uv(0, 0);
	CIwSVec2 duv(IW_GEOM_ONE, IW_GEOM_ONE);

    init();
    
	IwGxLightingOff();
    IwGxSetColClear(255, 255, 255, 255);
    
    float worldScrollMultiplier = 0.75;
    
    if(s3eDeviceGetInt(S3E_DEVICE_OS) == S3E_OS_ID_IPHONE) {
        worldScrollMultiplier = 0.925;
    }

	while (1) {
        
        int64 start = s3eTimerGetMs();
	
		s3eDeviceYield(0);
		s3eKeyboardUpdate();
		s3ePointerUpdate();
		
		if ((s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN)
				|| (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN)       
				|| (s3eDeviceCheckQuitRequest())) {
			
		    break;
		}
	
        switch(currentState) {

        case MAIN_MENU:
            if(s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_PRESSED) {
                currentState = IN_GAME;
            }
            if(frameCount % FRAMES_PER_UPDATE == 0) {
			    mainMenu->tick();
		    }
            mainMenu->render();
            break;
        case IN_GAME:
            IwGxSetMaterial(background);
            IwGxSetScreenSpaceSlot(-1);
            IwGxDrawRectScreenSpace(&CIwSVec2::g_Zero, &bg_wh, &uv, &duv);

		    IwGxSetMaterial(unit_ui);
            IwGxSetScreenSpaceSlot(1); 
            IwGxDrawRectScreenSpace(&ui_offset, &ui_wh, &uv, &duv);
        
		    if (worldScrollSpeed > .0005 || worldScrollSpeed < -.0005) {
			    game->rotate(worldScrollSpeed);
			    worldScrollSpeed *= worldScrollMultiplier;
		    }
            if(frameCount % FRAMES_PER_UPDATE == 0) {
			    game->tick();
		    }
		
		    game->render();
		    if(!renderTouches()) {
                break;
            }

            break;
        }
        		
        IwGxFlush();
        
        IwGxSwapBuffers();
		
		// Attempt frame rate
		while ((s3eTimerGetMs() - start) < MS_PER_FRAME){
			int32 yield = (MS_PER_FRAME - (s3eTimerGetMs() - start));
			if (yield < 0) {
				break;
			}
				
			s3eDeviceYield(yield);
		}
		
		frameCount++;

        
        IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);
	}
    
	delete game;
    delete mainMenu;
	delete localPlayer;
	delete opponentPlayer;
    delete background;
	delete unit_ui;
    palateGroup->Finalise();
    
    for(int i = 0; i < MAX_TOUCHES; ++i)
        if(touches[i].unit)
            delete touches[i].unit;
}
Пример #23
0
		void init(init_desc *desc_ptr)
		{
			Input::instance.__removeFromDebugList();

			log::messageln("initialize oxygine");
			if (desc_ptr)
				desc = *desc_ptr;

#ifdef __S3E__
			log::messageln("S3E build");
			if (!IwGLInit())
			{
				s3eDebugErrorShow(S3E_MESSAGE_CONTINUE, "IwGLInit failed");
				return;
			}
			//init_ext();

			int width = IwGLGetInt(IW_GL_WIDTH);
			int height = IwGLGetInt(IW_GL_HEIGHT);

			log::messageln("Screen BPP  : %d", s3eSurfaceGetInt(S3E_SURFACE_PIXEL_TYPE) & S3E_SURFACE_PIXEL_SIZE_MASK);
			log::messageln("Screen Size : %dx%d", width, height);
			log::messageln("Vendor      : %s", (const char*)glGetString( GL_VENDOR ) );
			log::messageln("Renderer    : %s", (const char*)glGetString( GL_RENDERER ));

			const char *version = (const char*)glGetString( GL_VERSION );
			log::messageln( "Version    : %s", version);

			s3ePointerUpdate();
			if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
			{
				s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &pointerTouchEvent, 0);
				s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &pointerTouchMotionEvent, 0);
			}
			else
			{
				s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &pointerEvent, 0);
				s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &pointerMotionEvent, 0);
			}	

			s3eDeviceRegister(S3E_DEVICE_UNPAUSE, applicationUnPause, 0);
			s3eDeviceRegister(S3E_DEVICE_PAUSE, applicationPause, 0);
#elif EMSCRIPTEN
			log::messageln("EMSCRIPTEN build");

			if (desc.w == -1 && desc.h == -1)
			{
				int fs = 0;
				emscripten_get_canvas_size(&desc.w, &desc.h, &fs);
			}

			if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) 
			{
				log::error("Unable to initialize SDL: %s\n", SDL_GetError());				
			}

			SDL_Surface *screen;
			screen = SDL_SetVideoMode(desc.w, desc.h, 32, SDL_OPENGL); 
			_displaySize = Point(desc.w, desc.h);

			emscripten_SDL_SetEventHandler(SDL_eventsHandler, 0);
#elif OXYGINE_SDL

			log::messageln("SDL build");
			

			SDL_Init(SDL_INIT_VIDEO);


			SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
			SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
			SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
			SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
			SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
			SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0);
			//SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
			SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
			SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
			SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

			int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;

#if TARGET_OS_IPHONE
			flags |= SDL_WINDOW_BORDERLESS;
#endif                

			SDL_DisplayMode mode;
			SDL_GetCurrentDisplayMode(0, &mode);
			log::messageln("display mode: %d %d", mode.w, mode.h);

			if (desc.w == -1 && desc.h == -1)
			{
				desc.w = 960;
				desc.h = 640;
			}

			if (desc.fullscreen)
				flags |= SDL_WINDOW_FULLSCREEN;

			log::messageln("creating window %d %d", desc.w, desc.h);

			_window = SDL_CreateWindow(desc.title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, desc.w, desc.h, flags);

			if (!_window)
			{
				log::error("can't create window: %s", SDL_GetError());
				return;
			}
			_context = SDL_GL_CreateContext(_window);
			if (!_context)
			{
				log::error("can't create gl context: %s", SDL_GetError());
				return;
			}

			SDL_GL_SetSwapInterval(desc.vsync ? 1 : 0);
			

			//SDL_SetEventFilter(eventsFilter, 0);

#endif
			file::init(desc.companyName, desc.appName);
			init2();
		}
Пример #24
0
        void init(init_desc* desc_ptr)
        {
            std::string t;

#ifdef OX_DEBUG
            t += "OX_DEBUG ";
#endif

#ifdef NDEBUG
            t += "NDEBUG ";
#endif

#ifdef _DEBUG
            t += "_DEBUG ";
#endif

#ifdef DEBUG
            t += "DEBUG ";
#endif

            log::messageln("build settings %s", t.c_str());

            init0();


            log::messageln("initialize oxygine");
            if (desc_ptr)
                desc = *desc_ptr;

#ifdef __S3E__
            log::messageln("S3E build");
            if (!IwGLInit())
            {
                s3eDebugErrorShow(S3E_MESSAGE_CONTINUE, "IwGLInit failed");
                return;
            }
            //init_ext();

            int width = IwGLGetInt(IW_GL_WIDTH);
            int height = IwGLGetInt(IW_GL_HEIGHT);

            log::messageln("Screen BPP  : %d", s3eSurfaceGetInt(S3E_SURFACE_PIXEL_TYPE) & S3E_SURFACE_PIXEL_SIZE_MASK);
            log::messageln("Screen Size : %dx%d", width, height);
            log::messageln("Vendor      : %s", (const char*)glGetString(GL_VENDOR));
            log::messageln("Renderer    : %s", (const char*)glGetString(GL_RENDERER));

            const char* version = (const char*)glGetString(GL_VERSION);
            log::messageln("Version    : %s", version);

            s3ePointerUpdate();
            if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
            {
                s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, &pointerTouchEvent, 0);
                s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, &pointerTouchMotionEvent, 0);
            }
            else
            {
                s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, &pointerEvent, 0);
                s3ePointerRegister(S3E_POINTER_MOTION_EVENT, &pointerMotionEvent, 0);
            }

            s3eDeviceRegister(S3E_DEVICE_UNPAUSE, applicationUnPause, 0);
            s3eDeviceRegister(S3E_DEVICE_PAUSE, applicationPause, 0);

#elif OXYGINE_SDL

            log::messageln("SDL build");


            SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");

            SDL_Init(SDL_INIT_VIDEO);


            if (desc.mode24bpp)
            {
                SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
                SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
                SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
            }
            else
            {
                SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
                SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
                SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
            }

            SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
            //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
            //SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

            if (desc.force_gles)
            {
                SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
                SDL_GL_SetAttribute(SDL_GL_CONTEXT_EGL, 1);
            }

            SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);

            int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;

#if TARGET_OS_IPHONE
            flags |= SDL_WINDOW_BORDERLESS;
            flags |= SDL_WINDOW_ALLOW_HIGHDPI;
            flags |= SDL_WINDOW_FULLSCREEN;
#endif

            //SDL_DisplayMode mode;
            //SDL_GetCurrentDisplayMode(0, &mode);
            //log::messageln("display mode: %d %d", mode.w, mode.h);

            if (desc.w == -1 && desc.h == -1)
            {
                desc.w = 960;
                desc.h = 640;
            }

            if (desc.fullscreen)
                flags |= SDL_WINDOW_FULLSCREEN;

            {
                Event ev(EVENT_PRECREATEWINDOW);
                _dispatcher->dispatchEvent(&ev);
            }

            log::messageln("creating window %d %d", desc.w, desc.h);

            _window = SDL_CreateWindow(desc.title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, desc.w, desc.h, flags);

            if (!_window)
            {
                log::error("can't create window: %s", SDL_GetError());
                return;
            }
            _context = SDL_GL_CreateContext(_window);
            if (!_context)
            {
                log::error("can't create gl context: %s", SDL_GetError());
                return;
            }

            SDL_GL_SetSwapInterval(desc.vsync ? 1 : 0);

#ifdef EMSCRIPTEN
            SDL_SetEventFilter(SDL_eventsHandler, 0);

            int v = EM_ASM_INT(
            {
                var p = navigator.platform;
                if (p == 'iPad' || p == 'iPhone' || p == 'iPod')
                    return 1;
                return 0;
            }, 0);
Пример #25
0
bool MarmaladeSystem::Initialize()
{
    LOG_INFO(LOGCAT_SYSTEM, "MarmaladeSystem initialization starting.\n");

    const char* marmaladeRuntimeVersion = s3eDeviceGetString(S3E_DEVICE_SDK_VERSION);
    LOG_INFO(LOGCAT_SYSTEM, "Marmalade Runtime Version %s, Linked Version %s\n", marmaladeRuntimeVersion, MARMALADE_VERSION_STRING);

    const char* s3eRuntimeVersion = s3eDeviceGetString(S3E_DEVICE_S3E_VERSION);
    LOG_INFO(LOGCAT_SYSTEM, "S3E Runtime Version: %s, Linked Version: %s\n", s3eRuntimeVersion, S3E_VERSION_STRING);

    const char* deviceID = s3eDeviceGetString(S3E_DEVICE_ID);
    const char* deviceOS = s3eDeviceGetString(S3E_DEVICE_OS);
    int deviceOsVersion = s3eDeviceGetInt(S3E_DEVICE_OS_VERSION);
    int osVersionMajor = (deviceOsVersion >> 16);
    int osVersionMinor =  deviceOsVersion & 0xffff;
    const char* deviceClass = s3eDeviceGetString(S3E_DEVICE_CLASS);
    const char* deviceArch = s3eDeviceGetString(S3E_DEVICE_ARCHITECTURE);
    const char* deviceChipset = s3eDeviceGetString(S3E_DEVICE_CHIPSET);
    int deviceTotalMemKB = s3eDeviceGetInt(S3E_DEVICE_MEM_TOTAL);
    int deviceFreeMemKB = s3eDeviceGetInt(S3E_DEVICE_MEM_FREE);
    int heapSize = s3eMemoryGetInt(S3E_MEMORY_SIZE);

    LOG_INFO(LOGCAT_SYSTEM, "Device ID: %s\n", deviceID);
    LOG_INFO(LOGCAT_SYSTEM, "Device OS: %s (%d.%d)\n", deviceOS, osVersionMajor, osVersionMinor);
    LOG_INFO(LOGCAT_SYSTEM, "Device Class: %s\n", deviceClass);
    LOG_INFO(LOGCAT_SYSTEM, "Device Architecture: %s\n", deviceArch);
    LOG_INFO(LOGCAT_SYSTEM, "Device Chipset: %s\n", deviceChipset);
    LOG_INFO(LOGCAT_SYSTEM, "Device Memory: %dKB free, %dKB total\n", deviceFreeMemKB, deviceTotalMemKB);
    LOG_INFO(LOGCAT_SYSTEM, "S3E Memory Heap Size: %d bytes\n", heapSize);

    bool keyboardHasAlpha = false;
    bool keyboardHasDirection = false;
    if (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_ALPHA))
    {
        keyboardHasAlpha = true;
        LOG_INFO(LOGCAT_SYSTEM, "Keyboard property: S3E_KEYBOARD_HAS_ALPHA\n");
    }
    if (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_NUMPAD))
        LOG_INFO(LOGCAT_SYSTEM, "Keyboard property: S3E_KEYBOARD_HAS_NUMPAD\n");
    if (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_DIRECTION))
    {
        keyboardHasDirection = true;
        LOG_INFO(LOGCAT_SYSTEM, "Keyboard property: S3E_KEYBOARD_HAS_DIRECTION\n");
    }

    // Android Xperia Play device detection
    // TODO: any other device ID's we need to worry about?
    bool isXperiaPlay = false;
    if (s3eDeviceGetInt(S3E_DEVICE_OS) == S3E_OS_ID_ANDROID)
    {
        LOG_INFO(LOGCAT_SYSTEM, "Detected Android as host OS.\n");
        if (strlen(deviceID) >= 4)
        {
            // possible device ID's I currently know of:
            //   R800i, R800a, R800x
            if (strncmp(deviceID, "R800", 4) == 0)
            {
                LOG_INFO(LOGCAT_SYSTEM, "Device is an Xperia Play.\n");
                isXperiaPlay = true;
            }
            else
                LOG_INFO(LOGCAT_SYSTEM, "Device is not an Xperia Play.\n");
        }
    }

    bool keyboardHasPhysicalGameControls = false;
    if ((keyboardHasAlpha && keyboardHasDirection) || isXperiaPlay)
        keyboardHasPhysicalGameControls = true;

    if (keyboardHasPhysicalGameControls)
        LOG_INFO(LOGCAT_SYSTEM, "Keyboard device has enough physical keys for full game controls.\n");
    else
        LOG_INFO(LOGCAT_SYSTEM, "Keyboard device does not have enough physical keys for full game controls.\n");

    m_keyboard = new MarmaladeKeyboard(keyboardHasPhysicalGameControls);
    ASSERT(m_keyboard != NULL);
    LOG_INFO(LOGCAT_SYSTEM, "Keyboard input device ready.\n");

    bool isMultitouchAvailable = false;
    if (s3ePointerGetInt(S3E_POINTER_AVAILABLE))
    {
        s3ePointerType pointerType = (s3ePointerType)s3ePointerGetInt(S3E_POINTER_TYPE);
        if (pointerType == S3E_POINTER_TYPE_INVALID)
            LOG_ERROR(LOGCAT_SYSTEM, "Pointer type = S3E_POINTER_TYPE_INVALID\n");
        else if (pointerType == S3E_POINTER_TYPE_MOUSE)
        {
            LOG_INFO(LOGCAT_SYSTEM, "Pointer device is a mouse.\n");

            m_mouse = new MarmaladeMouse();
            ASSERT(m_mouse != NULL);
            LOG_INFO(LOGCAT_SYSTEM, "Mouse input device ready.\n");
        }
        else if (pointerType == S3E_POINTER_TYPE_STYLUS)
        {
            s3eStylusType stylusType = (s3eStylusType)s3ePointerGetInt(S3E_POINTER_STYLUS_TYPE);
            if (stylusType == S3E_STYLUS_TYPE_INVALID)
                LOG_ERROR(LOGCAT_SYSTEM, "Stylus type = S3E_STYLUS_TYPE_INVALID\n");
            else
            {
                if (stylusType == S3E_STYLUS_TYPE_STYLUS)
                    LOG_INFO(LOGCAT_SYSTEM, "Pointer device is a touchscreen using a stylus.\n");
                else if (stylusType == S3E_STYLUS_TYPE_FINGER)
                    LOG_INFO(LOGCAT_SYSTEM, "Pointer device is a touchscreen.\n");

                if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE))
                {
                    LOG_INFO(LOGCAT_SYSTEM, "Pointer device supports multitouch.\n");
                    isMultitouchAvailable = true;
                }
                else
                    LOG_INFO(LOGCAT_SYSTEM, "Pointer device does not support multitouch.\n");

                m_touchscreen = new MarmaladeTouchscreen(this, isMultitouchAvailable);
                ASSERT(m_touchscreen != NULL);
                LOG_INFO(LOGCAT_SYSTEM, "Touchscreen input device ready.\n");
            }
        }
    }
    else
        LOG_WARN(LOGCAT_SYSTEM, "No pointer device is available.\n");

    s3eDeviceRegister(S3E_DEVICE_PAUSE, _MarmaladeEventCallback_Pause, this);
    s3eDeviceRegister(S3E_DEVICE_UNPAUSE, _MarmaladeEventCallback_Resume, this);
    s3eDeviceRegister(S3E_DEVICE_EXIT, _MarmaladeEventCallback_Exit, this);
    s3eGLRegister(S3E_GL_SUSPEND, _MarmaladeEventCallback_GLSuspend, this);
    s3eGLRegister(S3E_GL_RESUME, _MarmaladeEventCallback_GLResume, this);
    s3eSurfaceRegister(S3E_SURFACE_SCREENSIZE, _MarmaladeEventCallback_ScreenResize, this);
    s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, _MarmaladeEventCallback_Key, this);
    s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, _MarmaladeEventCallback_KeyChar, this);
    if (m_mouse != NULL || m_touchscreen != NULL)
    {
        if (isMultitouchAvailable)
        {
            s3ePointerRegister(S3E_POINTER_TOUCH_EVENT, _MarmaladeEventCallback_PointerMultitouchButton, this);
            s3ePointerRegister(S3E_POINTER_TOUCH_MOTION_EVENT, _MarmaladeEventCallback_PointerMultitouchMotion, this);
        }
        else
        {
            s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, _MarmaladeEventCallback_PointerButton, this);
            s3ePointerRegister(S3E_POINTER_MOTION_EVENT, _MarmaladeEventCallback_PointerMotion, this);
        }
    }
    else
        LOG_WARN(LOGCAT_SYSTEM, "No mouse or touchscreen device was initialized.\n");

    LOG_INFO(LOGCAT_SYSTEM, "Registered S3E event callbacks.\n");

    LOG_INFO(LOGCAT_SYSTEM, "Initializing file system access.\n");
    m_filesystem = new MarmaladeFileSystem();
    ASSERT(m_filesystem != NULL);

    LOG_INFO(LOGCAT_SYSTEM, "Finished initialization.\n");

    return true;
}