mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-02-16 00:51:05 +00:00
Merge pull request #32 from lvonasek/feature_pause_flow
Game pause flow improvements
This commit is contained in:
commit
d9791d0ef1
4 changed files with 51 additions and 3 deletions
|
@ -790,7 +790,7 @@ Scroll it up or down
|
||||||
void Con_RunConsole (void) {
|
void Con_RunConsole (void) {
|
||||||
// decide on the destination height of the console
|
// decide on the destination height of the console
|
||||||
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
|
if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
|
||||||
con.finalFrac = 0.5; // half screen
|
con.finalFrac = 0.4; // half screen
|
||||||
else
|
else
|
||||||
con.finalFrac = 0; // none visible
|
con.finalFrac = 0; // none visible
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,28 @@ void APIENTRY VR_GLDebugLog(GLenum source, GLenum type, GLuint id,
|
||||||
{
|
{
|
||||||
if (type == GL_DEBUG_TYPE_ERROR || type == GL_DEBUG_TYPE_PERFORMANCE || ENABLE_GL_DEBUG_VERBOSE)
|
if (type == GL_DEBUG_TYPE_ERROR || type == GL_DEBUG_TYPE_PERFORMANCE || ENABLE_GL_DEBUG_VERBOSE)
|
||||||
{
|
{
|
||||||
Com_Printf("GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
|
char typeStr[128];
|
||||||
(type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : ""), type, severity, message);
|
switch (type) {
|
||||||
|
case GL_DEBUG_TYPE_ERROR: sprintf(typeStr, "ERROR"); break;
|
||||||
|
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: sprintf(typeStr, "DEPRECATED_BEHAVIOR"); break;
|
||||||
|
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: sprintf(typeStr, "UNDEFINED_BEHAVIOR"); break;
|
||||||
|
case GL_DEBUG_TYPE_PORTABILITY: sprintf(typeStr, "PORTABILITY"); break;
|
||||||
|
case GL_DEBUG_TYPE_PERFORMANCE: sprintf(typeStr, "PERFORMANCE"); break;
|
||||||
|
case GL_DEBUG_TYPE_MARKER: sprintf(typeStr, "MARKER"); break;
|
||||||
|
case GL_DEBUG_TYPE_PUSH_GROUP: sprintf(typeStr, "PUSH_GROUP"); break;
|
||||||
|
case GL_DEBUG_TYPE_POP_GROUP: sprintf(typeStr, "POP_GROUP"); break;
|
||||||
|
default: sprintf(typeStr, "OTHER"); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
char severinityStr[128];
|
||||||
|
switch (severity) {
|
||||||
|
case GL_DEBUG_SEVERITY_HIGH: sprintf(severinityStr, "HIGH"); break;
|
||||||
|
case GL_DEBUG_SEVERITY_MEDIUM: sprintf(severinityStr, "MEDIUM"); break;
|
||||||
|
case GL_DEBUG_SEVERITY_LOW: sprintf(severinityStr, "LOW"); break;
|
||||||
|
default: sprintf(severinityStr, "VERBOSE"); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Com_Printf("[%s] GL issue - %s: %s\n", severinityStr, typeStr, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#include <client/keycodes.h>
|
||||||
#include <qcommon/q_shared.h>
|
#include <qcommon/q_shared.h>
|
||||||
#include <qcommon/qcommon.h>
|
#include <qcommon/qcommon.h>
|
||||||
#include <vr/vr_base.h>
|
#include <vr/vr_base.h>
|
||||||
|
@ -28,6 +29,7 @@ extern "C" {
|
||||||
static JNIEnv* g_Env = NULL;
|
static JNIEnv* g_Env = NULL;
|
||||||
static JavaVM* g_JavaVM = NULL;
|
static JavaVM* g_JavaVM = NULL;
|
||||||
static jobject g_ActivityObject = NULL;
|
static jobject g_ActivityObject = NULL;
|
||||||
|
static bool g_HasFocus = true;
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -37,6 +39,11 @@ extern "C"
|
||||||
g_ActivityObject = env->NewGlobalRef(thisObject);
|
g_ActivityObject = env->NewGlobalRef(thisObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_com_drbeef_ioq3quest_MainActivity_nativeFocusChanged(JNIEnv *env, jclass clazz, jboolean focus)
|
||||||
|
{
|
||||||
|
g_HasFocus = focus;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||||
{
|
{
|
||||||
g_JavaVM = vm;
|
g_JavaVM = vm;
|
||||||
|
@ -83,7 +90,22 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
VR_EnterVR(engine, java);
|
VR_EnterVR(engine, java);
|
||||||
|
|
||||||
|
bool hasFocus = true;
|
||||||
|
bool paused = false;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
if (hasFocus != g_HasFocus) {
|
||||||
|
hasFocus = g_HasFocus;
|
||||||
|
if (!hasFocus && !Cvar_VariableValue ("cl_paused")) {
|
||||||
|
Com_QueueEvent( Sys_Milliseconds(), SE_KEY, K_ESCAPE, qtrue, 0, NULL );
|
||||||
|
//Com_QueueEvent( Sys_Milliseconds(), SE_KEY, K_CONSOLE, qtrue, 0, NULL );
|
||||||
|
paused = true;
|
||||||
|
} else if (hasFocus && paused) {
|
||||||
|
//Com_QueueEvent( Sys_Milliseconds(), SE_KEY, K_CONSOLE, qtrue, 0, NULL );
|
||||||
|
Com_QueueEvent( Sys_Milliseconds(), SE_KEY, K_ESCAPE, qtrue, 0, NULL );
|
||||||
|
paused = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
LOGI("Received SDL Event: %d", event.type);
|
LOGI("Received SDL Event: %d", event.type);
|
||||||
|
|
|
@ -82,6 +82,11 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWindowFocusChanged(boolean hasFocus) {
|
||||||
|
nativeFocusChanged(hasFocus);
|
||||||
|
}
|
||||||
|
|
||||||
public void create() throws IOException {
|
public void create() throws IOException {
|
||||||
//Make the directories
|
//Make the directories
|
||||||
new File("/sdcard/ioquake3Quest/baseq3").mkdirs();
|
new File("/sdcard/ioquake3Quest/baseq3").mkdirs();
|
||||||
|
@ -188,6 +193,7 @@ public class MainActivity extends SDLActivity // implements KeyEvent.Callback
|
||||||
}
|
}
|
||||||
|
|
||||||
public static native void nativeCreate(MainActivity thisObject);
|
public static native void nativeCreate(MainActivity thisObject);
|
||||||
|
public static native void nativeFocusChanged(boolean focus);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("main");
|
System.loadLibrary("main");
|
||||||
|
|
Loading…
Reference in a new issue