mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
Some basic work on the vkeybd code
svn-id: r35931
This commit is contained in:
parent
57d118e930
commit
a27e456ace
@ -36,7 +36,12 @@ MODULE_OBJS := \
|
||||
saves/compressed/compressed-saves.o \
|
||||
saves/posix/posix-saves.o \
|
||||
saves/psp/psp-saves.o \
|
||||
timer/default/default-timer.o
|
||||
timer/default/default-timer.o \
|
||||
vkeybd/image-map.o \
|
||||
vkeybd/polygon.o \
|
||||
vkeybd/virtual-keyboard.o \
|
||||
vkeybd/virtual-keyboard-gui.o \
|
||||
vkeybd/virtual-keyboard-parser.o
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/rules.mk
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifdef ENABLE_VKEYBD
|
||||
|
||||
#include "graphics/cursorman.h"
|
||||
#include "gui/newgui.h"
|
||||
#include "gui/GuiManager.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
#ifdef ENABLE_VKEYBD
|
||||
|
||||
#include "common/keyboard.h"
|
||||
#include "graphics/imageman.h"
|
||||
#include "common/util.h"
|
||||
#include "common/system.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
@ -261,21 +261,26 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) {
|
||||
return parserError("Error loading bitmap '%s'", _mode->bitmapName.c_str());
|
||||
}
|
||||
|
||||
const Graphics::PixelFormat format = g_system->getOverlayFormat();
|
||||
int r, g, b;
|
||||
if (node->values.contains("transparent_color")) {
|
||||
int r, g, b;
|
||||
if (!parseIntegerKey(node->values["transparent_color"].c_str(), 3, &r, &g, &b))
|
||||
return parserError("Could not parse color value");
|
||||
_mode->transparentColor = g_system->RGBToColor(r, g, b);
|
||||
} else // default to purple
|
||||
_mode->transparentColor = g_system->RGBToColor(255, 0, 255);
|
||||
} else {
|
||||
// default to purple
|
||||
r = 255;
|
||||
g = 0;
|
||||
b = 255;
|
||||
}
|
||||
_mode->transparentColor = Graphics::RGBToColor(r, g, b, format);
|
||||
|
||||
if (node->values.contains("display_font_color")) {
|
||||
int r, g, b;
|
||||
if (!parseIntegerKey(node->values["display_font_color"].c_str(), 3, &r, &g, &b))
|
||||
return parserError("Could not parse color value");
|
||||
_mode->displayFontColor = g_system->RGBToColor(r, g, b);
|
||||
} else
|
||||
_mode->displayFontColor = g_system->RGBToColor(0, 0, 0); // default to black
|
||||
} else {
|
||||
r = g = b = 0; // default to black
|
||||
}
|
||||
_mode->displayFontColor = Graphics::RGBToColor(r, g, b, format);
|
||||
|
||||
_layoutParsed = true;
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "backends/vkeybd/keycode-descriptions.h"
|
||||
#include "common/config-manager.h"
|
||||
#include "common/fs.h"
|
||||
#include "graphics/imageman.h"
|
||||
#include "common/unzip.h"
|
||||
|
||||
#define KEY_START_CHAR ('[')
|
||||
@ -81,25 +80,25 @@ bool VirtualKeyboard::loadKeyboardPack(String packName) {
|
||||
|
||||
_kbdGUI->initSize(_system->getOverlayWidth(), _system->getOverlayHeight());
|
||||
|
||||
FilesystemNode *vkDir = 0;
|
||||
FSNode vkDir;
|
||||
if (ConfMan.hasKey("vkeybdpath")) {
|
||||
vkDir = new FilesystemNode(ConfMan.get("vkeybdpath"));
|
||||
vkDir = FSNode(ConfMan.get("vkeybdpath"));
|
||||
} else if (ConfMan.hasKey("extrapath")) {
|
||||
vkDir = new FilesystemNode(ConfMan.get("extrapath"));
|
||||
vkDir = FSNode(ConfMan.get("extrapath"));
|
||||
} else { // use current directory
|
||||
vkDir = new FilesystemNode(".");
|
||||
vkDir = FSNode(".");
|
||||
}
|
||||
|
||||
if (vkDir->getChild(packName + ".xml").exists()) {
|
||||
if (vkDir.getChild(packName + ".xml").exists()) {
|
||||
// uncompressed keyboard pack
|
||||
|
||||
if (!_parser->loadFile(vkDir->getChild(packName + ".xml")))
|
||||
if (!_parser->loadFile(vkDir.getChild(packName + ".xml")))
|
||||
return false;
|
||||
|
||||
} else if (vkDir->getChild(packName + ".zip").exists()) {
|
||||
} else if (vkDir.getChild(packName + ".zip").exists()) {
|
||||
// compressed keyboard pack
|
||||
#ifdef USE_ZLIB
|
||||
ZipArchive arch(vkDir->getChild(packName + ".zip").getPath().c_str());
|
||||
ZipArchive arch(vkDir.getChild(packName + ".zip").getPath().c_str());
|
||||
if (arch.hasFile(packName + ".xml")) {
|
||||
if (!_parser->loadStream(arch.openFile(packName + ".xml")))
|
||||
return false;
|
||||
@ -107,7 +106,7 @@ bool VirtualKeyboard::loadKeyboardPack(String packName) {
|
||||
warning("Could not find %s.xml file in %s.zip keyboard pack", packName.c_str(), packName.c_str());
|
||||
return false;
|
||||
}
|
||||
ImageMan.addArchive(vkDir->getChild(packName + ".zip").getPath().c_str());
|
||||
ImageMan.addArchive(vkDir.getChild(packName + ".zip").getPath().c_str());
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
@ -35,11 +35,14 @@ class OSystem;
|
||||
#include "common/events.h"
|
||||
#include "common/hashmap.h"
|
||||
#include "common/hash-str.h"
|
||||
#include "backends/vkeybd/image-map.h"
|
||||
#include "common/keyboard.h"
|
||||
#include "common/list.h"
|
||||
#include "common/str.h"
|
||||
|
||||
#include "backends/vkeybd/image-map.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
|
||||
namespace Common {
|
||||
|
||||
class VirtualKeyboardGUI;
|
||||
|
Loading…
x
Reference in New Issue
Block a user