help and bugfix editor and start of keyboard

This commit is contained in:
nosogo 2010-12-24 03:36:34 +00:00
parent 97ee61165a
commit 2a4c9a99cd
6 changed files with 43 additions and 25 deletions

View File

@ -332,7 +332,11 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
buttonVideoInfo.setText(lang.get("VideoInfo")); buttonVideoInfo.setText(lang.get("VideoInfo"));
buttonVideoInfo.registerGraphicComponent(containerName,"buttonVideoInfo"); buttonVideoInfo.registerGraphicComponent(containerName,"buttonVideoInfo");
buttonVideoInfo.init(620, buttonRowPos, 125); buttonVideoInfo.init(585, buttonRowPos, 125); // was 620
buttonKeyboardSetup.setText(lang.get("Keyboard"));
buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup");
buttonKeyboardSetup.init(720, buttonRowPos, 125);
GraphicComponent::applyAllCustomProperties(containerName); GraphicComponent::applyAllCustomProperties(containerName);
} }
@ -424,6 +428,11 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
soundRenderer.playFx(coreData.getClickSoundA()); soundRenderer.playFx(coreData.getClickSoundA());
mainMenu->setState(new MenuStateGraphicInfo(program, mainMenu)); mainMenu->setState(new MenuStateGraphicInfo(program, mainMenu));
} }
else if(buttonKeyboardSetup.mouseClick(x, y)){
soundRenderer.playFx(coreData.getClickSoundA());
// mainMenu->setState(new MenuStateKeyboardSetup(program, mainMenu)); // open keyboard shortcuts setup screen
showMessageBox("Not implemented yet", "Keyboard setup", false);
}
else if(labelPlayerName.mouseClick(x, y) && ( activeInputLabel != &labelPlayerName )){ else if(labelPlayerName.mouseClick(x, y) && ( activeInputLabel != &labelPlayerName )){
setActiveInputLable(&labelPlayerName); setActiveInputLable(&labelPlayerName);
} }
@ -455,6 +464,7 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
buttonAbort.mouseMove(x, y); buttonAbort.mouseMove(x, y);
buttonAutoConfig.mouseMove(x, y); buttonAutoConfig.mouseMove(x, y);
buttonVideoInfo.mouseMove(x, y); buttonVideoInfo.mouseMove(x, y);
buttonKeyboardSetup.mouseMove(x, y);
listBoxLang.mouseMove(x, y); listBoxLang.mouseMove(x, y);
listBoxSoundFactory.mouseMove(x, y); listBoxSoundFactory.mouseMove(x, y);
listBoxVolumeFx.mouseMove(x, y); listBoxVolumeFx.mouseMove(x, y);
@ -488,9 +498,13 @@ void MenuStateOptions::keyDown(char key){
void MenuStateOptions::keyPress(char c){ void MenuStateOptions::keyPress(char c){
if(activeInputLabel!=NULL) if(activeInputLabel!=NULL)
{ {
//printf("[%d]\n",c); fflush(stdout);
int maxTextSize= 16; int maxTextSize= 16;
if(&labelPlayerName==activeInputLabel){ if(&labelPlayerName==activeInputLabel){
if((c>='0' && c<='9')||(c>='a' && c<='z')||(c>='A' && c<='Z')|| if((c>='0' && c<='9')||(c>='a' && c<='z')||(c>='A' && c<='Z')||
// (c>=(192-256) && c<=(255-256))|| // test some support for accented letters in names, is this ok? (latin1 signed char)
// no master server breaks, and a russian translation with game switched to KOI-8p encoding? probably irc too.
// (use Shared::Platform::charSet in shared_lib/include/platform/sdl/gl_wrap.h ?)
(c=='-')||(c=='(')||(c==')')){ (c=='-')||(c=='(')||(c==')')){
if(activeInputLabel->getText().size()<maxTextSize){ if(activeInputLabel->getText().size()<maxTextSize){
string text= activeInputLabel->getText(); string text= activeInputLabel->getText();
@ -523,6 +537,7 @@ void MenuStateOptions::render(){
renderer.renderButton(&buttonAbort); renderer.renderButton(&buttonAbort);
renderer.renderButton(&buttonAutoConfig); renderer.renderButton(&buttonAutoConfig);
renderer.renderButton(&buttonVideoInfo); renderer.renderButton(&buttonVideoInfo);
renderer.renderButton(&buttonKeyboardSetup);
renderer.renderListBox(&listBoxLang); renderer.renderListBox(&listBoxLang);
renderer.renderListBox(&listBoxShadows); renderer.renderListBox(&listBoxShadows);
renderer.renderListBox(&listBoxTextures3D); renderer.renderListBox(&listBoxTextures3D);

View File

@ -3,9 +3,9 @@
// //
// Copyright (C) 2001-2005 Marti<74>o Figueroa // Copyright (C) 2001-2005 Marti<74>o Figueroa
// //
// You can redistribute this code and/or modify it under // You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published // the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the // by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version // License, or (at your option) any later version
// ============================================================== // ==============================================================
@ -18,17 +18,18 @@
namespace Glest{ namespace Game{ namespace Glest{ namespace Game{
// =============================== // ===============================
// class MenuStateOptions // class MenuStateOptions
// =============================== // ===============================
class MenuStateOptions: public MenuState{ class MenuStateOptions: public MenuState{
private: private:
GraphicButton buttonOk; GraphicButton buttonOk;
GraphicButton buttonAbort; GraphicButton buttonAbort;
GraphicButton buttonAutoConfig; GraphicButton buttonAutoConfig;
GraphicButton buttonVideoInfo; GraphicButton buttonVideoInfo;
GraphicButton buttonKeyboardSetup; // configure the keyboard
GraphicLabel labelLang; GraphicLabel labelLang;
GraphicLabel labelShadows; GraphicLabel labelShadows;
GraphicLabel labelFilter; GraphicLabel labelFilter;
@ -54,31 +55,31 @@ private:
GraphicLabel *activeInputLabel; GraphicLabel *activeInputLabel;
GraphicLabel labelServerPort; GraphicLabel labelServerPort;
GraphicLabel labelServerPortLabel; GraphicLabel labelServerPortLabel;
GraphicLabel labelScreenModes; GraphicLabel labelScreenModes;
GraphicListBox listBoxScreenModes; GraphicListBox listBoxScreenModes;
list<ModeInfo> modeInfos; list<ModeInfo> modeInfos;
GraphicLabel labelFullscreenWindowed; GraphicLabel labelFullscreenWindowed;
GraphicListBox listBoxFullscreenWindowed; GraphicListBox listBoxFullscreenWindowed;
GraphicLabel labelVideoSection; GraphicLabel labelVideoSection;
GraphicLabel labelAudioSection; GraphicLabel labelAudioSection;
GraphicLabel labelMiscSection; GraphicLabel labelMiscSection;
GraphicLabel labelFontSizeAdjustment; GraphicLabel labelFontSizeAdjustment;
GraphicListBox listFontSizeAdjustment; GraphicListBox listFontSizeAdjustment;
GraphicLabel labelMapPreview; GraphicLabel labelMapPreview;
GraphicListBox listBoxMapPreview; GraphicListBox listBoxMapPreview;
GraphicMessageBox mainMessageBox; GraphicMessageBox mainMessageBox;
int mainMessageBoxState; int mainMessageBoxState;
GraphicLabel labelPublishServerExternalPort; GraphicLabel labelPublishServerExternalPort;
GraphicListBox listBoxPublishServerExternalPort; GraphicListBox listBoxPublishServerExternalPort;
public: public:
MenuStateOptions(Program *program, MainMenu *mainMenu); MenuStateOptions(Program *program, MainMenu *mainMenu);
@ -88,7 +89,7 @@ public:
void render(); void render();
virtual void keyDown(char key); virtual void keyDown(char key);
virtual void keyPress(char c); virtual void keyPress(char c);
private: private:
void saveConfig(); void saveConfig();

View File

@ -80,7 +80,7 @@
#include "icons/brush_resource_5.xpm" #include "icons/brush_resource_5.xpm"
#include "icons/edit_randomize-heights.xpm" #include "icons/edit_randomize-heights.xpm"
#include "icons/edit_randomize.xpm" // #include "icons/edit_randomize.xpm"
#include "icons/edit_redo.xpm" #include "icons/edit_redo.xpm"
#include "icons/edit_switch-surfaces.xpm" #include "icons/edit_switch-surfaces.xpm"
#include "icons/edit_undo.xpm" #include "icons/edit_undo.xpm"

View File

@ -593,7 +593,7 @@ void MainWindow::onMenuEditResize(wxCommandEvent &event) {
simpleDialog.addValue("Height", intToStr(program->getMap()->getH()),"(must be 16,32,64,128,256,512...)"); simpleDialog.addValue("Height", intToStr(program->getMap()->getH()),"(must be 16,32,64,128,256,512...)");
simpleDialog.addValue("Surface", "1","(surface material for new area around map)"); simpleDialog.addValue("Surface", "1","(surface material for new area around map)");
simpleDialog.addValue("Altitude", "10","(surface height for new area around map)"); simpleDialog.addValue("Altitude", "10","(surface height for new area around map)");
if (!simpleDialog.show("Resze - expand around, shrink to topleft")) return; if (!simpleDialog.show("Resize - expand around, shrink to topleft")) return;
try { try {
program->resize( program->resize(
@ -750,11 +750,13 @@ void MainWindow::onMenuViewAbout(wxCommandEvent &event) {
void MainWindow::onMenuViewHelp(wxCommandEvent &event) { void MainWindow::onMenuViewHelp(wxCommandEvent &event) {
MsgDialog(this, MsgDialog(this,
wxT("Draw with left mouse\nMove viewport with right mouse drag\nZoom with center mouse drag, or mousewheel\n\ wxT("Draw with left mouse\nMove viewport with right mouse drag\nZoom with center mouse drag, or mousewheel\n\n\
You can change brush in the same category with key 1-9\n\ You can change brush in the same category with key 1-9\n\
and change category with their first letter (keys S, R, O, G, H)\n\
Press Space to set brush to the resource or object under the mouse cursor\n\
To center things in the map shift it with Shift-Up/Down/Left/Right keys\n\ To center things in the map shift it with Shift-Up/Down/Left/Right keys\n\
Height tool (blue) builds with integer height steps 0-20, \nwhile Gradient tool (red) uses any real number \n\ Height tool (blue) builds with integer height steps 0-20, \nwhile Gradient tool (red) uses any real number \n\
Units can go over water as long as it is less than 1.5 deep\n\ Units can go over water as long as it is less than 1.5 deep\n\n\
A good idea is to put some stone, gold and tree near starting position\n\ A good idea is to put some stone, gold and tree near starting position\n\
Starting position needs an open area for the tower and the starting units\n"), Starting position needs an open area for the tower and the starting units\n"),
wxT("Help")).ShowModal(); wxT("Help")).ShowModal();

View File

@ -74,7 +74,7 @@ class UndoPoint {
class ChangeStack : public std::stack<UndoPoint> { class ChangeStack : public std::stack<UndoPoint> {
public: public:
static const int maxSize = 100; static const unsigned int maxSize = 100;
void clear() { c.clear(); } void clear() { c.clear(); }

View File

@ -379,7 +379,7 @@ void MapPreview::changeObject(int x, int y, int object, int radius) {
for (j = y - radius + 1; j < y + radius; j++) { for (j = y - radius + 1; j < y + radius; j++) {
if (inside(i, j)) { if (inside(i, j)) {
dist = get_dist(i - x, j - y); dist = get_dist(i - x, j - y);
if (radius >= dist) { if (radius > dist) { // was >=
cells[i][j].object = object; cells[i][j].object = object;
cells[i][j].resource = 0; cells[i][j].resource = 0;
} }
@ -401,7 +401,7 @@ void MapPreview::changeResource(int x, int y, int resource, int radius) {
for (j = y - radius + 1; j < y + radius; j++) { for (j = y - radius + 1; j < y + radius; j++) {
if (inside(i, j)) { if (inside(i, j)) {
dist = get_dist(i - x, j - y); dist = get_dist(i - x, j - y);
if (radius >= dist) { if (radius > dist) { // was >=
cells[i][j].resource = resource; cells[i][j].resource = resource;
cells[i][j].object = 0; cells[i][j].object = 0;
} }