Esempio n. 1
0
void CCEGLView::setIMEKeyboardState(bool bOpen)
{
	if(bOpen && s3eOSReadStringAvailable() == S3E_TRUE) {
		const char* inputText = s3eOSReadStringUTF8("") ;
		if( inputText!=0 ) {
			CCIMEDispatcher::sharedDispatcher()->dispatchInsertText(inputText, strlen(inputText));
		}
	}
}
Esempio n. 2
0
File: input.cpp Progetto: dblo/XTD
const char* CInput::showOnScreenKeyboard(const char* prompt, int flags, const char* default_text)
{
	if (!OSKeyboardAvailable)
		return NULL;

	// Show on screen keyboard and return the input string
	if (default_text != NULL)
		return s3eOSReadStringUTF8WithDefault(prompt, default_text, flags);
	else
		return s3eOSReadStringUTF8(prompt, flags);
}
Esempio n. 3
0
bool ExampleUpdate()
{
    Button* pressed = GetSelectedButton();
    if (!pressed)
    {
        return true;
    }

    if (pressed == g_ButtonLogEvent)
    {
        char EventName[MAX_CHAR_SIZE];

        // Event Name: Key used to recognise event
        strcpy(EventName, s3eOSReadStringUTF8("Enter Event Name:", 0));
        s3eFlurryLogEvent(EventName, false);

        AppendMessageColour(GREEN, "Non Timed Event Logged");
    }
    else if (pressed == g_ButtonLogTimedEvent)
    {
        char EventName[MAX_CHAR_SIZE];

        // Event Name: Key used to recognise event
        strcpy(EventName, s3eOSReadStringUTF8("Enter Event Name:", 0));
        s3eFlurryLogEvent(EventName, true);

        AppendMessageColour(GREEN, "Timed Event Logged");
    }
    else if (pressed == g_ButtonEndTimedEvent)
    {
        char EventName[MAX_CHAR_SIZE];

        // Event Name: Key used to recognise event
        strcpy(EventName, s3eOSReadStringUTF8("Enter Event Name:", 0));
        s3eFlurryEndTimedEvent(EventName);
    }
    else if (pressed == g_ButtonLogError)
    {
        char Error[MAX_CHAR_SIZE];
        char Message[MAX_CHAR_SIZE];

        // Error ID: ID you can use to recognise this error
        strcpy(Error, s3eOSReadStringUTF8("Enter Error ID:", 0));
        // Error Message: Message describing the error
        strcpy(Message, s3eOSReadStringUTF8("Error Message:", 0));
        s3eFlurryLogError(Error, Message);
    }
    else if (pressed == g_ButtonUserInfo)
    {
        char userID[MAX_CHAR_SIZE];
        // User ID: Set an ID that can be used to recognise this user
        strcpy(userID, s3eOSReadStringUTF8("Enter User ID:", 0));
        s3eFlurrySetUserID(userID);

        char userAge[MAX_CHAR_SIZE];
        // User Age: Set the user's age
        strcpy(userAge, s3eOSReadStringUTF8("Enter User Age:", S3E_OSREADSTRING_FLAG_NUMBER));
        uint8 age = atoi(userAge);
        s3eFlurrySetUserAge(age);

        char userGender[MAX_CHAR_SIZE];
        // User Gender: Set the user's gender
        strcpy(userGender, s3eOSReadStringUTF8("Enter User Gender\n\"M\" or \"F\"", 0));
        if(!strcmp(userGender,"m") || !strcmp(userGender,"M"))
        {
            s3eFlurrySetUserGender(S3E_FLURRY_MALE);
            AppendMessageColour(GREEN, "Logged User Gender: Male");
        }
        else if(!strcmp(userGender,"f") || !strcmp(userGender,"F"))
        {
            s3eFlurrySetUserGender(S3E_FLURRY_FEMALE);
            AppendMessageColour(GREEN, "Logged User Gender: Female");
        }
        else
            AppendMessageColour(RED, "Gender given not valid");

        AppendMessageColour(GREEN, "Logged User age: %i", age);
        AppendMessageColour(GREEN, "Logged User ID: %s", userID);
    }
    else if (pressed == g_ButtonUserLocation)
    {
        //g_Error = s3eLocationGet(&g_Location);
        if(g_Error == S3E_RESULT_ERROR)
            AppendMessageColour(RED, "Could not determine location");
        else
        {
            //    s3eFlurrySetLocation(&g_Location);
            AppendMessageColour(GREEN, "Logged user location");
        }
    }
    else if (pressed == g_ButtonToggleSendOnClose)
    {
        bSendSessionReportOnClose = !bSendSessionReportOnClose;
        s3eFlurrySetSessionReportOnClose(bSendSessionReportOnClose);
        if(bSendSessionReportOnClose)
        {
            AppendMessageColour(GREEN, "Session report send on close: Enabled");
            g_ButtonToggleSendOnClose->m_Name = (char*)"Disable send session report on close";
        }
        else
        {
            AppendMessageColour(GREEN, "Session report send on close: Disabled");
            g_ButtonToggleSendOnClose->m_Name = (char*)"Enable send session report on close";
        }
    }
    else if (pressed == g_ButtonToggleSendOnPause)
    {
        bSendSessionReportOnPause = !bSendSessionReportOnPause;
        s3eFlurrySetSessionReportOnPause(bSendSessionReportOnPause);
        if(bSendSessionReportOnPause)
        {
            AppendMessageColour(GREEN, "Session report send on pause: Enabled");
            g_ButtonToggleSendOnPause->m_Name = (char*)"Disable send session report on pause";
        }
        else
        {
            AppendMessageColour(GREEN, "Session report send on pause: Disabled");
            g_ButtonToggleSendOnPause->m_Name = (char*)"Enable send session report on pause";
        }
    }

    else if (pressed == g_ButtonSetDefaultMessage)
    {
        char message[MAX_CHAR_SIZE];

        // User Gender: Set the user's gender
        strcpy(message, s3eOSReadStringUTF8("Enter a default message to be shown in the event no banner is available",0));
        s3eFlurrySetDefaultText(message);
    }
    else if (pressed == g_ButtonToggleAdBanner)
    {
        bShowBanner = !bShowBanner;
        s3eFlurryShowAdBanner(bShowBanner);

        if(bShowBanner)
            AppendMessageColour(GREEN, "Ad Banner: Enabled");
        else
            AppendMessageColour(GREEN, "Ad Banner: Disabled");

    }
    else if (pressed == g_ButtonShowOfferWall)
    {
        s3eFlurryShowOfferWall();
    }
    return true;
}