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;
mGLSurfaceView = null;
}
public boolean overrideKeys() {
return true;
}
@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.
// Maybe there's even more we need to eat on tablets?
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];
wacc += c.wx * fontscalex;
}
*w = wacc;
*h = atlasfont.height * fontscaley * lines;
if (w) *w = wacc;
if (h) *h = atlasfont.height * fontscaley * lines;
}
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 <string>
#include <string >
#include <vector>
// Mouse out of habit, applies just as well to touch events.

View File

@ -25,4 +25,18 @@ inline uint32 ComputeParity(uint32 v) {
} // 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