Added ingame console (use F1)
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@104 ea6a568a-9f4f-0410-981a-c910a81bb256actorid
parent
1b01de4294
commit
876fc482ca
@ -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;
|
||||
}
|
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>
|
@ -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>
|
Loading…
Reference in New Issue