Minor fixes.

This commit is contained in:
Henrik Rydgard 2012-04-11 20:26:56 +02:00
parent cfbc3dbbaa
commit 97ea3356a9
4 changed files with 25 additions and 5 deletions

View File

@ -376,9 +376,15 @@ public class NativeActivity extends Activity {
audioPlayer = null; audioPlayer = null;
mGLSurfaceView = null; mGLSurfaceView = null;
} }
public boolean overrideKeys() {
return true;
}
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!overrideKeys())
return false;
// Eat these keys, to avoid accidental exits / other screwups. // Eat these keys, to avoid accidental exits / other screwups.
// Maybe there's even more we need to eat on tablets? // Maybe there's even more we need to eat on tablets?
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {

View File

@ -280,8 +280,8 @@ void DrawBuffer::MeasureText(int font, const char *text, float *w, float *h) {
AtlasChar c = atlasfont.chars[cval - 32]; AtlasChar c = atlasfont.chars[cval - 32];
wacc += c.wx * fontscalex; wacc += c.wx * fontscalex;
} }
*w = wacc; if (w) *w = wacc;
*h = atlasfont.height * fontscaley * lines; if (h) *h = atlasfont.height * fontscaley * lines;
} }
void DrawBuffer::DrawTextShadow(int font, const char *text, float x, float y, Color color, int flags) { void DrawBuffer::DrawTextShadow(int font, const char *text, float x, float y, Color color, int flags) {

View File

@ -19,7 +19,7 @@
#include "gfx_es2/draw_buffer.h" #include "gfx_es2/draw_buffer.h"
#include <string> #include <string >
#include <vector> #include <vector>
// Mouse out of habit, applies just as well to touch events. // Mouse out of habit, applies just as well to touch events.

View File

@ -25,4 +25,18 @@ inline uint32 ComputeParity(uint32 v) {
} // namespace bits } // namespace bits
#ifndef _MSC_VER
// These are built-ins in MSVC, let's define them for other OS:es as well.
inline uint32_t _rotl(uint32_t val, int shift) {
return (val << shift) | (val >> (31 - shift));
}
inline uint32_t _rotr(uint32_t val, int shift) {
return (val << shift) | (val >> (31 - shift));
}
#endif
#endif #endif