enabled OK button on GuiCombat screen when choosing defenders/attackers. iOS solution only currently. To implement in Android, we need to create a mask/invisible button above the OK button coordinates and add a listener to activate when a user touches the appropriate area. Not ideal, but it works for now.

TODO:  translate functionality into core of engine.
This commit is contained in:
techdragon.nguyen@gmail.com
2011-12-30 16:04:21 +00:00
parent 7fef90f943
commit e102d3f369
10 changed files with 84 additions and 39 deletions
+31 -16
View File
@@ -589,6 +589,8 @@ void JGE::SendCommand(string command)
{
#if defined (ANDROID)
sendJNICommand(command);
#elif defined (IOS)
SendCommand(command, "");
#endif
}
@@ -597,29 +599,42 @@ void JGE::SendCommand(std::string command, std::string parameter)
#if defined (IOS)
// get the app delegate and have it handle the command
wagicAppDelegate *delegate = [ [UIApplication sharedApplication] delegate];
DebugTrace("Command: "<< command << " with parameter: " << parameter << endl);
[delegate handleWEngineCommand:[NSString stringWithCString: command.c_str() encoding: NSUTF8StringEncoding]
withParameter: [NSString stringWithCString: parameter.c_str() encoding:NSUTF8StringEncoding]];
#endif
}
#if defined (ANDROID)
/// Access to JNI Environment
void JGE::SetJNIEnv(JNIEnv * env, jclass cls)
{
mJNIEnv = env;
mJNIClass = cls;
midSendCommand = mJNIEnv->GetStaticMethodID(mJNIClass,"jgeSendCommand","(Ljava/lang/String;)V");
}
void JGE::sendJNICommand(string command)
{
if (midSendCommand) {
mJNIEnv->CallStaticVoidMethod(mJNIClass, midSendCommand, mJNIEnv->NewStringUTF(command.c_str()));
}
}
// this controls commands meant to modify/interact with UI
void JGE::SendCommand(std::string command, float& x, float& y, float& width, float& height)
{
#ifdef ANDROID
#elif IOS
wagicAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate handleWEngineCommand: [NSString stringWithCString: command.c_str() encoding: NSUTF8StringEncoding] withUIParameters: x yCoordinate: y width: width height: height];
#endif
}
#if defined (ANDROID)
/// Access to JNI Environment
void JGE::SetJNIEnv(JNIEnv * env, jclass cls)
{
mJNIEnv = env;
mJNIClass = cls;
midSendCommand = mJNIEnv->GetStaticMethodID(mJNIClass,"jgeSendCommand","(Ljava/lang/String;)V");
}
void JGE::sendJNICommand(string command)
{
if (midSendCommand) {
mJNIEnv->CallStaticVoidMethod(mJNIClass, midSendCommand, mJNIEnv->NewStringUTF(command.c_str()));
}
}
#endif
std::queue< pair< pair<LocalKeySym, JButton>, bool> > JGE::keyBuffer;
std::multimap<LocalKeySym, JButton> JGE::keyBinds;