mirror of
https://github.com/glest/glest-source.git
synced 2025-08-14 20:34:01 +02:00
A few changes to allow for better keyboard state detection
This commit is contained in:
@@ -118,12 +118,19 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||
int p = i - fontInfo->min_char_or_byte2;
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,p,fontInfo->per_char);
|
||||
if(fontInfo->per_char == NULL) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),p,fontInfo->per_char);
|
||||
|
||||
XCharStruct *charinfo = &(fontInfo->min_bounds);
|
||||
int charWidth = charinfo->rbearing - charinfo->lbearing;
|
||||
//int charWidth = charinfo->rbearing - charinfo->lbearing;
|
||||
//int charHeight = charinfo->ascent + charinfo->descent;
|
||||
//int spanLength = (charWidth + 7) / 8;
|
||||
|
||||
metrics.setWidth(i, static_cast<float> (charWidth));
|
||||
if(charinfo != NULL) {
|
||||
metrics.setWidth(i, static_cast<float> (charinfo->width));
|
||||
}
|
||||
else {
|
||||
metrics.setWidth(i, static_cast<float>(6));
|
||||
}
|
||||
}
|
||||
else {
|
||||
metrics.setWidth(i, static_cast<float> (
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "sdl_private.h"
|
||||
#include "noimpl.h"
|
||||
#include "util.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace Shared::Util;
|
||||
@@ -40,6 +40,7 @@ Vec2i Window::mousePos;
|
||||
MouseState Window::mouseState;
|
||||
bool Window::isKeyPressedDown = false;
|
||||
bool Window::isFullScreen = false;
|
||||
SDL_keysym Window::keystate;
|
||||
|
||||
// ========== PUBLIC ==========
|
||||
|
||||
@@ -118,6 +119,7 @@ bool Window::handleEvent() {
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
Window::isKeyPressedDown = true;
|
||||
keystate = event.key.keysym;
|
||||
/* handle ALT+Return */
|
||||
if(event.key.keysym.sym == SDLK_RETURN
|
||||
&& (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
|
||||
@@ -125,6 +127,7 @@ bool Window::handleEvent() {
|
||||
toggleFullscreen();
|
||||
}
|
||||
if(global_window) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
global_window->eventKeyDown(getKey(event.key.keysym));
|
||||
global_window->eventKeyPress(static_cast<char>(event.key.keysym.unicode));
|
||||
}
|
||||
@@ -133,6 +136,7 @@ bool Window::handleEvent() {
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
Window::isKeyPressedDown = false;
|
||||
keystate = event.key.keysym;
|
||||
|
||||
if(global_window) {
|
||||
global_window->eventKeyUp(getKey(event.key.keysym));
|
||||
|
Reference in New Issue
Block a user