yake-svn Mailing List for Yake Engine (Page 5)
Status: Beta
Brought to you by:
psyclonist
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
(51) |
Oct
(2) |
Nov
(18) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(44) |
Feb
(13) |
Mar
(73) |
Apr
(61) |
May
|
Jun
(4) |
Jul
(19) |
Aug
(50) |
Sep
(47) |
Oct
(7) |
Nov
(7) |
Dec
(14) |
2008 |
Jan
(2) |
Feb
|
Mar
(4) |
Apr
(4) |
May
(5) |
Jun
(7) |
Jul
(4) |
Aug
|
Sep
(5) |
Oct
|
Nov
(1) |
Dec
(4) |
2009 |
Jan
|
Feb
(22) |
Mar
(12) |
Apr
(1) |
May
(1) |
Jun
(4) |
Jul
(4) |
Aug
|
Sep
|
Oct
(17) |
Nov
(3) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
(12) |
Apr
(11) |
May
|
Jun
(5) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <psy...@us...> - 2008-09-25 17:09:22
|
Revision: 1937 http://yake.svn.sourceforge.net/yake/?rev=1937&view=rev Author: psyclonist Date: 2008-09-25 17:09:20 +0000 (Thu, 25 Sep 2008) Log Message: ----------- * [bindings.lua] added ui.lua.cpp (still inactive) Added Paths: ----------- trunk/yake/src/bindings.lua/detail/ui.lua.cpp Added: trunk/yake/src/bindings.lua/detail/ui.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ui.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/detail/ui.lua.cpp 2008-09-25 17:09:20 UTC (rev 1937) @@ -0,0 +1,91 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#include <yake/config.h> +#if 0 +#if YAKE_ENABLE_LUA_UI == 1 + +#include <yake/base/yake.h> +#include <yake/gui2/gui.h> + +// The order of the following 4 includes is very important! +// -> see task.cpp for more information! +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.h> +#include <yake/bindings.lua/common/yake.lua.common.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.inl> + +// + +#include <yake/bindings.lua/detail/private.h> +#include <yake/bindings.lua/common/lua.helpers.h> +#include <yake/bindings.lua/common/vminfo.lua.h> + +namespace yake { +namespace ui { + //------------------------------------------------------------------------- + //------------------------------------------------------------------------- + void bind(lua_State* L) + { + YAKE_ASSERT(L); + if (!L) + return; + // + using namespace luabind; +#define YAKE_RAF_MODULE L, "yake" + + + module( YAKE_RAF_MODULE ) + [ + namespace_("ui") + [ + class_<Widget,WidgetPtr>("Widget") + .property("style", &Widget::getStyleWidgetType, &Widget::setStyleWidgetType) +// , +// class_<raf::AppMachine>("AppMachine") +// .property("currentState", &raf::AppMachine::currentState) + ] + ]; + + } + + YAKE_WRAP_BINDER(ui,::yake::ui::bind); +} // namespace ui + void bind_ui(lua_State* L) + { + YAKE_ASSERT( L ); + ui::bind(L); + } + void bind_raf(scripting::IVM* vm) + { + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm); + YAKE_ASSERT( luavm ); + bind_ui(luavm->getLuaState()); + } +} // namespace yake + +#endif // YAKE_ENABLE_LUA_UI +#endif //0 \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-09-25 17:08:54
|
Revision: 1936 http://yake.svn.sourceforge.net/yake/?rev=1936&view=rev Author: psyclonist Date: 2008-09-25 17:08:47 +0000 (Thu, 25 Sep 2008) Log Message: ----------- * [gui] updated style "lua1": cleanup + use of 3x3 matrix rendering Modified Paths: -------------- trunk/yake/common/media/gui2/styles/lua1/lua.button.lua trunk/yake/common/media/gui2/styles/lua1/lua.colours.inc.lua trunk/yake/common/media/gui2/styles/lua1/lua.panel.lua trunk/yake/common/media/gui2/styles/lua1/lua.textedit.lua Modified: trunk/yake/common/media/gui2/styles/lua1/lua.button.lua =================================================================== --- trunk/yake/common/media/gui2/styles/lua1/lua.button.lua 2008-09-25 17:08:16 UTC (rev 1935) +++ trunk/yake/common/media/gui2/styles/lua1/lua.button.lua 2008-09-25 17:08:47 UTC (rev 1936) @@ -2,81 +2,118 @@ -- BUTTON ---------------------- dofile "lua.colours.inc.lua" +dofile "tools.lua" -property["normal.colour"] = theme.colours.control_normal -property["hover.colour"] = theme.colours.control_hover -property["text.colour"] = theme.colours.control_text -property["padding"] = 2 - ---------------------- -- Name "normal", "hover" etc is defined by the style/widget! -- Name "forall" is defined by us for easy reuse in "normal", "hover" etc. -function text2dim(text) - -- "2px" -> absolute - -- "1" -> relative - -- "1,2" -> 1 rel, 2 px - -- "1.2" -> 1.2 rel +function onClickedStateChanged() + if this:property("clicked_state") == true then + end end +function init() + this:connectToPropertyChanged("clicked_state",onClickedStateChanged) +end -geometry.forall_inner = function() - local px = property["padding"] - if (this:id() == "x") then - px = px - 1 - end - render:quad( - {{0,px},{0,px}}, - {{0,px},{1,-px}}, - {{1,-px},{1,-px}}, - {{1,-px},{0,px}}) - if (this:id() == "x") then - px = px + 2 - render:colour(property["hover.colour"]) - render:quad( - {{0,px},{0,px}}, - {{0,px},{1,-px}}, - {{1,-px},{1,-px}}, - {{1,-px},{0,px}}) - end - if (this:id() ~= "x") then - local off = property["padding"] + 1 - render:colour(property["text.colour"]) - render:text(pos(dim(0,off),dim(0,off)), this:property("text"), theme.font, theme.text_size) - end +local m = { + widths = {{0,theme.frame_width},{1,-2*theme.frame_width},{0,theme.frame_width}}, + heights = {{0,theme.frame_width},{1,-2*theme.frame_width},{0,theme.frame_width}}, + colours = { + -- top row + theme.colours.control_normal * .8, + theme.colours.control_normal * .8, + theme.colours.control_normal * .8, + -- middle row + theme.colours.control_normal * .8, + theme.colours.control_normal, + theme.colours.control_normal * .7, + -- bottom row + theme.colours.control_normal * .8, + theme.colours.control_normal * .7, + theme.colours.control_normal * .7, + } +} +--@todo local m_hover = derive_matrix(m,...) +local m_hover = { + widths = m.widths, + heights = m.heights, + colours = { + -- top row + theme.colours.control_normal, + theme.colours.control_normal, + theme.colours.control_normal, + -- middle row + theme.colours.control_normal, + theme.colours.control_normal * 1.8, + theme.colours.control_normal * .9, + -- bottom row + theme.colours.control_normal, + theme.colours.control_normal * .9, + theme.colours.control_normal * .9, + } +} +local m_clicked = { + widths = m_hover.widths, + heights = m_hover.heights, + colours = { + m_hover.colours[1], + m_hover.colours[2], + m_hover.colours[3], + m_hover.colours[4], + colour(.9,.8,0,1), + m_hover.colours[6], + m_hover.colours[7], + m_hover.colours[8], + m_hover.colours[9], + } +} +render:finishMatrix(m) +render:finishMatrix(m_hover) +render:finishMatrix(m_clicked) + +geometry.text = function(clr) + local off = theme.frame_width + 1 + render:colour(clr) + render:text(pos(dim(0,off),dim(0,off)), this:property("text"), theme.font, theme.text_size) end geometry.normal = function() if (this:id() == "x") then - render:colour(property["hover.colour"]) + render:colour(theme.colours.control_hover) render:quad({0,0},{0,1},{1,1},{1,0}) - - render:colour(property["normal.colour"]) - geometry.forall_inner() -- Reuse! + render:colour(theme.colours.control_normal) else - render:colour(property["normal.colour"]) - render:quad({0,0},{0,1},{1,1},{1,0}) - - render:colour(property["hover.colour"]) - geometry.forall_inner() -- Reuse! + render:matrix(m) end + + -- text + if (this:id() ~= "x") then + geometry.text(theme.colours.control_text) + end end geometry.hover = function() - render:colour(property["hover.colour"]) - render:quad({0,0},{0,1},{1,1},{1,0}) + if this:property("clicked_state") then + render:matrix(m_clicked) + else + render:matrix(m_hover) + end - --render:colour(property["normal.colour"]) - geometry.forall_inner() -- Reuse! + -- text + if (this:id() ~= "x") then + geometry.text(theme.colours.control_text) + end end ---------------------- methods["minimumSize"] = function() if (this:id() == "x") then - return size(6,6) + size(property["padding"],property["padding"]) * 2 + return size(6,6) + size(theme.frame_width,theme.frame_width) * 2 else local fnt = ui:getFont(theme.font) - return fnt:getTextSize( this:property("text") ) + size(property["padding"],property["padding"]) * 2 + return fnt:getTextSize( this:property("text") ) + size(theme.frame_width,theme.frame_width) * 2 end end Modified: trunk/yake/common/media/gui2/styles/lua1/lua.colours.inc.lua =================================================================== --- trunk/yake/common/media/gui2/styles/lua1/lua.colours.inc.lua 2008-09-25 17:08:16 UTC (rev 1935) +++ trunk/yake/common/media/gui2/styles/lua1/lua.colours.inc.lua 2008-09-25 17:08:47 UTC (rev 1936) @@ -2,13 +2,14 @@ theme = { colours = { background = colour(.1,.2,.2,1), - panel_hover = background, + panel_hover = colour(.1,.2,.2,1) * 2, control_normal = colour(.2,.4,.4,1), - control_hover = colour(.3,.6,.6,1), + control_hover = colour(.3,.5,.5,1), control_text = colour(1,1,1,1), edit_text = colour(.8,.8,.5,1) }, text_size = 14, + frame_width = 2, font = "BlueHighway-10", images = { cursor = "cursor2-glass1.png", Modified: trunk/yake/common/media/gui2/styles/lua1/lua.panel.lua =================================================================== --- trunk/yake/common/media/gui2/styles/lua1/lua.panel.lua 2008-09-25 17:08:16 UTC (rev 1935) +++ trunk/yake/common/media/gui2/styles/lua1/lua.panel.lua 2008-09-25 17:08:47 UTC (rev 1936) @@ -18,7 +18,7 @@ geometry.forall() -- Reuse! end geometry.hover = function() - render:colour(theme.colours.background) + render:colour(theme.colours.panel_hover) geometry.forall() -- Reuse! end Modified: trunk/yake/common/media/gui2/styles/lua1/lua.textedit.lua =================================================================== --- trunk/yake/common/media/gui2/styles/lua1/lua.textedit.lua 2008-09-25 17:08:16 UTC (rev 1935) +++ trunk/yake/common/media/gui2/styles/lua1/lua.textedit.lua 2008-09-25 17:08:47 UTC (rev 1936) @@ -17,8 +17,7 @@ render:colour(theme.colours.control_hover) render:quad({0,0},{0,1},{1,1},{1,0}) - local px = 1 - if hasFocus then px = 2 end + local px = 2 render:colour(theme.colours.control_normal) render:quad( {{0,px},{0,px}}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-09-25 17:08:22
|
Revision: 1935 http://yake.svn.sourceforge.net/yake/?rev=1935&view=rev Author: psyclonist Date: 2008-09-25 17:08:16 +0000 (Thu, 25 Sep 2008) Log Message: ----------- * [input] moved KeyCode handling (input::getKeyChar()) Added Paths: ----------- trunk/yake/yake/input/yakeKeyCode.h Added: trunk/yake/yake/input/yakeKeyCode.h =================================================================== --- trunk/yake/yake/input/yakeKeyCode.h (rev 0) +++ trunk/yake/yake/input/yakeKeyCode.h 2008-09-25 17:08:16 UTC (rev 1935) @@ -0,0 +1,206 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_INPUT_KEYCODE_H +#define YAKE_INPUT_KEYCODE_H + +#ifndef YAKE_INPUT_PREREQUISITES_H +#include <yake/input/yakePrerequisites.h> +#endif + +namespace yake { +namespace input { + + // Keyboard scan codes - copied from DirectInput for now for speed. + // (SK: actually I copied them from Ogre again...) + // + // NB For the Lua bindings we parse this header and extract the + // key codes. This is done by: scripts/tools/extract_input_kc.pl + // + // If this enum is updated, remember to run this script (and commit + // the changes to the source repository, too)! + enum KeyCode + { + KC_ESCAPE =0x01, + KC_1 =0x02, + KC_2 =0x03, + KC_3 =0x04, + KC_4 =0x05, + KC_5 =0x06, + KC_6 =0x07, + KC_7 =0x08, + KC_8 =0x09, + KC_9 =0x0A, + KC_0 =0x0B, + KC_MINUS =0x0C, /* - on main keyboard */ + KC_EQUALS =0x0D, + KC_BACK =0x0E, /* backspace */ + KC_TAB =0x0F, + KC_Q =0x10, + KC_W =0x11, + KC_E =0x12, + KC_R =0x13, + KC_T =0x14, + KC_Y =0x15, + KC_U =0x16, + KC_I =0x17, + KC_O =0x18, + KC_P =0x19, + KC_LBRACKET =0x1A, + KC_RBRACKET =0x1B, + KC_RETURN =0x1C, /* Enter on main keyboard */ + KC_LCONTROL =0x1D, + KC_A =0x1E, + KC_S =0x1F, + KC_D =0x20, + KC_F =0x21, + KC_G =0x22, + KC_H =0x23, + KC_J =0x24, + KC_K =0x25, + KC_L =0x26, + KC_SEMICOLON =0x27, + KC_APOSTROPHE =0x28, + KC_GRAVE =0x29, /* accent grave */ + KC_LSHIFT =0x2A, + KC_BACKSLASH =0x2B, + KC_Z =0x2C, + KC_X =0x2D, + KC_C =0x2E, + KC_V =0x2F, + KC_B =0x30, + KC_N =0x31, + KC_M =0x32, + KC_COMMA =0x33, + KC_PERIOD =0x34, /* . on main keyboard */ + KC_SLASH =0x35, /* '/' on main keyboard */ + KC_RSHIFT =0x36, + KC_MULTIPLY =0x37, /* * on numeric keypad */ + KC_LMENU =0x38, /* left Alt */ + KC_SPACE =0x39, + KC_CAPITAL =0x3A, + KC_F1 =0x3B, + KC_F2 =0x3C, + KC_F3 =0x3D, + KC_F4 =0x3E, + KC_F5 =0x3F, + KC_F6 =0x40, + KC_F7 =0x41, + KC_F8 =0x42, + KC_F9 =0x43, + KC_F10 =0x44, + KC_NUMLOCK =0x45, + KC_SCROLL =0x46, /* Scroll Lock */ + KC_NUMPAD7 =0x47, + KC_NUMPAD8 =0x48, + KC_NUMPAD9 =0x49, + KC_SUBTRACT =0x4A, /* - on numeric keypad */ + KC_NUMPAD4 =0x4B, + KC_NUMPAD5 =0x4C, + KC_NUMPAD6 =0x4D, + KC_ADD =0x4E, /* + on numeric keypad */ + KC_NUMPAD1 =0x4F, + KC_NUMPAD2 =0x50, + KC_NUMPAD3 =0x51, + KC_NUMPAD0 =0x52, + KC_DECIMAL =0x53, /* . on numeric keypad */ + KC_OEM_102 =0x56, /* < > | on UK/Germany keyboards */ + KC_F11 =0x57, + KC_F12 =0x58, + KC_F13 =0x64, /* (NEC PC98) */ + KC_F14 =0x65, /* (NEC PC98) */ + KC_F15 =0x66, /* (NEC PC98) */ + KC_KANA =0x70, /* (Japanese keyboard) */ + KC_ABNT_C1 =0x73, /* / ? on Portugese (Brazilian) keyboards */ + KC_CONVERT =0x79, /* (Japanese keyboard) */ + KC_NOCONVERT =0x7B, /* (Japanese keyboard) */ + KC_YEN =0x7D, /* (Japanese keyboard) */ + KC_ABNT_C2 =0x7E, /* Numpad . on Portugese (Brazilian) keyboards */ + KC_NUMPADEQUALS =0x8D, /* = on numeric keypad (NEC PC98) */ + KC_PREVTRACK =0x90, /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */ + KC_AT =0x91, /* (NEC PC98) */ + KC_COLON =0x92, /* (NEC PC98) */ + KC_UNDERLINE =0x93, /* (NEC PC98) */ + KC_KANJI =0x94, /* (Japanese keyboard) */ + KC_STOP =0x95, /* (NEC PC98) */ + KC_AX =0x96, /* (Japan AX) */ + KC_UNLABELED =0x97, /* (J3100) */ + KC_NEXTTRACK =0x99, /* Next Track */ + KC_NUMPADENTER =0x9C, /* Enter on numeric keypad */ + KC_RCONTROL =0x9D, + KC_MUTE =0xA0, /* Mute */ + KC_CALCULATOR =0xA1, /* Calculator */ + KC_PLAYPAUSE =0xA2, /* Play / Pause */ + KC_MEDIASTOP =0xA4, /* Media Stop */ + KC_VOLUMEDOWN =0xAE, /* Volume - */ + KC_VOLUMEUP =0xB0, /* Volume + */ + KC_WEBHOME =0xB2, /* Web home */ + KC_NUMPADCOMMA =0xB3, /* , on numeric keypad (NEC PC98) */ + KC_DIVIDE =0xB5, /* / on numeric keypad */ + KC_SYSRQ =0xB7, + KC_RMENU =0xB8, /* right Alt */ + KC_PAUSE =0xC5, /* Pause */ + KC_HOME =0xC7, /* Home on arrow keypad */ + KC_UP =0xC8, /* UpArrow on arrow keypad */ + KC_PGUP =0xC9, /* PgUp on arrow keypad */ + KC_LEFT =0xCB, /* LeftArrow on arrow keypad */ + KC_RIGHT =0xCD, /* RightArrow on arrow keypad */ + KC_END =0xCF, /* End on arrow keypad */ + KC_DOWN =0xD0, /* DownArrow on arrow keypad */ + KC_PGDOWN =0xD1, /* PgDn on arrow keypad */ + KC_INSERT =0xD2, /* Insert on arrow keypad */ + KC_DELETE =0xD3, /* Delete on arrow keypad */ + KC_LWIN =0xDB, /* Left Windows key */ + KC_RWIN =0xDC, /* Right Windows key */ + KC_APPS =0xDD, /* AppMenu key */ + KC_POWER =0xDE, /* System Power */ + KC_SLEEP =0xDF, /* System Sleep */ + KC_WAKE =0xE3, /* System Wake */ + KC_WEBSEARCH =0xE5, /* Web Search */ + KC_WEBFAVORITES =0xE6, /* Web Favorites */ + KC_WEBREFRESH =0xE7, /* Web Refresh */ + KC_WEBSTOP =0xE8, /* Web Stop */ + KC_WEBFORWARD =0xE9, /* Web Forward */ + KC_WEBBACK =0xEA, /* Web Back */ + KC_MYCOMPUTER =0xEB, /* My Computer */ + KC_MAIL =0xEC, /* Mail */ + KC_MEDIASELECT =0xED /* Media Select */ + }; + + /** + * Get character corresponding to passed keycode. + * @param keyCode + * @param modifiers Shows if shift button was pressed + * @return Character + * @remarks Taken from the mighty OGRE3D :) + */ + YAKE_INPUT_API char getKeyChar(KeyCode keyCode, long modifiers); + +} +} + +#endif + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-09-25 17:06:52
|
Revision: 1934 http://yake.svn.sourceforge.net/yake/?rev=1934&view=rev Author: psyclonist Date: 2008-09-25 17:06:42 +0000 (Thu, 25 Sep 2008) Log Message: ----------- * [gui] improved integration with yake libraries * [gui] added clipping * [gui] various improvements to gui interfaces Modified Paths: -------------- trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg trunk/yake/samples/gui/ui1/demo.cpp trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp trunk/yake/src/gui2/plugins/system.ogreois/ogre_ois.cpp trunk/yake/src/gui2/plugins/window_manager.2d/window_manager.2d.cpp trunk/yake/src/gui2/widget/button.cpp trunk/yake/src/gui2/widget/static_text.cpp trunk/yake/src/gui2/widget/text_edit.cpp trunk/yake/src/gui2/widget.cpp trunk/yake/yake/gui2/input_provider.h trunk/yake/yake/gui2/layout/vbox.h trunk/yake/yake/gui2/plugins/style.lua/style.lua.h trunk/yake/yake/gui2/plugins/system.ogreois/ogre_ois.h trunk/yake/yake/gui2/renderer.h trunk/yake/yake/gui2/style.h trunk/yake/yake/gui2/types.h trunk/yake/yake/gui2/widget/button.h trunk/yake/yake/gui2/widget/static_text.h trunk/yake/yake/gui2/widget/text_edit.h trunk/yake/yake/gui2/widget.h trunk/yake/yake/gui2/window_manager.h Modified: trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg =================================================================== --- trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg 2008-09-25 17:06:42 UTC (rev 1934) @@ -25,3 +25,4 @@ FileSystem=../../../common/media/gui/lua_scripts/ FileSystem=../../../common/media/gui/schemes/ Zip=../../../common/media/skybox.zip +FileSystem=../../../common/media/gui2/styles/lua1/ Modified: trunk/yake/samples/gui/ui1/demo.cpp =================================================================== --- trunk/yake/samples/gui/ui1/demo.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/samples/gui/ui1/demo.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -6,9 +6,15 @@ #include <yake/gui2/plugins/system.ogreois/ogre_ois.h> #include <yake/gui2/plugins/style.lua/style.lua.h> +#include <yake/raf/yakeRaf.h> +#include <yake/input/yakeInputSystem.h> +#include <yake/input/yakeInputEventGenerator.h> + // boost #include <boost/lexical_cast.hpp> + + // namespace yake { namespace ui { @@ -22,14 +28,17 @@ { mSys = create<ui::ISystem>(systemId);//create_default<ui::ISystem>(); mSys->start(); - mInput = create<ui::IInputProvider>(inputProviderId); + //mInput = create<ui::IInputProvider>(inputProviderId); mWindowMgr = create<ui::IWindowManager>(windowMgrId); mStyle = create<ui::IStyle>(styleId,mSys,mSys->getRenderer()); - mInput->connectToMouseMoved(boost::bind(&ui::IWindowManager::injectMouseMove,mWindowMgr,_1)); - mInput->connectToKey(boost::bind(&ui::IWindowManager::injectKeyPress,mWindowMgr,_1)); - mInput->connectToMouseButtonDown( boost::bind(&ui::IWindowManager::injectMouseDown,mWindowMgr,_1) ); - mInput->connectToMouseButtonUp( boost::bind(&ui::IWindowManager::injectMouseUp,mWindowMgr,_1) ); + if (mInput) + { + mInput->connectToMouseMoved(boost::bind(&ui::IWindowManager::injectMouseMove,mWindowMgr,_1)); + mInput->connectToKey(boost::bind(&ui::IWindowManager::injectChar,mWindowMgr,_1)); + mInput->connectToMouseButtonDown( boost::bind(&ui::IWindowManager::injectMouseDown,mWindowMgr,_1) ); + mInput->connectToMouseButtonUp( boost::bind(&ui::IWindowManager::injectMouseUp,mWindowMgr,_1) ); + } //@todo move out mSys->createFont("BlueHighway-10", "BlueHighway", 14); @@ -48,16 +57,18 @@ } void step() { - mInput->poll(); + if (mInput) + mInput->poll(); mSys->getRenderer()->begin(); mWindowMgr->update(); + const Rectangle fullClip(Position(10,0),mSys->getRenderer()->getScreenSize()); { // back-to-front int zLevel = 0;//int(wmgr_->numTopLevelWindows()); for (ui::IWindowManager::const_window_byReverseZ_it it = mWindowMgr->beginTopLevelByReverseZ(); it != mWindowMgr->endTopLevelByReverseZ(); ++it, --zLevel) { ui::WidgetPtr w = *it; - w->paint(zLevel); + w->paint(fullClip, zLevel); //std::cout << "'" << w->id() << " @ z=" << zLevel << "\n"; } @@ -82,11 +93,17 @@ { return mSys->getRenderer(); } + ui::SystemPtr system() const + { + return mSys; + } private: ui::StylePtr mStyle; ui::SystemPtr mSys; ui::InputProviderPtr mInput; ui::WindowManagerPtr mWindowMgr; + + SharedPtr<input::IInputSystem> mInputSys; }; struct ConsoleInput { @@ -97,85 +114,251 @@ typedef MessageT message_type; }; } // namespace ui -} // namespace yake - -#include "yake/res/res.h" -int main( int argc, char** argv ) -{ - try +namespace demo { + class TheMainState : public raf::RtMainState { - // configure logging (console, log file, etc) - using namespace yake; - typedef SharedPtr<logging::log_listener> log_listener_ptr; + private: + raf::Application& mApp; + SharedPtr<ui::Application> mUi; + ui::StaticText::Pointer mInfoText; + public: + TheMainState(raf::Application& owner) : raf::RtMainState(owner), + mApp(owner) + { + enableInstantQuitByKey( input::KC_ESCAPE ); + mApp.getKeyboardEventGenerator()->subscribeToKeyDown(boost::bind(&TheMainState::onKeyDown,this,_1)); + mApp.getMouseEventGenerator()->subscribeToMouseMoved(boost::bind(&TheMainState::onMouseMoved,this,_1)); + mApp.getMouseEventGenerator()->subscribeToMouseButtonDown(boost::bind(&TheMainState::onMouseButtonDown,this,_1)); + mApp.getMouseEventGenerator()->subscribeToMouseButtonUp(boost::bind(&TheMainState::onMouseButtonUp,this,_1)); + } + void onKeyDown(const input::KeyboardEvent& evt) + { + if (mUi) + { + mUi->windowMgr()->injectKeyPress( evt.keyCode ); - log_listener_ptr toStdErr( new logging::stderr_listener() ); - logging::addListener( toStdErr.get() ); + const long modifiers = mApp.getKeyboard()->isKeyDown(input::KC_LSHIFT) || mApp.getKeyboard()->isKeyDown(input::KC_RSHIFT) ? 1 : 0; + const char c = input::getKeyChar( evt.keyCode, modifiers ); + if (c>0) + mUi->windowMgr()->injectChar( c ); + } + } + void onMouseMoved(const Vector3& delta) + { + if (mUi) + mUi->windowMgr()->injectMouseMove(ui::vector2(delta.x,delta.y)); + } + void onMouseButtonDown(const uint8 btn) + { + if (mUi) + mUi->windowMgr()->injectMouseDown(btn); + } + void onMouseButtonUp(const uint8 btn) + { + if (mUi) + mUi->windowMgr()->injectMouseUp(btn); + } + void executeString(ui::TextEdit* w, ui::StaticText* list, ui::Widget* listParent) //<- use weak_ptr? + { + YAKE_ASSERT( list && listParent ); + using namespace ui; + if (!w) + return; + std::cout << "EXECUTE: '" << w->getText() << "'\n"; + if (list) + { + list->setText(list->getText()+"\n"+w->getText()); - log_listener_ptr toFile( new logging::file_listener("sampleUi1.log") ); - logging::addListener( toFile.get() ); + const AbsSize minSize = mUi->style()->determineMinimumSize(*list); + //list->style_->determineMinimumSize(*list); + //list->updateGeometry(); + const real this_height = minSize.y; //list->getSize().y; + const real parent_height = listParent->getSize().y; + const real offset = (this_height > parent_height) ? (parent_height - this_height) : 0.; + list->property("renderoffset",dim2(dim(),dim(0,offset))); + } + w->setText(""); + } + void move(ui::Widget* w, int pixels) + { + YAKE_ASSERT(w); + using namespace ui; + dim2 offset; + if (w->hasProperty("renderoffset")) + offset = boost::any_cast<dim2>(w->property("renderoffset")); + offset += dim2(dim(),dim(0,pixels)); + w->property("renderoffset",offset); + } + virtual void onEnter() + { + raf::RtMainState::onEnter(); // triggers onCreateScene() + } + virtual void onCreateScene() + { + // create movable ninja + graphics::ISceneNode* pSN = getGraphicalWorld()->createSceneNode("root"); + pSN->attachEntity( getGraphicalWorld()->createEntity("ninja.mesh") ); - // configure resource paths - res::SourceFactory::global().reg<res::FileSource>("file"); - res::SourceManager::global().addSource("file","../../../common/media/scripts/"); - res::SourceManager::global().addSource("file","../../../common/media/gui2/styles/lua1/"); + // create a light + graphics::ILight* pLight = getGraphicalWorld()->createLight(); + pLight->setType( graphics::ILight::LT_DIRECTIONAL ); + pLight->setDirection( Vector3(0,-1,1) ); + getGraphicalWorld()->createSceneNode("lightnode0")->attachLight( pLight ); - // instantiate UI application object - ui::Application app; + // position camera and look at the ninja + getDefaultCamera()->setFixedYawAxis(Vector3::kUnitY); + getDefaultCamera()->setPosition(Point3(100,20,-400)); + getDefaultCamera()->lookAt(Point3(0,100,0)); +#if 1 + mUi.reset(new ui::Application()); - // create UI elements/dialogs - using namespace ui; - // Example: Statistics Dialog - StaticText::Pointer infoText; - { - // Instantiate a dialog with internal id "infoDlg" - Dialog::Pointer dlg( new Dialog("infoDlg") ); - dlg->setCaption( "GUI Statistics" ); + // create UI elements/dialogs + using namespace ui; + // Example: Statistics Dialog + { + // Instantiate a dialog with internal id "infoDlg" + Dialog::Pointer dlg( new Dialog("infoDlg") ); + dlg->setCaption( "GUI Statistics" ); - // Apply current application's style. - // Note: You can use a different style for each widget if you like. - dlg->setStyle( app.style() ); + // Apply current application's style. + // Note: You can use a different style for each widget if you like. + dlg->setStyle( mUi->style() ); - dlg->setPosition( Position(400,10) ); + dlg->setPosition( Position(420,10) ); - // Arrange child widgets vertically: - dlg->setLayout(new VBoxLayout()); + // Arrange child widgets vertically: + dlg->setLayout(new VBoxLayout()); - // Create a text widget: - infoText.reset(new StaticText("","text")); - infoText->setMinimumSize(AbsSize(150,50)); - dlg->add( infoText ); + // Create a text widget: + mInfoText.reset(new StaticText("","text")); + mInfoText->setMinimumSize(AbsSize(150,50)); + dlg->add( mInfoText ); - //@todo should this be called automatically in Widget::add()? - dlg->updateGeometry(); + //@todo should this be called automatically in Widget::add()? + dlg->updateGeometry(); - // Make the dialog visible (and ready for user interaction): - app.windowMgr()->attach( dlg ); + // Make the dialog visible (and ready for user interaction): + mUi->windowMgr()->attach( dlg ); + } + { + Dialog::Pointer dlg( new Dialog("dlg/console") ); + dlg->setCaption("Console"); + dlg->setStyle( mUi->style() ); + dlg->setPosition( Position(200,10) ); + + // Arrange child widgets vertically: + dlg->setLayout(new VBoxLayout()); + + // Create a text widget: +#if 0 + StaticText::Pointer txt(new StaticText("Enter the address:","text")); + txt->setMinimumSize(AbsSize(100,50)); + dlg->add( txt ); +#else + Panel::Pointer p(new Panel("dlg/console/text_panel")); + p->setLayout(new VBoxLayout()); + p->setMinimumSize(AbsSize(200,75)); + dlg->add(p); + + StaticText::Pointer txt(new StaticText("","text")); + p->add( txt ); +#endif + + TextEdit::Pointer edtAddr(new TextEdit(mUi->system(),"dlg/console/command")); + edtAddr->setText("localhost"); + edtAddr->property("stretch",true); // use same width as the 'text_panel' (aka console history) + dlg->add(edtAddr); + edtAddr->editingFinished.connect(boost::bind(&TheMainState::executeString,this,edtAddr.get(),txt.get(),p.get())); + + { + Button::Pointer btn(new Button("Scroll Up","dlg/console/up")); + dlg->add(btn); + btn->clicked.connect(boost::bind(&TheMainState::move,this,txt.get(),5)); + } + + { + Button::Pointer btn(new Button("Scroll Down","dlg/console/down")); + dlg->add(btn); + btn->clicked.connect(boost::bind(&TheMainState::move,this,txt.get(),-5)); + } + + //@todo should this be called automatically in Widget::add()? + dlg->updateGeometry(); + + // Make the dialog visible (and ready for user interaction): + mUi->windowMgr()->attach( dlg ); + } +#endif } - - // main application loop: - for (;;) + virtual void onFrame(const real timeElapsed) { // let the UI process input and render its graphics - app.step(); + if (mUi) + mUi->step(); // update the statistics UI window: - if (infoText) + if (mInfoText) { - IWindowRenderer::Statistics stats; - app.renderer()->getFrameStatistics(stats); + ui::IWindowRenderer::Statistics stats; + mUi->renderer()->getFrameStatistics(stats); - string text; - for (IWindowRenderer::Statistics::const_iterator it = stats.begin(); + ui::string text; + for (ui::IWindowRenderer::Statistics::const_iterator it = stats.begin(); it != stats.end(); ++it) { if (it != stats.begin()) text += "\n"; text += it->first + ": " + it->second; } - infoText->setText(text); + mInfoText->setText(text); } } + virtual void onExit() + { + if (mUi) + mUi->stop(); + mUi.reset(); + raf::RtMainState::onExit(); + } + }; +} // namespace demo +} // namespace yake + +/** The mighty application itself! */ +class TheApp : public yake::raf::ExampleApplication<> +{ +public: + TheApp() + { + getConfiguration().get().load("sampleUI1.cfg"); } +private: + virtual yake::raf::MainState* createMainState() + { + return new yake::demo::TheMainState(*this); + } +}; + + +#include "yake/res/res.h" +int main( int argc, char** argv ) +{ + try + { + // configure logging (console, log file, etc) + using namespace yake; + typedef SharedPtr<logging::log_listener> log_listener_ptr; + + log_listener_ptr toStdErr( new logging::stderr_listener() ); + logging::addListener( toStdErr.get() ); + + log_listener_ptr toFile( new logging::file_listener("sampleUi1.log") ); + logging::addListener( toFile.get() ); + + // + TheApp app; + return (raf::runApplication( app )) ? 0 : 1; + } catch ( std::exception& e ) { std::cerr << "EXCEPTION: " << e.what() << "\n"; Modified: trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp =================================================================== --- trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -28,6 +28,8 @@ { Ogre::TexturePtr pTex0; FaceVertex vtx[4]; + bool is_tri; + Face() : is_tri(true) {} }; #define FACELIST_MULTISET 1 @@ -68,6 +70,7 @@ Ogre::Camera* cam_; Ogre::SceneManager* sceneMgr_; Ogre::RenderWindow* window_; + bool externallyManaged_; void _setupResources(); }; @@ -144,6 +147,15 @@ //boost::shared_ptr<FTGLPixmapFont> font_; Ogre::Font* font_; string materialName_; + + /* + struct GlyphInfo + { + real aspectRatio; + Rectangle uv; + }; + boost::array<GlyphInfo,128> glyphs_; + */ }; @@ -345,7 +357,8 @@ } catch (Ogre::Exception&) { - assert( false && "failed to acquire glyph information for this character/code point" ); + //assert( false && "failed to acquire glyph information for this character/code point" ); + std::cerr << "failed to acquire glypth information for this character/code point: " << c << "\n"; } } @@ -353,32 +366,16 @@ //const vector2 size(scale.x*gi.aspectRatio, scale.y); const vector2 size(scale.y*gi.aspectRatio, scale.y); - /* - Quadrangle verts; - verts[0] = topLeft; - verts[1] = topLeft + vector2(0,size.y); - verts[2] = topLeft + size; - verts[3] = topLeft + vector2(size.x,0); - Quadrangle clipped; - clip(clipRect,verts,clipped); - */ - Quadrangle clipped; - clipped[0] = topLeft; - clipped[1] = topLeft + vector2(0,size.y); - clipped[2] = topLeft + size; - clipped[3] = topLeft + vector2(size.x,0); + const boost::array<vertex,4> poly = + {{ + vertex(topLeft, currClr, vector2(gi.uvRect.left,gi.uvRect.top)), + vertex(topLeft + vector2(0,size.y), currClr, vector2(gi.uvRect.left,gi.uvRect.bottom)), + vertex(topLeft + size, currClr, vector2(gi.uvRect.right,gi.uvRect.bottom)), + vertex(topLeft + vector2(size.x,0), currClr, vector2(gi.uvRect.right,gi.uvRect.top)) + }}; + renderer_->quad2d(poly,z); - renderer_->quad2duv(clipped[0], clipped[1], clipped[2], clipped[3], - vector2(gi.uvRect.left,gi.uvRect.top), // top left - vector2(gi.uvRect.left,gi.uvRect.bottom), - vector2(gi.uvRect.right,gi.uvRect.bottom), - vector2(gi.uvRect.right,gi.uvRect.top), - currClr, - z - ); - // next character - //currPos.x += size.x; currPos.x += real(int(size.x)+1); // round to full pixels, then convert } @@ -433,47 +430,74 @@ } void GraphicsCore::start() { - root_ = new Ogre::Root("plugins.cfg","ogre.cfg","ogre.log"); + if (Ogre::Root::getSingletonPtr()) + { + externallyManaged_ = true; - //@todo setup resource paths + root_ = Ogre::Root::getSingletonPtr(); + window_ = root_->getAutoCreatedWindow(); + sceneMgr_ = root_->getSceneManagerIterator().getNext(); + if (window_->getNumViewports()>0) + { + Ogre::Viewport* vp = window_->getViewport(0); + //cam_ = vp->getCamera(); + scrSize_.x = vp->getActualWidth(); + scrSize_.y = vp->getActualHeight(); + } + else + { + scrSize_.x = 640; + scrSize_.y = 480; + //scrSize_.x = window_->getMetrics( + } + return; + } + else + { + externallyManaged_ = false; - if (!root_->showConfigDialog()) - throw std::logic_error("ui.GraphicsCore:start(): User aborted."); //@todo convert to regular exit + root_ = new Ogre::Root("plugins.cfg","ogre.cfg","ogre.log"); - this->_setupResources(); + //@todo setup resource paths - window_ = root_->initialise(true/*=create default rendering system*/); + if (!root_->showConfigDialog()) + throw std::logic_error("ui.GraphicsCore:start(): User aborted."); //@todo convert to regular exit - sceneMgr_ = root_->createSceneManager(Ogre::ST_GENERIC, "GUIT_SMInstance"); + this->_setupResources(); - { - cam_ = sceneMgr_->createCamera("PlayerCam"); - // Position it at 50 in Z direction - cam_->setPosition(Ogre::Vector3(0,0,50)); - // Look back along -Z - cam_->lookAt(Ogre::Vector3(0,0,-30)); - cam_->setNearClipDistance(1.); - } + window_ = root_->initialise(true/*=create default rendering system*/); - { - // Create one viewport, entire window - Ogre::Viewport* vp = window_->addViewport(cam_); - vp->setBackgroundColour(Ogre::ColourValue(0.1,0.1,0.15)); + sceneMgr_ = root_->createSceneManager(Ogre::ST_GENERIC, "GUIT_SMInstance"); - // Alter the camera aspect ratio to match the viewport - cam_->setAspectRatio( - Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight())); + { + cam_ = sceneMgr_->createCamera("PlayerCam"); + // Position it at 50 in Z direction + cam_->setPosition(Ogre::Vector3(0,0,50)); + // Look back along -Z + cam_->lookAt(Ogre::Vector3(0,0,-30)); + cam_->setNearClipDistance(1.); + } + { + // Create one viewport, entire window + Ogre::Viewport* vp = window_->addViewport(cam_); + vp->setBackgroundColour(Ogre::ColourValue(0.1,0.1,0.15)); + + // Alter the camera aspect ratio to match the viewport + cam_->setAspectRatio( + Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight())); + + // + scrSize_.x = vp->getActualWidth(); + scrSize_.y = vp->getActualHeight(); + } + + Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); + // - scrSize_.x = vp->getActualWidth(); - scrSize_.y = vp->getActualHeight(); + Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); } - Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); - - // - Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); - { Ogre::Entity* e = sceneMgr_->createEntity("n1","ninja.mesh"); sceneMgr_->getRootSceneNode()->createChildSceneNode()->attachObject(e); @@ -504,7 +528,7 @@ } void GraphicsCore::stop() { - if (root_) + if (!externallyManaged_ && root_) { root_->shutdown(); delete root_; @@ -513,6 +537,9 @@ } void GraphicsCore::frame() { + if (externallyManaged_) + return; + root_->renderOneFrame(); // Pump events on Win32 @@ -584,12 +611,23 @@ virtual void getFrameStatistics(Statistics&) const; +#if 0 virtual void quad2duv(const Position& v0, const Position& v1, const Position& v2, const Position& v3, const vector2& uv00, const vector2& uv01, const vector2& uv02, const vector2& uv03, const colour& c0, const colour& c1, const colour& c2, const colour& c3, const real z); + virtual void tri2duv(const Position& v0, const Position& v1, const Position& v2, + const vector2& uv00, const vector2& uv01, const vector2& uv02, + const colour& c0, const colour& c1, const colour& c2, + const real z); +#endif + virtual void quad2d(const vertex&, const vertex&, const vertex&, const vertex&, const real z); + virtual void tri2d(const vertex&, const vertex&, const vertex&, const real z); + virtual void quad2d(const boost::array<vertex,4>&, const real z); virtual void pushMaterial(const string& name); virtual void popMaterial(); + virtual void pushClipRegion(const Rectangle&); + virtual void popClipRegion(); private: void _render(); void _initRenderStates(); @@ -642,6 +680,8 @@ vector2 texelOffset_; GraphicsCore& core_; + ClipPlaneMgr clipPlaneMgr_; + inline void toScreen(const Position& in, float& x, float& y, float& z) const { x = in.x / (scrSize_.x * .5); @@ -857,35 +897,21 @@ for (FaceList::const_iterator it = faces_.begin(); it != faces_.end(); ++it) { const Face& f = *it; -#if 1 - /* - memcpy(vtx,&f.vtx[0],sizeof(FaceVertex)); ++vtx; - memcpy(vtx,&f.vtx[1],sizeof(FaceVertex)); ++vtx; - memcpy(vtx,&f.vtx[2],sizeof(FaceVertex)); ++vtx; - */ + *vtx = f.vtx[0]; ++vtx; *vtx = f.vtx[1]; ++vtx; *vtx = f.vtx[2]; ++vtx; - /* - memcpy(vtx,&f.vtx[0],sizeof(FaceVertex)); ++vtx; - memcpy(vtx,&f.vtx[2],sizeof(FaceVertex)); ++vtx; - memcpy(vtx,&f.vtx[3],sizeof(FaceVertex)); ++vtx; - */ - *vtx = f.vtx[0]; ++vtx; - *vtx = f.vtx[2]; ++vtx; - *vtx = f.vtx[3]; ++vtx; -#else - // 0,1,2 - memcpy(vtx,&f.vtx[0],sizeof(FaceVertex)*3); vtx += 3; - - // 0,2,3 - *vtx = f.vtx[0]; ++vtx; - memcpy(vtx,&f.vtx[2],sizeof(FaceVertex)*2); vtx += 2; -#endif + if (!f.is_tri) + { + *vtx = f.vtx[0]; ++vtx; + *vtx = f.vtx[2]; ++vtx; + *vtx = f.vtx[3]; ++vtx; + } } vertexBuffer_->unlock(); } + // render: bool first = true; bufferPos_ = 0; @@ -901,7 +927,7 @@ const Face& f = *it; if (f.pTex0 != tex) break; - bufferPos_ += VERTEX_PER_QUAD; + bufferPos_ += f.is_tri ? 3 : VERTEX_PER_QUAD; } renderOp_.vertexData->vertexCount = bufferPos_ - renderOp_.vertexData->vertexStart; @@ -910,7 +936,6 @@ first = false; _initRenderStates(); } - if (tex.get()) oSystem_->_setTexture(0,true,tex); else @@ -944,6 +969,7 @@ out *= -1.; // flip Y return out; } +#if 0 void OgreWindowRenderer::quad2duv(const Position& v0, const Position& v1, const Position& v2, const Position& v3, const vector2& uv00, const vector2& uv01, const vector2& uv02, const vector2& uv03, const colour& c0, const colour& c1, const colour& c2, const colour& c3, @@ -953,6 +979,7 @@ ++frameStats_.numNewFaces; Face f; + f.is_tri = false; //f.z = 0; //@todo FIXME z handling oSystem_->convertColourValue(Ogre::ColourValue( c0.r, c0.g, c0.b, c0.a ), &f.vtx[0].diffuse); oSystem_->convertColourValue(Ogre::ColourValue( c1.r, c1.g, c1.b, c1.a ), &f.vtx[1].diffuse); @@ -995,7 +1022,133 @@ mesh->colour( c3.r, c3.g, c3.b, c3.a ); */ } + void OgreWindowRenderer::tri2duv(const Position& v0, const Position& v1, const Position& v2, + const vector2& uv00, const vector2& uv01, const vector2& uv02, + const colour& c0, const colour& c1, const colour& c2, + const real z) + { + dirty_ = true; + ++frameStats_.numNewFaces; + Face f; + f.is_tri = true; + //f.z = 0; //@todo FIXME z handling + oSystem_->convertColourValue(Ogre::ColourValue( c0.r, c0.g, c0.b, c0.a ), &f.vtx[0].diffuse); + oSystem_->convertColourValue(Ogre::ColourValue( c1.r, c1.g, c1.b, c1.a ), &f.vtx[1].diffuse); + oSystem_->convertColourValue(Ogre::ColourValue( c2.r, c2.g, c2.b, c2.a ), &f.vtx[2].diffuse); + toScreen(v0,f.vtx[0].x,f.vtx[0].y,f.vtx[0].z); + toScreen(v1,f.vtx[1].x,f.vtx[1].y,f.vtx[1].z); + toScreen(v2,f.vtx[2].x,f.vtx[2].y,f.vtx[2].z); + f.vtx[0].tu0 = uv00.x + texelOffset_.x; + f.vtx[0].tv0 = uv00.y + texelOffset_.y; + f.vtx[1].tu0 = uv01.x + texelOffset_.x; + f.vtx[1].tv0 = uv01.y + texelOffset_.y; + f.vtx[2].tu0 = uv02.x + texelOffset_.x; + f.vtx[2].tv0 = uv02.y + texelOffset_.y; + + if (!curMaterialStack_.empty()) + f.pTex0 = curMaterialStack_.back(); + + addFace(faces_,f); + if (currWidgetData_) + addFace(currWidgetData_->faces,f); + } +#endif + void OgreWindowRenderer::quad2d(const boost::array<vertex,4>& in, const real z) + { + const std::deque<vertex> clipped = clipPlaneMgr_.clip(in); + + if (clipped.size()>=3) + { + const vertex& a = clipped.at(0); + for (size_t i=1; i<clipped.size()-1; ++i) + { + const vertex& b = clipped.at(i); + const vertex& c = clipped.at(i+1); + // + dirty_ = true; + ++frameStats_.numNewFaces; + + Face f; + f.is_tri = true; + //f.z = 0; //@todo FIXME z handling + oSystem_->convertColourValue(Ogre::ColourValue( a.clr.r, a.clr.g, a.clr.b, a.clr.a ), &f.vtx[0].diffuse); + oSystem_->convertColourValue(Ogre::ColourValue( b.clr.r, b.clr.g, b.clr.b, b.clr.a ), &f.vtx[1].diffuse); + oSystem_->convertColourValue(Ogre::ColourValue( c.clr.r, c.clr.g, c.clr.b, c.clr.a ), &f.vtx[2].diffuse); + toScreen(a.abs_pos,f.vtx[0].x,f.vtx[0].y,f.vtx[0].z); + toScreen(b.abs_pos,f.vtx[1].x,f.vtx[1].y,f.vtx[1].z); + toScreen(c.abs_pos,f.vtx[2].x,f.vtx[2].y,f.vtx[2].z); + f.vtx[0].tu0 = a.uv.x + texelOffset_.x; + f.vtx[0].tv0 = a.uv.y + texelOffset_.y; + f.vtx[1].tu0 = b.uv.x + texelOffset_.x; + f.vtx[1].tv0 = b.uv.y + texelOffset_.y; + f.vtx[2].tu0 = c.uv.x + texelOffset_.x; + f.vtx[2].tv0 = c.uv.y + texelOffset_.y; + + if (!curMaterialStack_.empty()) + f.pTex0 = curMaterialStack_.back(); + + addFace(faces_,f); + if (currWidgetData_) + addFace(currWidgetData_->faces,f); + } + } + } + void OgreWindowRenderer::quad2d(const vertex& v0, const vertex& v1, const vertex& v2, const vertex& v3, const real z) + { + const boost::array<vertex,4> in = {{v0,v1,v2,v3}}; + quad2d(in,z); + } + void OgreWindowRenderer::tri2d(const vertex& v0, const vertex& v1, const vertex& v2, const real z) + { + const boost::array<vertex,3> in = {{v0,v1,v2}}; + const std::deque<vertex> clipped = clipPlaneMgr_.clip(in); + + if (clipped.size()>=3) + { + const vertex& a = clipped.at(0); + for (size_t i=1; i<clipped.size()-1; ++i) + { + const vertex& b = clipped.at(i); + const vertex& c = clipped.at(i+1); + // + dirty_ = true; + ++frameStats_.numNewFaces; + + Face f; + f.is_tri = true; + //f.z = 0; //@todo FIXME z handling + oSystem_->convertColourValue(Ogre::ColourValue( a.clr.r, a.clr.g, a.clr.b, a.clr.a ), &f.vtx[0].diffuse); + oSystem_->convertColourValue(Ogre::ColourValue( b.clr.r, b.clr.g, b.clr.b, b.clr.a ), &f.vtx[1].diffuse); + oSystem_->convertColourValue(Ogre::ColourValue( c.clr.r, c.clr.g, c.clr.b, c.clr.a ), &f.vtx[2].diffuse); + toScreen(a.abs_pos,f.vtx[0].x,f.vtx[0].y,f.vtx[0].z); + toScreen(b.abs_pos,f.vtx[1].x,f.vtx[1].y,f.vtx[1].z); + toScreen(c.abs_pos,f.vtx[2].x,f.vtx[2].y,f.vtx[2].z); + f.vtx[0].tu0 = a.uv.x + texelOffset_.x; + f.vtx[0].tv0 = a.uv.y + texelOffset_.y; + f.vtx[1].tu0 = b.uv.x + texelOffset_.x; + f.vtx[1].tv0 = b.uv.y + texelOffset_.y; + f.vtx[2].tu0 = c.uv.x + texelOffset_.x; + f.vtx[2].tv0 = c.uv.y + texelOffset_.y; + + if (!curMaterialStack_.empty()) + f.pTex0 = curMaterialStack_.back(); + + addFace(faces_,f); + if (currWidgetData_) + addFace(currWidgetData_->faces,f); + } + } + } + void OgreWindowRenderer::pushClipRegion(const Rectangle& region) + { + clipPlaneMgr_.push(region); + } + void OgreWindowRenderer::popClipRegion() + { + clipPlaneMgr_.pop(); + } + //----------------------------------------------------- //----------------------------------------------------- Modified: trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp =================================================================== --- trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -23,6 +23,9 @@ #include "yake/bindings.lua/bindings.lua.h" #include "yake/res/res.h" +#include "yake/base/math/yakePolygonClipper.h" +#include <boost/array.hpp> + namespace yake { namespace ui { YAKE_REGISTER_CONCRETE(LuaStyle) @@ -33,33 +36,125 @@ NamedFnMap renderFns; NamedFnMap methods; }; + // + //Rectangle ClipPlaneMgr::s_clipUnlimitedRegion = Rectangle(Position(-1000,-1000),Position(10000,10000)); + Rectangle ClipPlaneMgr::s_clipUnlimitedRegion = Rectangle(Position(10,10),Position(10000,10000)); + ClipPlaneMgr::ClipPlaneMgr() + { + push(s_clipUnlimitedRegion); + } + void ClipPlaneMgr::push(const Rectangle& cr) + { + const boost::array<Plane,4> planes = {{ + Plane(Vector3::kUnitX,-cr.left()), + Plane(-Vector3::kUnitX,cr.right()), + Plane(Vector3::kUnitY,-cr.top()), + Plane(-Vector3::kUnitY,cr.bottom()) + }}; + clipRegionStack_.push_back(std::make_pair(cr,planes)); + } + void ClipPlaneMgr::pop() + { + clipRegionStack_.pop_back(); + YAKE_ASSERT( !clipRegionStack_.empty() ); + } + std::deque<vertex> ClipPlaneMgr::clip(const boost::array<vertex,3>& in) const + { + const ClipPlanes& p = clipRegionStack_.back(); + std::deque<vertex> out; + // Early out by testing against the 2D clip rectangle: + int left = 0; // No of elements "outside" of this clip plane. + int top = 0; + int right = 0; + int bottom = 0; + for (size_t i=0; i<3; ++i) + { + if (in[i].abs_pos.x < p.first.topLeft.x) + ++left; + else if (in[i].abs_pos.x > p.first.bottomRight.x) + ++right; + if (in[i].abs_pos.y < p.first.topLeft.y) + ++top; + else if (in[i].abs_pos.y > p.first.bottomRight.y) + ++bottom; + } + + // completely outside? + if ((left==3 || right==3 || top==3 || bottom==3)) + return out; // return empty! + + // completely inside? + if ((left==0 && right==0 && top==0 && bottom==0)) + std::copy(in.begin(),in.end(),std::back_inserter(out)); // return (copy of) original + else + math::Clipper<vertex>::clip(p.second,in,out); // intersect with planes + return out; + } + std::deque<vertex> ClipPlaneMgr::clip(const boost::array<vertex,4>& in) const + { + const ClipPlanes& p = clipRegionStack_.back(); + std::deque<vertex> out; + // Early out by testing against the 2D clip rectangle: + int left = 0; // No of elements "outside" of this clip plane. + int top = 0; + int right = 0; + int bottom = 0; + for (size_t i=0; i<4; ++i) + { + if (in[i].abs_pos.x < p.first.topLeft.x) + ++left; + else if (in[i].abs_pos.x > p.first.bottomRight.x) + ++right; + if (in[i].abs_pos.y < p.first.topLeft.y) + ++top; + else if (in[i].abs_pos.y > p.first.bottomRight.y) + ++bottom; + } + + // completely outside? + if ((left==4 || right==4 || top==4 || bottom==4)) + return out; // return empty! + + // completely inside? + if ((left==0 && right==0 && top==0 && bottom==0)) + std::copy(in.begin(),in.end(),std::back_inserter(out)); // return (copy of) original + else + math::Clipper<vertex>::clip(p.second,in,out); // intersect with planes + return out; + } + // struct LuaStyleBatcher { void setRenderer(IWindowRenderer* r) - { renderer_ = r; } + { + renderer_ = r; + if (renderer_) + { + } + } void setSystem(SystemPtr sys) { sys_ = sys; } - struct vertex + + private: + ClipPlaneMgr clipMgr_; + public: + LuaStyleBatcher() : + curr_(0), + currZ_(0), + renderer_(0) { - dim2 pos; - colour clr; - vector2 uv; - vertex(const dim2& p, const colour& c = colour()) : pos(p), clr(c) - {} - vertex(const dim2& p, const colour& c, const vector2& uv0) : pos(p), clr(c), uv(uv0) - {} - vertex(const dim2& p, const vector2& uv0) : pos(p), clr(1,1,1,1), uv(uv0) - {} - }; - - LuaStyleBatcher() : curr_(0), currZ_(0), renderer_(0) - {} + } void setCurrentWidget(Widget& w, real z) { curr_ = &w; currZ_ = z; //if (curr_) // std::cout << "W " << curr_->id() << "\n"; + + if (curr_->hasProperty("renderoffset")) + currOffset_ = boost::any_cast<dim2>(curr_->property("renderoffset")); + else + currOffset_ = dim2(); } void pushMaterial(const string& name) { @@ -80,16 +175,22 @@ } void quad(const vertex& v0, const vertex& v1, const vertex& v2, const vertex& v3) { + assert(renderer_); + if (!renderer_) + return; //assert( curr_ ); const Position absPos = curr_ ? curr_->getDerivedPosition() : Position(); const AbsSize size = curr_ ? curr_->getSize() : AbsSize(); + const real z = .01*currZ_+(curr_?curr_->getZBias():0.); +#if 0 //std::cout << "quad(" << v0 << v1 << v2 << v3 << ")\n"; Position abs0 = absPos + toAbsolute(v0); Position abs1 = absPos + toAbsolute(v1); Position abs2 = absPos + toAbsolute(v2); Position abs3 = absPos + toAbsolute(v3); //std::cout << "quad(" << abs0 << abs1 << abs2 << abs3 << ")\n"; + if ((v0.clr.a <= 0.001) && (v1.clr.a <= 0.001) && (v2.clr.a <= 0.001) && (v3.clr.a <= 0.001)) { std::cout << "=> hidden quad\n"; @@ -97,9 +198,61 @@ else if (renderer_) { renderer_->quad2duv(abs0,abs1,abs2,abs3, - v0.uv, v1.uv, v2.uv, v3.uv, - v0.clr, v1.clr, v2.clr, v3.clr, .01*currZ_+(curr_?curr_->getZBias():0.)); + v0.uv, v1.uv, v2.uv, v3.uv, + v0.clr, v1.clr, v2.clr, v3.clr, z); } +#else + boost::array<vertex,4> poly = {{v0,v1,v2,v3}}; + /* + std::deque<vertex> poly; + poly.push_back(v0); + poly.push_back(v1); + poly.push_back(v2); + poly.push_back(v3); + */ + poly.at(0).abs_pos = absPos + toAbsolute(v0); + poly.at(1).abs_pos = absPos + toAbsolute(v1); + poly.at(2).abs_pos = absPos + toAbsolute(v2); + poly.at(3).abs_pos = absPos + toAbsolute(v3); + renderer_->quad2d(poly,z); +#if 0 + std::deque<vertex> clipped; + + //@todo early out (poly vs quad AND rect vs quad) + + //Plane p_left(Vector3(1,0,0),-100/*clip_.left()*/); + //Clipper<vertex>::clip(p_left,poly,clipped); + YAKE_ASSERT(!clipRegionStack_.empty()); + Clipper<vertex>::clip(clipRegionStack_.back(),poly,clipped); + + if (clipped.empty()) + { + //std::cout << "empty\n"; + return; + } + if (clipped.size()>4) + { + std::cout << clipped.size() << "\n"; + } + else if (clipped.size()<3) + { + std::cout << clipped.size() << "\n"; + } + if (clipped.size()>=3) + { + const vertex& a = clipped.at(0); + for (size_t i=1; i<clipped.size()-1; ++i) + { + const vertex& b = clipped.at(i); + const vertex& c = clipped.at(i+1); + renderer_->tri2duv( + a.abs_pos,b.abs_pos,c.abs_pos, + a.uv,b.uv,c.uv, + a.clr,b.clr,c.clr,z); + } + } +#endif +#endif } void setColour(const colour& clr) { @@ -131,6 +284,7 @@ private: Widget* curr_; real currZ_; + dim2 currOffset_; colour clr_; IWindowRenderer* renderer_; SystemPtr sys_; @@ -148,8 +302,8 @@ Position out; if (curr_) { - out.x = x.abs + curr_->getSize().x * x.rel; - out.y = y.abs + curr_->getSize().y * y.rel; + out.x = currOffset_.x.abs + x.abs + curr_->getSize().x * x.rel; + out.y = currOffset_.y.abs + y.abs + curr_->getSize().y * y.rel; } else out = Position(x.abs, y.abs); @@ -360,6 +514,7 @@ class_<colour>("colour") .def(constructor<real,real,real,real>()) .def(constructor<real,real,real>()) + .def(self * other<real>()) //.def(self + other<colour>()) //.def(self - other<colour>()) .def_readwrite("r", &colour::r) @@ -393,13 +548,13 @@ , // special "LuaStyle" stuff: - class_<LuaStyleBatcher::vertex>("vertex") + class_<vertex>("vertex") .def(constructor<dim2>()) .def(constructor<dim2,colour>()) .def(constructor<dim2,vector2>()), class_<LuaStyleBatcher, boost::shared_ptr<LuaStyleBatcher> >("LuaStyleBatcher") - .def("doquad",(void(LuaStyleBatcher::*)(const LuaStyleBatcher::vertex&,const LuaStyleBatcher::vertex&,const LuaStyleBatcher::vertex&,const LuaStyleBatcher::vertex&))&LuaStyleBatcher::quad) + .def("doquad",(void(LuaStyleBatcher::*)(const vertex&,const vertex&,const vertex&,const vertex&))&LuaStyleBatcher::quad) .def("doquad",(void(LuaStyleBatcher::*)(const dim2&,const dim2&,const dim2&,const dim2&))&LuaStyleBatcher::quad) .def("doquad",(void(LuaStyleBatcher::*)(const dim2&,const dim2&,const dim2&,const dim2&,const vector2&,const vector2&,const vector2&,const vector2&))&LuaStyleBatcher::quad) .def("colour",(void(LuaStyleBatcher::*)(const colour&))&LuaStyleBatcher::setColour) @@ -537,7 +692,7 @@ renderer_->popMaterial(); } } - void LuaStyle::renderSingleWidget(Widget& w, const int zLevel) + void LuaStyle::renderSingleWidget(Widget& w, const Rectangle& clipRect, const int zLevel) { assert( renderer_ ); renderer_->setZLevel( zLevel ); @@ -564,10 +719,13 @@ assert( luabind::type(o) == LUA_TFUNCTION ); assert( batcher_ ); + renderer_->pushClipRegion(clipRect); batcher_->setCurrentWidget( w, zLevel ); luabind::globals(state(entry.vm))["this"] = &w; o(); + + renderer_->popClipRegion(); } renderer_->endWidget( w ); } Modified: trunk/yake/src/gui2/plugins/system.ogreois/ogre_ois.cpp =================================================================== --- trunk/yake/src/gui2/plugins/system.ogreois/ogre_ois.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/plugins/system.ogreois/ogre_ois.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -162,11 +162,20 @@ bool mouseButtons_[3]; }; } // namespace detail - OgreOIS_InputProvider::OgreOIS_InputProvider() : frameListener_(0) + OgreOIS_InputProvider::OgreOIS_InputProvider(const CreationParameters& params) : frameListener_(0) { frameListener_ = new detail::OgreOIS_FrameListener(); for (size_t i=0; i<3; ++i) mouseButtons_[i] = false; +#if 0 + IInputProvider::CreationParameters::const_iterator itParam = params.find("yake.key_event_generator"); + YAKE_ASSERT( itParam != params.end() ); + input::KeyboardEventGenerator* keyEvents = boost::any_cast<input::KeyboardEventGenerator*>(itParam->second); + + itParam = params.find("yake.mouse_event_generator"); + YAKE_ASSERT( itParam != params.end() ); + input::MouseEventGenerator* mouseEvents = boost::any_cast<input::MouseEventGenerator*>(itParam->second); +#endif } OgreOIS_InputProvider::~OgreOIS_InputProvider() { Modified: trunk/yake/src/gui2/plugins/window_manager.2d/window_manager.2d.cpp =================================================================== --- trunk/yake/src/gui2/plugins/window_manager.2d/window_manager.2d.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/plugins/window_manager.2d/window_manager.2d.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -11,7 +11,8 @@ virtual void injectMouseMove(const vector2& delta); virtual void injectMouseDown(const int); virtual void injectMouseUp(const int); - virtual void injectKeyPress(const char); + virtual void injectKeyPress(const input::KeyCode); + virtual void injectChar(const char); virtual vector2 getCursorPosition() const; virtual void setFocusWidget(WidgetPtr); @@ -85,14 +86,22 @@ } } } - void DefaultWindowManager::injectKeyPress(const char key) + void DefaultWindowManager::injectChar(const char key) { //@todo here or in update() ? if (focusWidget_) - focusWidget_->_onProcessKey(key); + focusWidget_->_onProcessChar(key); else if (lastActiveWidget_) - lastActiveWidget_->_onProcessKey(key); + lastActiveWidget_->_onProcessChar(key); } + void DefaultWindowManager::injectKeyPress(const input::KeyCode code) + { + //@todo here or in update() ? + if (focusWidget_) + focusWidget_->_onProcessKeyDown(code); + else if (lastActiveWidget_) + lastActiveWidget_->_onProcessKeyDown(code); + } void DefaultWindowManager::onUpdate() { mousePos_ += mouseMovement_; @@ -168,11 +177,9 @@ { if (mouseButtonDown_[0]) { - std::cout << "CLICKED " << ((lastActiveWidget_) ? lastActiveWidget_->id() : "") << "\n"; if (lastActiveWidget_) { lastActiveWidget_->_onProcessMouseButtonDown(0, mousePos_); - lastActiveWidget_->_onProcessMouseButtonClicked(0, mousePos_); this->setFocusWidget(lastActiveWidget_); } @@ -181,7 +188,18 @@ { std::cout << "MOUSE UP " << ((lastActiveWidget_) ? lastActiveWidget_->id() : "") << "\n"; if (lastActiveWidget_) + { + // Trigger 'clicked' only if the 'mouse up' event occured + // within the widget's space. + const Position pos = lastActiveWidget_->getDerivedPosition(); + if (Rectangle(pos,pos+lastActiveWidget_->getSize()).containsPoint(mousePos_)) + { + std::cout << "CLICKED " << ((lastActiveWidget_) ? lastActiveWidget_->id() : "") << "\n"; + lastActiveWidget_->_onProcessMouseButtonClicked(0, mousePos_); + } + // Trigger 'up' event always. lastActiveWidget_->_onProcessMouseButtonUp(0, mousePos_); + } } } // prepare for next step/update Modified: trunk/yake/src/gui2/widget/button.cpp =================================================================== --- trunk/yake/src/gui2/widget/button.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/widget/button.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -6,11 +6,20 @@ Button::Button(const string& text, const string& id) : Widget(id) { this->property("text",text); + this->property("clicked_state",false); // true=down, false=up this->updateGeometry(); } void Button::_onProcessMouseButtonClicked(const int btn, const Position& pos) { clicked(); } + void Button::_onProcessMouseButtonDown(const int btn, const Position& pos) + { + this->property("clicked_state",true); + } + void Button::_onProcessMouseButtonUp(const int btn, const Position& pos) + { + this->property("clicked_state",false); + } } // namespace ui } // namespace yake Modified: trunk/yake/src/gui2/widget/static_text.cpp =================================================================== --- trunk/yake/src/gui2/widget/static_text.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/widget/static_text.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -21,6 +21,10 @@ { this->property("text",text); } + string StaticText::getText() const + { + return boost::any_cast<string>(this->property("text")); + } void StaticText::setFontSize(const real size) { this->property("fontsize",size); Modified: trunk/yake/src/gui2/widget/text_edit.cpp =================================================================== --- trunk/yake/src/gui2/widget/text_edit.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/widget/text_edit.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -9,15 +9,29 @@ this->setText(""); //this->setMinimumSize(sys->getFont("BlueHighway-10")->getTextSize("This is hopefully long engouh")); + this->connectToPropertyChanged("hasFocus",boost::bind(&TextEdit::onFocusChange,this)); } void TextEdit::setText(const string& text) { this->property("text",text); } + string TextEdit::getText() const + { + return boost::any_cast<string>(this->property("text")); + } bool TextEdit::onChangeState(const State state) { return true; } + void TextEdit::onFocusChange() + { + if (boost::any_cast<bool>(property("hasFocus"))) + { + //@todo start blinking cursor + } + else + ; //@todo stop blinking cursor + } void TextEdit::_onProcessMouseButtonDown(const int btn, const Position& pos) { Panel::_onProcessMouseButtonDown(btn,pos); @@ -28,8 +42,31 @@ //bool hasFocus = sys_->acquireInput(this); //this->property("hasFocus",hasFocus); } - void TextEdit::_onProcessKey(const char c) + void TextEdit::_onProcessKeyDown(const input::KeyCode code) { + switch (code) + { + case input::KC_BACK: + { + string text = this->getText(); + if (!text.empty()) + text.erase(text.size()-1); + setText(text); + } + break; + case input::KC_RETURN: + case input::KC_NUMPADENTER: + case input::KC_ESCAPE: +// if (getParent()) +// getParent()->setFocus(); + editingFinished(); + break; + default: + break; + }; + } + void TextEdit::_onProcessChar(const char c) + { //if (!hasFocus_) // return; string text = boost::any_cast<string>(this->property("text")); Modified: trunk/yake/src/gui2/widget.cpp =================================================================== --- trunk/yake/src/gui2/widget.cpp 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/src/gui2/widget.cpp 2008-09-25 17:06:42 UTC (rev 1934) @@ -257,16 +257,27 @@ repaint(); } } - void Widget::paint(const int zLevel) + void Widget::paint(const Rectangle& clipRect, const int zLevel) { StylePtr style = getStyle(); assert( style ); - style->renderSingleWidget( *this, zLevel ); + style->renderSingleWidget( *this, clipRect, zLevel ); if (needsRepaint_) std::for_each(children_.begin(), children_.end(), boost::bind(&Widget::repaint,_1) ); - std::for_each(children_.begin(), children_.end(), boost::bind(&Widget::paint,_1,zLevel) ); + const Position thisPos = this->getDerivedPosition(); + const AbsSize thisSize = this->getSize(); + Rectangle thisClip(clipRect); + thisClip.topLeft.x = std::max(thisPos.x,thisClip.topLeft.x); + thisClip.topLeft.y = std::max(thisPos.y,thisClip.topLeft.y); + thisClip.bottomRight.x = std::min(thisPos.x+thisSize.x,thisClip.bottomRight.x); + thisClip.bottomRight.y = std::min(thisPos.y+thisSize.y,thisClip.bottomRight.y); + //thisClip.bottomRight = thisPos + thisSize; + //thisClip.topLeft += vector2(2,2); + //thisClip.bottomRight -= vector2(2,2); + std::for_each(children_.begin(), children_.end(), boost::bind(&Widget::paint,_1,thisClip,zLevel) ); + needsRepaint_ = false; } struct SortByZ @@ -330,11 +341,16 @@ { return styleWidgetType_.empty() ? isA() : styleWidgetType_; } - void Widget::_onProcessKey(const char key) + void Widget::_onProcessChar(const char key) { if (getParent()) - getParent()->_onProcessKey(key); + getParent()->_onProcessChar(key); } + void Widget::_onProcessKeyDown(const input::KeyCode code) + { + if (getParent()) + getParent()->_onProcessKeyDown(code); + } void Widget::_onProcessMouseMove(const vector2& delta) { if (getParent()) @@ -358,7 +374,7 @@ void Widget::property(const string& name, const boost::any& value) { //@todo type check - properties_[ name ] = value; + properties_[ name ].reset(new property_t(value)); repaint(); } @@ -372,8 +388,15 @@ PropertyMap::const_iterator it = properties_.find( name ); if (it == properties_.end()) throw NotFoundException("property '" + name + "' not found in '" + this->id() + "' of type '" + this->isA() + "'."); - return it->second; + return it->second->value_; } + boost::signals::connection Widget::connectToPropertyChanged(const string& name, const boost::function<void(void)>& slot) + { + PropertyMap::const_iterator it = properties_.find( name ); + if (it == properties_.end()) + throw NotFoundException("property '" + name + "' not found in '" + this->id() + "' of type '" + this->isA() + "'."); + return it->second->modified_.connect(slot); + } void Widget::_setCachedGeometry(IRenderableGeometry::pointer geom) { geometry_ = geom; Modified: trunk/yake/yake/gui2/input_provider.h =================================================================== --- trunk/yake/yake/gui2/input_provider.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/input_provider.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -4,12 +4,14 @@ #include "prerequisites.h" #include "yake/base/templates/yakeRegistry.h" #include "types.h" +#include <boost/any.hpp> namespace yake { namespace ui { struct YAKE_GUI_API IInputProvider : public boost::noncopyable { - YAKE_DECLARE_REGISTRY_0(IInputProvider,string) + typedef std::map<string,boost::any> CreationParameters; + YAKE_DECLARE_REGISTRY_1(IInputProvider,string,CreationParameters) typedef boost::signal<void(const vector2&)> MouseMovedSignal; virtual boost::signals::connection connectToMouseMoved(const MouseMovedSignal::slot_type&) = 0; Modified: trunk/yake/yake/gui2/layout/vbox.h =================================================================== --- trunk/yake/yake/gui2/layout/vbox.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/layout/vbox.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -5,7 +5,7 @@ namespace yake { namespace ui { - struct VBoxLayout : public ILayout + struct YAKE_GUI_API VBoxLayout : public ILayout { VBoxLayout(const real padding = 1.) : padding_(padding) {} @@ -51,10 +51,15 @@ } //@todo really? - if ((parent.getSize().x < newSize.x || parent.getSize().y < newSize.y)) + if ((parent.getSize().x < newSize.x || parent.getSize().y < newSize.y || + parent.getSize().y < parentMinSize.x || parent.getSize().y < parentMinSize.y)) { parent.setSize( newSize ); - parent.setMinimumSize( newSize ); + + // Set new minimum size. But make sure the new minimum size is equal or larger than the currently set minimum size. + // (The minimum size may have been set by the application developer...) + AbsSize newMinSize( std::max(newSize.x,parentMinSize.x), std::max(newSize.y,parentMinSize.y) ); + parent.setMinimumSize( newMinSize ); std::cout << " vbox: " << parent.id() << "'s size is now " << parent.getSize() << "\n"; // parent got resized - so apply stretch ... (if any) Modified: trunk/yake/yake/gui2/plugins/style.lua/style.lua.h =================================================================== --- trunk/yake/yake/gui2/plugins/style.lua/style.lua.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/plugins/style.lua/style.lua.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -17,7 +17,7 @@ LuaStyle(SystemPtr,WindowRendererPtr); virtual ~LuaStyle(); virtual AbsSize determineMinimumSize(Widget&); - virtual void renderSingleWidget(Widget&, const int zLevel); + virtual void renderSingleWidget(Widget&, const Rectangle& clipRect, const int zLevel); virtual void renderCursor(const Position&, const int zLevel); //void loadWidgetStyle(const string& scriptFile, const string& widgetType = ""); Modified: trunk/yake/yake/gui2/plugins/system.ogreois/ogre_ois.h =================================================================== --- trunk/yake/yake/gui2/plugins/system.ogreois/ogre_ois.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/plugins/system.ogreois/ogre_ois.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -16,7 +16,7 @@ { YAKE_DECLARE_CONCRETE(OgreOIS_InputProvider,"yake.ogreois") public: - OgreOIS_InputProvider(); + OgreOIS_InputProvider(const CreationParameters&); virtual ~OgreOIS_InputProvider(); virtual boost::signals::connection connectToMouseMoved(const MouseMovedSignal::slot_type&); Modified: trunk/yake/yake/gui2/renderer.h =================================================================== --- trunk/yake/yake/gui2/renderer.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/renderer.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -3,9 +3,58 @@ #include "prerequisites.h" #include "types.h" +#include "yake/base/math/yakePlane.h" +#include <boost/array.hpp> namespace yake { namespace ui { + struct vertex + { + dim2 pos; + colour clr; + vector2 uv; + Position abs_pos; + vertex(const dim2& p, const colour& c = colour()) : pos(p), clr(c) + {} + vertex(const dim2& p, const colour& c, const vector2& uv0) : pos(p), clr(c), uv(uv0) + {} + vertex(const dim2& p, const vector2& uv0) : pos(p), clr(1,1,1,1), uv(uv0) + {} + vertex(const Position& p, const colour& c, const vector2& uv0) : abs_pos(p), clr(c), uv(uv0) + {} + }; + // + inline Point3 get_position(const vertex& vtx) + { + return Point3(vtx.abs_pos.x,vtx.abs_pos.y,0); + } + inline void set_position(vertex& vtx, const Point3& pos) + { + vtx.abs_pos.x = pos.x; + vtx.abs_pos.y = pos.y; + } + inline vertex interpolate(const vertex& from, const vertex& to, const real s) + { + vertex out(from); + out.abs_pos += (to.abs_pos-from.abs_pos) * s; + out.clr += (to.clr-from.clr) * s; + out.uv += (to.uv-from.uv) * s; + return out; + } + // + struct ClipPlaneMgr : public boost::noncopyable + { + typedef std::pair<Rectangle,boost::array<Plane,4> > ClipPlanes; + ClipPlaneMgr(); + void push(const Rectangle&); + void pop(); + std::deque<vertex> clip(const boost::array<vertex,3>&) const; + std::deque<vertex> clip(const boost::array<vertex,4>&) const; + private: + static Rectangle s_clipUnlimitedRegion; + std::deque<ClipPlanes> clipRegionStack_; + }; + // struct YAKE_GUI_API IWindowRenderer : public boost::noncopyable { protected: @@ -61,15 +110,51 @@ { this->quad2duv(v0,v1,v2,v3,uv00,uv01,uv02,uv03,c,c,c,c,z); } - +#if 0 virtual void quad2duv(const Position& v0, const Position& v1, const Position& v2, const Position& v3, const vector2& uv00, const vector2& uv01, const vector2& uv02, const vector2& uv03, const colour& c0, const colour& c1, const colour& c2, const colour& c3, const real z) = 0; + virtual void tri2duv(const Position& v0, const Position& v1, const Position& v2, + const vector2& uv00, const vector2& uv01, const vector2& uv02, + const colour& c0, const colour& c1, const colour& c2, + const real z) = 0; +#else + void quad2duv(const Position& v0, const Position& v1, const Position& v2, const Position& v3, + const vector2& uv00, const vector2& uv01, const vector2& uv02, const vector2& uv03, + const colour& c0, const colour& c1, const colour& c2, const colour& c3, + const real z) + { + quad2d( + vertex(v0,c0,uv00), + vertex(v1,c1,uv01), + vertex(v2,c2,uv02), + vertex(v3,c3,uv03), + z); + } + void tri2duv(const Position& v0, const Position& v1, const Position& v2, + const vector2& uv00, const vector2& uv01, const vector2& uv02, + const colour& c0, const colour& c1, const colour& c2, + const real z) + { + tri2d( + vertex(v0,c0,uv00), + vertex(v1,c1,uv01), + vertex(v2,c2,uv02), + z); + } +#endif + virtual void quad2d(const vertex&, const vertex&, const vertex&, const vertex&, const real z) = 0; + virtual void tri2d(const vertex&, const vertex&, const vertex&, const real z) = 0; + virtual void quad2d(const boost::array<vertex,4>&, const real z) = 0; + virtual void pushMaterial(const string&) = 0; virtual void popMaterial() = 0; + virtual void pushClipRegion(const Rectangle&) = 0; + virtual void popClipRegion() = 0; + void setZLevel(const int); protected: //static real to_absolute(const dim& d, const real absSize); Modified: trunk/yake/yake/gui2/style.h =================================================================== --- trunk/yake/yake/gui2/style.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/style.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -16,7 +16,7 @@ IStyle(SystemPtr,WindowRendererPtr); public: virtual AbsSize determineMinimumSize(Widget&) = 0; - virtual void renderSingleWidget(Widget&, const int zLevel = 0) = 0; + virtual void renderSingleWidget(Widget&, const Rectangle& clipRect, const int zLevel = 0) = 0; virtual void renderCursor(const Position&, const int zLevel = 0) = 0; //virtual void setRenderer(WindowRenderPtr) = 0; }; Modified: trunk/yake/yake/gui2/types.h =================================================================== --- trunk/yake/yake/gui2/types.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/types.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -3,6 +3,7 @@ #include "yake/base/yakeString.h" #include "yake/base/math/yakeMath.h" +#include "yake/input/yakeKeyCode.h" #include "prerequisites.h" namespace yake { @@ -59,12 +60,6 @@ real abs; dim(const real relV = 0., const real absV = 0.) : rel(relV), abs(absV) {} - const dim& operator += (const dim& rhs) - { - rel += rhs.rel; - abs += rhs.abs; - return *this; - } dim operator + (const dim& rhs) const { dim out(*this); @@ -72,6 +67,12 @@ out.abs += rhs.abs; return out; } + const dim& operator += (const dim& rhs) + { + rel += rhs.rel; + abs += rhs.abs; + return *this; + } const dim& operator -= (const dim& rhs) { rel -= rhs.rel; @@ -145,6 +146,12 @@ out.y += rhs.y; return out; } + const dim2& operator += (const dim2& rhs) + { + x += rhs.x; + y += rhs.y; + return *this; + } bool operator < (const dim2& rhs) const { if (x == rhs.x) Modified: trunk/yake/yake/gui2/widget/button.h =================================================================== --- trunk/yake/yake/gui2/widget/button.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/widget/button.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -16,6 +16,8 @@ VoidSignal clicked; private: virtual void _onProcessMouseButtonClicked(const int btn, const Position& pos); + virtual void _onProcessMouseButtonDown(const int btn, const Position& pos); + virtual void _onProcessMouseButtonUp(const int btn, const Position& pos); private: //Panel panel_; //StaticText text_; Modified: trunk/yake/yake/gui2/widget/static_text.h =================================================================== --- trunk/yake/yake/gui2/widget/static_text.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/widget/static_text.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -16,6 +16,7 @@ StaticText(const string& id); StaticText(const string& text, const string& id); void setText(const string& text); + string getText() const; void setFontSize(const real size); private: }; Modified: trunk/yake/yake/gui2/widget/text_edit.h =================================================================== --- trunk/yake/yake/gui2/widget/text_edit.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/widget/text_edit.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -13,12 +13,18 @@ TextEdit(SystemPtr sys, const string& id); void setText(const string& text); + string getText() const; + + boost::signal<void(void)> editingFinished; private: SystemPtr sys_; virtual bool onChangeState(const State state); virtual void _onProcessMouseButtonDown(const int btn, const Position& pos); virtual void _onProcessMouseButtonUp(const int btn, const Position& pos); - virtual void _onProcessKey(const char c); + virtual void _onProcessChar(const char c); + virtual void _onProcessKeyDown(const input::KeyCode code); + + void onFocusChange(); }; } // namespace ui } // namespace yake Modified: trunk/yake/yake/gui2/widget.h =================================================================== --- trunk/yake/yake/gui2/widget.h 2008-09-25 17:02:21 UTC (rev 1933) +++ trunk/yake/yake/gui2/widget.h 2008-09-25 17:06:42 UTC (rev 1934) @@ -4,6 +4,7 @@ #include "prerequisites.h" #include "types.h" #include "mutator.h" +#include <boost/signals/connection.hpp> namespace yake { namespace ui { @@ -70,6 +71,7 @@ /** @exception throws NotFoundException if property of given name does not exist. */ const boost::any& property(const string&) const; bool hasProperty(const string&) const; + boost::signals::connection connectToPropertyChanged(const string&, const boost::function<void(void)>& slot); //@todo move out! const colour& getColour() const; @@ -121,7 +123,7 @@ void setStyle(StylePtr); StylePtr ge... [truncated message content] |
From: <psy...@us...> - 2008-09-25 17:02:29
|
Revision: 1933 http://yake.svn.sourceforge.net/yake/?rev=1933&view=rev Author: psyclonist Date: 2008-09-25 17:02:21 +0000 (Thu, 25 Sep 2008) Log Message: ----------- * [input] moved KeyCode handling (input::getKeyChar()) Modified Paths: -------------- trunk/yake/src/input/yakeInputSystem.cpp trunk/yake/src/raf/yakeApplication.cpp trunk/yake/yake/common/yakeCEGUIHelpers.h trunk/yake/yake/input/yakeInputSystem.h Modified: trunk/yake/src/input/yakeInputSystem.cpp =================================================================== --- trunk/yake/src/input/yakeInputSystem.cpp 2008-07-28 23:17:25 UTC (rev 1932) +++ trunk/yake/src/input/yakeInputSystem.cpp 2008-09-25 17:02:21 UTC (rev 1933) @@ -29,7 +29,144 @@ namespace yake { namespace input { + char getKeyChar(KeyCode keyCode, long modifiers) + { + //HACK ripped from OgreInput + //TODO Ogre is rendering engine... should Yake input system contain this method? + using namespace yake::input; + if (modifiers == 0) + { + switch (keyCode) + { + case KC_1: return '1'; + case KC_2: return '2'; + case KC_3: return '3'; + case KC_4: return '4'; + case KC_5: return '5'; + case KC_6: return '6'; + case KC_7: return '7'; + case KC_8: return '8'; + case KC_9: return '9'; + case KC_0: return '0'; + case KC_MINUS: return '-'; /* - on main keyboard */ + case KC_EQUALS: return '='; + case KC_Q: return 'q'; + case KC_W: return 'w'; + case KC_E: return 'e'; + case KC_R: return 'r'; + case KC_T: return 't'; + case KC_Y: return 'y'; + case KC_U: return 'u'; + case KC_I: return 'i'; + case KC_O: return 'o'; + case KC_P: return 'p'; + case KC_LBRACKET: return '['; + case KC_RBRACKET: return ']'; + case KC_A: return 'a'; + case KC_S: return 's'; + case KC_D: return 'd'; + case KC_F: return 'f'; + case KC_G: return 'g'; + case KC_H: return 'h'; + case KC_J: return 'j'; + case KC_K: return 'k'; + case KC_L: return 'l'; + case KC_SEMICOLON: return ';'; + case KC_APOSTROPHE: return '\''; + case KC_GRAVE: return '`'; /* accent grave */ + case KC_BACKSLASH: return '\\'; + case KC_Z: return 'z'; + case KC_X: return 'x'; + case KC_C: return 'c'; + case KC_V: return 'v'; + case KC_B: return 'b'; + case KC_N: return 'n'; + case KC_M: return 'm'; + case KC_COMMA: return ','; + case KC_PERIOD: return '.'; /* . on main keyboard */ + case KC_SLASH: return '/'; /* '/' on main keyboard */ + case KC_MULTIPLY: return '*'; /* * on numeric keypad */ + case KC_SPACE: return ' '; + case KC_NUMPAD7: return '7'; + case KC_NUMPAD8: return '8'; + case KC_NUMPAD9: return '9'; + case KC_SUBTRACT: return '-'; /* - on numeric keypad */ + case KC_NUMPAD4: return '4'; + case KC_NUMPAD5: return '5'; + case KC_NUMPAD6: return '6'; + case KC_ADD: return '+'; /* + on numeric keypad */ + case KC_NUMPAD1: return '1'; + case KC_NUMPAD2: return '2'; + case KC_NUMPAD3: return '3'; + case KC_NUMPAD0: return '0'; + case KC_DECIMAL: return '.'; /* . on numeric keypad */ + case KC_NUMPADEQUALS: return '='; /* = on numeric keypad (NEC PC98) */ + case KC_AT: return '@'; /* (NEC PC98) */ + case KC_COLON: return ':'; /* (NEC PC98) */ + case KC_UNDERLINE: return '_'; /* (NEC PC98) */ + case KC_NUMPADCOMMA: return ','; /* , on numeric keypad (NEC PC98) */ + case KC_DIVIDE: return '/'; /* / on numeric keypad */ + } + } + else //HACK if ( modifiers == InputEvent::SHIFT_MASK) + { + switch (keyCode) + { + case KC_1: return '!'; + case KC_2: return '@'; + case KC_3: return '#'; + case KC_4: return '$'; + case KC_5: return '%'; + case KC_6: return '^'; + case KC_7: return '&'; + case KC_8: return '*'; + case KC_9: return '('; + case KC_0: return ')'; + case KC_MINUS: return '_'; + case KC_EQUALS: return '+'; + case KC_Q: return 'Q'; + case KC_W: return 'W'; + case KC_E: return 'E'; + case KC_R: return 'R'; + case KC_T: return 'T'; + case KC_Y: return 'Y'; + case KC_U: return 'U'; + case KC_I: return 'I'; + case KC_O: return 'O'; + case KC_P: return 'P'; + case KC_LBRACKET: return '{'; + case KC_RBRACKET: return '}'; + case KC_A: return 'A'; + case KC_S: return 'S'; + case KC_D: return 'D'; + case KC_F: return 'F'; + case KC_G: return 'G'; + case KC_H: return 'H'; + case KC_J: return 'J'; + case KC_K: return 'K'; + case KC_L: return 'L'; + case KC_SEMICOLON: return ':'; + case KC_APOSTROPHE: return '"'; + case KC_GRAVE: return '~'; /* accent grave */ + case KC_BACKSLASH: return '|'; + case KC_Z: return 'Z'; + case KC_X: return 'X'; + case KC_C: return 'C'; + case KC_V: return 'V'; + case KC_B: return 'B'; + case KC_N: return 'N'; + case KC_M: return 'M'; + case KC_COMMA: return '<'; + case KC_PERIOD: return '>'; /* . on main keyboard */ + case KC_SLASH: return '?'; /* '/' on main keyboard */ + case KC_MULTIPLY: return '*'; /* * on numeric keypad */ + case KC_SPACE: return ' '; + } + } + return 0; + } + YAKE_IMPLEMENT_REGISTRY( IInputSystem ) IInputSystem::~IInputSystem() Modified: trunk/yake/src/raf/yakeApplication.cpp =================================================================== --- trunk/yake/src/raf/yakeApplication.cpp 2008-07-28 23:17:25 UTC (rev 1932) +++ trunk/yake/src/raf/yakeApplication.cpp 2008-09-25 17:02:21 UTC (rev 1933) @@ -319,7 +319,7 @@ { CEGUI::System::getSingleton().injectKeyDown( rEvent.keyCode ); long modifiers = getKeyboard()->isKeyDown(input::KC_LSHIFT) || getKeyboard()->isKeyDown(input::KC_RSHIFT) ? 1 : 0; - CEGUI::System::getSingleton().injectChar( getKeyChar( rEvent.keyCode, modifiers ) ); + CEGUI::System::getSingleton().injectChar( input::getKeyChar( rEvent.keyCode, modifiers ) ); } } void Application::onKeyUp( const yake::input::KeyboardEvent& rEvent ) Modified: trunk/yake/yake/common/yakeCEGUIHelpers.h =================================================================== --- trunk/yake/yake/common/yakeCEGUIHelpers.h 2008-07-28 23:17:25 UTC (rev 1932) +++ trunk/yake/yake/common/yakeCEGUIHelpers.h 2008-09-25 17:02:21 UTC (rev 1933) @@ -52,152 +52,6 @@ } } - /** - * Get character corresponding to passed keycode. - * @param keyCode - * @param modifiers Shows if shift button was pressed - * @return Character - * @todo move this into yake::input - * @remarks Taken from the mighty OGRE3D :) - */ - char getKeyChar(int keyCode, long modifiers) - { - //HACK ripped from OgreInput - //TODO Ogre is rendering engine... should Yake input system contain this method? - using namespace yake::input; - - if (modifiers == 0) - { - switch (keyCode) - { - case KC_1: return '1'; - case KC_2: return '2'; - case KC_3: return '3'; - case KC_4: return '4'; - case KC_5: return '5'; - case KC_6: return '6'; - case KC_7: return '7'; - case KC_8: return '8'; - case KC_9: return '9'; - case KC_0: return '0'; - case KC_MINUS: return '-'; /* - on main keyboard */ - case KC_EQUALS: return '='; - case KC_Q: return 'q'; - case KC_W: return 'w'; - case KC_E: return 'e'; - case KC_R: return 'r'; - case KC_T: return 't'; - case KC_Y: return 'y'; - case KC_U: return 'u'; - case KC_I: return 'i'; - case KC_O: return 'o'; - case KC_P: return 'p'; - case KC_LBRACKET: return '['; - case KC_RBRACKET: return ']'; - case KC_A: return 'a'; - case KC_S: return 's'; - case KC_D: return 'd'; - case KC_F: return 'f'; - case KC_G: return 'g'; - case KC_H: return 'h'; - case KC_J: return 'j'; - case KC_K: return 'k'; - case KC_L: return 'l'; - case KC_SEMICOLON: return ';'; - case KC_APOSTROPHE: return '\''; - case KC_GRAVE: return '`'; /* accent grave */ - case KC_BACKSLASH: return '\\'; - case KC_Z: return 'z'; - case KC_X: return 'x'; - case KC_C: return 'c'; - case KC_V: return 'v'; - case KC_B: return 'b'; - case KC_N: return 'n'; - case KC_M: return 'm'; - case KC_COMMA: return ','; - case KC_PERIOD: return '.'; /* . on main keyboard */ - case KC_SLASH: return '/'; /* '/' on main keyboard */ - case KC_MULTIPLY: return '*'; /* * on numeric keypad */ - case KC_SPACE: return ' '; - case KC_NUMPAD7: return '7'; - case KC_NUMPAD8: return '8'; - case KC_NUMPAD9: return '9'; - case KC_SUBTRACT: return '-'; /* - on numeric keypad */ - case KC_NUMPAD4: return '4'; - case KC_NUMPAD5: return '5'; - case KC_NUMPAD6: return '6'; - case KC_ADD: return '+'; /* + on numeric keypad */ - case KC_NUMPAD1: return '1'; - case KC_NUMPAD2: return '2'; - case KC_NUMPAD3: return '3'; - case KC_NUMPAD0: return '0'; - case KC_DECIMAL: return '.'; /* . on numeric keypad */ - case KC_NUMPADEQUALS: return '='; /* = on numeric keypad (NEC PC98) */ - case KC_AT: return '@'; /* (NEC PC98) */ - case KC_COLON: return ':'; /* (NEC PC98) */ - case KC_UNDERLINE: return '_'; /* (NEC PC98) */ - case KC_NUMPADCOMMA: return ','; /* , on numeric keypad (NEC PC98) */ - case KC_DIVIDE: return '/'; /* / on numeric keypad */ - } - } - else //HACK if ( modifiers == InputEvent::SHIFT_MASK) - { - switch (keyCode) - { - case KC_1: return '!'; - case KC_2: return '@'; - case KC_3: return '#'; - case KC_4: return '$'; - case KC_5: return '%'; - case KC_6: return '^'; - case KC_7: return '&'; - case KC_8: return '*'; - case KC_9: return '('; - case KC_0: return ')'; - case KC_MINUS: return '_'; - case KC_EQUALS: return '+'; - case KC_Q: return 'Q'; - case KC_W: return 'W'; - case KC_E: return 'E'; - case KC_R: return 'R'; - case KC_T: return 'T'; - case KC_Y: return 'Y'; - case KC_U: return 'U'; - case KC_I: return 'I'; - case KC_O: return 'O'; - case KC_P: return 'P'; - case KC_LBRACKET: return '{'; - case KC_RBRACKET: return '}'; - case KC_A: return 'A'; - case KC_S: return 'S'; - case KC_D: return 'D'; - case KC_F: return 'F'; - case KC_G: return 'G'; - case KC_H: return 'H'; - case KC_J: return 'J'; - case KC_K: return 'K'; - case KC_L: return 'L'; - case KC_SEMICOLON: return ':'; - case KC_APOSTROPHE: return '"'; - case KC_GRAVE: return '~'; /* accent grave */ - case KC_BACKSLASH: return '|'; - case KC_Z: return 'Z'; - case KC_X: return 'X'; - case KC_C: return 'C'; - case KC_V: return 'V'; - case KC_B: return 'B'; - case KC_N: return 'N'; - case KC_M: return 'M'; - case KC_COMMA: return '<'; - case KC_PERIOD: return '>'; /* . on main keyboard */ - case KC_SLASH: return '?'; /* '/' on main keyboard */ - case KC_MULTIPLY: return '*'; /* * on numeric keypad */ - case KC_SPACE: return ' '; - } - } - return 0; - } - } // namespace yake #endif Modified: trunk/yake/yake/input/yakeInputSystem.h =================================================================== --- trunk/yake/yake/input/yakeInputSystem.h 2008-07-28 23:17:25 UTC (rev 1932) +++ trunk/yake/yake/input/yakeInputSystem.h 2008-09-25 17:02:21 UTC (rev 1933) @@ -32,166 +32,11 @@ #endif #include <yake/base/math/yakeGeometry.h> #include <boost/any.hpp> +#include "yakeKeyCode.h" namespace yake { namespace input { - // Keyboard scan codes - copied from DirectInput for now for speed. - // (SK: actually I copied them from Ogre again...) - // - // NB For the Lua bindings we parse this header and extract the - // key codes. This is done by: scripts/tools/extract_input_kc.pl - // - // If this enum is updated, remember to run this script (and commit - // the changes to the source repository, too)! - enum KeyCode - { - KC_ESCAPE =0x01, - KC_1 =0x02, - KC_2 =0x03, - KC_3 =0x04, - KC_4 =0x05, - KC_5 =0x06, - KC_6 =0x07, - KC_7 =0x08, - KC_8 =0x09, - KC_9 =0x0A, - KC_0 =0x0B, - KC_MINUS =0x0C, /* - on main keyboard */ - KC_EQUALS =0x0D, - KC_BACK =0x0E, /* backspace */ - KC_TAB =0x0F, - KC_Q =0x10, - KC_W =0x11, - KC_E =0x12, - KC_R =0x13, - KC_T =0x14, - KC_Y =0x15, - KC_U =0x16, - KC_I =0x17, - KC_O =0x18, - KC_P =0x19, - KC_LBRACKET =0x1A, - KC_RBRACKET =0x1B, - KC_RETURN =0x1C, /* Enter on main keyboard */ - KC_LCONTROL =0x1D, - KC_A =0x1E, - KC_S =0x1F, - KC_D =0x20, - KC_F =0x21, - KC_G =0x22, - KC_H =0x23, - KC_J =0x24, - KC_K =0x25, - KC_L =0x26, - KC_SEMICOLON =0x27, - KC_APOSTROPHE =0x28, - KC_GRAVE =0x29, /* accent grave */ - KC_LSHIFT =0x2A, - KC_BACKSLASH =0x2B, - KC_Z =0x2C, - KC_X =0x2D, - KC_C =0x2E, - KC_V =0x2F, - KC_B =0x30, - KC_N =0x31, - KC_M =0x32, - KC_COMMA =0x33, - KC_PERIOD =0x34, /* . on main keyboard */ - KC_SLASH =0x35, /* '/' on main keyboard */ - KC_RSHIFT =0x36, - KC_MULTIPLY =0x37, /* * on numeric keypad */ - KC_LMENU =0x38, /* left Alt */ - KC_SPACE =0x39, - KC_CAPITAL =0x3A, - KC_F1 =0x3B, - KC_F2 =0x3C, - KC_F3 =0x3D, - KC_F4 =0x3E, - KC_F5 =0x3F, - KC_F6 =0x40, - KC_F7 =0x41, - KC_F8 =0x42, - KC_F9 =0x43, - KC_F10 =0x44, - KC_NUMLOCK =0x45, - KC_SCROLL =0x46, /* Scroll Lock */ - KC_NUMPAD7 =0x47, - KC_NUMPAD8 =0x48, - KC_NUMPAD9 =0x49, - KC_SUBTRACT =0x4A, /* - on numeric keypad */ - KC_NUMPAD4 =0x4B, - KC_NUMPAD5 =0x4C, - KC_NUMPAD6 =0x4D, - KC_ADD =0x4E, /* + on numeric keypad */ - KC_NUMPAD1 =0x4F, - KC_NUMPAD2 =0x50, - KC_NUMPAD3 =0x51, - KC_NUMPAD0 =0x52, - KC_DECIMAL =0x53, /* . on numeric keypad */ - KC_OEM_102 =0x56, /* < > | on UK/Germany keyboards */ - KC_F11 =0x57, - KC_F12 =0x58, - KC_F13 =0x64, /* (NEC PC98) */ - KC_F14 =0x65, /* (NEC PC98) */ - KC_F15 =0x66, /* (NEC PC98) */ - KC_KANA =0x70, /* (Japanese keyboard) */ - KC_ABNT_C1 =0x73, /* / ? on Portugese (Brazilian) keyboards */ - KC_CONVERT =0x79, /* (Japanese keyboard) */ - KC_NOCONVERT =0x7B, /* (Japanese keyboard) */ - KC_YEN =0x7D, /* (Japanese keyboard) */ - KC_ABNT_C2 =0x7E, /* Numpad . on Portugese (Brazilian) keyboards */ - KC_NUMPADEQUALS =0x8D, /* = on numeric keypad (NEC PC98) */ - KC_PREVTRACK =0x90, /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */ - KC_AT =0x91, /* (NEC PC98) */ - KC_COLON =0x92, /* (NEC PC98) */ - KC_UNDERLINE =0x93, /* (NEC PC98) */ - KC_KANJI =0x94, /* (Japanese keyboard) */ - KC_STOP =0x95, /* (NEC PC98) */ - KC_AX =0x96, /* (Japan AX) */ - KC_UNLABELED =0x97, /* (J3100) */ - KC_NEXTTRACK =0x99, /* Next Track */ - KC_NUMPADENTER =0x9C, /* Enter on numeric keypad */ - KC_RCONTROL =0x9D, - KC_MUTE =0xA0, /* Mute */ - KC_CALCULATOR =0xA1, /* Calculator */ - KC_PLAYPAUSE =0xA2, /* Play / Pause */ - KC_MEDIASTOP =0xA4, /* Media Stop */ - KC_VOLUMEDOWN =0xAE, /* Volume - */ - KC_VOLUMEUP =0xB0, /* Volume + */ - KC_WEBHOME =0xB2, /* Web home */ - KC_NUMPADCOMMA =0xB3, /* , on numeric keypad (NEC PC98) */ - KC_DIVIDE =0xB5, /* / on numeric keypad */ - KC_SYSRQ =0xB7, - KC_RMENU =0xB8, /* right Alt */ - KC_PAUSE =0xC5, /* Pause */ - KC_HOME =0xC7, /* Home on arrow keypad */ - KC_UP =0xC8, /* UpArrow on arrow keypad */ - KC_PGUP =0xC9, /* PgUp on arrow keypad */ - KC_LEFT =0xCB, /* LeftArrow on arrow keypad */ - KC_RIGHT =0xCD, /* RightArrow on arrow keypad */ - KC_END =0xCF, /* End on arrow keypad */ - KC_DOWN =0xD0, /* DownArrow on arrow keypad */ - KC_PGDOWN =0xD1, /* PgDn on arrow keypad */ - KC_INSERT =0xD2, /* Insert on arrow keypad */ - KC_DELETE =0xD3, /* Delete on arrow keypad */ - KC_LWIN =0xDB, /* Left Windows key */ - KC_RWIN =0xDC, /* Right Windows key */ - KC_APPS =0xDD, /* AppMenu key */ - KC_POWER =0xDE, /* System Power */ - KC_SLEEP =0xDF, /* System Sleep */ - KC_WAKE =0xE3, /* System Wake */ - KC_WEBSEARCH =0xE5, /* Web Search */ - KC_WEBFAVORITES =0xE6, /* Web Favorites */ - KC_WEBREFRESH =0xE7, /* Web Refresh */ - KC_WEBSTOP =0xE8, /* Web Stop */ - KC_WEBFORWARD =0xE9, /* Web Forward */ - KC_WEBBACK =0xEA, /* Web Back */ - KC_MYCOMPUTER =0xEB, /* My Computer */ - KC_MAIL =0xEC, /* Mail */ - KC_MEDIASELECT =0xED /* Media Select */ - }; - enum InputDeviceType { IDT_KEYBOARD, IDT_JOYSTICK, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-07-28 23:17:16
|
Revision: 1932 http://yake.svn.sourceforge.net/yake/?rev=1932&view=rev Author: psyclonist Date: 2008-07-28 23:17:25 +0000 (Mon, 28 Jul 2008) Log Message: ----------- * [ui] various preparations Modified Paths: -------------- trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/yake.lua trunk/yake/yake/gui2/types.h Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2008-07-28 23:15:51 UTC (rev 1931) +++ trunk/yake/scripts/premake/config.lua 2008-07-28 23:17:25 UTC (rev 1932) @@ -62,6 +62,7 @@ ENABLE_LUA_INPUT = true ENABLE_LUA_RAF = true -- example application framework ENABLE_LUA_RES = true -- resource management +ENABLE_LUA_UI = true -- graphical user interface library -------------------------------------- -- Samples Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2008-07-28 23:15:51 UTC (rev 1931) +++ trunk/yake/scripts/premake/yake.lua 2008-07-28 23:17:25 UTC (rev 1932) @@ -79,6 +79,7 @@ f:write("#define YAKE_ENABLE_LUA_INPUT " .. bool_to_int(ENABLE_LUA_INPUT) .. "\n") f:write("#define YAKE_ENABLE_LUA_RAF " .. bool_to_int(ENABLE_LUA_RAF) .. "\n") f:write("#define YAKE_ENABLE_LUA_RES " .. bool_to_int(ENABLE_LUA_RES) .. "\n") + f:write("#define YAKE_ENABLE_LUA_UI " .. bool_to_int(ENABLE_LUA_UI) .. "\n") f:write("\n") f:write("#endif\n") io.close(f) Modified: trunk/yake/yake/gui2/types.h =================================================================== --- trunk/yake/yake/gui2/types.h 2008-07-28 23:15:51 UTC (rev 1931) +++ trunk/yake/yake/gui2/types.h 2008-07-28 23:17:25 UTC (rev 1932) @@ -2,6 +2,7 @@ #define UI_TYPES_H #include "yake/base/yakeString.h" +#include "yake/base/math/yakeMath.h" #include "prerequisites.h" namespace yake { @@ -16,6 +17,32 @@ colour(const real red = 1., const real green = 1., const real blue = 1., const real alpha = 1.) : r(red), g(green), b(blue), a(alpha) {} + colour operator - (const colour& rhs) const + { + colour out(*this); + out.r -= rhs.r; + out.g -= rhs.g; + out.b -= rhs.b; + out.a -= rhs.a; + return out; + } + colour operator * (const real k) const + { + colour out(*this); + out.r *= k; + out.g *= k; + out.b *= k; + out.a *= k; + return out; + } + const colour& operator += (const colour& rhs) + { + r += rhs.r; + g += rhs.g; + b += rhs.b; + a += rhs.a; + return *this; + } }; inline std::ostream& operator << (std::ostream& out, const colour& rhs) { @@ -174,6 +201,12 @@ y += rhs.y; return *this; } + const vector2& operator -= (const vector2& rhs) + { + x -= rhs.x; + y -= rhs.y; + return *this; + } bool operator < (const vector2& rhs) const { if (x == rhs.x) @@ -260,6 +293,18 @@ topLeft = Position(left,top); bottomRight = Position(right,bottom); } + bool operator == (const Rectangle& rhs) const + { + using math::Math; + return (Math::Abs(rhs.left()-left()) < std::numeric_limits<real>::epsilon() && + Math::Abs(rhs.right()-right()) < std::numeric_limits<real>::epsilon() && + Math::Abs(rhs.top()-top()) < std::numeric_limits<real>::epsilon() && + Math::Abs(rhs.bottom()-bottom()) < std::numeric_limits<real>::epsilon()); + } + bool operator != (const Rectangle& rhs) const + { + return !(*this == rhs); + } }; } // namespace ui } // namespace yake This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-07-28 23:15:45
|
Revision: 1931 http://yake.svn.sourceforge.net/yake/?rev=1931&view=rev Author: psyclonist Date: 2008-07-28 23:15:51 +0000 (Mon, 28 Jul 2008) Log Message: ----------- * [base/math] added 3D polygon clipper (math::Clipper<>) for clipping polygons against one or more planes Added Paths: ----------- trunk/yake/yake/base/math/yakePolygonClipper.h Added: trunk/yake/yake/base/math/yakePolygonClipper.h =================================================================== --- trunk/yake/yake/base/math/yakePolygonClipper.h (rev 0) +++ trunk/yake/yake/base/math/yakePolygonClipper.h 2008-07-28 23:15:51 UTC (rev 1931) @@ -0,0 +1,162 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_BASE_MATH_POLYGONCLIPPER_H +#define YAKE_BASE_MATH_POLYGONCLIPPER_H + +#include "yake/base/yakePrerequisites.h" +#include "yake/base/math/yakeMath.h" +#include "yake/base/math/yakeVector3.h" +#include "yake/base/math/yakePoint3.h" +#include "yake/base/math/yakePlane.h" + +namespace yake { +namespace math { + + /** + For the vertex type the following free (!) functions need to be available: + @code + Point3 get_position(const VertexType&); + void set_position(VertexType&, const Point3&); + VertexType interpolate(const VertexType& from, const VertexType& to, const real s); + @endcode + Yake ships with functions for VertexType = Point3. + The PolygonType needs to provide the following member (!) functions: + @code + const VertexType& at(size_t) const; + size_t size() const; // return the number of vertices in the polygon + R push_back(const VertexType&); // appends the vertex to the polygon (return value is not used) + @endcode + Example Usage: + @code + struct vertex; + Plane p(...); + boost::array<vertex,4> quad = {{...}}; + std::deque<vertex> clipped; + Clipper<vertex>::clip(p, quad, clipped); + @endcode + */ + template<class VertexType/*, class PolygonType = std::deque<VertexType> */> + struct Clipper + { + typedef VertexType vertex_type; + //typedef PolygonType polygon_type; + /** Clips the (convex or concave) polygon inPoly against all the planes and returns the (possibly) + clipped polygon in currPoly. + The container for the planes needs to provide two functions: + @code + const Plane& at(size_t) const; + size_t size() const; + @endcode + @note If the polygon did not need to be clipped then the returned currPoly will nevertheless + contain the same vertices as inPoly. + @todo Optimize: Remove unnecessary copies in the intersection loop (currPoly=outPoly). + */ + template<typename Ct, class polygon_type_in, class polygon_type_out> + static void clip(const Ct& planes, const polygon_type_in& inPoly, polygon_type_out& currPoly) + { + currPoly.clear(); + if (inPoly.empty()) + return; + + //currPoly = inPoly; + std::copy(inPoly.begin(),inPoly.end(),std::back_inserter(currPoly)); + + YAKE_ASSERT(currPoly.size() >= 3)(currPoly.size()); + for (size_t planeIdx=0; planeIdx<planes.size(); ++planeIdx) + { + const Plane& plane = planes.at(planeIdx); + polygon_type_out outPoly; + clip(plane,currPoly,outPoly); + currPoly = outPoly; + } + } + /** Clips the (convex or concave) polygon inPoly against the plane and returns the + (possibly) clipped polygon in outPoly. + @note If the polygon did not need to be clipped then outPoly will nevertheless contain the + same vertices as inPoly. + @todo Optimize: Use references as return values of get_position() ? + @note Algorithm used is Sutherland-Hodgman for simplicity. + */ + template<class polygon_type_in, class polygon_type_out> + static void clip(const Plane& plane, const polygon_type_in& inPoly, polygon_type_out& outPoly) + { + outPoly.clear(); + if (inPoly.empty()) + return; + + const real eps = std::numeric_limits<real>::epsilon(); + YAKE_ASSERT(inPoly.size() >= 3)(inPoly.size()); + + // for each edge: + for (size_t vtxIdx=0; vtxIdx<inPoly.size(); ++vtxIdx) + { + const vertex_type& from_vtx = inPoly.at(vtxIdx); + const vertex_type& to_vtx = inPoly.at((vtxIdx == inPoly.size()-1) ? 0 : (vtxIdx+1)); + + const Point3 from = get_position(from_vtx); + const Point3 to = get_position(to_vtx); + + const bool start_in = plane.distanceTo(from) > .01; + const bool end_in = plane.distanceTo(to) > .01; + if (end_in) + { + if (!start_in) + { +#if 0 + const Vector3 delta = (to-from); + const double delta_length = delta.length(); + Ray r(from, delta / delta_length/*delta.normalisedCopy()*/); + const std::pair<bool,real> intResult = intersect(plane,r); + outPoly.push_back(interpolate(from_vtx,to_vtx,intResult.second / delta_length)); +#else + // We can avoid a sqrt() call and a division by using the + // vector (end-start) as the ray direction, i.e. without normalization! + // This way intersect() returns the intersection parameter as [0..1] which we can feed + // directly into interpolate() thereby avoiding a division. + const Vector3 delta = (to-from); + Ray r(from, delta); + const std::pair<bool,real> intResult = intersect(plane,r); + outPoly.push_back(interpolate(from_vtx,to_vtx,intResult.second)); +#endif + } + outPoly.push_back(to_vtx); + } + else if (start_in) + { + const Vector3 delta = (to-from); + Ray r(from, delta); + const std::pair<bool,real> intResult = intersect(plane,r); + outPoly.push_back(interpolate(from_vtx,to_vtx,intResult.second)); + } + } + } + }; + +} // math +} // yake + +#endif // YAKE_BASE_MATH_POLYGONCLIPPER_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-07-25 20:19:14
|
Revision: 1930 http://yake.svn.sourceforge.net/yake/?rev=1930&view=rev Author: psyclonist Date: 2008-07-25 20:19:23 +0000 (Fri, 25 Jul 2008) Log Message: ----------- * [base/math] fixed errors in previous commit (Ray/Plane) Modified Paths: -------------- trunk/yake/src/base/math/yakeRay.cpp trunk/yake/yake/base/math/yakePlane.h trunk/yake/yake/base/math/yakeRay.h Modified: trunk/yake/src/base/math/yakeRay.cpp =================================================================== --- trunk/yake/src/base/math/yakeRay.cpp 2008-07-24 18:47:30 UTC (rev 1929) +++ trunk/yake/src/base/math/yakeRay.cpp 2008-07-25 20:19:23 UTC (rev 1930) @@ -31,21 +31,21 @@ namespace yake { namespace math { - std::pair<bool, real> Ray::intersects(const Plane& plane) const + std::pair<bool,real> intersect(const Plane& plane, const Ray& ray) { - real denom = plane.normal.dotProduct(mDirection); + const real denom = plane.normal.dotProduct(ray.direction()); if (Math::Abs(denom) < std::numeric_limits<real>::epsilon()) - { - // Parallel - return std::pair<bool, real>(false, 0); - } - else - { - real nom = plane.normal.dotProduct(mOrigin.asVector()) + plane.d; - real t = -(nom/denom); - return std::pair<bool, real>(t >= 0, t); - } + return std::make_pair(false,0); + + const real nom = plane.normal.dotProduct(ray.origin().asVector()) + plane.d; + const real t = - (nom / denom); + return std::make_pair(t >= 0,t); } + std::pair<bool,real> Ray::intersects(const Plane& plane) const + { + return intersect(plane,*this); + } + } } Modified: trunk/yake/yake/base/math/yakePlane.h =================================================================== --- trunk/yake/yake/base/math/yakePlane.h 2008-07-24 18:47:30 UTC (rev 1929) +++ trunk/yake/yake/base/math/yakePlane.h 2008-07-25 20:19:23 UTC (rev 1930) @@ -73,16 +73,7 @@ or intPt= ray.getPoint(result.second). @note The returned length can be negative! */ - inline std::pair<bool,real> intersect(const Plane& plane, const Ray& ray) - { - const real denom = plane.normal.dotProduct(ray.direction()); - if (fabs(denom)<0.0001) //@todo use a proper EPS - return std::make_pair(false,0); - - const real nom = plane.normal.dotProduct(ray.origin().asVector()) + plane.d; - const real s = - (nom / denom); - return (s >= 0.) ? std::make_pair(true,s) : std::make_pair(false,0); - } + YAKE_BASE_API std::pair<bool,real> intersect(const Plane& plane, const Ray& ray); } // namespace math using math::Plane; } // namespace yake Modified: trunk/yake/yake/base/math/yakeRay.h =================================================================== --- trunk/yake/yake/base/math/yakeRay.h 2008-07-24 18:47:30 UTC (rev 1929) +++ trunk/yake/yake/base/math/yakeRay.h 2008-07-25 20:19:23 UTC (rev 1930) @@ -34,10 +34,10 @@ #include "yakeMath.h" #include "yakeVector3.h" #include "yakePoint3.h" -#include "yakePlane.h" namespace yake { namespace math { + class Plane; /** Represents a ray; from a point along a direction. */ class YAKE_BASE_API Ray @@ -82,6 +82,8 @@ return (mOrigin + (mDirection * s)); } + std::pair<bool,real> intersects(const Plane& plane) const; + private: Point3 mOrigin; Vector3 mDirection; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-07-24 18:47:21
|
Revision: 1929 http://yake.svn.sourceforge.net/yake/?rev=1929&view=rev Author: psyclonist Date: 2008-07-24 18:47:30 +0000 (Thu, 24 Jul 2008) Log Message: ----------- * [base/math] added Plane::distanceTo() * [base/math] added Plane c'tor: from 3 points * [base/math] added intersect(Plane,Ray) Modified Paths: -------------- trunk/yake/yake/base/math/yakePlane.h trunk/yake/yake/base/math/yakeRay.h Modified: trunk/yake/yake/base/math/yakePlane.h =================================================================== --- trunk/yake/yake/base/math/yakePlane.h 2008-06-30 20:25:46 UTC (rev 1928) +++ trunk/yake/yake/base/math/yakePlane.h 2008-07-24 18:47:30 UTC (rev 1929) @@ -33,22 +33,58 @@ #endif #include "yakeMath.h" #include "yakeVector3.h" +#include "yakeRay.h" namespace yake { namespace math { + /** Represents a plane in space. */ class YAKE_BASE_API Plane { public: + /** @param kD distance (from the plane to the origin) in direction of rkNormal */ Plane( const Vector3 & rkNormal, const real kD ) : normal( rkNormal ), d( kD ) { } + Plane(const Point3& p0, const Point3& p1, const Point3& p2) : + normal((p1-p0).crossProduct(p2-p0).normalisedCopy()), d(-normal.dotProduct(p0.asVector())) + { + } + /** Positive if plane faces the point, + negative if it's on the other side ("behind" the plane). + @note d=(pt-p0).n + @note n.pt+D + */ + real distanceTo(const Point3& pt) const + { + return (normal.dotProduct(pt.asVector()) + d); + } Vector3 normal; real d; }; -} -} + /** Intersects a ray with a plane (if possible) and returns + the parameter on the ray which can be used to calculate + the intersection point. + @return result.first is true if the ray intersects. result.second is + the length along the ray which can be used to calculate the + intersection point like this: intPt= ray.origin + ray.direction * result.second + or intPt= ray.getPoint(result.second). + @note The returned length can be negative! + */ + inline std::pair<bool,real> intersect(const Plane& plane, const Ray& ray) + { + const real denom = plane.normal.dotProduct(ray.direction()); + if (fabs(denom)<0.0001) //@todo use a proper EPS + return std::make_pair(false,0); + const real nom = plane.normal.dotProduct(ray.origin().asVector()) + plane.d; + const real s = - (nom / denom); + return (s >= 0.) ? std::make_pair(true,s) : std::make_pair(false,0); + } +} // namespace math +using math::Plane; +} // namespace yake + #endif Modified: trunk/yake/yake/base/math/yakeRay.h =================================================================== --- trunk/yake/yake/base/math/yakeRay.h 2008-06-30 20:25:46 UTC (rev 1928) +++ trunk/yake/yake/base/math/yakeRay.h 2008-07-24 18:47:30 UTC (rev 1929) @@ -39,6 +39,7 @@ namespace yake { namespace math { + /** Represents a ray; from a point along a direction. */ class YAKE_BASE_API Ray { public: @@ -52,6 +53,14 @@ { return mOrigin; } + const Vector3& direction() const + { + return mDirection; + } + const Point3& origin() const + { + return mOrigin; + } const Vector3& getDirection() const { return mDirection; @@ -64,11 +73,14 @@ { mDirection = rDirection; } + /** Evaluate the parameter s (i.e. length here) + along the ray. + @note s may be negative. + */ Point3 getPoint( const real s ) const { return (mOrigin + (mDirection * s)); } - std::pair<bool, real> intersects(const Plane& plane) const; private: Point3 mOrigin; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-06-30 20:25:45
|
Revision: 1928 http://yake.svn.sourceforge.net/yake/?rev=1928&view=rev Author: psyclonist Date: 2008-06-30 13:25:46 -0700 (Mon, 30 Jun 2008) Log Message: ----------- * added build scripts for Microsoft Visual C++ 2008 (9.0) Modified Paths: -------------- trunk/yake/scripts/msvc90/build.cmd Added Paths: ----------- trunk/yake/scripts/msvc90/ Removed Paths: ------------- trunk/yake/scripts/msvc90/yake.suo Copied: trunk/yake/scripts/msvc90 (from rev 1927, trunk/yake/scripts/msvc80) Modified: trunk/yake/scripts/msvc90/build.cmd =================================================================== --- trunk/yake/scripts/msvc80/build.cmd 2008-06-30 16:16:26 UTC (rev 1927) +++ trunk/yake/scripts/msvc90/build.cmd 2008-06-30 20:25:46 UTC (rev 1928) @@ -5,8 +5,8 @@ echo warning: premake.exe not found in yake/scripts/premake. echo This file is expected to be found in yake/scripts/premake or in global path. ) -set SOLUTION_TARGET_DIR=msvc80 -premake --file yake.lua --target vs2005 %1 %2 %3 +set SOLUTION_TARGET_DIR=msvc90 +premake --file yake.lua --target vs2008 %1 %2 %3 popd pause Deleted: trunk/yake/scripts/msvc90/yake.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-06-30 16:16:32
|
Revision: 1927 http://yake.svn.sourceforge.net/yake/?rev=1927&view=rev Author: psyclonist Date: 2008-06-30 09:16:26 -0700 (Mon, 30 Jun 2008) Log Message: ----------- * ui: added demo ui2 Added Paths: ----------- trunk/yake/samples/gui/ui2/ trunk/yake/samples/gui/ui2/demo.cpp Added: trunk/yake/samples/gui/ui2/demo.cpp =================================================================== --- trunk/yake/samples/gui/ui2/demo.cpp (rev 0) +++ trunk/yake/samples/gui/ui2/demo.cpp 2008-06-30 16:16:26 UTC (rev 1927) @@ -0,0 +1,229 @@ +// Yake +#include <yake/base/yake.h> +#include <yake/gui2/gui.h> + +#include <yake/gui2/plugins/renderer.ogre/renderer.ogre.h> +#include <yake/gui2/plugins/system.ogreois/ogre_ois.h> +#include <yake/gui2/plugins/style.lua/style.lua.h> + +// console +#include <yake/gui_addons/console/yakeGenericConsole.h> +#include <yake/gui_addons/console/yakeDefaultHistory.h> +#include <yake/gui_addons/console/yakeConsoleLuaProcessor.h> +//#include <yake/gui_addons/console/cegui/yakeCEGUIInputArea.h> +//#include <yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h> + +// boost +#include <boost/lexical_cast.hpp> + +// luabind +//#include <luabind/luabind.hpp> + +// +namespace yake { +namespace ui { + //@todo rename to System or ??? + struct Application : public noncopyable + { + Application(const string& styleId = "yake.lua", + const string& systemId = "yake.ogre", + const string& inputProviderId = "yake.ogreois", + const string& windowMgrId = "yake.2d") + { + mSys = create<ui::ISystem>(systemId);//create_default<ui::ISystem>(); + mSys->start(); + mInput = create<ui::IInputProvider>(inputProviderId); + mWindowMgr = create<ui::IWindowManager>(windowMgrId); + mStyle = create<ui::IStyle>(styleId,mSys,mSys->getRenderer()); + + mInput->connectToMouseMoved(boost::bind(&ui::IWindowManager::injectMouseMove,mWindowMgr,_1)); + mInput->connectToKey(boost::bind(&ui::IWindowManager::injectKeyPress,mWindowMgr,_1)); + mInput->connectToMouseButtonDown( boost::bind(&ui::IWindowManager::injectMouseDown,mWindowMgr,_1) ); + mInput->connectToMouseButtonUp( boost::bind(&ui::IWindowManager::injectMouseUp,mWindowMgr,_1) ); + + //@todo move out + mSys->createFont("BlueHighway-10", "BlueHighway", 14); + } + ~Application() + { + // Destruct explicitely to enforce correct order of destruction: + mStyle.reset(); + mWindowMgr.reset(); + mInput.reset(); + mSys.reset(); + } + void stop() + { + mSys->stop(); + } + void step() + { + mInput->poll(); + mSys->getRenderer()->begin(); + mWindowMgr->update(); + { + // back-to-front + int zLevel = 0;//int(wmgr_->numTopLevelWindows()); + for (ui::IWindowManager::const_window_byReverseZ_it it = mWindowMgr->beginTopLevelByReverseZ(); it != mWindowMgr->endTopLevelByReverseZ(); ++it, --zLevel) + { + ui::WidgetPtr w = *it; + w->paint(zLevel); + //std::cout << "'" << w->id() << " @ z=" << zLevel << "\n"; + } + + { + ui::Position pos = mWindowMgr->getCursorPosition(); + mStyle->renderCursor(pos,zLevel+1); + } + } + mSys->getRenderer()->end(); + + mSys->getRenderer()->frame(); + } + ui::StylePtr style() const + { + return mStyle; + } + ui::WindowManagerPtr windowMgr() const + { + return mWindowMgr; + } + ui::WindowRendererPtr renderer() const + { + return mSys->getRenderer(); + } + private: + ui::StylePtr mStyle; + ui::SystemPtr mSys; + ui::InputProviderPtr mInput; + ui::WindowManagerPtr mWindowMgr; + }; + struct ConsoleInput + { + }; + template<class MessageT> + struct ConsoleOuput + { + typedef MessageT message_type; + }; +} // namespace ui +} // namespace yake + +namespace yake { + struct ConsoleMessage + { + typedef String::value_type char_t; + typedef String string_t; + typedef std::deque<String> ListType; + }; +} // namespace yake +#include "yake/res/res.h" +// +int main( int argc, char** argv ) +{ + try + { + // configure logging (console, log file, etc) + using namespace yake; + typedef SharedPtr<logging::log_listener> log_listener_ptr; + + log_listener_ptr toStdErr( new logging::stderr_listener() ); + logging::addListener( toStdErr.get() ); + + log_listener_ptr toFile( new logging::file_listener("sampleUi1.log") ); + logging::addListener( toFile.get() ); + + // configure resource paths + res::SourceFactory::global().reg<res::FileSource>("file"); + res::SourceManager::global().addSource("file","../../../common/media/scripts/"); + res::SourceManager::global().addSource("file","../../../common/media/gui2/styles/lua1/"); + + // instantiate UI application object + ui::Application app; + + // create UI elements/dialogs + using namespace ui; + // Example: Statistics Dialog + StaticText::Pointer infoText; + { + // Instantiate a dialog with internal id "infoDlg" + Dialog::Pointer dlg( new Dialog("infoDlg") ); + dlg->setCaption( "GUI Statistics" ); + + // Apply current application's style. + // Note: You can use a different style for each widget if you like. + dlg->setStyle( app.style() ); + + dlg->setPosition( Position(400,10) ); + + // Arrange child widgets vertically: + dlg->setLayout(new VBoxLayout()); + + // Create a text widget: + infoText.reset(new StaticText("","text")); + infoText->setMinimumSize(AbsSize(150,50)); + dlg->add( infoText ); + + //@todo should this be called automatically in Widget::add()? + dlg->updateGeometry(); + + // Make the dialog visible (and ready for user interaction): + app.windowMgr()->attach( dlg ); + } + + // InputPolicy<>: // <- input handler (usually, UI connector, e.g. LineEdit) + // typename message_type::string_t getCommandLine() + // void clearCommandLine() + // void setCommand(string_t) + // void addText(string_t) + // void addCommandCharacter(char_t) + // OutputPolicy<>: // <- rendering output handler (usually, UI connector, e.g. ListBox) + // void clearScroll() + // void render() + // void scrollUp(size_t lines) + // void scrollDown(size_t lines) + // void addMessage(const message_type&) + // Processor<message_type>: + // void process(const typename message_type::string_t&) + // History<>:: + // ... getNextCommand() + typedef gui::Console<ConsoleMessage, ui::ConsoleInput, gui::LuaInterpreter, gui::History, ui::ConsoleOuput> console_t; + console_t c; + + // main application loop: + for (;;) + { + // let the UI process input and render its graphics + app.step(); + + // update the statistics UI window: + if (infoText) + { + IWindowRenderer::Statistics stats; + app.renderer()->getFrameStatistics(stats); + + string text; + for (IWindowRenderer::Statistics::const_iterator it = stats.begin(); + it != stats.end(); ++it) + { + if (it != stats.begin()) + text += "\n"; + text += it->first + ": " + it->second; + } + infoText->setText(text); + } + } + } + catch ( std::exception& e ) + { + std::cerr << "EXCEPTION: " << e.what() << "\n"; + std::cin.get(); + } + catch ( ... ) + { + std::cerr << "Caught unhandled exception.\n"; + std::cin.get(); + } + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-06-28 19:55:33
|
Revision: 1926 http://yake.svn.sourceforge.net/yake/?rev=1926&view=rev Author: psyclonist Date: 2008-06-28 12:55:40 -0700 (Sat, 28 Jun 2008) Log Message: ----------- * [ui] added demo #1 (for the 'new' gui lib) Added Paths: ----------- trunk/yake/samples/gui/ui1/ trunk/yake/samples/gui/ui1/demo.cpp Added: trunk/yake/samples/gui/ui1/demo.cpp =================================================================== --- trunk/yake/samples/gui/ui1/demo.cpp (rev 0) +++ trunk/yake/samples/gui/ui1/demo.cpp 2008-06-28 19:55:40 UTC (rev 1926) @@ -0,0 +1,191 @@ +// Yake +#include <yake/base/yake.h> +#include <yake/gui2/gui.h> + +#include <yake/gui2/plugins/renderer.ogre/renderer.ogre.h> +#include <yake/gui2/plugins/system.ogreois/ogre_ois.h> +#include <yake/gui2/plugins/style.lua/style.lua.h> + +// boost +#include <boost/lexical_cast.hpp> + +// +namespace yake { +namespace ui { + //@todo rename to System or ??? + struct Application : public noncopyable + { + Application(const string& styleId = "yake.lua", + const string& systemId = "yake.ogre", + const string& inputProviderId = "yake.ogreois", + const string& windowMgrId = "yake.2d") + { + mSys = create<ui::ISystem>(systemId);//create_default<ui::ISystem>(); + mSys->start(); + mInput = create<ui::IInputProvider>(inputProviderId); + mWindowMgr = create<ui::IWindowManager>(windowMgrId); + mStyle = create<ui::IStyle>(styleId,mSys,mSys->getRenderer()); + + mInput->connectToMouseMoved(boost::bind(&ui::IWindowManager::injectMouseMove,mWindowMgr,_1)); + mInput->connectToKey(boost::bind(&ui::IWindowManager::injectKeyPress,mWindowMgr,_1)); + mInput->connectToMouseButtonDown( boost::bind(&ui::IWindowManager::injectMouseDown,mWindowMgr,_1) ); + mInput->connectToMouseButtonUp( boost::bind(&ui::IWindowManager::injectMouseUp,mWindowMgr,_1) ); + + //@todo move out + mSys->createFont("BlueHighway-10", "BlueHighway", 14); + } + ~Application() + { + // Destruct explicitely to enforce correct order of destruction: + mStyle.reset(); + mWindowMgr.reset(); + mInput.reset(); + mSys.reset(); + } + void stop() + { + mSys->stop(); + } + void step() + { + mInput->poll(); + mSys->getRenderer()->begin(); + mWindowMgr->update(); + { + // back-to-front + int zLevel = 0;//int(wmgr_->numTopLevelWindows()); + for (ui::IWindowManager::const_window_byReverseZ_it it = mWindowMgr->beginTopLevelByReverseZ(); it != mWindowMgr->endTopLevelByReverseZ(); ++it, --zLevel) + { + ui::WidgetPtr w = *it; + w->paint(zLevel); + //std::cout << "'" << w->id() << " @ z=" << zLevel << "\n"; + } + + { + ui::Position pos = mWindowMgr->getCursorPosition(); + mStyle->renderCursor(pos,zLevel+1); + } + } + mSys->getRenderer()->end(); + + mSys->getRenderer()->frame(); + } + ui::StylePtr style() const + { + return mStyle; + } + ui::WindowManagerPtr windowMgr() const + { + return mWindowMgr; + } + ui::WindowRendererPtr renderer() const + { + return mSys->getRenderer(); + } + private: + ui::StylePtr mStyle; + ui::SystemPtr mSys; + ui::InputProviderPtr mInput; + ui::WindowManagerPtr mWindowMgr; + }; + struct ConsoleInput + { + }; + template<class MessageT> + struct ConsoleOuput + { + typedef MessageT message_type; + }; +} // namespace ui +} // namespace yake + +#include "yake/res/res.h" +int main( int argc, char** argv ) +{ + try + { + // configure logging (console, log file, etc) + using namespace yake; + typedef SharedPtr<logging::log_listener> log_listener_ptr; + + log_listener_ptr toStdErr( new logging::stderr_listener() ); + logging::addListener( toStdErr.get() ); + + log_listener_ptr toFile( new logging::file_listener("sampleUi1.log") ); + logging::addListener( toFile.get() ); + + // configure resource paths + res::SourceFactory::global().reg<res::FileSource>("file"); + res::SourceManager::global().addSource("file","../../../common/media/scripts/"); + res::SourceManager::global().addSource("file","../../../common/media/gui2/styles/lua1/"); + + // instantiate UI application object + ui::Application app; + + // create UI elements/dialogs + using namespace ui; + // Example: Statistics Dialog + StaticText::Pointer infoText; + { + // Instantiate a dialog with internal id "infoDlg" + Dialog::Pointer dlg( new Dialog("infoDlg") ); + dlg->setCaption( "GUI Statistics" ); + + // Apply current application's style. + // Note: You can use a different style for each widget if you like. + dlg->setStyle( app.style() ); + + dlg->setPosition( Position(400,10) ); + + // Arrange child widgets vertically: + dlg->setLayout(new VBoxLayout()); + + // Create a text widget: + infoText.reset(new StaticText("","text")); + infoText->setMinimumSize(AbsSize(150,50)); + dlg->add( infoText ); + + //@todo should this be called automatically in Widget::add()? + dlg->updateGeometry(); + + // Make the dialog visible (and ready for user interaction): + app.windowMgr()->attach( dlg ); + } + + // main application loop: + for (;;) + { + // let the UI process input and render its graphics + app.step(); + + // update the statistics UI window: + if (infoText) + { + IWindowRenderer::Statistics stats; + app.renderer()->getFrameStatistics(stats); + + string text; + for (IWindowRenderer::Statistics::const_iterator it = stats.begin(); + it != stats.end(); ++it) + { + if (it != stats.begin()) + text += "\n"; + text += it->first + ": " + it->second; + } + infoText->setText(text); + } + } + } + catch ( std::exception& e ) + { + std::cerr << "EXCEPTION: " << e.what() << "\n"; + std::cin.get(); + } + catch ( ... ) + { + std::cerr << "Caught unhandled exception.\n"; + std::cin.get(); + } + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-06-28 19:54:33
|
Revision: 1925 http://yake.svn.sourceforge.net/yake/?rev=1925&view=rev Author: psyclonist Date: 2008-06-28 12:54:36 -0700 (Sat, 28 Jun 2008) Log Message: ----------- * fixed due to /W4 warnings Modified Paths: -------------- trunk/yake/src/base/yakeConfigFile.cpp trunk/yake/yake/base/templates/yakeSmartAssert.h trunk/yake/yake/factory/dynamic_factory.h trunk/yake/yake/factory/policies.h Modified: trunk/yake/src/base/yakeConfigFile.cpp =================================================================== --- trunk/yake/src/base/yakeConfigFile.cpp 2008-06-23 22:24:25 UTC (rev 1924) +++ trunk/yake/src/base/yakeConfigFile.cpp 2008-06-28 19:54:36 UTC (rev 1925) @@ -109,7 +109,7 @@ } void Configuration::readFromFile(const String& fn, const String& insertAt) { - YAKE_ASSERT( insertAt.empty() && "not yet supported" ); + YAKE_ASSERT( insertAt.empty() ).debug("not yet supported" ); std::ifstream in(fn.c_str()); if (!in.is_open()) return; //@todo @@ -117,7 +117,7 @@ } void Configuration::readFromXML(const String& fn, const String& insertAt) { - YAKE_ASSERT( insertAt.empty() && "not yet supported" ); + YAKE_ASSERT( insertAt.empty() ).debug("not yet supported" ); std::ifstream in(fn.c_str()); if (!in.is_open()) return; //@todo @@ -125,7 +125,7 @@ } void Configuration::writeToFile(const String& fn, const String& startAt) { - YAKE_ASSERT( startAt.empty() && "not yet supported" ); + YAKE_ASSERT( startAt.empty() ).debug("not yet supported" ); //boost::property_tree::write_info(cout,*tree_); std::ofstream out(fn.c_str()); Modified: trunk/yake/yake/base/templates/yakeSmartAssert.h =================================================================== --- trunk/yake/yake/base/templates/yakeSmartAssert.h 2008-06-23 22:24:25 UTC (rev 1924) +++ trunk/yake/yake/base/templates/yakeSmartAssert.h 2008-06-28 19:54:36 UTC (rev 1925) @@ -133,6 +133,16 @@ #pragma warning(push) #pragma warning(disable: 4355) // 'this': used in base member initializer list SmartAssert( const char * strExpr ) : YAKE_ASSERT_A(*this), YAKE_ASSERT_B(*this), mCtx(strExpr) {} + SmartAssert(const SmartAssert& other) : YAKE_ASSERT_A(*this), YAKE_ASSERT_B(*this), mCtx(other.mCtx) + { + } + const SmartAssert& operator = (const SmartAssert& rhs) + { + if (this == &rhs) + return *this; + mCtx = rhs.mCtx; + return *this; + } #pragma warning(pop) ~SmartAssert(); Modified: trunk/yake/yake/factory/dynamic_factory.h =================================================================== --- trunk/yake/yake/factory/dynamic_factory.h 2008-06-23 22:24:25 UTC (rev 1924) +++ trunk/yake/yake/factory/dynamic_factory.h 2008-06-28 19:54:36 UTC (rev 1925) @@ -25,7 +25,7 @@ R create(const Kt& id) { std::cout << "attempt create '" << typeid(X::return_t).name() << "' id='" << id << "' sig='" << typeid(X::signature_t).name() << "'\n"; - typedef X::Id2Class::const_iterator it_t; + typedef typename X::Id2Class::const_iterator it_t; const X& x = static_cast<X&>(*this); it_t it = x.id2class_.find(id); if (it == x.id2class_.end()) @@ -38,7 +38,7 @@ R create_default() { std::cout << "attempt create default sig='" << typeid(X::signature_t).name() << "'\n"; - typedef X::Id2Class::const_iterator it_t; + typedef typename X::Id2Class::const_iterator it_t; const X& x = static_cast<X&>(*this); it_t it = x.id2class_.begin(); if (it == x.id2class_.end()) @@ -62,7 +62,7 @@ R create(const Kt& id, const A0& a0 = A0()) { std::cout << "attempt create '" << typeid(X::return_t).name() << "' id='" << id << "' sig='" << typeid(X::signature_t).name() << "'\n"; - typedef X::Id2Class::const_iterator it_t; + typedef typename X::Id2Class::const_iterator it_t; const X& x = static_cast<X&>(*this); it_t it = x.id2class_.find(id); if (it == x.id2class_.end()) @@ -75,7 +75,7 @@ R create_default(const A0& a0 = A0()) { std::cout << "attempt create default sig='" << typeid(X::signature_t).name() << "'\n"; - typedef X::Id2Class::const_iterator it_t; + typedef typename X::Id2Class::const_iterator it_t; const X& x = static_cast<X&>(*this); it_t it = x.id2class_.begin(); if (it == x.id2class_.end()) @@ -98,7 +98,7 @@ R create(const Kt& id, const A0& a0 = A0(), const A1& a1 = A1()) { std::cout << "attempt create '" << typeid(X::return_t).name() << "' id='" << id << "' sig='" << typeid(X::signature_t).name() << "'\n"; - typedef X::Id2Class::const_iterator it_t; + typedef typename X::Id2Class::const_iterator it_t; const X& x = static_cast<X&>(*this); it_t it = x.id2class_.find(id); if (it == x.id2class_.end()) @@ -111,7 +111,7 @@ R create_default(const A0& a0 = A0(), const A1& a1 = A1()) { std::cout << "attempt create default sig='" << typeid(X::signature_t).name() << "'\n"; - typedef X::Id2Class::const_iterator it_t; + typedef typename X::Id2Class::const_iterator it_t; const X& x = static_cast<X&>(*this); it_t it = x.id2class_.begin(); if (it == x.id2class_.end()) Modified: trunk/yake/yake/factory/policies.h =================================================================== --- trunk/yake/yake/factory/policies.h 2008-06-23 22:24:25 UTC (rev 1924) +++ trunk/yake/yake/factory/policies.h 2008-06-28 19:54:36 UTC (rev 1925) @@ -19,7 +19,7 @@ { Exception(const std::string& msg) : msg_(msg) {} - virtual const char* what() const + virtual const char* what() const throw() { return msg_.c_str(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-06-23 22:24:26
|
Revision: 1924 http://yake.svn.sourceforge.net/yake/?rev=1924&view=rev Author: psyclonist Date: 2008-06-23 15:24:25 -0700 (Mon, 23 Jun 2008) Log Message: ----------- * doc: updated DEPENDENCIES file for yake 0.8 Modified Paths: -------------- trunk/yake/dependencies/DEPENDENCIES Modified: trunk/yake/dependencies/DEPENDENCIES =================================================================== --- trunk/yake/dependencies/DEPENDENCIES 2008-06-23 22:23:32 UTC (rev 1923) +++ trunk/yake/dependencies/DEPENDENCIES 2008-06-23 22:24:25 UTC (rev 1924) @@ -1,22 +1,109 @@ -------------------------------------------------- +ubuntu +-------------------------------------------------- + +packages + +* bjam (sudo apt-get install bjam) +* g++ (4.2...) <- was not installed on a clean ubuntu (sudo apt-get install g++) + +libboost-dev (18May2008) +- 1.34.1-4ubuntu3 (hardy) +-> requires gcc/g++/cpp 3.3 :( + +- download boost_1_35_0.tar.gz (-> URL) +- extract + +http://www.boost.org/doc/libs/1_35_0/more/getting_started/unix-variants.html + +-------------------------------------------------- +tools +-------------------------------------------------- + +premake (3.6) + + Website: http://premake.sourceforge.net/ + + Downloads of precompiled binaries for Windows, MacOSX, Linux, Ubuntu as well as the sources: + http://premake.sourceforge.net/download + + Direct Links (as of 18May2008): + * Windows: http://prdownloads.sf.net/premake/premake-win32-3.6.zip + * Linux: http://prdownloads.sf.net/premake/premake-linux-3.6.tar.gz + * Ubuntu: http://launchpad.net/~rjmyst3/+archive + * Source: http://prdownloads.sf.net/premake/premake-src-3.6.zip + + Installation + * Copy premake executable into <yake>/scripts/premake/ . + + Note: 2005 target can be used for 2008 (conversion by msvc ide works fine) + + +-------------------------------------------------- dependencies -------------------------------------------------- -boost/ 1.33.x (1.32.x should work, too) -lua/ Lua 5.1.x -enet/ enet 1.0 -libogg-1.1/ -libvorbis-1.0/ -luabind/ Luabind SVN HEAD (stable) -ode/ ODE 0.8 -ogrenew/ OGRE 1.2 (aka Dagon) +boost/ minimum: >= 1.34.0 + current: 1.35.0 + build: + get bjam (3.1.16 or later): http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 + MSVC: + bjam: boost-jam-3.1.16-1-ntx86.zip + details: http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html + execute (msvc cmd prompt): <boostdir>\bjam --build-dir=build.vc90 --build-type=complete --toolset=msvc stage + + +property_tree minimum: rev5 + source: property_tree_rev5.zip from the Boost Vault (http://www.boost-consulting.com/vault/) + direct download: http://www.boost-consulting.com/vault/index.php?action=downloadfile&filename=property_tree_rev5.zip&directory=& + installation: extract into 'dependencies/boost/' + +lua/ minimum: >= 5.1.x + current: 5.1.3 + sources: http://www.lua.org/download.html lua-5.1.3.tar.gz (or later) + msvc makefiles: http://luabinaries.luaforge.net/download.html + all: http://luaforge.net/frs/?group_id=110 + msvc: + - custom .sln+.vcproj + - configured luaconf.h for DLL build + + +luabind/ Luabind SVN HEAD (stable) current:r507 + website: http://www.rasterbar.com/products/luabind.html + project site: http://luabind.sourceforge.net/ + how to get the sources: http://sourceforge.net/svn/?group_id=77060 + msvc: + - custom .sln+.vcproj (LUABIND_BUILDING as preproc-def) + - configured config.hpp for DLL build (LUABIND_IMPORT,LUABIND_EXPORT) + + +ode/ current: ODE 0.9 + website: http://www.ode.org/ + download: http://sourceforge.net/project/showfiles.php?group_id=24884 + +ogrenew/ OGRE 1.4.x + msvc: + - use the SDKs: http://www.ogre3d.org/index.php?option=com_content&task=view&id=411&Itemid=131 (VC7.1,VC8.0SP1,VC9.0,C::B+MinGW) + +tinyxml/ current: 2.5.3 + sources: http://sourceforge.net/projects/tinyxml + direct download 2.5.3: + - zip: http://downloads.sourceforge.net/tinyxml/tinyxml_2_5_3.zip?modtime=1178462706&big_mirror=0 + - tar.gz: http://downloads.sourceforge.net/tinyxml/tinyxml_2_5_3.tar.gz?modtime=1178462695&big_mirror=0 + +OIS + + + +oSceneLoaderLib/ pseudo-.scene loader :P (Community Edition 2006/28.07) + + cegui/ CEGUI 0.5+ OpenAL/ OpenAL 1.1 openalpp/ OpenThreads/ -oSceneLoaderLib/ pseudo-.scene loader :P (Community Edition 2006/28.07) -tinyxml/ freealut/ freealut 1.1.0 +libogg-1.1/ +libvorbis-1.0/ -------------------------------------------------- @@ -26,3 +113,4 @@ ttl/ zThread/ loki/ +enet/ enet 1.0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-06-23 22:23:25
|
Revision: 1923 http://yake.svn.sourceforge.net/yake/?rev=1923&view=rev Author: psyclonist Date: 2008-06-23 15:23:32 -0700 (Mon, 23 Jun 2008) Log Message: ----------- * base: removed use of static instance in native log console Modified Paths: -------------- trunk/yake/src/base/native/win32/yakeDebug.cpp Modified: trunk/yake/src/base/native/win32/yakeDebug.cpp =================================================================== --- trunk/yake/src/base/native/win32/yakeDebug.cpp 2008-06-23 22:22:28 UTC (rev 1922) +++ trunk/yake/src/base/native/win32/yakeDebug.cpp 2008-06-23 22:23:32 UTC (rev 1923) @@ -126,17 +126,8 @@ } -static class LogConsole +namespace LogConsole { -public: - LogConsole() - { - } - - ~LogConsole() - { - } - void Print( const char * text, WORD wAttributes ) { //AllocConsole(); // this would actually open a console window... @@ -157,12 +148,8 @@ // restore settings ::SetConsoleTextAttribute( outHandle, csbiInfo.wAttributes ); } +} -private: - static int niftyCounter_; - static bool consoleApp_; -} logConsole_g; - bool debug_Log_available() { return (GetStdHandle( STD_ERROR_HANDLE ) != 0); @@ -203,7 +190,7 @@ void debug_Print( const char * string ) { - logConsole_g.Print( string, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED ); + LogConsole::Print( string, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-06-23 22:22:33
|
Revision: 1922 http://yake.svn.sourceforge.net/yake/?rev=1922&view=rev Author: psyclonist Date: 2008-06-23 15:22:28 -0700 (Mon, 23 Jun 2008) Log Message: ----------- * bindings.lua: provided registerClass<> for binding 'this' of parent classes * sampleEntFsm: provided MyEntity to demonstrate how to create custom entities * ent: fixed namespace reference in macro Modified Paths: -------------- trunk/yake/samples/ent/sampleEntFsm/demo.cpp trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h trunk/yake/yake/ent/object.h Modified: trunk/yake/samples/ent/sampleEntFsm/demo.cpp =================================================================== --- trunk/yake/samples/ent/sampleEntFsm/demo.cpp 2008-05-20 21:32:17 UTC (rev 1921) +++ trunk/yake/samples/ent/sampleEntFsm/demo.cpp 2008-06-23 22:22:28 UTC (rev 1922) @@ -11,13 +11,22 @@ namespace yake { namespace exapp { + // Some states for the entity state machine: const yake::String ksAwakening = "awakening"; const yake::String ksAlive = "alive"; const yake::String ksDead = "dead"; + + // A custom entity for our demo application: + struct MyEntity : public ent::Entity + { + DECL_OBJECT(MyEntity,"MyEntity") + + MyEntity() {} + }; + IMPL_OBJECT(MyEntity); } // namespace exapp } // namespace yake - int main(int argc, char* argv[]) { using namespace yake; @@ -49,6 +58,10 @@ ent::registerClass<ent::Object>(); ent::registerClass<ent::Entity>(); ent::registerClass<ent::Trigger>(); + // Note, that we specify Entity as the parent class, as there've been Lua bindings defined for it + // while exapp::MyEntity has no Lua bindings. So, from Lua a MyEntity instance + // will look like an Entity instance. + ent::registerClass<exapp::MyEntity,ent::Entity>(); // Register object class(es) ent::ObjectCreationParameters params; @@ -59,12 +72,22 @@ ret = objMgr.registerClass<ent::Trigger>("Trigger",params); YAKE_ASSERT( ret.first == object::RC_OK ); + ret = objMgr.registerClass<exapp::MyEntity>("MyEntity",params); + YAKE_ASSERT( ret.first == object::RC_OK ); + // Create trigger { ent::Trigger* trigger = ent::Trigger::cast(objMgr.makeObject("Trigger")); YAKE_ASSERT( trigger ); } + // Create instance of MyEntity + { + exapp::MyEntity* myEnt = exapp::MyEntity::cast(objMgr.makeObject("MyEntity")); + YAKE_ASSERT( myEnt ); + } + + // run the sim for 10 ticks for (size_t i=0; i<10; ++i) objMgr.tick(); Modified: trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h =================================================================== --- trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h 2008-05-20 21:32:17 UTC (rev 1921) +++ trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h 2008-06-23 22:22:28 UTC (rev 1922) @@ -239,6 +239,11 @@ { classRegistry().registerClass<T>( boost::bind(&detail::do_register_bindThis<T>,_1,_2) ); } + template<class T, class ParentT> + inline void registerClass() + { + classRegistry().registerClass<T>( boost::bind(&detail::do_register_bindThis<ParentT>,_1,_2) ); + } } // namespace ent } // namespace yake Modified: trunk/yake/yake/ent/object.h =================================================================== --- trunk/yake/yake/ent/object.h 2008-05-20 21:32:17 UTC (rev 1921) +++ trunk/yake/yake/ent/object.h 2008-06-23 22:22:28 UTC (rev 1922) @@ -45,7 +45,7 @@ #define DECL_OBJECT(CLASS,DESC) \ DECL_CLASS_RTTI(CLASS,DESC) \ public: \ - static ::yake::ent::Object* create(const ObjectId& id) \ + static ::yake::ent::Object* create(const ::yake::ent::ObjectId& id) \ { \ ::yake::ent::Object* obj = new CLASS(); \ obj->setId(id); \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-05-20 21:32:19
|
Revision: 1921 http://yake.svn.sourceforge.net/yake/?rev=1921&view=rev Author: psyclonist Date: 2008-05-20 14:32:17 -0700 (Tue, 20 May 2008) Log Message: ----------- * updated manual Modified Paths: -------------- trunk/yake/documentation/manual/yake-manual.txt Modified: trunk/yake/documentation/manual/yake-manual.txt =================================================================== --- trunk/yake/documentation/manual/yake-manual.txt 2008-05-20 21:31:45 UTC (rev 1920) +++ trunk/yake/documentation/manual/yake-manual.txt 2008-05-20 21:32:17 UTC (rev 1921) @@ -85,20 +85,25 @@ Requirements ------------ -1. a recent C++ compiler (for example, MSVC 7.1/8.0 or GCC 3.3+/4.x) +The following are the minimum requirements for building the Yake core. + +1. a recent C++ compiler (for example, MSVC 8.0/9.0 or GCC 3.4/4.2) 2. a good standard template library (STL) -3. boost 1.32.x or above (certain selected libraries are used) +3. boost 1.35.x or above (certain selected libraries are used) For specific components/plugins additional dependencies may be required. -1. ODE 0.7/0.8 for physicsODE -#. OGRE 1.3/1.4 for graphicsOGRE -#. Lua 5.x for scriptingLua, entLua etc -#. Luabind (0.7+1, i.e. SVN) for scriptingLua, entLua etc +1. OGRE 1.4 for 'graphicsOGRE' +#. ODE 0.7/0.8 for 'physicsODE' +#. OIS for inputOIS (included in OGRE SDK) +#. Lua 5.1.x for the Lua bindings +#. Luabind (0.7+, preferrably SVN trunk) for the Lua bindings + For MSVC 9.0 we use a patched version. Changes are available. #. CEGUI 0.5.x for graphical UI +#. TinyXML 2.5.x for 'data' +#. FMOD ? SDK for audioFMOD #. OpenAL 1.1 SDK for audioOpenAL #. OpenAL++ for audioOpenAL -#. TinyXML 2.5.x for data #. Enet 1.0.x for networking Supported platforms: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-05-20 21:31:51
|
Revision: 1920 http://yake.svn.sourceforge.net/yake/?rev=1920&view=rev Author: psyclonist Date: 2008-05-20 14:31:45 -0700 (Tue, 20 May 2008) Log Message: ----------- * fixed: S_NORMAL is a define on VC9 and collides with our enum Modified Paths: -------------- trunk/yake/yake/gui2/widget.h Modified: trunk/yake/yake/gui2/widget.h =================================================================== --- trunk/yake/yake/gui2/widget.h 2008-05-20 21:30:48 UTC (rev 1919) +++ trunk/yake/yake/gui2/widget.h 2008-05-20 21:31:45 UTC (rev 1920) @@ -52,6 +52,11 @@ void _setCachedGeometry(IRenderableGeometry::pointer); IRenderableGeometry::pointer _getCachedGeometry() const; +// S_NORMAL is defined win WinBase.h. Confirmed at least for VC9.0. +// Obviously, this collides with our enum. +#if defined(S_NORMAL) +#undef S_NORMAL +#endif enum State { S_NORMAL, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-05-20 21:31:18
|
Revision: 1919 http://yake.svn.sourceforge.net/yake/?rev=1919&view=rev Author: psyclonist Date: 2008-05-20 14:30:48 -0700 (Tue, 20 May 2008) Log Message: ----------- * cleanup: use NOMINMAX for VC so that the min() and max() macros are not defined and cannot interfere with STL's std::min and std::max Modified Paths: -------------- trunk/yake/yake/base/yakePrerequisites.h Modified: trunk/yake/yake/base/yakePrerequisites.h =================================================================== --- trunk/yake/yake/base/yakePrerequisites.h 2008-05-20 21:30:00 UTC (rev 1918) +++ trunk/yake/yake/base/yakePrerequisites.h 2008-05-20 21:30:48 UTC (rev 1919) @@ -30,21 +30,19 @@ //============================================================================ // IMPLEMENTATION HEADERS //=========================================================================== + #include <yake/config.h> #include <yake/base/yakePlatform.h> + +// Make sure we don't get the min and max macros on Windows. They're defined in windef.h. +#if (YAKE_PLATFORM == PLATFORM_WIN32) +# define NOMINMAX +#endif + #include <assert.h> #include <ctime> #include <math.h> #include <cmath> -// Undef min and max macros on Windows. They're defined in windef.h. -#if (YAKE_PLATFORM == PLATFORM_WIN32) - #ifdef min - #undef min - #endif - #ifdef max - #undef max - #endif -#endif #include <limits> #include <cstdio> #include <stdio.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-05-20 21:30:29
|
Revision: 1918 http://yake.svn.sourceforge.net/yake/?rev=1918&view=rev Author: psyclonist Date: 2008-05-20 14:30:00 -0700 (Tue, 20 May 2008) Log Message: ----------- * feature: added support for Visual C++ 9.0 (incl. Express Edition!) * bug: fixed a few namespace and include issues for PC/Windows Modified Paths: -------------- trunk/yake/src/base/native/win32/yakeApplication.cpp trunk/yake/src/base/native/win32/yakeTime.cpp trunk/yake/src/data/yakeXMLSerializer.cpp trunk/yake/yake/base/math/yakeQuaternion.h trunk/yake/yake/base/native/win32/win32.rc trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h trunk/yake/yake/base/yakePlatform.h Modified: trunk/yake/src/base/native/win32/yakeApplication.cpp =================================================================== --- trunk/yake/src/base/native/win32/yakeApplication.cpp 2008-05-02 11:34:55 UTC (rev 1917) +++ trunk/yake/src/base/native/win32/yakeApplication.cpp 2008-05-20 21:30:00 UTC (rev 1918) @@ -25,27 +25,17 @@ ------------------------------------------------------------------------------------ */ -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Yake #include <yake/base/yakePCH.h> #include <yake/base/native/yakeNative.h> -namespace Win32 -{ +#ifndef STRICT # define STRICT -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -} +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace native -{ +namespace yake { +namespace native { const char* getApplicationDir() { @@ -53,7 +43,7 @@ if( !*szBuffer ) { - Win32::GetModuleFileName( NULL, szBuffer, MAX_PATH ); + GetModuleFileName( NULL, szBuffer, MAX_PATH ); *strrchr( szBuffer, '\\' ) = '\0'; } Modified: trunk/yake/src/base/native/win32/yakeTime.cpp =================================================================== --- trunk/yake/src/base/native/win32/yakeTime.cpp 2008-05-02 11:34:55 UTC (rev 1917) +++ trunk/yake/src/base/native/win32/yakeTime.cpp 2008-05-20 21:30:00 UTC (rev 1918) @@ -32,41 +32,35 @@ #include <yake/base/yakePCH.h> #include <yake/base/native/yakeNative.h> -namespace Win32 -{ +#ifndef STRICT # define STRICT -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -# include <mmsystem.h> -} +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <mmsystem.h> -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace native -{ +namespace yake { +namespace native { static class TimerInit { public: // Public member for a gain of speed. - Win32::LARGE_INTEGER mTimerFrequency; + ::LARGE_INTEGER mTimerFrequency; double mStart; // Constructor. TimerInit() { - if( !Win32::QueryPerformanceFrequency( &mTimerFrequency ) ) + if( !::QueryPerformanceFrequency( &mTimerFrequency ) ) { mTimerFrequency.QuadPart = 0; - mStart = Win32::timeGetTime() / 1000.0f; + mStart = ::timeGetTime() / 1000.0f; } else { - Win32::LARGE_INTEGER largeCount; - Win32::QueryPerformanceCounter( &largeCount ); + ::LARGE_INTEGER largeCount; + ::QueryPerformanceCounter( &largeCount ); double count = double( largeCount.QuadPart ); double frequency = double( mTimerFrequency.QuadPart ); @@ -81,10 +75,10 @@ { // No performance timer available. if( TimerInit_g.mTimerFrequency.QuadPart == 0 ) - return real( Win32::timeGetTime() / 1000.0f - TimerInit_g.mStart ); + return real( ::timeGetTime() / 1000.0f - TimerInit_g.mStart ); - Win32::LARGE_INTEGER largeCount; - Win32::QueryPerformanceCounter( &largeCount ); + ::LARGE_INTEGER largeCount; + ::QueryPerformanceCounter( &largeCount ); double count = double( largeCount.QuadPart ); double frequency = double( TimerInit_g.mTimerFrequency.QuadPart ); Modified: trunk/yake/src/data/yakeXMLSerializer.cpp =================================================================== --- trunk/yake/src/data/yakeXMLSerializer.cpp 2008-05-02 11:34:55 UTC (rev 1917) +++ trunk/yake/src/data/yakeXMLSerializer.cpp 2008-05-20 21:30:00 UTC (rev 1918) @@ -27,7 +27,9 @@ #include <yake/data/yakePCH.h> #include <yake/data/yakeXMLSerializer.h> -#define STRICT +#ifndef STRICT +# define STRICT +#endif #define WIN32_LEAN_AND_MEAN #include <dependencies/tinyxml/tinyxml.h> Modified: trunk/yake/yake/base/math/yakeQuaternion.h =================================================================== --- trunk/yake/yake/base/math/yakeQuaternion.h 2008-05-02 11:34:55 UTC (rev 1917) +++ trunk/yake/yake/base/math/yakeQuaternion.h 2008-05-20 21:30:00 UTC (rev 1918) @@ -36,7 +36,6 @@ #endif // Yake #include "yake/base/math/yakeMath.h" -#include <iostream> //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES Modified: trunk/yake/yake/base/native/win32/win32.rc =================================================================== --- trunk/yake/yake/base/native/win32/win32.rc 2008-05-02 11:34:55 UTC (rev 1917) +++ trunk/yake/yake/base/native/win32/win32.rc 2008-05-20 21:30:00 UTC (rev 1918) @@ -1,5 +1,9 @@ // Microsoft Visual C++ generated resource script. // +// NB We're including windows.h instead of afxres.h so that the resources +// can be compiled on VC++Express2008(9.0), too. The Express Edition +// does not ship with support for MFC/ATL, so afxres.h is missing there. +// #include "yakeResource.h" #define APSTUDIO_READONLY_SYMBOLS @@ -7,7 +11,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "windows.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -34,7 +38,7 @@ 2 TEXTINCLUDE BEGIN - "#include ""afxres.h""\r\n" + "#include ""windows.h""\r\n" "\0" END Modified: trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h =================================================================== --- trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h 2008-05-02 11:34:55 UTC (rev 1917) +++ trunk/yake/yake/base/prerequisites/yakePrerequisitesVC.h 2008-05-20 21:30:00 UTC (rev 1918) @@ -41,12 +41,19 @@ # include <xhash> # include "yakePrerequisitesVC71Types.h" # elif(YAKE_COMP_VER == 1400) -# //pragma message("Yake platform/compiler config: yake.prerequisites.vc8") +# //pragma message("Yake platform/compiler config: yake.prerequisites.vc80") # include "yakePrerequisitesVC8Warnings.h" # include <wchar.h> # include <hash_map> # include <xhash> # include "yakePrerequisitesVC8Types.h" +# elif(YAKE_COMP_VER == 1500) +# //pragma message("Yake platform/compiler config: yake.prerequisites.vc90") +# include "yakePrerequisitesVC8Warnings.h" +# include <wchar.h> +# include <hash_map> +# include <xhash> +# include "yakePrerequisitesVC8Types.h" # else # error("Yake platform/compiler error: no configuration file for this compiler!") # endif Modified: trunk/yake/yake/base/yakePlatform.h =================================================================== --- trunk/yake/yake/base/yakePlatform.h 2008-05-02 11:34:55 UTC (rev 1917) +++ trunk/yake/yake/base/yakePlatform.h 2008-05-20 21:30:00 UTC (rev 1918) @@ -49,6 +49,7 @@ // 1300 for vc7.0 (2002) // 1310 for vc7.1 (2003) // 1400 for vc8.0 (2005) + // 1500 for vc9.0 (2008) # define YAKE_COMP_VER _MSC_VER #elif defined( __GNUC__ ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-05-02 11:34:48
|
Revision: 1917 http://yake.svn.sourceforge.net/yake/?rev=1917&view=rev Author: psyclonist Date: 2008-05-02 04:34:55 -0700 (Fri, 02 May 2008) Log Message: ----------- * [sample] fixed input handlinge Modified Paths: -------------- trunk/yake/samples/gui/console/yakeConsoleDemo.cpp Modified: trunk/yake/samples/gui/console/yakeConsoleDemo.cpp =================================================================== --- trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2008-04-22 18:19:42 UTC (rev 1916) +++ trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2008-05-02 11:34:55 UTC (rev 1917) @@ -44,6 +44,7 @@ #include <yake/plugins/scriptingLua/ScriptingSystemLua.h> #include <yake/graphics/yakeGraphicsSystem.h> #include <yake/data/yakeData.h> +#include <yake/input/yakeInput.h> #include "yake/raf/yakeRaf.h" @@ -143,9 +144,9 @@ mListBox( 0 ) { enableInstantQuitByKey( input::KC_ESCAPE ); + mApp.getKeyboardEventGenerator()->subscribeToKeyDown(boost::bind(&TheMainState::onKeyDown,this,_1)); } -#if 0 /** * Keyboard key pressed event handler. * Implements console key combinations processing. Feeds events to CEGUI. @@ -155,9 +156,6 @@ { YAKE_LOG("demo", "KEY: " + boost::lexical_cast<String>( rEvent.keyCode ) ); - if ( rEvent.keyCode == input::KC_ESCAPE ) - requestShutdown(); - if ( rEvent.keyCode == input::KC_RETURN || rEvent.keyCode == input::KC_TAB ) { mConsole.execute(); @@ -170,71 +168,17 @@ { mConsole.nextCommand(); } - else if ( ( getKeyboard()->isKeyDown(input::KC_LSHIFT) || getKeyboard()->isKeyDown(input::KC_RSHIFT) ) && getKeyboard()->isKeyDown(input::KC_PGUP) ) + else if ( ( mApp.getKeyboard()->isKeyDown(input::KC_LSHIFT) || mApp.getKeyboard()->isKeyDown(input::KC_RSHIFT) ) && mApp.getKeyboard()->isKeyDown(input::KC_PGUP) ) { mConsole.scrollOutputUp( 30 ); } - else if ( ( getKeyboard()->isKeyDown(input::KC_LSHIFT) || getKeyboard()->isKeyDown(input::KC_RSHIFT) ) && getKeyboard()->isKeyDown(input::KC_PGDOWN) ) + else if ( ( mApp.getKeyboard()->isKeyDown(input::KC_LSHIFT) || mApp.getKeyboard()->isKeyDown(input::KC_RSHIFT) ) && mApp.getKeyboard()->isKeyDown(input::KC_PGDOWN) ) { mConsole.scrollOutputDown( 30 ); } - else - { - CEGUI::System::getSingleton().injectKeyDown( rEvent.keyCode ); - - long modifiers = getKeyboard()->isKeyDown(input::KC_LSHIFT) || getKeyboard()->isKeyDown(input::KC_RSHIFT) ? 1 : 0; - - CEGUI::System::getSingleton().injectChar( getKeyChar( rEvent.keyCode, modifiers ) ); - } } /** - * Keyboard key release event handler. - * Feeds event to CEGUI. - * @param rEvent - */ - void onKeyUp( const yake::input::KeyboardEvent& rEvent ) - { - YAKE_LOG("demo", "KEY released: " + boost::lexical_cast<String>( rEvent.keyCode ) ); - - CEGUI::System::getSingleton().injectKeyUp( rEvent.keyCode ); - } - - /** - * Mouse button event handler - * @param btn Button index - */ - void onMBDown( uint8 btn ) - { - YAKE_LOG("demo", "MB: " + boost::lexical_cast<String>( static_cast<int>( btn ) ) ); - CEGUI::System::getSingleton().injectMouseButtonDown( convertYakeButtonToCegui( btn ) ); - } - - /** - * Mouse button event handler - * @param btn Button index - */ - void onMBUp( uint8 btn ) - { - YAKE_LOG("demo", "MB: " + boost::lexical_cast<String>( static_cast<int>( btn ) ) ); - CEGUI::System::getSingleton().injectMouseButtonUp( convertYakeButtonToCegui( btn ) ); - } - - /** - * Mouse movement handler - * @param rDelta Mouse movement since last such event - */ - void onMouseMoved( const Vector3& rDelta ) - { - const real scale = 1; - if (CEGUI::System::getSingletonPtr()) - { - CEGUI::System::getSingleton().injectMouseMove( rDelta.x*scale, rDelta.y*scale ); - } - } -#endif - - /** * Helper method to add console message. * Used from scripts. * @param msg Message to add. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-04-22 18:20:39
|
Revision: 1916 http://yake.svn.sourceforge.net/yake/?rev=1916&view=rev Author: psyclonist Date: 2008-04-22 11:19:42 -0700 (Tue, 22 Apr 2008) Log Message: ----------- * [gui2] "lua style" now uses Yake's Lua scripting * [gui2] "lua style" now uses Yake's resource management * [gui2] improved exception safety * [gui2] added missing export declarations Modified Paths: -------------- trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp trunk/yake/yake/gui2/plugins/style.lua/style.lua.h trunk/yake/yake/gui2/widget/button.h trunk/yake/yake/gui2/widget/dialog.h trunk/yake/yake/gui2/widget/panel.h trunk/yake/yake/gui2/widget/static_text.h trunk/yake/yake/gui2/widget/text_edit.h trunk/yake/yake/gui2/widget/titlebar.h Modified: trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp =================================================================== --- trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/src/gui2/plugins/renderer.ogre/renderer.ogre.cpp 2008-04-22 18:19:42 UTC (rev 1916) @@ -150,18 +150,25 @@ Font::Font(const string& name, WindowRendererPtr renderer, const real size) : name_(name), renderer_(renderer), size_(size), font_(0) { - Ogre::FontManager::ResourceCreateOrRetrieveResult succ = Ogre::FontManager::getSingleton().createOrRetrieve("BlueHighway","Default"); - Ogre::FontPtr font = succ.first; - font->load(); - assert( (font.get()!=0) && "failed to create or retrieve font" ); - const Ogre::MaterialPtr& material = font->getMaterial(); - assert( material.get() && "font material not (yet?) loaded" ); - //materialName_ = material->getName(); - //materialName_ = "BlueHighwayTexture"; - materialName_ = font->getName() + "Texture"; - font_ = font.get(); - //material->setSceneBlending( Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA ); - //material->setSceneBlending( Ogre::SBF_SOURCE_COLOUR, Ogre::SBF_ZERO ); + try { + Ogre::FontManager::ResourceCreateOrRetrieveResult succ = Ogre::FontManager::getSingleton().createOrRetrieve(name.c_str(),"Default"); + Ogre::FontPtr font = succ.first; + if (!font->isLoaded()) + font->load(); + assert( (font.get()!=0) && "failed to create or retrieve font" ); + const Ogre::MaterialPtr& material = font->getMaterial(); + assert( material.get() && "font material not (yet?) loaded" ); + //materialName_ = material->getName(); + //materialName_ = "BlueHighwayTexture"; + materialName_ = font->getName() + "Texture"; + font_ = font.get(); + //material->setSceneBlending( Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA ); + //material->setSceneBlending( Ogre::SBF_SOURCE_COLOUR, Ogre::SBF_ZERO ); + } + catch (Ogre::Exception& ex) + { + YAKE_EXCEPT(string("OGRE Exception: ")+ex.what()); + } } typedef boost::array<Position,4> Quadrangle; /* @@ -677,16 +684,19 @@ /* colourBlend_.source1 = Ogre::LBS_DIFFUSE; colourBlend_.source2 = Ogre::LBS_CURRENT; - colourBlend_.operation = Ogre::LBX_BLEND_DIFFUSE_ALPHA; */ colourBlend_.source1 = Ogre::LBS_TEXTURE; colourBlend_.source2 = Ogre::LBS_DIFFUSE; colourBlend_.operation = Ogre::LBX_MODULATE; + //colourBlend_.operation = Ogre::LBX_BLEND_DIFFUSE_ALPHA; + //colourBlend_.operation = Ogre::LBX_BLEND_TEXTURE_ALPHA; alphaBlend_.blendType = Ogre::LBT_ALPHA; alphaBlend_.source1 = Ogre::LBS_TEXTURE; alphaBlend_.source2 = Ogre::LBS_DIFFUSE; alphaBlend_.operation = Ogre::LBX_MODULATE; + //alphaBlend_.operation = Ogre::LBX_BLEND_DIFFUSE_ALPHA; + //alphaBlend_.operation = Ogre::LBX_BLEND_TEXTURE_ALPHA; uvwAddressingMode_.u = Ogre::TextureUnitState::TAM_CLAMP; uvwAddressingMode_.v = Ogre::TextureUnitState::TAM_CLAMP; @@ -884,6 +894,8 @@ { renderOp_.vertexData->vertexStart = bufferPos_; Ogre::TexturePtr tex = it->pTex0; + //if (tex.get() && !tex->isLoaded()) + // tex->load(); for (; it != faces_.end(); ++it) { const Face& f = *it; @@ -996,16 +1008,17 @@ if (it != fonts_.end()) return it->second; - try { + //try + { FontPtr fnt(new Font(name,getRenderer(),size)); fonts_[id] = fnt; return fnt; } - catch (Exception&) - { - assert( false && "CAUGHT EXCEPTION during FONT CREATION" ); //@todo <- replace with logging? - throw; - } +// catch (Exception&) +// { +// //assert( false && "CAUGHT EXCEPTION during FONT CREATION" ); //@todo <- replace with logging? +// throw; +// } } FontPtr OgreSystem::getFont(const string& id) const { Modified: trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp =================================================================== --- trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/src/gui2/plugins/style.lua/style.lua.cpp 2008-04-22 18:19:42 UTC (rev 1916) @@ -18,6 +18,9 @@ #include "yake/gui2/font.h" #include "yake/gui2/plugins/style.lua/style.lua.h" +#include "yake/scripting/scripting.h" +#include "yake/plugins/scriptingLua/ScriptingSystemLua.h" +#include "yake/bindings.lua/bindings.lua.h" #include "yake/res/res.h" namespace yake { @@ -32,7 +35,7 @@ }; struct LuaStyleBatcher { - void setRenderer(WindowRendererPtr r) + void setRenderer(IWindowRenderer* r) { renderer_ = r; } void setSystem(SystemPtr sys) { sys_ = sys; } @@ -49,7 +52,7 @@ {} }; - LuaStyleBatcher() : curr_(0), currZ_(0) + LuaStyleBatcher() : curr_(0), currZ_(0), renderer_(0) {} void setCurrentWidget(Widget& w, real z) { @@ -129,7 +132,7 @@ Widget* curr_; real currZ_; colour clr_; - WindowRendererPtr renderer_; + IWindowRenderer* renderer_; SystemPtr sys_; Position toAbsolute(const dim2& pos) @@ -183,6 +186,7 @@ // UI namespace yake { namespace ui { +#if 0 int pcall_handler(lua_State* L) { return 1; @@ -247,16 +251,26 @@ private: lua_State* L; }; +#endif + lua_State* state(VMPtr vm) + { + if (!vm) + return 0; + return static_cast<scripting::LuaVM*>(vm.get())->getLuaState(); + } LuaStyle::LuaStyle(SystemPtr sys, WindowRendererPtr w) : sys_(sys), renderer_(w), batcher_( new LuaStyleBatcher() ) { - batcher_->setRenderer( renderer_ ); + batcher_->setRenderer( renderer_.get() ); batcher_->setSystem( sys_ ); + scriptingSys_ = create<scripting::IScriptingSystem>("lua"); + YAKE_ASSERT( scriptingSys_ ).error("could init scripting system");; + { VMPtr init = this->createVM(); - init->doFile("lua.init.lua"); + init->execute(getOrLoadScript("lua.init.lua")); { - lua_State* L = init->state(); + lua_State* L = state(init); using namespace luabind; object o = globals(L)["widgets"]; if (o && (type(o) == LUA_TTABLE)) @@ -301,6 +315,15 @@ // this->createVM("Dialog","lua.dialogpanel.lua"); // this->createVM("DialogPanel","lua.dialogpanel.lua"); } + LuaStyle::~LuaStyle() + { + scripts_.clear(); + vm_.clear(); + scriptingSys_.reset(); + batcher_.reset(); + renderer_.reset(); + sys_.reset(); + } bool widget_hasMutator(Widget* w,const string& tag) { @@ -309,8 +332,8 @@ void LuaStyle::bind(VMPtr vm) { - lua_State* L = vm ? vm->state() : 0; - assert(L && "null state"); + lua_State* L = vm ? state(vm) : 0; + YAKE_ASSERT(L).error("null state"); if (!L) return; @@ -401,7 +424,7 @@ globals(L)["geometry"] = luabind::newtable(L); globals(L)["render"] = batcher_; - batcher_->setRenderer( renderer_ ); + batcher_->setRenderer( renderer_.get() ); globals(L)["ui"] = sys_; globals(L)["methods"] = luabind::newtable(L); @@ -409,10 +432,25 @@ } VMPtr LuaStyle::createVM() { - VMPtr vm(new LuaVM()); + YAKE_ASSERT(scriptingSys_); + VMPtr vm = scriptingSys_->createVM(); + bind_all(vm.get()); + vm->execute(getOrLoadScript("bind_resource_loaders.lua")); this->bind(vm); return vm; } + scripting::ScriptPtr LuaStyle::getOrLoadScript(const string& filename) + { + YAKE_ASSERT(scriptingSys_); + ScriptMap::const_iterator it = scripts_.find(filename); + if (it != scripts_.end()) + return it->second; + + scripting::ScriptPtr script = scriptingSys_->createScriptFromFile(filename); + if (script) + scripts_[filename] = script; + return script; + } void LuaStyle::createVM(const string& widgetType,const string& fn) { vm_[ widgetType ].reset( new LuaStyleWidgetEntry() ); @@ -420,8 +458,8 @@ // widgetEntry->vm = this->createVM(); - lua_State* L = widgetEntry->vm->state(); - widgetEntry->vm->doFile( fn.c_str() ); + lua_State* L = state(widgetEntry->vm); + widgetEntry->vm->execute( getOrLoadScript(fn) ); // for (luabind::iterator it(luabind::globals(L)["property"]), end; it != end; ++it) @@ -458,7 +496,7 @@ luabind::object o = entry.methods.find("minimumSize")->second; - luabind::globals(entry.vm->state())["this"] = &w; + luabind::globals(state(entry.vm))["this"] = &w; AbsSize value = luabind::call_function<AbsSize>( o ); return value; @@ -479,7 +517,7 @@ if (itVM != this->vm_.end()) { try { - luabind::object o = luabind::globals(itVM->second->vm->state())["renderCursor"]; + luabind::object o = luabind::globals(state(itVM->second->vm))["renderCursor"]; assert( luabind::type(o) == LUA_TFUNCTION ); //luabind::call_function(); o( pos.x, pos.y ); @@ -527,7 +565,7 @@ assert( batcher_ ); batcher_->setCurrentWidget( w, zLevel ); - luabind::globals(entry.vm->state())["this"] = &w; + luabind::globals(state(entry.vm))["this"] = &w; o(); } Modified: trunk/yake/yake/gui2/plugins/style.lua/style.lua.h =================================================================== --- trunk/yake/yake/gui2/plugins/style.lua/style.lua.h 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/yake/gui2/plugins/style.lua/style.lua.h 2008-04-22 18:19:42 UTC (rev 1916) @@ -2,11 +2,11 @@ #define UI_LUASTYLE_H #include "yake/gui2/style.h" +#include "yake/scripting/scripting.h" namespace yake { namespace ui { - struct LuaVM; - typedef boost::shared_ptr<LuaVM> VMPtr; + typedef scripting::VMPtr VMPtr; struct LuaStyleWidgetEntry; typedef boost::shared_ptr<LuaStyleWidgetEntry> LuaStyleWidgetEntryPtr; struct LuaStyleBatcher; @@ -15,6 +15,7 @@ YAKE_DECLARE_CONCRETE(LuaStyle,"yake.lua") public: LuaStyle(SystemPtr,WindowRendererPtr); + virtual ~LuaStyle(); virtual AbsSize determineMinimumSize(Widget&); virtual void renderSingleWidget(Widget&, const int zLevel); virtual void renderCursor(const Position&, const int zLevel); @@ -22,9 +23,10 @@ //void loadWidgetStyle(const string& scriptFile, const string& widgetType = ""); private: typedef std::map<string,LuaStyleWidgetEntryPtr> VmMap; - VmMap vm_; - //typedef std::map<string,string> ScriptMap; - //ScriptMap widgetScripts_; + VmMap vm_; + typedef std::map<string,scripting::ScriptPtr> ScriptMap; + ScriptMap scripts_; + SharedPtr<scripting::IScriptingSystem> scriptingSys_; //typedef std::map<string,string> NamedImagesMap; //NamedImagesMap images_; @@ -36,6 +38,7 @@ void bind(VMPtr); VMPtr createVM(); void createVM(const string&,const string&); + scripting::ScriptPtr getOrLoadScript(const string& filename); }; } // namespace ui } // namespace yake Modified: trunk/yake/yake/gui2/widget/button.h =================================================================== --- trunk/yake/yake/gui2/widget/button.h 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/yake/gui2/widget/button.h 2008-04-22 18:19:42 UTC (rev 1916) @@ -6,7 +6,7 @@ namespace yake { namespace ui { - struct Button : public Widget + struct YAKE_GUI_API Button : public Widget { YAKE_WIDGET(Button); Modified: trunk/yake/yake/gui2/widget/dialog.h =================================================================== --- trunk/yake/yake/gui2/widget/dialog.h 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/yake/gui2/widget/dialog.h 2008-04-22 18:19:42 UTC (rev 1916) @@ -7,7 +7,7 @@ namespace yake { namespace ui { - struct Dialog : public Widget + struct YAKE_GUI_API Dialog : public Widget { YAKE_WIDGET(Dialog); Modified: trunk/yake/yake/gui2/widget/panel.h =================================================================== --- trunk/yake/yake/gui2/widget/panel.h 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/yake/gui2/widget/panel.h 2008-04-22 18:19:42 UTC (rev 1916) @@ -6,7 +6,7 @@ namespace yake { namespace ui { - struct Panel : public Widget + struct YAKE_GUI_API Panel : public Widget { YAKE_WIDGET(Panel); Panel(const string& id) : Widget(id) Modified: trunk/yake/yake/gui2/widget/static_text.h =================================================================== --- trunk/yake/yake/gui2/widget/static_text.h 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/yake/gui2/widget/static_text.h 2008-04-22 18:19:42 UTC (rev 1916) @@ -10,7 +10,7 @@ @property text string @property fontsize real */ - struct StaticText : public Widget + struct YAKE_GUI_API StaticText : public Widget { YAKE_WIDGET(StaticText); StaticText(const string& id); Modified: trunk/yake/yake/gui2/widget/text_edit.h =================================================================== --- trunk/yake/yake/gui2/widget/text_edit.h 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/yake/gui2/widget/text_edit.h 2008-04-22 18:19:42 UTC (rev 1916) @@ -7,7 +7,7 @@ namespace yake { namespace ui { - struct TextEdit : public Panel + struct YAKE_GUI_API TextEdit : public Panel { YAKE_WIDGET(TextEdit); Modified: trunk/yake/yake/gui2/widget/titlebar.h =================================================================== --- trunk/yake/yake/gui2/widget/titlebar.h 2008-04-22 18:17:42 UTC (rev 1915) +++ trunk/yake/yake/gui2/widget/titlebar.h 2008-04-22 18:19:42 UTC (rev 1916) @@ -9,7 +9,7 @@ namespace yake { namespace ui { /** @todo convert into Behaviour !? */ - struct Titlebar : public Panel + struct YAKE_GUI_API Titlebar : public Panel { YAKE_WIDGET(Titlebar); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-04-22 18:19:01
|
Revision: 1915 http://yake.svn.sourceforge.net/yake/?rev=1915&view=rev Author: psyclonist Date: 2008-04-22 11:17:42 -0700 (Tue, 22 Apr 2008) Log Message: ----------- * [bindings.lua] provided global 'dofile' for compatibility with Lua's dofile Modified Paths: -------------- trunk/yake/common/media/scripts/bind_resource_loaders.lua Modified: trunk/yake/common/media/scripts/bind_resource_loaders.lua =================================================================== --- trunk/yake/common/media/scripts/bind_resource_loaders.lua 2008-04-22 18:14:05 UTC (rev 1914) +++ trunk/yake/common/media/scripts/bind_resource_loaders.lua 2008-04-22 18:17:42 UTC (rev 1915) @@ -19,6 +19,7 @@ end return nil end + dofile = yake.dofile else assert( 1==0, "resource loaders already bound") end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-04-22 18:14:23
|
Revision: 1914 http://yake.svn.sourceforge.net/yake/?rev=1914&view=rev Author: psyclonist Date: 2008-04-22 11:14:05 -0700 (Tue, 22 Apr 2008) Log Message: ----------- * [gui] added "lua style" media Added Paths: ----------- trunk/yake/common/media/gui2/styles/lua1/cursor2-glass1.png Added: trunk/yake/common/media/gui2/styles/lua1/cursor2-glass1.png =================================================================== (Binary files differ) Property changes on: trunk/yake/common/media/gui2/styles/lua1/cursor2-glass1.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2008-04-22 18:13:24
|
Revision: 1913 http://yake.svn.sourceforge.net/yake/?rev=1913&view=rev Author: psyclonist Date: 2008-04-22 11:12:42 -0700 (Tue, 22 Apr 2008) Log Message: ----------- * [media] updated media (fonts, OgreCore.zip) Modified Paths: -------------- trunk/yake/common/media/OgreCore.zip Added Paths: ----------- trunk/yake/common/media/graphics.fonts/bluebold.ttf trunk/yake/common/media/graphics.fonts/bluecond.ttf trunk/yake/common/media/graphics.fonts/bluehigh.ttf trunk/yake/common/media/graphics.fonts/read_me.html trunk/yake/common/media/graphics.fonts/sample.fontdef Modified: trunk/yake/common/media/OgreCore.zip =================================================================== (Binary files differ) Added: trunk/yake/common/media/graphics.fonts/bluebold.ttf =================================================================== (Binary files differ) Property changes on: trunk/yake/common/media/graphics.fonts/bluebold.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/yake/common/media/graphics.fonts/bluecond.ttf =================================================================== (Binary files differ) Property changes on: trunk/yake/common/media/graphics.fonts/bluecond.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/yake/common/media/graphics.fonts/bluehigh.ttf =================================================================== (Binary files differ) Property changes on: trunk/yake/common/media/graphics.fonts/bluehigh.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/yake/common/media/graphics.fonts/read_me.html =================================================================== --- trunk/yake/common/media/graphics.fonts/read_me.html (rev 0) +++ trunk/yake/common/media/graphics.fonts/read_me.html 2008-04-22 18:12:42 UTC (rev 1913) @@ -0,0 +1,2 @@ +<html><head><title>Larabie Fonts "read me" file, license and FAQ</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta name="keywords" content="typodermic,typo dermic,fonts,Larabie,Larabie Fonts,fontd,fotn,fnots,fons,fots,fnts,font,truetype,typefaces,typeface,logo,ttf,opentype,larbie,laribie,larby,larabee,lairby,larrabie,larraby,laraby,typography,Type1,postscript,macintosh,windows,design,lettering,type"><font face="Georgia"><h3>LARABIE FONTS \x93README.TXT\x94</h3><p>All Larabie Fonts in this file are free to use for personal and/or commercial purposes. No payment is necessary to use these fonts for personal or commercial use. For Software Products who want to include Larabie Fonts see the License Agreement below. You can add this font to a website but do not combine fonts into a single archive or alter them in any way.</p><p>All Larabie Fonts are free for commercial use but a sample of your product would be gratefully appreciated so I can see how the font looks in use. Contact <a href="http://www.larabiefonts.com/donation.html">www.larabiefonts.com/donation.html</a> for mailing information.</p><p>Some Larabie Fonts have enhanced and expanded families available for sale at <a href="http://www.typodermic.com">www.typodermic.com</a>.</p><p>If you'd like to make a voluntary donation to Larabie Fonts for the use of the free fonts in any amount please go to <a href="http://www.larabiefonts.com/donation.html">www.larabiefonts.com/donation.html</a></p><p>I accept CDs, magazines, t-shirts, a sample of your merchandise or anything featuring Larabie Fonts. Please remember to list your item as a \x91gift\x92 on the customs form or I will have to pay import duties and taxes on the item. Mailing information is provided at the link above.</p><p>Font installation help is available at <a href="http://www.larabiefonts.com/help.html">www.larabiefonts.com/help.html</a></p><h3>LARABIE FONTS FREQUENTLY ASKED QUESTIONS</h3><ul><li>Q: How do use these fonts in my favourite software?<li>A: In Windows, you take the fonts out of the ZIP archive and place them in your fonts folder which can be found in your Control Panel. The next time you run your software, the font will be available. For example: If you install a new font, the next time you run Microsoft Word, that font will be available in the menu under Format / Font. For anything more complicated, or Mac installation, visit <a href="http://www.larabiefonts.com/help.html">www.larabiefonts.com/help.html</a></ul><ul><li>Q: How can I use this font in <a href="http://www.aol.com/aim/">AOL Instant Messenger</a>, <a href="http://messenger.msn.com/">MSN Messenger</a>, <a href="http://www.microsoft.com/office/outlook/">Outlook</a>, <a href="http://www.microsoft.com/office/outlook/">Outlook Express</a>, <a href="http://www.eudora.com/">Euodora</a> or any other email software?<li>A: At the time of this writing (Feb 2004) you can\x92t. After installing one of my fonts, you may be able to select it in the above applications but the person at the other end won\x92t see that same thing unless they have the font installed. If you really want to use my fonts in these applications, make sure the people at the other end have the same fonts installed.</ul><ul><li>Q: How can I use these fonts on a web page?<li>A: If you\x92re creating a web page using Flash, it\x92s easy. Consult your Flash manual. If you\x92re using <a href="http://www.adobe.com/products/acrobat/">Acrobat</a>, make sure the font embedding settings are turned on. Consult your Acrobat manual. For anything else there are limitations: If you want to use one of my fonts as your main, text font you\x92re pretty much out of luck unless you explore a font embedding tool such as <a href="http://www.microsoft.com/typography/web/embedding/weft/">WEFT</a> but I don\x92t recommend it. To use my fonts as headings or titles, use image creation software such as <a href="http://www.gimp.org/">The Gimp</a>, <a href="http://www.adobe.com/products/photoshop/">Photoshop</a>, <a href="http://www.jasc.com/">Paint Shop Pro</a>, <a href="http://www.google.com/search?q=pixia">Pixia</a> etc. Save the images as GIF files and place them on your web page. There\x92s a lot more to it than can be explained here but there are countless books available on web page design.</ul><ul><li>Q: How can I make these fonts bigger?<li>A: All my fonts are infinitely scalable; the limitations are in your software. A common problem is scaling fonts in Microsoft Word. If you choose Format / Font you can type in any number you like under \x93size\x94.</ul><ul><li>Q: Are these fonts really free?<li>A: Yes they are. Some fonts such as <a href="http://www.typodermic.com/fonts/19.html">Neuropol</a> have expanded font families available for sale at <a href="http://www.typodermic.com">www.typodermic.com</a> but the version you downloaded at Larabie Fonts is free.</ul><ul><li>Q: Your licence agreement states that the fonts can\x92t be altered. Does that mean I can\x92t mess around with your fonts in Photoshop/Illustrator/Publisher etc?<li>A: Those license restrictions refer to altering the actual fonts themselves, not what you make with them. As long as you don\x92t alter the font files in font creation software such as FontLab or Fontographer you\x92re free to create anything you like with them.</ul><ul><li>Q: Can I use your fonts in a logo?<li>A: Yes. But check with a lawyer if you\x92re not sure. It\x92s okay with me if you use it but do so at your own risk.</ul><ul><li>Q: Can I send you a sample of the nifty thing I created with your fonts?<li>A: Of course. Check <a href="http://www.larabiefonts.com/donation.html">www.larabiefonts.com/donation.html</a> for my current email or mailing address.</ul><ul><li>Q: Can you make a custom font for me?<li>A: Possibly. Check <a href="http://typodermic.com/custom.html">typodermic.com/custom.html</a> for details. Keep in mind that making fonts is my full-time job so no freebies.</ul><ul><li>Q: I want to sell software that includes you font files.<li>A: Contact me first at <a href="http://www.larabiefonts.com/email.html">www.larabiefonts.com/email.html</a>.</ul><ul><li>Q: I want to sell rubber stamp alphabets, alphabet punches or stencil alphabets using your font designs.<li>A: Contact me first at <a href="http://www.larabiefonts.com/email.html">www.larabiefonts.com/email.html</a>.</ul><ul><li>Q: My software won\x92t let me embed one of your fonts.<li>A: You may have an old version of one of my fonts. Uninstall it and install a current version on Larabie Fonts.</ul><ul><li>Q: Can you help me find a font?<li>A: I really don\x92t have the time but if you send a donation, I can give it a try. If not. post your question on my font forum: <a href="http://www.larabiefonts.com/info.html">www.larabiefonts.com/info.html</a>.</ul><h3>LARABIE FONTS END-USER LICENSE AGREEMENT FOR SOFTWARE PRODUCTS</h3><h4>SOFTWARE PRODUCT LICENSE</h4><p>The SOFTWARE PRODUCT is protected by copyright laws and International copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.</p><h5>1. GRANT OF LICENSE. This document grants you the following rights:</h5><p>- Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT. You may copy and distribute unlimited copies of the SOFTWARE PRODUCT as you receive them, in any medium, provided that you publish on each copy an appropriate copyright notice. Keep intact all the notices that refer to this License and give any other recipients of the fonts a copy of this License along with the fonts.</p><h5>2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.</h5><p>- You may modify your copy or copies of the SOFTWARE PRODUCT or any portion of it, provided that you also meet all of these rules:</p><p>a) Do not alter in any way alphanumeric characters (A-Z, a-z, 1-9) contained in the font. An exception is converting between formats, here is allowed the nominal distortion that occurs during conversion from second order to third order quadratic curves (TrueType to Postscript) and vice versa.</p><p>b) Extra characters may be added; here it is allowed to use curves (shapes) from alphanumeric characters in fonts under same license.</p><p>c) It is allowed to modify and remove analpahbetics (punctuation, special characters, ligatures and symbols).</p><p>d) The original font name must be retained but can be augmented. (ie. a Font named Blue Highway can be renamed Blue Highway Cyrillic or Blue Highway ANSI, etc.)</p><p>e) Character mapping may be altered.</p><p>f) If the kerning information is altered or discarded it must be stated in the user notes or documentation.</p><p>g) All modifications must be released under this license.</p></p>LIMITED WARRANTY NO WARRANTIES. Larabie Fonts expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or non-infringement. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.</p><p>NO LIABILITY FOR CONSEQUENTIAL DAMAGES. In no event shall Larabie Fonts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if Larabie Fonts has been advised of the possibility of such damages.</p><h5>3. MISCELLANEOUS</h5><p>Should you have any questions concerning this document, or if you desire to contact Larabie Fonts for any reason, please email <a href="http://www.larabiefonts.com/email.html">www.larabiefonts.com/email.html</a>.</p></font></BODY></HTML> + Added: trunk/yake/common/media/graphics.fonts/sample.fontdef =================================================================== --- trunk/yake/common/media/graphics.fonts/sample.fontdef (rev 0) +++ trunk/yake/common/media/graphics.fonts/sample.fontdef 2008-04-22 18:12:42 UTC (rev 1913) @@ -0,0 +1,11 @@ +StarWars +{ + // Now this one I agree with ;) + // A Star Wars font :) + type truetype + source solo5.ttf + size 16 + resolution 96 +} + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |