Add a way to get the "System name" (will be mostly useful for android). Tweaks.

This commit is contained in:
Henrik Rydgard 2013-08-18 00:14:25 +02:00
parent 2175499217
commit 0a857fe4a1
6 changed files with 20 additions and 2 deletions

View File

@ -31,6 +31,8 @@ static JNIEnv *jniEnvUI;
std::string frameCommand;
std::string frameCommandParam;
std::string systemName;
const bool extraLog = true;
static float left_joystick_x_async;
@ -84,6 +86,10 @@ void System_InputBox(const char *title, const char *defaultValue) {
frameCommandParam = title;
}
std::string System_GetName() {
return systemName;
}
// Remember that all of these need initialization on init! The process
// may be reused when restarting the game. Globals are DANGEROUS.
@ -152,7 +158,7 @@ extern "C" void Java_com_henrikrydgard_libnative_NativeApp_init
ILOG("NativeApp::Init: APK path: %s", apkPath.c_str());
VFSRegister("", new ZipAssetReader(apkPath.c_str(), "assets/"));
std::string deviceType = GetJavaString(env, jdevicetype);
systemName = GetJavaString(env, jdevicetype);
std::string externalDir = GetJavaString(env, jexternalDir);
std::string user_data_path = GetJavaString(env, jdataDir) + "/";

View File

@ -97,3 +97,4 @@ void LaunchBrowser(const char *url);
void LaunchMarket(const char *url);
void LaunchEmail(const char *email_address);
void System_InputBox(const char *title, const char *defaultValue);
std::string System_GetName();

View File

@ -248,6 +248,11 @@ void LaunchEmail(const char *email_address)
#endif
}
std::string System_GetName() {
// TODO
return "SDL";
}
InputState input_state;

View File

@ -82,10 +82,12 @@ void CheckGLExtensions() {
memset(&gl_extensions, 0, sizeof(gl_extensions));
const char *extString = (const char *)glGetString(GL_EXTENSIONS);
gl_extensions.all_gl_extensions = extString;
#ifdef WIN32
const char *wglString = wglGetExtensionsStringEXT();
gl_extensions.EXT_swap_control_tear = strstr(wglString, "WGL_EXT_swap_control_tear") != 0;
gl_extensions.all_egl_extensions = wglString;
#elif !defined(USING_GLES2)
// const char *glXString = glXQueryExtensionString();
// gl_extensions.EXT_swap_control_tear = strstr(glXString, "GLX_EXT_swap_control_tear") != 0;
@ -132,6 +134,7 @@ void CheckGLExtensions() {
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
const char *eglString = eglQueryString(display, EGL_EXTENSIONS);
gl_extensions.all_egl_extensions = eglString;
gl_extensions.EGL_NV_system_time = strstr(eglString, "EGL_NV_system_time") != 0;
gl_extensions.EGL_NV_coverage_sample = strstr(eglString, "EGL_NV_coverage_sample") != 0;

View File

@ -270,6 +270,9 @@ struct GLExtensions {
bool EGL_NV_system_time;
bool EGL_NV_coverage_sample;
std::string all_gl_extensions;
std::string all_egl_extensions;
};
extern GLExtensions gl_extensions;

View File

@ -304,7 +304,7 @@ void InfoItem::Draw(UIContext &dc) {
Item::Draw(dc);
int paddingX = 12;
dc.Draw()->DrawText(dc.theme->uiFont, text_.c_str(), bounds_.x + paddingX, bounds_.centerY(), 0xFFFFFFFF, ALIGN_VCENTER);
dc.Draw()->DrawText(dc.theme->uiFont, text_.c_str(), bounds_.x2() - paddingX, bounds_.centerY(), 0xFFFFFFFF, ALIGN_VCENTER | ALIGN_RIGHT);
dc.Draw()->DrawText(dc.theme->uiFont, rightText_.c_str(), bounds_.x2() - paddingX, bounds_.centerY(), 0xFFFFFFFF, ALIGN_VCENTER | ALIGN_RIGHT);
// dc.Draw()->DrawImageStretch(dc.theme->whiteImage, bounds_.x, bounds_.y, bounds_.x2(), bounds_.y + 2, dc.theme->itemDownStyle.bgColor);
}