mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Added ingame console (use F1)
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@104 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
1b01de4294
commit
876fc482ca
22 changed files with 374 additions and 192 deletions
8
Makefile
8
Makefile
|
@ -21,7 +21,11 @@ BGCC=$(CXX) $(CXXFLAGS) $(CF_BULLET)
|
||||||
|
|
||||||
# Ogre C++ files, on the form ogre/cpp_X.cpp. Only the first file is
|
# Ogre C++ files, on the form ogre/cpp_X.cpp. Only the first file is
|
||||||
# passed to the compiler, the rest are dependencies.
|
# passed to the compiler, the rest are dependencies.
|
||||||
ogre_cpp=ogre framelistener interface bsaarchive mygui
|
ogre_cpp=ogre framelistener interface bsaarchive
|
||||||
|
|
||||||
|
# MyGUI C++ files, gui/cpp_X.cpp. These are currently included into
|
||||||
|
# with cpp_ogre.cpp.
|
||||||
|
mygui_cpp=mygui console
|
||||||
|
|
||||||
# FFmpeg files, in the form sound/cpp_X.cpp.
|
# FFmpeg files, in the form sound/cpp_X.cpp.
|
||||||
avcodec_cpp=avcodec
|
avcodec_cpp=avcodec
|
||||||
|
@ -31,7 +35,7 @@ bullet_cpp=bullet player scale
|
||||||
|
|
||||||
#### No modifications should be required below this line. ####
|
#### No modifications should be required below this line. ####
|
||||||
|
|
||||||
ogre_cpp_files=$(ogre_cpp:%=ogre/cpp_%.cpp)
|
ogre_cpp_files=$(ogre_cpp:%=ogre/cpp_%.cpp) $(mygui_cpp:%=gui/cpp_%.cpp)
|
||||||
avcodec_cpp_files=$(avcodec_cpp:%=sound/cpp_%.cpp)
|
avcodec_cpp_files=$(avcodec_cpp:%=sound/cpp_%.cpp)
|
||||||
bullet_cpp_files=$(bullet_cpp:%=bullet/cpp_%.cpp)
|
bullet_cpp_files=$(bullet_cpp:%=bullet/cpp_%.cpp)
|
||||||
|
|
||||||
|
|
|
@ -56,14 +56,6 @@ struct ConfigManager
|
||||||
|
|
||||||
IniWriter iniWriter;
|
IniWriter iniWriter;
|
||||||
|
|
||||||
// Sound setting
|
|
||||||
/*
|
|
||||||
float musicVolume;
|
|
||||||
float sfxVolume;
|
|
||||||
float mainVolume;
|
|
||||||
bool useMusic;
|
|
||||||
//*/
|
|
||||||
|
|
||||||
// Mouse sensitivity
|
// Mouse sensitivity
|
||||||
float *mouseSensX;
|
float *mouseSensX;
|
||||||
float *mouseSensY;
|
float *mouseSensY;
|
||||||
|
@ -157,11 +149,6 @@ struct ConfigManager
|
||||||
*/
|
*/
|
||||||
|
|
||||||
readIni(reset);
|
readIni(reset);
|
||||||
|
|
||||||
// I think DMD is on the brink of collapsing here. This has been
|
|
||||||
// moved elsewhere, because DMD couldn't handle one more import in
|
|
||||||
// this file.
|
|
||||||
//updateMouseSensitivity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read config from morro.ini, if it exists. The reset parameter is
|
// Read config from morro.ini, if it exists. The reset parameter is
|
||||||
|
@ -172,10 +159,6 @@ struct ConfigManager
|
||||||
// Read configuration file, if it exists.
|
// Read configuration file, if it exists.
|
||||||
IniReader ini;
|
IniReader ini;
|
||||||
|
|
||||||
// TODO: Right now we have to specify each option twice, once for
|
|
||||||
// reading and once for writing. Fix it? Nah. Don't do anything,
|
|
||||||
// this entire configuration scheme is likely to change anyway.
|
|
||||||
|
|
||||||
ini.readFile(confFile);
|
ini.readFile(confFile);
|
||||||
|
|
||||||
screenShotNum = ini.getInt("General", "Screenshots", 0);
|
screenShotNum = ini.getInt("General", "Screenshots", 0);
|
||||||
|
@ -209,13 +192,9 @@ struct ConfigManager
|
||||||
finalOgreConfig = showOgreConfig || firstRun ||
|
finalOgreConfig = showOgreConfig || firstRun ||
|
||||||
!exists("ogre.cfg");
|
!exists("ogre.cfg");
|
||||||
|
|
||||||
// Set default key bindings if the user specified the -rk setting,
|
// Set default key bindings first.
|
||||||
// or if no config file was found.
|
with(keyBindings)
|
||||||
if(reset || !ini.wasRead) with(keyBindings)
|
|
||||||
{
|
{
|
||||||
// Remove all existing key bindings
|
|
||||||
//clear();
|
|
||||||
|
|
||||||
// Bind some default keys
|
// Bind some default keys
|
||||||
bind(Keys.MoveLeft, KC.A, KC.LEFT);
|
bind(Keys.MoveLeft, KC.A, KC.LEFT);
|
||||||
bind(Keys.MoveRight, KC.D, KC.RIGHT);
|
bind(Keys.MoveRight, KC.D, KC.RIGHT);
|
||||||
|
@ -238,20 +217,32 @@ struct ConfigManager
|
||||||
bind(Keys.PhysMode, KC.T);
|
bind(Keys.PhysMode, KC.T);
|
||||||
bind(Keys.Nighteye, KC.N);
|
bind(Keys.Nighteye, KC.N);
|
||||||
bind(Keys.ToggleGui, KC.Mouse1);
|
bind(Keys.ToggleGui, KC.Mouse1);
|
||||||
|
bind(Keys.Console, KC.F1);
|
||||||
bind(Keys.Debug, KC.G);
|
bind(Keys.Debug, KC.G);
|
||||||
|
|
||||||
bind(Keys.Pause, KC.PAUSE, KC.P);
|
bind(Keys.Pause, KC.PAUSE, KC.P);
|
||||||
bind(Keys.ScreenShot, KC.SYSRQ);
|
bind(Keys.ScreenShot, KC.SYSRQ);
|
||||||
bind(Keys.Exit, KC.Q, KC.ESCAPE);
|
bind(Keys.Exit, KC.Q, KC.ESCAPE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// Unless the ini file was missing or we were asked to reset all
|
||||||
|
// keybindings to default, replace all present bindings with the
|
||||||
|
// values from the ini.
|
||||||
|
if(!reset && ini.wasRead)
|
||||||
{
|
{
|
||||||
// Read key bindings
|
// Read key bindings
|
||||||
for(int i; i<Keys.Length; i++)
|
for(int i; i<Keys.Length; i++)
|
||||||
{
|
{
|
||||||
char[] s = keyToString[i];
|
char[] s = keyToString[i];
|
||||||
if(s.length)
|
if(s.length)
|
||||||
keyBindings.bindComma(cast(Keys)i, ini.getString("Bindings", s, ""));
|
{
|
||||||
|
char[] iniVal = ini.getString("Bindings", s, "_def");
|
||||||
|
|
||||||
|
// Was the setting present in the ini file?
|
||||||
|
if(iniVal != "_def")
|
||||||
|
// If so, bind it!
|
||||||
|
keyBindings.bindComma(cast(Keys)i, iniVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,16 +26,20 @@ module gui.bindings;
|
||||||
extern(C):
|
extern(C):
|
||||||
|
|
||||||
// GUI functions. Under development. The corresponding C++ functions
|
// GUI functions. Under development. The corresponding C++ functions
|
||||||
// are in ogre/cpp_mygui.cpp
|
// are in cpp_mygui.cpp
|
||||||
|
|
||||||
typedef void* WidgetPtr;
|
typedef void* WidgetPtr;
|
||||||
void gui_setupGUI(int debugOut);
|
void gui_setupGUI(int debugOut);
|
||||||
void gui_toggleGui();
|
void gui_toggleGui();
|
||||||
|
void gui_toggleConsole();
|
||||||
void gui_setCellName(char *str);
|
void gui_setCellName(char *str);
|
||||||
|
|
||||||
// Get the widget type, as a string
|
// Get the widget type, as a string
|
||||||
char *gui_widgetType(WidgetPtr);
|
char *gui_widgetType(WidgetPtr);
|
||||||
|
|
||||||
|
// Get the guiMode flag
|
||||||
|
int *gui_getGuiModePtr();
|
||||||
|
|
||||||
// Get the height or width of a widget. If the argument is null,
|
// Get the height or width of a widget. If the argument is null,
|
||||||
// return the size of the screen.
|
// return the size of the screen.
|
||||||
int gui_getHeight(WidgetPtr);
|
int gui_getHeight(WidgetPtr);
|
||||||
|
|
91
gui/cpp_console.cpp
Normal file
91
gui/cpp_console.cpp
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||||
|
Copyright (C) 2008 Nicolay Korslund
|
||||||
|
Email: < korslund@gmail.com >
|
||||||
|
WWW: http://openmw.snaptoad.com/
|
||||||
|
|
||||||
|
This file (cpp_console.cpp) is part of the OpenMW package.
|
||||||
|
|
||||||
|
OpenMW is distributed as free software: you can redistribute it
|
||||||
|
and/or modify it under the terms of the GNU General Public License
|
||||||
|
version 3, as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
version 3 along with this program. If not, see
|
||||||
|
http://www.gnu.org/licenses/ .
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Console : public Layout
|
||||||
|
{
|
||||||
|
MyGUI::EditPtr command;
|
||||||
|
MyGUI::EditPtr history;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Console()
|
||||||
|
: Layout("openmw_console_layout.xml")
|
||||||
|
{
|
||||||
|
setCoord(0,0,
|
||||||
|
mWindow->getWidth()*2/3, mWindow->getHeight()/2);
|
||||||
|
|
||||||
|
getWidget(command, "edit_Command");
|
||||||
|
getWidget(history, "list_History");
|
||||||
|
|
||||||
|
// Set up the command line combobox
|
||||||
|
command->eventEditSelectAccept =
|
||||||
|
newDelegate(this, &Console::acceptCommand);
|
||||||
|
|
||||||
|
// Set up the log window
|
||||||
|
history->setOverflowToTheLeft(true);
|
||||||
|
history->setEditStatic(true);
|
||||||
|
history->setVisibleVScroll(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void takeFocus()
|
||||||
|
{
|
||||||
|
// Give keyboard focus to the combo box whenever the console is
|
||||||
|
// turned on
|
||||||
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
void acceptCommand(MyGUI::EditPtr _sender)
|
||||||
|
{
|
||||||
|
const Ogre::UTFString &cm = command->getCaption();
|
||||||
|
if(cm.empty()) return;
|
||||||
|
|
||||||
|
if(cm == "big")
|
||||||
|
history->setFontName("youtube");
|
||||||
|
|
||||||
|
history->addText(cm + "\n");
|
||||||
|
history->addText("this is a fake output result\n");
|
||||||
|
command->setCaption("");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Console *cons;
|
||||||
|
|
||||||
|
extern "C" void gui_toggleConsole()
|
||||||
|
{
|
||||||
|
if(consoleMode)
|
||||||
|
{
|
||||||
|
leaveGui();
|
||||||
|
if(cons)
|
||||||
|
cons->setVisible(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
enterGui();
|
||||||
|
if(cons)
|
||||||
|
{
|
||||||
|
cons->setVisible(true);
|
||||||
|
cons->takeFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
consoleMode = !consoleMode;
|
||||||
|
}
|
|
@ -1,3 +1,26 @@
|
||||||
|
/*
|
||||||
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||||
|
Copyright (C) 2008 Nicolay Korslund
|
||||||
|
Email: < korslund@gmail.com >
|
||||||
|
WWW: http://openmw.snaptoad.com/
|
||||||
|
|
||||||
|
This file (cpp_mygui.cpp) is part of the OpenMW package.
|
||||||
|
|
||||||
|
OpenMW is distributed as free software: you can redistribute it
|
||||||
|
and/or modify it under the terms of the GNU General Public License
|
||||||
|
version 3, as published by the Free Software Foundation.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
version 3 along with this program. If not, see
|
||||||
|
http://www.gnu.org/licenses/ .
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO: KILLME
|
// TODO: KILLME
|
||||||
std::string cellName;
|
std::string cellName;
|
||||||
|
|
||||||
|
@ -134,16 +157,17 @@ public:
|
||||||
mPrefix = MyGUI::utility::toString(this, "_");
|
mPrefix = MyGUI::utility::toString(this, "_");
|
||||||
mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent);
|
mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent);
|
||||||
|
|
||||||
const std::string main_name = mPrefix + MAIN_WINDOW;
|
const std::string main_name = mPrefix + MAIN_WINDOW;
|
||||||
for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); iter!=mListWindowRoot.end(); ++iter) {
|
for (MyGUI::VectorWidgetPtr::iterator iter=mListWindowRoot.begin(); iter!=mListWindowRoot.end(); ++iter)
|
||||||
if ((*iter)->getName() == main_name)
|
|
||||||
{
|
{
|
||||||
mMainWidget = (*iter);
|
if ((*iter)->getName() == main_name)
|
||||||
break;
|
{
|
||||||
|
mMainWidget = (*iter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
MYGUI_ASSERT(mMainWidget, "root widget name '" << MAIN_WINDOW << "' in layout '" << mLayoutName << "' not found.");
|
||||||
}
|
}
|
||||||
MYGUI_ASSERT(mMainWidget, "root widget name '" << MAIN_WINDOW << "' in layout '" << mLayoutName << "' not found.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutdown()
|
void shutdown()
|
||||||
|
@ -361,48 +385,70 @@ HUD *hud;
|
||||||
StatsWindow *stats;
|
StatsWindow *stats;
|
||||||
MapWindow *map;
|
MapWindow *map;
|
||||||
MyGUI::WidgetPtr FPSText;
|
MyGUI::WidgetPtr FPSText;
|
||||||
MyGUI::WindowPtr mwindow;
|
|
||||||
OIS::MouseState state;
|
OIS::MouseState state;
|
||||||
|
bool consoleMode = false;
|
||||||
|
bool inventoryMode = false;
|
||||||
|
|
||||||
// KILLME
|
void enterGui()
|
||||||
extern "C" void gui_toggleGui()
|
|
||||||
{
|
{
|
||||||
|
guiMode++;
|
||||||
|
|
||||||
if(guiMode == 1)
|
if(guiMode == 1)
|
||||||
{
|
{
|
||||||
guiMode = 0;
|
// If we just entered GUI mode, enable the pointer
|
||||||
mGUI->hidePointer();
|
mGUI->showPointer();
|
||||||
if(mwindow)
|
|
||||||
mwindow->setVisible(false);
|
|
||||||
if(stats)
|
|
||||||
stats->setVisible(false);
|
|
||||||
if(map)
|
|
||||||
map->setVisible(false);
|
|
||||||
state = mMouse->getMouseState();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Restore the GUI mouse position. This is a hack because silly
|
// Restore the GUI mouse position. This is a hack because silly
|
||||||
// OIS doesn't allow us to set the mouse position ourselves.
|
// OIS doesn't allow us to set the mouse position ourselves.
|
||||||
*((OIS::MouseState*)&(mMouse->getMouseState())) = state;
|
*((OIS::MouseState*)&(mMouse->getMouseState())) = state;
|
||||||
mGUI->injectMouseMove(state.X.abs, state.Y.abs, 0);
|
mGUI->injectMouseMove(state.X.abs, state.Y.abs, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
guiMode = 1;
|
void leaveGui()
|
||||||
mGUI->showPointer();
|
{
|
||||||
if(mwindow)
|
guiMode--;
|
||||||
mwindow->setVisible(true);
|
|
||||||
|
if(guiMode < 0)
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: guiMode is " << guiMode << "\n";
|
||||||
|
guiMode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Are we done with all GUI windows?
|
||||||
|
if(guiMode == 0)
|
||||||
|
{
|
||||||
|
// If so, hide the pointer and store the mouse state for later.
|
||||||
|
mGUI->hidePointer();
|
||||||
|
state = mMouse->getMouseState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "cpp_console.cpp"
|
||||||
|
|
||||||
|
extern "C" void gui_toggleGui()
|
||||||
|
{
|
||||||
|
if(inventoryMode)
|
||||||
|
{
|
||||||
|
leaveGui();
|
||||||
|
if(stats)
|
||||||
|
stats->setVisible(false);
|
||||||
|
if(map)
|
||||||
|
map->setVisible(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
enterGui();
|
||||||
if(stats)
|
if(stats)
|
||||||
stats->setVisible(true);
|
stats->setVisible(true);
|
||||||
if(map)
|
if(map)
|
||||||
map->setVisible(true);
|
map->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inventoryMode = !inventoryMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// KILLME
|
extern "C" int32_t* gui_getGuiModePtr() { return &guiMode; }
|
||||||
void turnGuiOff(MyGUI::WidgetPtr sender)
|
|
||||||
{
|
|
||||||
guiMode = 1;
|
|
||||||
gui_toggleGui();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void gui_setupGUI(int32_t debugOut)
|
extern "C" void gui_setupGUI(int32_t debugOut)
|
||||||
{
|
{
|
||||||
|
@ -421,46 +467,15 @@ extern "C" void gui_setupGUI(int32_t debugOut)
|
||||||
|
|
||||||
stats = new StatsWindow();
|
stats = new StatsWindow();
|
||||||
map = new MapWindow();
|
map = new MapWindow();
|
||||||
|
cons = new Console();
|
||||||
|
|
||||||
/*
|
// Hide all the windows at startup
|
||||||
// Window with Morrowind skin
|
stats->setVisible(false);
|
||||||
mwindow = mGUI->createWidget<MyGUI::Window>
|
map->setVisible(false);
|
||||||
("MW_Window",
|
cons->setVisible(false);
|
||||||
(mWidth-width)/2, (mHeight-height)/2, // Position
|
guiMode = 1;
|
||||||
400, 190, // Size
|
leaveGui();
|
||||||
MyGUI::ALIGN_DEFAULT, "Windows");
|
|
||||||
mwindow->setCaption("Skin test");
|
|
||||||
mwindow->setMinSize(120, 140);
|
|
||||||
|
|
||||||
MyGUI::WidgetPtr tmp;
|
|
||||||
tmp = mwindow->createWidget<MyGUI::Button>
|
|
||||||
("MW_Button",
|
|
||||||
10, 32, // Position
|
|
||||||
45, 24, // Size
|
|
||||||
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
|
|
||||||
"MWButton1");
|
|
||||||
tmp->setCaption("Close");
|
|
||||||
tmp->eventMouseButtonClick = MyGUI::newDelegate(&turnGuiOff);
|
|
||||||
|
|
||||||
tmp = mwindow->createWidget<MyGUI::StaticText>
|
|
||||||
("DaedricText_orig",
|
|
||||||
20,80,
|
|
||||||
500, 30,
|
|
||||||
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
|
|
||||||
"Daed1");
|
|
||||||
tmp->setCaption("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
||||||
|
|
||||||
tmp = mwindow->createWidget<MyGUI::StaticText>
|
|
||||||
("DaedricText",
|
|
||||||
20,130,
|
|
||||||
500, 30,
|
|
||||||
MyGUI::ALIGN_LEFT | MyGUI::ALIGN_TOP,
|
|
||||||
"Daed2");
|
|
||||||
tmp->setCaption("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Turn the GUI off at startup
|
|
||||||
turnGuiOff(NULL);
|
|
||||||
// Start the mouse in the middle of the screen
|
// Start the mouse in the middle of the screen
|
||||||
state.X.abs = mWidth / 2;
|
state.X.abs = mWidth / 2;
|
||||||
state.Y.abs = mHeight / 2;
|
state.Y.abs = mHeight / 2;
|
|
@ -39,6 +39,7 @@ import monster.monster;
|
||||||
import monster.vm.dbg;
|
import monster.vm.dbg;
|
||||||
|
|
||||||
import ogre.bindings;
|
import ogre.bindings;
|
||||||
|
import gui.bindings;
|
||||||
|
|
||||||
import input.keys;
|
import input.keys;
|
||||||
import input.ois;
|
import input.ois;
|
||||||
|
@ -53,6 +54,7 @@ import input.ois;
|
||||||
|
|
||||||
// Pause?
|
// Pause?
|
||||||
bool pause = false;
|
bool pause = false;
|
||||||
|
int *guiMode;
|
||||||
|
|
||||||
void toggleFullscreen()
|
void toggleFullscreen()
|
||||||
{
|
{
|
||||||
|
@ -123,6 +125,8 @@ extern(C) void d_handleMouseMove(MouseState *state)
|
||||||
state.X.abs, state.Y.abs, state.Z.abs,
|
state.X.abs, state.Y.abs, state.Z.abs,
|
||||||
state.X.rel, state.Y.rel, state.Z.rel);
|
state.X.rel, state.Y.rel, state.Z.rel);
|
||||||
|
|
||||||
|
if(*guiMode) return;
|
||||||
|
|
||||||
ogre_rotateCamera( state.X.rel * effMX,
|
ogre_rotateCamera( state.X.rel * effMX,
|
||||||
state.Y.rel * effMY );
|
state.Y.rel * effMY );
|
||||||
}
|
}
|
||||||
|
@ -169,35 +173,45 @@ extern(C) void d_handleKey(KC keycode, dchar text = 0)
|
||||||
// text.
|
// text.
|
||||||
Keys k = keyBindings.findMatch(keycode, text);
|
Keys k = keyBindings.findMatch(keycode, text);
|
||||||
|
|
||||||
|
// These are handled even if we are in gui mode:
|
||||||
|
if(k)
|
||||||
|
switch(k)
|
||||||
|
{
|
||||||
|
case Keys.ToggleGui: gui_toggleGui(); return;
|
||||||
|
case Keys.Console: gui_toggleConsole(); return;
|
||||||
|
case Keys.ScreenShot: takeScreenShot(); return;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*guiMode) return;
|
||||||
|
|
||||||
if(k)
|
if(k)
|
||||||
switch(k)
|
switch(k)
|
||||||
{
|
{
|
||||||
case Keys.ToggleBattleMusic:
|
case Keys.ToggleBattleMusic:
|
||||||
Music.toggle();
|
Music.toggle();
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case Keys.MainVolUp: mainVolume(true); break;
|
case Keys.MainVolUp: mainVolume(true); return;
|
||||||
case Keys.MainVolDown: mainVolume(false); break;
|
case Keys.MainVolDown: mainVolume(false); return;
|
||||||
case Keys.MusVolUp: musVolume(true); break;
|
case Keys.MusVolUp: musVolume(true); return;
|
||||||
case Keys.MusVolDown: musVolume(false); break;
|
case Keys.MusVolDown: musVolume(false); return;
|
||||||
case Keys.SfxVolUp: sfxVolume(true); break;
|
case Keys.SfxVolUp: sfxVolume(true); return;
|
||||||
case Keys.SfxVolDown: sfxVolume(false); break;
|
case Keys.SfxVolDown: sfxVolume(false); return;
|
||||||
case Keys.Mute: Music.toggleMute(); break;
|
case Keys.Mute: Music.toggleMute(); return;
|
||||||
case Keys.Fullscreen: toggleFullscreen(); break;
|
case Keys.Fullscreen: toggleFullscreen(); return;
|
||||||
|
|
||||||
case Keys.PhysMode: bullet_nextMode(); break;
|
case Keys.PhysMode: bullet_nextMode(); return;
|
||||||
case Keys.Nighteye: ogre_toggleLight(); break;
|
case Keys.Nighteye: ogre_toggleLight(); return;
|
||||||
case Keys.ToggleGui: gui_toggleGui(); break;
|
|
||||||
|
|
||||||
case Keys.Debug: break;
|
case Keys.Debug: return;
|
||||||
case Keys.ScreenShot: takeScreenShot(); break;
|
case Keys.Pause: togglePause(); return;
|
||||||
case Keys.Pause: togglePause(); break;
|
case Keys.Exit: exitProgram(); return;
|
||||||
case Keys.Exit: exitProgram(); break;
|
|
||||||
default:
|
default:
|
||||||
assert(k >= 0 && k < keyToString.length);
|
assert(k >= 0 && k < keyToString.length);
|
||||||
writefln("WARNING: Event %s has no effect", keyToString[k]);
|
writefln("WARNING: Event %s has no effect", keyToString[k]);
|
||||||
}
|
}
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh rate for sfx placements, in seconds.
|
// Refresh rate for sfx placements, in seconds.
|
||||||
|
@ -226,6 +240,9 @@ void initializeInput()
|
||||||
// put another import in core.config. I should probably check the
|
// put another import in core.config. I should probably check the
|
||||||
// bug list and report it.
|
// bug list and report it.
|
||||||
updateMouseSensitivity();
|
updateMouseSensitivity();
|
||||||
|
|
||||||
|
// Get a pointer to the 'guiMode' flag in cpp_ogre.cpp
|
||||||
|
guiMode = gui_getGuiModePtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern(C) int ois_isPressed(int keysym);
|
extern(C) int ois_isPressed(int keysym);
|
||||||
|
@ -239,7 +256,7 @@ bool isPressed(Keys key)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern(C) int d_frameStarted(float time, int guiMode)
|
extern(C) int d_frameStarted(float time)
|
||||||
{
|
{
|
||||||
if(doExit) return 0;
|
if(doExit) return 0;
|
||||||
|
|
||||||
|
@ -257,7 +274,7 @@ extern(C) int d_frameStarted(float time, int guiMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The rest is ignored in pause or GUI mode
|
// The rest is ignored in pause or GUI mode
|
||||||
if(pause || guiMode == 1) return 1;
|
if(pause || *guiMode > 0) return 1;
|
||||||
|
|
||||||
// Walking / floating speed, in points per second.
|
// Walking / floating speed, in points per second.
|
||||||
const float speed = 300;
|
const float speed = 300;
|
||||||
|
|
|
@ -67,7 +67,8 @@ enum Keys
|
||||||
ToggleBattleMusic,
|
ToggleBattleMusic,
|
||||||
PhysMode, // Toggle physics mode between walking, flying and ghost
|
PhysMode, // Toggle physics mode between walking, flying and ghost
|
||||||
Nighteye, // Full ambient lighting
|
Nighteye, // Full ambient lighting
|
||||||
ToggleGui, // Turn the GUI on/off
|
ToggleGui,// Turn the GUI on/off
|
||||||
|
Console, // Turn console on/off
|
||||||
Debug,
|
Debug,
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
@ -254,6 +255,7 @@ struct KeyBindings
|
||||||
keyToString[Keys.PhysMode] = "Toggle Physics Mode";
|
keyToString[Keys.PhysMode] = "Toggle Physics Mode";
|
||||||
keyToString[Keys.Nighteye] = "Toggle Nighteye";
|
keyToString[Keys.Nighteye] = "Toggle Nighteye";
|
||||||
keyToString[Keys.ToggleGui] = "Toggle GUI";
|
keyToString[Keys.ToggleGui] = "Toggle GUI";
|
||||||
|
keyToString[Keys.Console] = "Console";
|
||||||
keyToString[Keys.Debug] = "OGRE Test Action";
|
keyToString[Keys.Debug] = "OGRE Test Action";
|
||||||
|
|
||||||
keyToString[Keys.Pause] = "Pause";
|
keyToString[Keys.Pause] = "Pause";
|
||||||
|
|
BIN
media_mygui/VeraMono.ttf
Normal file
BIN
media_mygui/VeraMono.ttf
Normal file
Binary file not shown.
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<MyGUI type="Lang">
|
|
||||||
|
|
||||||
<Help name="name_language">
|
|
||||||
"unassigned, escape, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, backspace, tab, q, w, e, r, t, y, u, i, o, p, [, ], enter, lcontrol, a, s, d, f, g, h, j, k, l, ;, ', `, lshift, \, z, x, c, v, b, n, m, comma, ., /, rshift, * on numeric keypad, leftalt, space,
|
|
||||||
unassigned, escape, !, @, #, $, %, ^, &, *, (, ), _, +, backspace, tab, Q, W, E, R, T, Y, U, I, O, P, {, }, enter, lcontrol, A, S, D, F, G, H, J, K, L, :, double quotes, ~, lshift, |, Z, X, C, V, B, N, M, <, >, ?, rshift, * on numeric keypad, leftalt, space"
|
|
||||||
</Help>
|
|
||||||
|
|
||||||
<Lang name="Russian">
|
|
||||||
0, 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 45, 61, 0, 0, 1081, 1094, 1091, 1082, 1077, 1085, 1075, 1096, 1097, 1079, 1093, 1098, 0, 0, 1092, 1099, 1074, 1072, 1087, 1088, 1086, 1083, 1076, 1078, 1101, 1105, 0, 92, 1103, 1095, 1089, 1084, 1080, 1090, 1100, 1073, 1102, 46, 0, 42, 0, 32,
|
|
||||||
0, 0, 33, 34, 8470, 59, 37, 58, 63, 42, 40, 41, 95, 43, 0, 0, 1049, 1062, 1059, 1050, 1045, 1053, 1043, 1064, 1065, 1047, 1061, 1066, 0, 0, 1060, 1067, 1042, 1040, 1055, 1056, 1054, 1051, 1044, 1046, 1069, 1025, 0, 47, 1071, 1063, 1057, 1052, 1048, 1058, 1068, 1041, 1070, 44, 0, 42, 0, 32
|
|
||||||
</Lang>
|
|
||||||
|
|
||||||
</MyGUI>
|
|
|
@ -1,20 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<MyGUI type="Layer">
|
|
||||||
|
|
||||||
<Layer name="Back" overlapped="false" peek="true"/>
|
|
||||||
<Layer name="Overlapped" overlapped="true" peek="true"/>
|
|
||||||
<Layer name="Middle" overlapped="false" peek="true"/>
|
|
||||||
<Layer name="Modal" overlapped="true" peek="true"/>
|
|
||||||
<Layer name="Main" overlapped="false" peek="true"/>
|
|
||||||
<Layer name="Popup" overlapped="true" peek="true"/>
|
|
||||||
<Layer name="FadeMiddle" overlapped="false" peek="false"/>
|
|
||||||
<Layer name="Info" overlapped="true" peek="true"/>
|
|
||||||
<Layer name="Tooltip"overlapped="false" peek="true"/>
|
|
||||||
<Layer name="DragAndDrop"overlapped="false" peek="false"/>
|
|
||||||
<Layer name="FadeBusy" overlapped="false" peek="false"/>
|
|
||||||
<Layer name="Pointer" overlapped="false" peek="false"/>
|
|
||||||
<Layer name="Fade" overlapped="false" peek="false"/>
|
|
||||||
<Layer name="Statistic" overlapped="false" peek="false"/>
|
|
||||||
|
|
||||||
</MyGUI>
|
|
Binary file not shown.
Before Width: | Height: | Size: 68 KiB |
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<MyGUI type="Pointer">
|
|
||||||
|
|
||||||
<Pointer layer="Pointer" texture="core.png" default="arrow">
|
|
||||||
<Info name="arrow" point="1 1" size="32 32" offset="0 224 32 32"/>
|
|
||||||
<Info name="beam" point="16 16" size="32 32" offset="32 224 32 32"/>
|
|
||||||
<Info name="size_left" point="16 16" size="32 32" offset="64 224 32 32"/>
|
|
||||||
<Info name="hand" point="16 16" size="32 32" offset="96 224 32 32"/>
|
|
||||||
</Pointer>
|
|
||||||
|
|
||||||
</MyGUI>
|
|
|
@ -1,16 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Skin">
|
<MyGUI type="Skin">
|
||||||
|
|
||||||
<Skin name = "EditClient" size = "10 10">
|
|
||||||
<Property key="Pointer" value = "beam" />
|
|
||||||
</Skin>
|
|
||||||
|
|
||||||
<Skin name = "StaticText" size = "16 16">
|
<Skin name = "StaticText" size = "16 16">
|
||||||
<Property key="FontName" value = "MyGUI_CoreFont.18" />
|
<Property key="FontName" value = "MyGUI_CoreFont.18" />
|
||||||
<Property key="FontHeight" value = "18" />
|
<Property key="FontHeight" value = "18" />
|
||||||
<Property key="AlignText" value = "ALIGN_DEFAULT" />
|
<Property key="AlignText" value = "ALIGN_DEFAULT" />
|
||||||
<Property key="Colour" value = "0.7 0.7 0.7" />
|
<Property key="TextColour" value = "0.7 0.7 0.7" />
|
||||||
|
|
||||||
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
|
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
@ -18,4 +13,5 @@
|
||||||
<Skin name = "StaticImage" size = "16 16">
|
<Skin name = "StaticImage" size = "16 16">
|
||||||
<BasisSkin type="MainSkin" offset = "0 0 16 16"/>
|
<BasisSkin type="MainSkin" offset = "0 0 16 16"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<List file="openmw_hud_energybar.skin.xml" group="General"/>
|
<List file="openmw_hud_energybar.skin.xml" group="General"/>
|
||||||
<List file="openmw_hud_box.skin.xml" group="General"/>
|
<List file="openmw_hud_box.skin.xml" group="General"/>
|
||||||
<List file="openmw_mainmenu_skin.xml" group="General"/>
|
<List file="openmw_mainmenu_skin.xml" group="General"/>
|
||||||
|
<List file="openmw_console.skin.xml" group="General"/>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
|
@ -10,6 +10,19 @@
|
||||||
<Code hide="1026 1039"/>
|
<Code hide="1026 1039"/>
|
||||||
<Code hide="1104"/>
|
<Code hide="1104"/>
|
||||||
</Font>
|
</Font>
|
||||||
|
|
||||||
|
|
||||||
|
<Font name="MonoFont" default_height="17" source="VeraMono.ttf" size="18" resolution="50" antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="5" offset_height="0">
|
||||||
|
<Code range="33 126"/>
|
||||||
|
<Code range="1025 1105"/>
|
||||||
|
</Font>
|
||||||
|
|
||||||
|
<!-- Useful for youtube videos :) -->
|
||||||
|
<Font name="youtube" default_height="34" source="VeraMono.ttf" size="36" resolution="50" antialias_colour="false" space_width="4" tab_width="8" cursor_width="2" distance="5" offset_height="0">
|
||||||
|
<Code range="33 126"/>
|
||||||
|
<Code range="1025 1105"/>
|
||||||
|
</Font>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<Font name="gothic" source="gothic.ttf" size="18" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
|
<Font name="gothic" source="gothic.ttf" size="18" resolution="72" antialias_colour="false" space_width="4" tab_count="4" spacer="5">
|
||||||
<Code range="33 126"/>
|
<Code range="33 126"/>
|
||||||
|
|
69
media_mygui/openmw_console.skin.xml
Normal file
69
media_mygui/openmw_console.skin.xml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<MyGUI type="Skin">
|
||||||
|
<Skin name = "MW_ConsoleWindow" size = "256 54">
|
||||||
|
<Property key="FontName" value = "MyGUI_CoreFont.18" />
|
||||||
|
<Property key="FontHeight" value = "17" />
|
||||||
|
<Property key="AlignText" value = "ALIGN_CENTER" />
|
||||||
|
<Property key="Colour" value = "0.8 0.8 0.8" />
|
||||||
|
<Property key="ToStick" value = "true" />
|
||||||
|
|
||||||
|
<Child type="Widget" skin="BlackBG" offset = "4 4 248 46" align = "ALIGN_STRETCH" name = "Client"/>
|
||||||
|
|
||||||
|
<!-- Outer borders -->
|
||||||
|
<Child type="Widget" skin="TB_T" offset="4 0 248 4" align="ALIGN_TOP ALIGN_HSTRETCH" name="Action">
|
||||||
|
<Property key="Scale" value = "0 1 0 -1"/>
|
||||||
|
</Child>
|
||||||
|
<Child type="Widget" skin="TB_L" offset="0 4 4 46" align="ALIGN_LEFT ALIGN_VSTRETCH" name="Action">
|
||||||
|
<Property key="Scale" value = "1 0 -1 0"/>
|
||||||
|
</Child>
|
||||||
|
<Child type="Widget" skin="TB_B" offset="4 50 248 4" align="ALIGN_BOTTOM ALIGN_HSTRETCH" name="Action">
|
||||||
|
<Property key="Scale" value = "0 0 0 1"/>
|
||||||
|
</Child>
|
||||||
|
<Child type="Widget" skin="TB_R" offset="252 4 4 46" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="Action">
|
||||||
|
<Property key="Scale" value = "0 0 1 0"/>
|
||||||
|
</Child>
|
||||||
|
|
||||||
|
<Child type="Widget" skin="TB_BR" offset="252 50 4 4" align="ALIGN_RIGHT ALIGN_BOTTOM" name="Action">
|
||||||
|
<Property key="Scale" value = "0 0 1 1"/>
|
||||||
|
</Child>
|
||||||
|
<Child type="Widget" skin="TB_BL" offset="0 50 4 4" align="ALIGN_LEFT ALIGN_BOTTOM" name="Action">
|
||||||
|
<Property key="Scale" value = "1 0 -1 1"/>
|
||||||
|
</Child>
|
||||||
|
<Child type="Widget" skin="TB_TR" offset="252 0 4 4" align="ALIGN_RIGHT ALIGN_TOP" name="Action">
|
||||||
|
<Property key="Scale" value = "0 1 1 -1"/>
|
||||||
|
</Child>
|
||||||
|
<Child type="Widget" skin="TB_TL" offset="0 0 4 4" align="ALIGN_LEFT ALIGN_TOP" name="Action">
|
||||||
|
<Property key="Scale" value = "1 1 -1 -1"/>
|
||||||
|
</Child>
|
||||||
|
</Skin>
|
||||||
|
|
||||||
|
<Skin name = "MW_LogClient" size = "10 10">
|
||||||
|
<Property key="FontName" value = "MonoFont" />
|
||||||
|
<Property key="AlignText" value = "Left Top" />
|
||||||
|
<Property key="Colour" value = "1 1 1" />
|
||||||
|
<!--Property key="Pointer" value = "beam" /-->
|
||||||
|
<BasisSkin type="EditText" offset = "0 0 10 10" align = "Stretch"/>
|
||||||
|
</Skin>
|
||||||
|
|
||||||
|
<Skin name="MW_ConsoleLog" size="0 0 50 50">
|
||||||
|
<Property key="WordWrap" value = "true" />
|
||||||
|
<Child type="Widget" skin="MW_LogClient" offset="0 0 35 10" align = "ALIGN_STRETCH" name = "Client"/>
|
||||||
|
<!--Child type="VScroll" skin="VScroll" offset = "35 0 15 50" align = "Right VStretch" name = "VScroll"/-->
|
||||||
|
</Skin>
|
||||||
|
|
||||||
|
<Skin name = "MW_EditClient" size = "10 10">
|
||||||
|
<Property key="FontName" value = "MonoFont" />
|
||||||
|
<Property key="AlignText" value = "Left VCenter" />
|
||||||
|
<Property key="Colour" value = "1 1 1" />
|
||||||
|
<!--Property key="Pointer" value = "beam" /-->
|
||||||
|
<BasisSkin type="EditText" offset = "0 0 10 10" align = "Stretch"/>
|
||||||
|
</Skin>
|
||||||
|
|
||||||
|
<!-- The edit control used for entering commands -->
|
||||||
|
<Skin name = "MW_ConsoleCommand" size = "29 26">
|
||||||
|
<Child type="Widget" skin="MW_EditClient" offset = "2 1 23 22" align = "Stretch" name = "Client"/>
|
||||||
|
|
||||||
|
<Child type="Widget" skin="MW_BarFrame" offset="0 0 29 26" align="ALIGN_STRETCH"/>
|
||||||
|
</Skin>
|
||||||
|
</MyGUI>
|
14
media_mygui/openmw_console_layout.xml
Normal file
14
media_mygui/openmw_console_layout.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<MyGUI type="Layout">
|
||||||
|
<Widget type="Window" skin="MW_ConsoleWindow" position="0 0 400 400" layer="Console" name="_Main">
|
||||||
|
<Property key="Widget_Caption" value="Console"/>
|
||||||
|
<Property key="Window_MinMax" value="200 100 2000 2000"/>
|
||||||
|
|
||||||
|
<!-- Log window -->
|
||||||
|
<Widget type="Edit" skin="MW_ConsoleLog" position="0 0 400 365" align="Stretch" name="list_History"/>
|
||||||
|
|
||||||
|
<!-- Command line -->
|
||||||
|
<Widget type="Edit" skin="MW_ConsoleCommand" position="0 365 392 28" align="HStretch Bottom" name="edit_Command"/>
|
||||||
|
|
||||||
|
</Widget>
|
||||||
|
</MyGUI>
|
|
@ -4,9 +4,10 @@
|
||||||
<Layer name="Scene" overlapped="false" peek="true"/>
|
<Layer name="Scene" overlapped="false" peek="true"/>
|
||||||
<Layer name="HUD" overlapped="false" peek="true"/>
|
<Layer name="HUD" overlapped="false" peek="true"/>
|
||||||
<Layer name="Windows" overlapped="true" peek="true"/>
|
<Layer name="Windows" overlapped="true" peek="true"/>
|
||||||
<Layer name="Journal" overlapped="false" peek="false"/>
|
<Layer name="Books" overlapped="false" peek="false"/>
|
||||||
<Layer name="MainMenu" overlapped="false" peek="false"/>
|
<Layer name="MainMenu" overlapped="false" peek="false"/>
|
||||||
<Layer name="Console" overlapped="false" peek="false"/>
|
<Layer name="Console" overlapped="false" peek="true"/>
|
||||||
|
<Layer name="Popup" overlapped="true" peek="true"/>
|
||||||
<Layer name="Pointer" overlapped="false" peek="false"/>
|
<Layer name="Pointer" overlapped="false" peek="false"/>
|
||||||
<Layer name="Statistic" overlapped="false" peek="false"/>
|
<Layer name="Statistic" overlapped="false" peek="false"/>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
|
|
||||||
<Child type="Widget" skin="BlackBG" offset = "8 28 240 18" align = "ALIGN_STRETCH" name = "Client"/>
|
<Child type="Widget" skin="BlackBG" offset = "8 28 240 18" align = "ALIGN_STRETCH" name = "Client"/>
|
||||||
|
|
||||||
<!-- Outer orders -->
|
<!-- Outer borders -->
|
||||||
<Child type="Widget" skin="TB_T" offset="4 0 248 4" align="ALIGN_TOP ALIGN_HSTRETCH" name="Action">
|
<Child type="Widget" skin="TB_T" offset="4 0 248 4" align="ALIGN_TOP ALIGN_HSTRETCH" name="Action">
|
||||||
<Property key="Scale" value = "0 1 0 -1"/>
|
<Property key="Scale" value = "0 1 0 -1"/>
|
||||||
</Child>
|
</Child>
|
||||||
|
@ -240,14 +240,5 @@
|
||||||
<Child type="Button" offset="4 4 248 20" align="ALIGN_HSTRETCH ALIGN_TOP" name="Action">
|
<Child type="Button" offset="4 4 248 20" align="ALIGN_HSTRETCH ALIGN_TOP" name="Action">
|
||||||
<Property key="Scale" value = "1 1 0 0"/>
|
<Property key="Scale" value = "1 1 0 0"/>
|
||||||
</Child>
|
</Child>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Leftover code - remove later
|
|
||||||
<Child type="Button" skin="WindowX" offset = "20 80 24 30" align = "ALIGN_LEFT ALIGN_TOP" name = "Button">
|
|
||||||
<Property key="Event" value = "close"/>
|
|
||||||
</Child>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</Skin>
|
</Skin>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
|
@ -27,5 +27,13 @@ class Console
|
||||||
// This class contains all the functions available to the ingame
|
// This class contains all the functions available to the ingame
|
||||||
// console.
|
// console.
|
||||||
|
|
||||||
import io;
|
import game
|
||||||
import game;
|
|
||||||
|
native walk()
|
||||||
|
native fly()
|
||||||
|
native ghost()
|
||||||
|
|
||||||
|
native wireframe()
|
||||||
|
tvf() { wireframe() }
|
||||||
|
|
||||||
|
native fontsize(int size)
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
// Callbacks to D code.
|
// Callbacks to D code.
|
||||||
|
|
||||||
// Called once each frame
|
// Called once each frame
|
||||||
extern "C" int32_t d_frameStarted(float time, int guiMode);
|
extern "C" int32_t d_frameStarted(float time);
|
||||||
|
|
||||||
// Handle events
|
// Handle events
|
||||||
extern "C" void d_handleKey(int keycode, uint32_t text);
|
extern "C" void d_handleKey(int keycode, uint32_t text);
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
mGUI->injectFrameEntered(evt.timeSinceLastFrame);
|
mGUI->injectFrameEntered(evt.timeSinceLastFrame);
|
||||||
|
|
||||||
// Turn over control to the D code
|
// Turn over control to the D code
|
||||||
return d_frameStarted(evt.timeSinceLastFrame, guiMode);
|
return d_frameStarted(evt.timeSinceLastFrame);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,6 +69,9 @@ public:
|
||||||
<< ", " << ((OIS::Keyboard*)(arg.device))->getAsString(arg.key)
|
<< ", " << ((OIS::Keyboard*)(arg.device))->getAsString(arg.key)
|
||||||
<< "} || Character (" << (char)arg.text << ")\n";
|
<< "} || Character (" << (char)arg.text << ")\n";
|
||||||
//*/
|
//*/
|
||||||
|
if(guiMode)
|
||||||
|
mGUI->injectKeyPress(arg);
|
||||||
|
|
||||||
d_handleKey(arg.key, arg.text);
|
d_handleKey(arg.key, arg.text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -85,8 +88,8 @@ public:
|
||||||
// Monster script.
|
// Monster script.
|
||||||
if(guiMode)
|
if(guiMode)
|
||||||
mGUI->injectMouseMove(arg);
|
mGUI->injectMouseMove(arg);
|
||||||
else
|
|
||||||
d_handleMouseMove(&arg.state);
|
d_handleMouseMove(&arg.state);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +115,12 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unused
|
bool keyReleased( const OIS::KeyEvent &arg )
|
||||||
bool keyReleased( const OIS::KeyEvent &arg ) { return true; }
|
{
|
||||||
|
if(guiMode)
|
||||||
|
mGUI->injectKeyRelease(arg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MorroFrameListener mFrameListener;
|
MorroFrameListener mFrameListener;
|
||||||
|
|
|
@ -59,7 +59,11 @@ OIS::Keyboard *mKeyboard;
|
||||||
|
|
||||||
// The global GUI object
|
// The global GUI object
|
||||||
MyGUI::Gui *mGUI;
|
MyGUI::Gui *mGUI;
|
||||||
int guiMode = 0;
|
|
||||||
|
// This is used to determine if we are displaying any gui elements
|
||||||
|
// right now. If we are (and guiMode > 0), we redirect mouse/keyboard
|
||||||
|
// input into MyGUI.
|
||||||
|
int32_t guiMode = 0;
|
||||||
|
|
||||||
// Root node for all objects added to the scene. This is rotated so
|
// Root node for all objects added to the scene. This is rotated so
|
||||||
// that the OGRE coordinate system matches that used internally in
|
// that the OGRE coordinate system matches that used internally in
|
||||||
|
@ -67,7 +71,7 @@ int guiMode = 0;
|
||||||
SceneNode *root;
|
SceneNode *root;
|
||||||
|
|
||||||
// Include the other parts of the code, and make one big object file.
|
// Include the other parts of the code, and make one big object file.
|
||||||
#include "cpp_mygui.cpp"
|
#include "../gui/cpp_mygui.cpp"
|
||||||
#include "cpp_framelistener.cpp"
|
#include "cpp_framelistener.cpp"
|
||||||
#include "cpp_bsaarchive.cpp"
|
#include "cpp_bsaarchive.cpp"
|
||||||
#include "cpp_interface.cpp"
|
#include "cpp_interface.cpp"
|
||||||
|
|
Loading…
Reference in a new issue