yake-svn Mailing List for Yake Engine (Page 7)
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...> - 2007-11-08 18:41:05
|
Revision: 1887 http://yake.svn.sourceforge.net/yake/?rev=1887&view=rev Author: psyclonist Date: 2007-11-08 10:40:55 -0800 (Thu, 08 Nov 2007) Log Message: ----------- * [bindings.lua] added overload for graphics::ISceneNode::createChildNode() Modified Paths: -------------- trunk/yake/src/bindings.lua/detail/graphics.lua.cpp Modified: trunk/yake/src/bindings.lua/detail/graphics.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/graphics.lua.cpp 2007-11-05 22:26:03 UTC (rev 1886) +++ trunk/yake/src/bindings.lua/detail/graphics.lua.cpp 2007-11-08 18:40:55 UTC (rev 1887) @@ -98,6 +98,10 @@ { return (w ? w->createSceneNode() : 0); } + ISceneNode* ISceneNode_createChildNode_NoName(ISceneNode* n) + { + return (n ? n->createChildNode() : 0); + } void bind( lua_State* L ) { @@ -126,6 +130,7 @@ .def("setInheritScale", &ISceneNode::setInheritScale) .def("addChild", &ISceneNode::addChildNode) .def("createChildNode", &ISceneNode::createChildNode) + .def("createChildNode", &ISceneNode_createChildNode_NoName) .def("attach", &ISceneNode::attachEntity) .def("attach", &ISceneNode::attachCamera) .def("attach", &ISceneNode::attachLight) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-11-05 22:26:08
|
Revision: 1886 http://yake.svn.sourceforge.net/yake/?rev=1886&view=rev Author: psyclonist Date: 2007-11-05 14:26:03 -0800 (Mon, 05 Nov 2007) Log Message: ----------- * [demo] fixed scaling issue in physics demo #1 Modified Paths: -------------- trunk/yake/samples/physics/demo/yakeDemo.cpp Modified: trunk/yake/samples/physics/demo/yakeDemo.cpp =================================================================== --- trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-10-29 22:01:34 UTC (rev 1885) +++ trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-11-05 22:26:03 UTC (rev 1886) @@ -129,7 +129,7 @@ bool createBox( SharedPtr<physics::IWorld> pPWorld, Simple & rSimple, const Point3 & rkPosition, const Vector3 & rkDimensions ) { // graphics - createSimpleGraphicalObject( rSimple, "box_1x1x1.mesh", Point3::kZero, 2*rkDimensions ); + createSimpleGraphicalObject( rSimple, "box_1x1x1.mesh", Point3::kZero, rkDimensions ); // physics createSimpleActor( pPWorld, rSimple, physics::IShape::BoxDesc(rkDimensions), rkPosition ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-10-29 22:01:42
|
Revision: 1885 http://yake.svn.sourceforge.net/yake/?rev=1885&view=rev Author: psyclonist Date: 2007-10-29 15:01:34 -0700 (Mon, 29 Oct 2007) Log Message: ----------- * [base/native] Linux: use RTLD_NOW|RTLD_GLOBAL instead of RTLD_LAZY. Modified Paths: -------------- trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp Modified: trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp =================================================================== --- trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp 2007-10-28 20:33:13 UTC (rev 1884) +++ trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp 2007-10-29 22:01:34 UTC (rev 1885) @@ -61,17 +61,17 @@ assert( pFilename && "Invalid filename." ); String name( pFilename ); - + // dlopen() does not add .so to the filename, like windows does for .dll if ( name.size() > 3 && name.substr( name.length() - 3, 3 ) != ".so" ) name += ".so"; - + #ifdef YAKE_DEBUG debug_Print( String( "yake:Trying to load " + name ).c_str() ); #endif - LibraryHandle handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_LAZY ); - + LibraryHandle handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_NOW|RTLD_GLOBAL ); + // trying to load library with "lib" prefix if ( handle == NULL ) { @@ -83,8 +83,8 @@ #ifdef YAKE_DEBUG debug_Print( String( "yake:Trying to load " + name ).c_str() ); #endif - handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_LAZY ); - + handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_NOW|RTLD_GLOBAL ); + if ( handle == NULL ) { throw "Failed to load " + name + " (" + pFilename + ") due to " + String( dlerror() ); @@ -97,7 +97,7 @@ #ifdef YAKE_DEBUG debug_Print( String( "yake:successfully loaded " + name ).c_str() ); #endif - + return handle; } @@ -111,7 +111,7 @@ return address; } - + void library_Free( LibraryHandle library ) { assert( library && "Invalid library handle" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-10-28 20:33:09
|
Revision: 1884 http://yake.svn.sourceforge.net/yake/?rev=1884&view=rev Author: psyclonist Date: 2007-10-28 13:33:13 -0700 (Sun, 28 Oct 2007) Log Message: ----------- * [media] added missing cegui data files (thanks Tomen for spotting this!) Added Paths: ----------- trunk/yake/common/media/gui/fonts/ trunk/yake/common/media/gui/fonts/Iconified-12.font trunk/yake/common/media/gui/fonts/Iconiv2.ttf trunk/yake/common/media/gui/fonts/Legal.txt trunk/yake/common/media/gui/fonts/README trunk/yake/common/media/gui/fonts/icon.txt trunk/yake/common/media/gui/imagesets/ trunk/yake/common/media/gui/imagesets/Vanilla.imageset trunk/yake/common/media/gui/imagesets/vanilla.tga trunk/yake/common/media/gui/looknfeel/ trunk/yake/common/media/gui/looknfeel/Vanilla.looknfeel trunk/yake/common/media/gui/schemes/ trunk/yake/common/media/gui/schemes/VanillaSkin.scheme Added: trunk/yake/common/media/gui/fonts/Iconified-12.font =================================================================== --- trunk/yake/common/media/gui/fonts/Iconified-12.font (rev 0) +++ trunk/yake/common/media/gui/fonts/Iconified-12.font 2007-10-28 20:33:13 UTC (rev 1884) @@ -0,0 +1,2 @@ +<?xml version="1.0" ?> +<Font Name="Iconified-12" Filename="Iconiv2.ttf" Type="FreeType" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/> Added: trunk/yake/common/media/gui/fonts/Iconiv2.ttf =================================================================== (Binary files differ) Property changes on: trunk/yake/common/media/gui/fonts/Iconiv2.ttf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/yake/common/media/gui/fonts/Legal.txt =================================================================== --- trunk/yake/common/media/gui/fonts/Legal.txt (rev 0) +++ trunk/yake/common/media/gui/fonts/Legal.txt 2007-10-28 20:33:13 UTC (rev 1884) @@ -0,0 +1,29 @@ +The file fkp.de.pcf is a X11 bitmap font, taken from the artwiz font collection: +http://artwizaleczapka.sourceforge.net + +artwiz-aleczapka is released under the terms of GNU General Public License +(GPL) version 2. Read file 'COPYING' from the artwiz package for detailed info. + +================================================================================ + +DejaVuSans.ttf is a international TrueType font from the excellent DejaVu font +package, which is distributed under the conditions of the Bitstream Vera Fonts +Copyright, which can be found in the DejaVu package. + +DejaVu fonts 2.2 (c)2004-2006 Stepan Roh and DejaVu fonts team +-------------------------------------------------------------- + +The DejaVu fonts are a font family based on the Bitstream Vera Fonts +(http://gnome.org/fonts/). Its purpose is to provide a wider range of +characters (see status.txt for more information) while maintaining the +original look and feel. + +DejaVu fonts are based on Bitstream Vera fonts version 1.10. + +================================================================================ + +FairChar.font is a image-based font from the good old days of the demo scene, +when 320x240 and 320x480 were the best resolutions invented ever ;-) I don't +know who is the original author of these nice glyphs, everything but the .GIF +file was lost in the long road from early 90s, when I got it from some BBS +to nowadays... -- Andrew Zabolotny. Added: trunk/yake/common/media/gui/fonts/README =================================================================== --- trunk/yake/common/media/gui/fonts/README (rev 0) +++ trunk/yake/common/media/gui/fonts/README 2007-10-28 20:33:13 UTC (rev 1884) @@ -0,0 +1,4 @@ +The fonts in this directory were obtained from Iconian Fonts and may be freely used for all non-commercial uses. + +http://www.iconian.com/ + \ No newline at end of file Added: trunk/yake/common/media/gui/fonts/icon.txt =================================================================== --- trunk/yake/common/media/gui/fonts/icon.txt (rev 0) +++ trunk/yake/common/media/gui/fonts/icon.txt 2007-10-28 20:33:13 UTC (rev 1884) @@ -0,0 +1,11 @@ +Iconified Truetype Font for Windows version 2 + +2003 Iconian Fonts - Daniel Zadorozny + +http://www.iconian.com/ + +"Iconified" was named by Graham Meade of Gemfonts (http://skyscraper.fortunecity.com/windows/3/maingemnew.htm) + +This font may be freely distributed and is free for all non-commercial uses. This font is e-mailware; that is, if you like it, please e-mail the author at: + +ic...@ao... \ No newline at end of file Added: trunk/yake/common/media/gui/imagesets/Vanilla.imageset =================================================================== --- trunk/yake/common/media/gui/imagesets/Vanilla.imageset (rev 0) +++ trunk/yake/common/media/gui/imagesets/Vanilla.imageset 2007-10-28 20:33:13 UTC (rev 1884) @@ -0,0 +1,21 @@ +<?xml version="1.0" ?> +<Imageset Name="Vanilla-Images" Imagefile="vanilla.tga" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"> + <Image Name="GenericBrush" XPos="46" YPos="46" Width="3" Height="3" /> + <Image Name="FrameTopLeft" XPos="1" YPos="1" Width="6" Height="6" /> + <Image Name="FrameTopRight" XPos="10" YPos="1" Width="6" Height="6" /> + <Image Name="FrameBottomLeft" XPos="1" YPos="10" Width="6" Height="6" /> + <Image Name="FrameBottomRight" XPos="10" YPos="10" Width="6" Height="6" /> + <Image Name="FrameLeft" XPos="1" YPos="18" Width="6" Height="1" /> + <Image Name="FrameRight" XPos="10" YPos="18" Width="6" Height="1" /> + <Image Name="FrameTop" XPos="18" YPos="1" Width="1" Height="6" /> + <Image Name="FrameBottom" XPos="18" YPos="10" Width="1" Height="6" /> + <Image Name="ScrollUpArrow" XPos="1" YPos="22" Width="20" Height="20" /> + <Image Name="ScrollDownArrow" XPos="22" YPos="22" Width="20" Height="20" /> + <Image Name="VertScrollContainer" XPos="69" YPos="3" Width="20" Height="1" /> + <Image Name="ScrollLeftArrow" XPos="21" YPos="1" Width="20" Height="20" /> + <Image Name="ScrollRightArrow" XPos="42" YPos="1" Width="20" Height="20" /> + <Image Name="HorzScrollContainer" XPos="65" YPos="1" Width="1" Height="20" /> + <Image Name="ScrollbarThumb" XPos="43" YPos="22" Width="20" Height="20" /> + <Image Name="ShadowBrush" XPos="4" YPos="45" Width="24" Height="24" /> + <Image Name="MouseArrow" XPos="69" YPos="7" Width="17" Height="25" /> +</Imageset> Added: trunk/yake/common/media/gui/imagesets/vanilla.tga =================================================================== (Binary files differ) Property changes on: trunk/yake/common/media/gui/imagesets/vanilla.tga ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/yake/common/media/gui/looknfeel/Vanilla.looknfeel =================================================================== --- trunk/yake/common/media/gui/looknfeel/Vanilla.looknfeel (rev 0) +++ trunk/yake/common/media/gui/looknfeel/Vanilla.looknfeel 2007-10-28 20:33:13 UTC (rev 1884) @@ -0,0 +1,1076 @@ +<?xml version="1.0" ?> +<Falagard> + <WidgetLook name="Vanilla/Shared"> + <ImagerySection name="Frame"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image type="TopLeftCorner" imageset="Vanilla-Images" image="FrameTopLeft" /> + <Image type="TopRightCorner" imageset="Vanilla-Images" image="FrameTopRight" /> + <Image type="BottomLeftCorner" imageset="Vanilla-Images" image="FrameBottomLeft" /> + <Image type="BottomRightCorner" imageset="Vanilla-Images" image="FrameBottomRight" /> + <Image type="LeftEdge" imageset="Vanilla-Images" image="FrameLeft" /> + <Image type="TopEdge" imageset="Vanilla-Images" image="FrameTop" /> + <Image type="RightEdge" imageset="Vanilla-Images" image="FrameRight" /> + <Image type="BottomEdge" imageset="Vanilla-Images" image="FrameBottom" /> + <Image type="Background" imageset="Vanilla-Images" image="GenericBrush" /> + </FrameComponent> + </ImagerySection> + + <ImagerySection name="FrameOnly"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image type="TopLeftCorner" imageset="Vanilla-Images" image="FrameTopLeft" /> + <Image type="TopRightCorner" imageset="Vanilla-Images" image="FrameTopRight" /> + <Image type="BottomLeftCorner" imageset="Vanilla-Images" image="FrameBottomLeft" /> + <Image type="BottomRightCorner" imageset="Vanilla-Images" image="FrameBottomRight" /> + <Image type="LeftEdge" imageset="Vanilla-Images" image="FrameLeft" /> + <Image type="TopEdge" imageset="Vanilla-Images" image="FrameTop" /> + <Image type="RightEdge" imageset="Vanilla-Images" image="FrameRight" /> + <Image type="BottomEdge" imageset="Vanilla-Images" image="FrameBottom" /> + </FrameComponent> + </ImagerySection> + + <ImagerySection name="BackgroundOnly"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge"><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge"> + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge"> + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + <Image type="Background" imageset="Vanilla-Images" image="GenericBrush" /> + </FrameComponent> + </ImagerySection> + + <ImagerySection name="BackgroundOnlyFull"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image type="Background" imageset="Vanilla-Images" image="GenericBrush" /> + </FrameComponent> + </ImagerySection> + + </WidgetLook> + + <WidgetLook name="Vanilla/Titlebar"> + <PropertyDefinition name="CaptionColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> + <ImagerySection name="caption"> + <TextComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <ColourProperty name="CaptionColour" /> + <VertFormat type="CentreAligned" /> + <HorzFormat type="CentreAligned" /> + </TextComponent> + </ImagerySection> + <StateImagery name="Active"> + <Layer> + <Section section="caption" /> + </Layer> + </StateImagery> + <StateImagery name="Inactive"> + <Layer> + <Section section="caption" /> + </Layer> + </StateImagery> + <StateImagery name="Disabled"> + <Layer> + <Section section="caption" /> + </Layer> + </StateImagery> + </WidgetLook> + + + <WidgetLook name="Vanilla/Button"> + <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> + <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> + <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> + <PropertyDefinition name="DisabledTextColour" initialValue="FF888888" redrawOnWrite="true" /> + <Property name="WantsMultiClickEvents" value="False" /> + <ImagerySection name="label"> + <TextComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" offset="-4" type="BottomEdge" /></Dim> + </Area> + <VertFormat type="CentreAligned" /> + <HorzFormat type="WordWrapCentreAligned" /> + </TextComponent> + </ImagerySection> + <StateImagery name="Normal"> + <Layer> + <Section look="Vanilla/Shared" section="Frame"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + <Section section="label"> + <ColourProperty name="NormalTextColour" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="Hover"> + <Layer> + <Section look="Vanilla/Shared" section="Frame"> + <Colours topLeft="FF9F9F9F" topRight="FF9F9F9F" bottomLeft="FF9F9F9F" bottomRight="FF9F9F9F" /> + </Section> + <Section section="label"> + <ColourProperty name="HoverTextColour" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="Pushed"> + <Layer> + <Section look="Vanilla/Shared" section="Frame"> + <Colours topLeft="FF6F6F6F" topRight="FF6F6F6F" bottomLeft="FF6F6F6F" bottomRight="FF6F6F6F" /> + </Section> + <Section section="label"> + <ColourProperty name="PushedTextColour" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="Disabled"> + <Layer> + <Section look="Vanilla/Shared" section="Frame"> + <Colours topLeft="FF3F3F3F" topRight="FF3F3F3F" bottomLeft="FF3F3F3F" bottomRight="FF3F3F3F" /> + </Section> + <Section section="label"> + <ColourProperty name="DisabledTextColour" /> + </Section> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/FrameWindow"> + <PropertyLinkDefinition name="CaptionColour" widget="__auto_titlebar__" targetProperty="CaptionColour" initialValue="FFFFFFFF" /> + <PropertyLinkDefinition name="TitlebarFont" widget="__auto_titlebar__" targetProperty="Font" /> + <Property name="NSSizingCursorImage" value="set:Vanilla-Images image:MouseArrow" /> + <Property name="EWSizingCursorImage" value="set:Vanilla-Images image:MouseArrow" /> + <Property name="NWSESizingCursorImage" value="set:Vanilla-Images image:MouseArrow" /> + <Property name="NESWSizingCursorImage" value="set:Vanilla-Images image:MouseArrow" /> + <Property name="RollUpEnabled" value="False" /> + <NamedArea name="ClientWithTitleWithFrame"> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="7" /></Dim> + <Dim type="TopEdge"><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" offset="-7" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" offset="-7" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <NamedArea name="ClientWithTitleNoFrame"> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <NamedArea name="ClientNoTitleWithFrame"> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="7" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="7" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" offset="-7" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" offset="-7" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <NamedArea name="ClientNoTitleNoFrame"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim> + </Area> + </NamedArea> + <Child type="Vanilla/Titlebar" nameSuffix="__auto_titlebar__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> + <Dim type="Height" ><FontDim type="LineSpacing" padding="14" /></Dim> + </Area> + <Property name="AlwaysOnTop" value="False" /> + </Child> + <Child type="Vanilla/Button" nameSuffix="__auto_closebutton__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="-7" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="7" /></Dim> + <Dim type="Width" ><AbsoluteDim value="7" /></Dim> + <Dim type="Height" ><AbsoluteDim value="7" /></Dim> + </Area> + <HorzAlignment type="RightAligned" /> + <Property name="AlwaysOnTop" value="True" /> + </Child> + <ImagerySection name="withtitle_frame"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image type="TopLeftCorner" imageset="Vanilla-Images" image="FrameTopLeft" /> + <Image type="TopRightCorner" imageset="Vanilla-Images" image="FrameTopRight" /> + <Image type="BottomLeftCorner" imageset="Vanilla-Images" image="FrameBottomLeft" /> + <Image type="BottomRightCorner" imageset="Vanilla-Images" image="FrameBottomRight" /> + <Image type="LeftEdge" imageset="Vanilla-Images" image="FrameLeft" /> + <Image type="TopEdge" imageset="Vanilla-Images" image="FrameTop" /> + <Image type="RightEdge" imageset="Vanilla-Images" image="FrameRight" /> + <Image type="BottomEdge" imageset="Vanilla-Images" image="FrameBottom" /> + <Image type="Background" imageset="Vanilla-Images" image="GenericBrush" /> + <Colours topLeft="FF333333" topRight="FF333333" bottomLeft="FF333333" bottomRight="FF333333" /> + </FrameComponent> + </ImagerySection> + <ImagerySection name="notitle_frame"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image type="TopLeftCorner" imageset="Vanilla-Images" image="FrameTopLeft" /> + <Image type="TopRightCorner" imageset="Vanilla-Images" image="FrameTopRight" /> + <Image type="BottomLeftCorner" imageset="Vanilla-Images" image="FrameBottomLeft" /> + <Image type="BottomRightCorner" imageset="Vanilla-Images" image="FrameBottomRight" /> + <Image type="LeftEdge" imageset="Vanilla-Images" image="FrameLeft" /> + <Image type="TopEdge" imageset="Vanilla-Images" image="FrameTop" /> + <Image type="RightEdge" imageset="Vanilla-Images" image="FrameRight" /> + <Image type="BottomEdge" imageset="Vanilla-Images" image="FrameBottom" /> + <Image type="Background" imageset="Vanilla-Images" image="GenericBrush" /> + <Colours topLeft="FF333333" topRight="FF333333" bottomLeft="FF333333" bottomRight="FF333333" /> + </FrameComponent> + </ImagerySection> + <ImagerySection name="withtitle_noframe_client_area"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image type="TopLeftCorner" imageset="Vanilla-Images" image="FrameTopLeft" /> + <Image type="TopRightCorner" imageset="Vanilla-Images" image="FrameTopRight" /> + <Image type="BottomLeftCorner" imageset="Vanilla-Images" image="FrameBottomLeft" /> + <Image type="BottomRightCorner" imageset="Vanilla-Images" image="FrameBottomRight" /> + <Image type="LeftEdge" imageset="Vanilla-Images" image="FrameLeft" /> + <Image type="TopEdge" imageset="Vanilla-Images" image="FrameTop" /> + <Image type="RightEdge" imageset="Vanilla-Images" image="FrameRight" /> + <Image type="BottomEdge" imageset="Vanilla-Images" image="FrameBottom" /> + <Image type="Background" imageset="Vanilla-Images" image="GenericBrush" /> + <Colours topLeft="FF333333" topRight="FF333333" bottomLeft="FF333333" bottomRight="FF333333" /> + </FrameComponent> + </ImagerySection> + <ImagerySection name="notitle_noframe_client_area"> + <FrameComponent> + <Area> + <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image type="TopLeftCorner" imageset="Vanilla-Images" image="FrameTopLeft" /> + <Image type="TopRightCorner" imageset="Vanilla-Images" image="FrameTopRight" /> + <Image type="BottomLeftCorner" imageset="Vanilla-Images" image="FrameBottomLeft" /> + <Image type="BottomRightCorner" imageset="Vanilla-Images" image="FrameBottomRight" /> + <Image type="LeftEdge" imageset="Vanilla-Images" image="FrameLeft" /> + <Image type="TopEdge" imageset="Vanilla-Images" image="FrameTop" /> + <Image type="RightEdge" imageset="Vanilla-Images" image="FrameRight" /> + <Image type="BottomEdge" imageset="Vanilla-Images" image="FrameBottom" /> + <Image type="Background" imageset="Vanilla-Images" image="GenericBrush" /> + <Colours topLeft="FF333333" topRight="FF333333" bottomLeft="FF333333" bottomRight="FF333333" /> + </FrameComponent> + </ImagerySection> + <StateImagery name="ActiveWithTitleWithFrame"> + <Layer> + <Section section="withtitle_frame" /> + </Layer> + </StateImagery> + <StateImagery name="InactiveWithTitleWithFrame"> + <Layer> + <Section section="withtitle_frame" /> + </Layer> + </StateImagery> + <StateImagery name="DisabledWithTitleWithFrame"> + <Layer> + <Section section="withtitle_frame" /> + </Layer> + </StateImagery> + <StateImagery name="ActiveWithTitleNoFrame"> + <Layer> + <Section section="withtitle_noframe_client_area" /> + </Layer> + </StateImagery> + <StateImagery name="InactiveWithTitleNoFrame"> + <Layer> + <Section section="withtitle_noframe_client_area" /> + </Layer> + </StateImagery> + <StateImagery name="DisabledWithTitleNoFrame"> + <Layer> + <Section section="withtitle_noframe_client_area" /> + </Layer> + </StateImagery> + <StateImagery name="ActiveNoTitleWithFrame"> + <Layer> + <Section section="notitle_frame" /> + </Layer> + </StateImagery> + <StateImagery name="InactiveNoTitleWithFrame"> + <Layer> + <Section section="notitle_frame" /> + </Layer> + </StateImagery> + <StateImagery name="DisabledNoTitleWithFrame"> + <Layer> + <Section section="notitle_frame" /> + </Layer> + </StateImagery> + <StateImagery name="ActiveNoTitleNoFrame"> + <Layer> + <Section section="notitle_noframe_client_area" /> + </Layer> + </StateImagery> + <StateImagery name="InactiveNoTitleNoFrame"> + <Layer> + <Section section="notitle_noframe_client_area" /> + </Layer> + </StateImagery> + <StateImagery name="DisabledNoTitleNoFrame"> + <Layer> + <Section section="notitle_noframe_client_area" /> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/Editbox"> + <PropertyDefinition name="ReadOnlyBGColour" initialValue="FFDFDFDF" redrawOnWrite="true" /> + <PropertyDefinition name="NormalTextColour" initialValue="FF000000" redrawOnWrite="true" /> + <PropertyDefinition name="SelectedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> + <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" /> + <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" /> + <NamedArea name="TextArea"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="7" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-7" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-7" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <ImagerySection name="selection"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim> + </Area> + <Image imageset="Vanilla-Images" image="GenericBrush" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <ImagerySection name="Carat"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><AbsoluteDim value="2" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim> + </Area> + <Image imageset="Vanilla-Images" image="GenericBrush" /> + <Colours topLeft="FF2222FF" topRight="FF2222FF" bottomLeft="FF2222FF" bottomRight="FF2222FF" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <StateImagery name="Enabled"> + <Layer> + <Section look="Vanilla/Shared" section="Frame" /> + </Layer> + </StateImagery> + <StateImagery name="ReadOnly"> + <Layer> + <Section look="Vanilla/Shared" section="Frame" > + <ColourProperty name="ReadOnlyBGColour" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="Disabled"> + <Layer> + <Section look="Vanilla/Shared" section="Frame" > + <ColourProperty name="ReadOnlyBGColour" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="ActiveSelection"> + <Layer> + <Section section="selection"> + <ColourProperty name="ActiveSelectionColour" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="InactiveSelection"> + <Layer> + <Section section="selection"> + <ColourProperty name="InactiveSelectionColour" /> + </Section> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/VerticalScrollbarThumb"> + <Property name="VertFree" value="True" /> + <ImagerySection name="thumb"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim> + </Area> + <Image imageset="Vanilla-Images" image="ScrollbarThumb" /> + <Colours topLeft="FF494949" topRight="FF494949" bottomLeft="FF494949" bottomRight="FF494949" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <StateImagery name="Normal"> + <Layer> + <Section section="thumb" /> + </Layer> + </StateImagery> + <StateImagery name="Hover"> + <Layer> + <Section section="thumb" /> + </Layer> + </StateImagery> + <StateImagery name="Pushed"> + <Layer> + <Section section="thumb" /> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/HorizontalScrollbarThumb"> + <Property name="HorzFree" value="True" /> + <ImagerySection name="thumb"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim> + </Area> + <Image imageset="Vanilla-Images" image="ScrollbarThumb" /> + <Colours topLeft="FF494949" topRight="FF494949" bottomLeft="FF494949" bottomRight="FF494949" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <StateImagery name="Normal"> + <Layer> + <Section section="thumb" /> + </Layer> + </StateImagery> + <StateImagery name="Hover"> + <Layer> + <Section section="thumb" /> + </Layer> + </StateImagery> + <StateImagery name="Pushed"> + <Layer> + <Section section="thumb" /> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/HorizontalScrollbar"> + <NamedArea name="ThumbTrackArea"> + <Area> + <Dim type="LeftEdge"><WidgetDim widget="__auto_decbtn__" dimension="RightEdge" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"> + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <WidgetDim widget="__auto_incbtn__" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <Child type="Vanilla/Button" nameSuffix="__auto_incbtn__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Height" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim> + </Area> + <VertAlignment type="CentreAligned" /> + <HorzAlignment type="RightAligned" /> + <Property name="UseStandardImagery" value="False" /> + <Property name="NormalImage" value="set:Vanilla-Images image:ScrollRightArrow" /> + <Property name="HoverImage" value="set:Vanilla-Images image:ScrollRightArrow" /> + <Property name="PushedImage" value="set:Vanilla-Images image:ScrollRightArrow" /> + </Child> + <Child type="Vanilla/Button" nameSuffix="__auto_decbtn__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Height" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim> + </Area> + <VertAlignment type="CentreAligned" /> + <Property name="UseStandardImagery" value="False" /> + <Property name="NormalImage" value="set:Vanilla-Images image:ScrollLeftArrow" /> + <Property name="HoverImage" value="set:Vanilla-Images image:ScrollLeftArrow" /> + <Property name="PushedImage" value="set:Vanilla-Images image:ScrollLeftArrow" /> + </Child> + <Child type="Vanilla/HorizontalScrollbarThumb" nameSuffix="__auto_thumb__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Height" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim> + </Area> + </Child> + <ImagerySection name="main"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge"><WidgetDim widget="__auto_decbtn__" dimension="RightEdge" /></Dim> + <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge"> + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <WidgetDim widget="__auto_incbtn__" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + <Image imageset="Vanilla-Images" image="HorzScrollContainer" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <StateImagery name="Enabled"> + <Layer> + <Section section="main" /> + </Layer> + </StateImagery> + <StateImagery name="Disabled"> + <Layer> + <Section section="main" /> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/VerticalScrollbar"> + <Property name="VerticalScrollbar" value="True" /> + <NamedArea name="ThumbTrackArea"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><WidgetDim widget="__auto_decbtn__" dimension="BottomEdge" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1.0" type="BottomEdge"> + <DimOperator op="Subtract"> + <WidgetDim widget="__auto_incbtn__" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + </NamedArea> + <Child type="Vanilla/Button" nameSuffix="__auto_incbtn__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Width" /></Dim> + </Area> + <VertAlignment type="BottomAligned" /> + <HorzAlignment type="CentreAligned" /> + <Property name="UseStandardImagery" value="False" /> + <Property name="NormalImage" value="set:Vanilla-Images image:ScrollDownArrow" /> + <Property name="HoverImage" value="set:Vanilla-Images image:ScrollDownArrow" /> + <Property name="PushedImage" value="set:Vanilla-Images image:ScrollDownArrow" /> + </Child> + <Child type="Vanilla/Button" nameSuffix="__auto_decbtn__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Width" /></Dim> + </Area> + <HorzAlignment type="CentreAligned" /> + <Property name="UseStandardImagery" value="False" /> + <Property name="NormalImage" value="set:Vanilla-Images image:ScrollUpArrow" /> + <Property name="HoverImage" value="set:Vanilla-Images image:ScrollUpArrow" /> + <Property name="PushedImage" value="set:Vanilla-Images image:ScrollUpArrow" /> + </Child> + <Child type="Vanilla/VerticalScrollbarThumb" nameSuffix="__auto_thumb__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" type="Width" /></Dim> + </Area> + </Child> + <ImagerySection name="main"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><WidgetDim widget="__auto_decbtn__" dimension="BottomEdge" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1.0" type="BottomEdge"> + <DimOperator op="Subtract"> + <WidgetDim widget="__auto_incbtn__" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + <Image imageset="Vanilla-Images" image="VertScrollContainer" /> + <VertFormat type="Stretched" /> + <HorzFormat type="Stretched" /> + </ImageryComponent> + </ImagerySection> + <StateImagery name="Enabled"> + <Layer> + <Section section="main" /> + </Layer> + </StateImagery> + <StateImagery name="Disabled"> + <Layer> + <Section section="main" /> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/StaticImage"> + <PropertyDefinition name="ImageColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" /> + <PropertyDefinition name="VertFormatting" initialValue="Stretched" redrawOnWrite="true" /> + <PropertyDefinition name="HorzFormatting" initialValue="Stretched" redrawOnWrite="true" /> + <Property name="BackgroundEnabled" value="True" /> + <Property name="FrameEnabled" value="True" /> + <ImagerySection name="image_withframe"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + <ImageProperty name="Image" /> + <ColourRectProperty name="ImageColours" /> + <VertFormatProperty name="VertFormatting" /> + <HorzFormatProperty name="HorzFormatting" /> + </ImageryComponent> + </ImagerySection> + <ImagerySection name="image_noframe"> + <ImageryComponent> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim> + </Area> + <ImageProperty name="Image" /> + <ColourRectProperty name="ImageColours" /> + <VertFormatProperty name="VertFormatting" /> + <HorzFormatProperty name="HorzFormatting" /> + </ImageryComponent> + </ImagerySection> + <StateImagery name="Enabled" /> + <StateImagery name="Disabled" /> + <StateImagery name="EnabledFrame"> + <Layer> + <Section look="Vanilla/Shared" section="FrameOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="DisabledFrame"> + <Layer> + <Section look="Vanilla/Shared" section="FrameOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="WithFrameEnabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="WithFrameDisabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="NoFrameEnabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnlyFull"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="NoFrameDisabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnlyFull"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="WithFrameImage"> + <Layer> + <Section section="image_withframe" /> + </Layer> + </StateImagery> + <StateImagery name="NoFrameImage"> + <Layer> + <Section section="image_noframe" /> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/StaticText"> + <Property name="BackgroundEnabled" value="True" /> + <Property name="FrameEnabled" value="True" /> + <NamedArea name="WithFrameTextRenderArea"> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + </NamedArea> + <NamedArea name="WithFrameTextRenderAreaHScroll"> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" offset="-20" type="BottomEdge" /> + </Dim> + </Area> + </NamedArea> + <NamedArea name="WithFrameTextRenderAreaVScroll"> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" offset="-20" type="RightEdge" /> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + </NamedArea> + <NamedArea name="WithFrameTextRenderAreaHVScroll"> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" offset="-20" type="RightEdge" /> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" offset="-20" type="BottomEdge" /> + </Dim> + </Area> + </NamedArea> + <NamedArea name="NoFrameTextRenderArea"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <NamedArea name="NoFrameTextRenderAreaHScroll"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1" offset="-20" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <NamedArea name="NoFrameTextRenderAreaVScroll"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1" offset="-20" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <NamedArea name="NoFrameTextRenderAreaHVScroll"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="RightEdge" ><UnifiedDim scale="1" offset="-20" type="RightEdge" /></Dim> + <Dim type="BottomEdge" ><UnifiedDim scale="1" offset="-20" type="BottomEdge" /></Dim> + </Area> + </NamedArea> + <Child type="Vanilla/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" offset="-20" type="Width" /></Dim> + <Dim type="Height" ><AbsoluteDim value="20" /></Dim> + </Area> + <VertAlignment type="BottomAligned" /> + </Child> + <Child type="Vanilla/VerticalScrollbar" nameSuffix="__auto_vscrollbar__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim> + <Dim type="Width" ><AbsoluteDim value="20" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" offset="-20" type="Height" /></Dim> + </Area> + <HorzAlignment type="RightAligned" /> + </Child> + <StateImagery name="Enabled" /> + <StateImagery name="Disabled" /> + <StateImagery name="EnabledFrame"> + <Layer> + <Section look="Vanilla/Shared" section="FrameOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="DisabledFrame"> + <Layer> + <Section look="Vanilla/Shared" section="FrameOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="WithFrameEnabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="WithFrameDisabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnly"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="NoFrameEnabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnlyFull"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="NoFrameDisabledBackground"> + <Layer> + <Section look="Vanilla/Shared" section="BackgroundOnlyFull"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/Listbox"> + <Property name="ForceVertScrollbar" value="True" /> + <NamedArea name="ItemRenderingArea"> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Area> + </NamedArea> + <Child type="Vanilla/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="-5" /></Dim> + <Dim type="Width" ><UnifiedDim scale="1" offset="-25" type="Width" /></Dim> + <Dim type="Height" ><AbsoluteDim value="20" /></Dim> + </Area> + <VertAlignment type="BottomAligned" /> + </Child> + <Child type="Vanilla/VerticalScrollbar" nameSuffix="__auto_vscrollbar__"> + <Area> + <Dim type="LeftEdge" ><AbsoluteDim value="-5" /></Dim> + <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim> + <Dim type="Width" ><AbsoluteDim value="20" /></Dim> + <Dim type="Height" ><UnifiedDim scale="1" offset="-10" type="Height" /></Dim> + </Area> + <HorzAlignment type="RightAligned" /> + </Child> + <StateImagery name="Enabled"> + <Layer> + <Section look="Vanilla/Shared" section="Frame"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + <StateImagery name="Disabled"> + <Layer> + <Section look="Vanilla/Shared" section="Frame"> + <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" /> + </Section> + </Layer> + </StateImagery> + </WidgetLook> + + <WidgetLook name="Vanilla/MultiLineEditbox"> + <PropertyDefinition name="NormalTextColour" initialValue="FF000000" redrawOnWrite="true" /> + <PropertyDefinition name="SelectedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" /> + <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" /> + <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" /> + <Property name="SelectionBrushImage" value="set:Vanilla-Images image:GenericBrush" /> + <NamedArea name="TextArea"> + <Area> + <Dim type="LeftEdge" ><ImageDim imageset="Vanilla-Images" image="FrameLeft" dimension="Width" /></Dim> + <Dim type="TopEdge" ><ImageDim imageset="Vanilla-Images" image="FrameTop" dimension="Height" /></Dim> + <Dim type="RightEdge" > + <UnifiedDim scale="1" type="RightEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameRight" dimension="Width" /> + </DimOperator> + </UnifiedDim> + </Dim> + <Dim type="BottomEdge" > + <UnifiedDim scale="1" type="BottomEdge"> + <DimOperator op="Subtract"> + <ImageDim imageset="Vanilla-Images" image="FrameBottom" dimension="Height" /> + </DimOperator> + </UnifiedDim> + </Dim> + </Ar... [truncated message content] |
From: <psy...@us...> - 2007-10-28 20:21:12
|
Revision: 1883 http://yake.svn.sourceforge.net/yake/?rev=1883&view=rev Author: psyclonist Date: 2007-10-28 13:21:15 -0700 (Sun, 28 Oct 2007) Log Message: ----------- * [net] removed debug verification code Modified Paths: -------------- trunk/yake/yake/net/netBitstreamAdapters.h Modified: trunk/yake/yake/net/netBitstreamAdapters.h =================================================================== --- trunk/yake/yake/net/netBitstreamAdapters.h 2007-10-28 20:20:38 UTC (rev 1882) +++ trunk/yake/yake/net/netBitstreamAdapters.h 2007-10-28 20:21:15 UTC (rev 1883) @@ -43,17 +43,11 @@ stlsequence_data_sink& operator << (const uint8 rhs) { assert(data_); - for (size_t i=0; i<tmp_.size(); ++i) - { - assert(tmp_[i] == data_->at(i)); - } data_->push_back(rhs); - tmp_.push_back(rhs); return *this; } private: container_type* data_; - container_type tmp_; }; typedef stlsequence_data_sink<std::vector<uint8> > ByteVectorSink; typedef obitstream_base<ByteVectorSink> obitstream_vector; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-10-28 20:20:36
|
Revision: 1882 http://yake.svn.sourceforge.net/yake/?rev=1882&view=rev Author: psyclonist Date: 2007-10-28 13:20:38 -0700 (Sun, 28 Oct 2007) Log Message: ----------- * [net2] modified demo to use new serialization code Modified Paths: -------------- trunk/yake/samples/net2/message1/demo.cpp Modified: trunk/yake/samples/net2/message1/demo.cpp =================================================================== --- trunk/yake/samples/net2/message1/demo.cpp 2007-10-28 20:19:49 UTC (rev 1881) +++ trunk/yake/samples/net2/message1/demo.cpp 2007-10-28 20:20:38 UTC (rev 1882) @@ -1,36 +1,43 @@ #include <yake/base/yakePrerequisites.h> +#include <yake/base/yake.h> // for YAKE_ASSERT etc #include <yake/net2/net.h> #undef min #undef max -#include <yake/base/yake.h> // for YAKE_ASSERT etc #include <boost/bind.hpp> + using namespace yake; -#define YAKE_LOG_INFORMATION_X(X) \ -{ \ -std::stringstream ss; \ -ss << X; \ -YAKE_LOG_INFORMATION("demo",(ss.str())); \ -} - struct Hello { +private: + friend class boost::serialization::access; + template<class Archive> + void serialize(Archive & ar, const unsigned int version) + { + ar & message; + } +public: enum { ID = 1 }; Hello(const std::string& msg = "") : message(msg) {} std::string message; }; -namespace yake { -namespace net { - template<class Ar> - Ar& serialize(Ar& ar, Hello& rhs) + +struct c2sLoginReq +{ +private: + friend class boost::serialization::access; + template<class Archive> + void serialize(Archive & ar, const unsigned int version) { - ar & rhs.message; - return ar; + ar & user & passhash; } -} // namespace net -} // namespace yake +public: + enum { ID = 2 }; + std::string user; + std::string passhash; +}; #include <yake/base/yakeStderrLog.h> #include <boost/thread/thread.hpp> @@ -120,7 +127,7 @@ } }; server_type server(io, - "localhost", // <- throws exception of invalid + "localhost", // <- throws exception if invalid 40000, boost::bind(&ServerHandler::onCreateConnection,_1,_2)); @@ -196,6 +203,7 @@ boost::thread netThread( boost::bind(&net::io_service::run,&netIo_) ); // Send some data (or enqueue, depending on connection state) + net::ArchiveContext arCtx; //<- reuse of context improves performance. for (size_t i=0; i<10; ++i) { #if 0 @@ -205,9 +213,15 @@ c->async_send(p,&onConnection); //net::async_send( *c, p, Hello("yeeha"), &onConnection ); #else - net::async_send( *c, Hello("yeeha"), &ClientHandler::onConnection ); + net::async_send( *c, Hello("yeeha"), &ClientHandler::onConnection, arCtx ); #endif } + { + c2sLoginReq req; + req.user = "admin"; + req.passhash = "letme"; + net::async_send( *c, req, &ClientHandler::onConnection, arCtx ); + } // Wait for the connection thread to exit. netThread.join(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-10-28 20:19:44
|
Revision: 1881 http://yake.svn.sourceforge.net/yake/?rev=1881&view=rev Author: psyclonist Date: 2007-10-28 13:19:49 -0700 (Sun, 28 Oct 2007) Log Message: ----------- * [net] removed debug verification code Added Paths: ----------- trunk/yake/yake/net2/serialization.h Added: trunk/yake/yake/net2/serialization.h =================================================================== --- trunk/yake/yake/net2/serialization.h (rev 0) +++ trunk/yake/yake/net2/serialization.h 2007-10-28 20:19:49 UTC (rev 1881) @@ -0,0 +1,121 @@ +#ifndef NET_SERIALIZATION_H +#define NET_SERIALIZATION_H + +#include "types.h" +#include "packet.h" +#include <boost/archive/binary_oarchive.hpp> +#include <boost/archive/binary_iarchive.hpp> +#include <boost/iostreams/stream.hpp> + +namespace yake { +namespace net { + + namespace detail { + class write_and_count_sink { + public: + typedef char char_type; + private: + char* dest_; + std::streamsize size_; + std::streamsize count_; + public: + write_and_count_sink(char* dest, std::streamsize size) : dest_(dest), size_(size), count_(0) + {} + typedef boost::iostreams::sink_tag category; + // + std::streamsize write(const char* s, std::streamsize n) + { + // Write up to n characters to the underlying + // data sink into the buffer s, returning the + // number of characters written +#undef min + size_t toWrite = std::min( n, (size_ - count_) ); + if (toWrite == 0) + throw std::out_of_range("Out of packet buffer"); + if (toWrite > 0) + memcpy( dest_, s, toWrite ); + + count_ += toWrite; + return toWrite; + } + + /* Other members */ + std::streamsize count() const + { + return count_; + } + void reset(char* dest, std::streamsize size) + { + count_ = 0; + dest_ = dest; + size_ = size; + } + }; + } // namespace detail + struct ArchiveContext + { + typedef boost::archive::binary_oarchive oarchive; + static const int archive_flags = + boost::archive::no_header | boost::archive::no_codecvt | boost::archive::no_tracking; + + template<typename Pt> + oarchive* reset(Pt& pckt) + { + char* outdata = (char*)pckt.payload(); + out_.component()->reset( outdata, Pt::nMaxPayloadSize ); + + //@todo find out how to reset a oarchive for subsequent archiving. + //if (!oar_) + oar_.reset( new oarchive( out_, ArchiveContext::archive_flags) ); + //else + // ; + return oar_.get(); + } + void flush() + { + out_.flush(); + } + size_t count() + { + return out_.component()->count(); + } + + ArchiveContext() : out_((char*)0,0) + {} + private: + boost::iostreams::stream<detail::write_and_count_sink> out_; + boost::shared_ptr<oarchive> oar_; + }; + namespace detail { + template<class Mt, class Pt> + bool serialize_to_packet(Pt& pckt, const Mt& msg, ArchiveContext& ctx) + { + namespace archive = boost::archive; + namespace io = boost::iostreams; + + char* outdata = (char*)pckt.payload(); + + //io::stream<write_and_count_sink> out( outdata, Pt::nMaxPayloadSize ); + //ArchiveContext::oarchive ar(out,ArchiveContext::archive_flags); + ArchiveContext::oarchive& ar = *ctx.reset( pckt ); + + try { + ar << msg; + ctx.flush(); + } + catch (std::out_of_range&) + { + return false; + } + + pckt.setPayloadSize( ctx.count() ); + pckt.setId(Mt::ID); + + return true; + } + } // namespace detail + +} // namespace net +} // namespace yake + +#endif \ 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...> - 2007-10-22 15:53:08
|
Revision: 1880 http://yake.svn.sourceforge.net/yake/?rev=1880&view=rev Author: psyclonist Date: 2007-10-22 08:53:03 -0700 (Mon, 22 Oct 2007) Log Message: ----------- * quit demo if lua script runs into error Modified Paths: -------------- trunk/yake/samples/raf/lua2/demo.cpp Modified: trunk/yake/samples/raf/lua2/demo.cpp =================================================================== --- trunk/yake/samples/raf/lua2/demo.cpp 2007-10-22 15:50:52 UTC (rev 1879) +++ trunk/yake/samples/raf/lua2/demo.cpp 2007-10-22 15:53:03 UTC (rev 1880) @@ -302,6 +302,7 @@ { const char* code = lua_tostring(L,-1); YAKE_LOG_ERROR("demo",String(ex.what()) + ":" + code); + requestQuit(); } catch (std::exception& ex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-10-22 15:50:49
|
Revision: 1879 http://yake.svn.sourceforge.net/yake/?rev=1879&view=rev Author: psyclonist Date: 2007-10-22 08:50:52 -0700 (Mon, 22 Oct 2007) Log Message: ----------- * added demo net2/message2 * replaced custom serialization with boost::serialization for complex network messages Modified Paths: -------------- trunk/yake/scripts/premake/samples.lua trunk/yake/yake/net2/async_send.h trunk/yake/yake/net2/error.h trunk/yake/yake/net2/message_decoder.h trunk/yake/yake/net2/net.h trunk/yake/yake/net2/packet_connection.h trunk/yake/yake/net2/simple_serialization.h Added Paths: ----------- trunk/yake/samples/net2/message2/ trunk/yake/samples/net2/message2/demo.cpp Added: trunk/yake/samples/net2/message2/demo.cpp =================================================================== --- trunk/yake/samples/net2/message2/demo.cpp (rev 0) +++ trunk/yake/samples/net2/message2/demo.cpp 2007-10-22 15:50:52 UTC (rev 1879) @@ -0,0 +1,505 @@ +#include <yake/base/yakePrerequisites.h> +#include <yake/base/yake.h> // for YAKE_ASSERT etc +#include <yake/net2/net.h> +#undef min +#undef max +#include <boost/bind.hpp> + + +using namespace yake; + +struct c2sLoginReq +{ +private: + friend class boost::serialization::access; + template<class Archive> + void serialize(Archive & ar, const unsigned int version) + { + ar & user & passhash; + } +public: + enum { ID = 2 }; + std::string user; + std::string passhash; +}; +#define DEF_SIMPLE_MESSAGE_0(NAME,MSGID) \ +struct NAME \ +{ \ +private: \ + friend class boost::serialization::access; \ + template<class Archive> \ + void serialize(Archive & ar, const unsigned int version) \ + { \ + } \ +public: \ + enum { ID = MSGID }; \ +}; +#define DEF_SIMPLE_MESSAGE_1(NAME,MSGID,T1,NAME1) \ +struct NAME \ +{ \ +private: \ + friend class boost::serialization::access; \ + template<class Archive> \ + void serialize(Archive & ar, const unsigned int version) \ + { \ + ar & NAME1; \ + } \ +public: \ + enum { ID = MSGID }; \ + T1 NAME1; \ + NAME() {} \ + NAME(const T1& NAME1 ##_) : NAME1(NAME1 ##_) {} \ +}; +#define DEF_SIMPLE_MESSAGE_2(NAME,MSGID,T1,NAME1,T2,NAME2) \ +struct NAME \ +{ \ +private: \ + friend class boost::serialization::access; \ + template<class Archive> \ + void serialize(Archive & ar, const unsigned int version) \ + { \ + ar & NAME1 & NAME2; \ + } \ +public: \ + enum { ID = MSGID }; \ + T1 NAME1; \ + T2 NAME2; \ + NAME() {} \ + NAME(const T1& NAME1 ##_, const T2& NAME2 ##_) : NAME1(NAME1 ##_), NAME2(NAME2 ##_) {} \ +}; +DEF_SIMPLE_MESSAGE_2(s2cLoginResult,3,bool,success,std::string,reason); + +DEF_SIMPLE_MESSAGE_1(c2sCommJoinChannel,10,std::string,channel); +DEF_SIMPLE_MESSAGE_2(c2sCommSendMessage,11,std::string,channel,std::string,text); +DEF_SIMPLE_MESSAGE_1(c2sCommCreateChannel,20,std::string,channel); +DEF_SIMPLE_MESSAGE_1(c2sCommDestroyChannel,21,std::string,channel); +DEF_SIMPLE_MESSAGE_2(s2cCommMessage,22,std::string,channel,std::string,text); +namespace CommError { + enum Code + { + access_denied_or_channel_does_not_exist = 0, //<- We are vague here. And that's right! + access_denied = 1, + numCodes + }; + const char* toString(const Code code) + { + static const char* s_text[numCodes+1] = { + "Access denied or channel does not exist.", + "Access denied.", + "(no text available)" + }; + if (code < numCodes && int(code) >= 0) + return s_text[code]; + else + return s_text[numCodes]; + } +} // namespace CommError +DEF_SIMPLE_MESSAGE_2(s2cCommError,23,CommError::Code,code,std::string,text); + +DEF_SIMPLE_MESSAGE_2(s2cSimBegin,1100,std::string,name,std::vector<uint8>,initialData); +typedef std::map<std::string,uint32> ClassIdMap; +DEF_SIMPLE_MESSAGE_1(s2cSimClassMapData,1110,ClassIdMap,clsId); + +#include <yake/base/yakeStderrLog.h> +#include <boost/thread/thread.hpp> + +namespace placeholders = net::placeholders; + +// required Host interface: +// * ... Host::dispatcher(clientId) +// * ... Host:: +/** Synchronized: No */ +template<class Host> +struct CommServerService : public noncopyable +{ + typedef typename Host::connection_ptr connection_ptr; + typedef typename Host::connection_data connection_data; + typedef connection_data ClientId; + void onNewConnection(connection_data clientId, connection_ptr conn) + { + std::cout << "s:comm: connect\n"; + + net::setDecoder<c2sCommJoinChannel>( Host::dispatcher(clientId), + boost::bind(&CommServerService::onJoinRequest,this,clientId,conn,placeholders::error,placeholders::message) ); + + //should be done for when the client joins the first channel: + net::setDecoder<c2sCommSendMessage>( Host::dispatcher(clientId), + boost::bind(&CommServerService::onMessage,this,clientId,conn,placeholders::error,placeholders::message) ); + + YAKE_ASSERT( !users_[ clientId ] ); + users_[ clientId ].reset( new UserEntry() ); + } + void onDisconnect(connection_data clientId, connection_ptr conn) + { + std::cout << "s:comm: disconnect\n"; + net::setDecoder<c2sCommSendMessage>( Host::dispatcher(clientId), 0 ); + net::setDecoder<c2sCommJoinChannel>( Host::dispatcher(clientId), 0 ); + + UserMap::iterator it = users_.find( clientId ); + if (it == users_.end()) + ; + else + { + // remove user from channels + YAKE_FOR_EACH(ChannelIdList::const_iterator, itCid, it->second->channels_) + { + ChannelMap::iterator itC = channels_.find( *itCid ); + if (itC == channels_.end()) + continue; // should not happen, but to be safe... + UserList::iterator itU = itC->second->users_.find( clientId ); + if (itU != itC->second->users_.end()) + itC->second->users_.erase( itU ); + } + // + users_.erase( it ); + } + } + CommServerService() + { + channels_.insert( + std::make_pair("#lobby", + ChannelEntry::pointer(new ChannelEntry()) )); + channels_.insert( + std::make_pair("#team_a", + ChannelEntry::pointer(new ChannelEntry()) )); + channels_.insert( + std::make_pair("#team_b", + ChannelEntry::pointer(new ChannelEntry()) )); + } +private: + void onJoinRequest(connection_data clientId, connection_ptr conn, const net::Error&, const c2sCommJoinChannel& msg) + { + std::cout << "s:comm: X wants to join '" << msg.channel << "'\n"; + + if (msg.channel.size() > 100) + return; //@todo log this + + channel_iterator it = channels_.find( msg.channel ); + if (it == channels_.end()) + { + net::async_send( *conn, s2cCommError(CommError::access_denied_or_channel_does_not_exist,msg.channel) ); + } + else + { + UserMap::iterator itUser = users_.find( clientId ); + if (itUser == users_.end()) + return; //@todo log this + if (!itUser->second) + return; //@todo log this - report failure to client? + UserEntry& userEntry = *itUser->second; + userEntry.channels_.push_back( msg.channel ); + + ChannelEntry& chan = *it->second; + chan.users_.insert( IdConnPair(clientId,conn) ); + + net::async_send( *conn, s2cCommMessage(msg.channel,"Welcome to "+msg.channel+"!") ); + + sendToAllExcept( chan.users_, clientId, s2cCommMessage(msg.channel,"X joined the channel") ); + } + } + void onMessage(connection_data clientId, connection_ptr conn, const net::Error&, const c2sCommSendMessage& msg) + { + std::cout << "s:comm: in '" << msg.channel << "' '?' says '" << msg.text << "'\n"; + const_channel_iterator it = channels_.find( msg.channel ); + if (it == channels_.end()) + net::async_send( *conn, s2cCommError(CommError::access_denied,msg.channel) ); + else + { + const UserList& users = it->second->users_; + UserList::const_iterator itFindUser = users.find( clientId ); + if (itFindUser == users.end()) + ; //@todo report "not a member of channel" ? + else + sendToAllExcept( users, clientId, s2cCommMessage(msg.channel,msg.text) ); + } + } + //helper: + typedef std::pair<ClientId,connection_ptr> IdConnPair; + typedef std::map<ClientId,connection_ptr> UserList; + template<class Mt> + void sendToAllExcept(const UserList& users, ClientId clientId, const Mt& msg) + { + net::ArchiveContext arCtx; //<- reuse for performance. + YAKE_FOR_EACH( UserList::const_iterator, itUser, users ) + { + const IdConnPair& idconn = *itUser; + if (idconn.first == clientId) // Don't send to self. + continue; + net::async_send( *idconn.second, msg, arCtx ); + } + } + template<class Mt> + void sendToAll(const UserList& users, const Mt& msg) + { + net::ArchiveContext arCtx; //<- reuse for performance. + YAKE_FOR_EACH( UserList::const_iterator, itUser, users ) + { + const IdConnPair& idconn = *itUser; + net::async_send( *idconn.second, msg, arCtx ); + } + } +private: + net::io_service io_; + boost::mutex channelMtx_; + boost::mutex userMtx_; + + struct ChannelEntry + { + typedef boost::shared_ptr<ChannelEntry> pointer; + + UserList users_; + }; + typedef std::map<std::string,typename ChannelEntry::pointer> ChannelMap; + typedef typename ChannelMap::const_iterator const_channel_iterator; + typedef typename ChannelMap::iterator channel_iterator; + ChannelMap channels_; + + typedef std::deque<std::string> ChannelIdList; + struct UserEntry + { + typedef boost::shared_ptr<UserEntry> pointer; + + ChannelIdList channels_; + }; + typedef std::map<ClientId,typename UserEntry::pointer> UserMap; + UserMap users_; +}; + +//typedef net::TCPServer<> server_type; +typedef net::TCPServer<net::TCPPacketConnection<>,net::ConnectionFilterByIP> server_type; +struct ServerHandler +{ + typedef server_type::packet_type packet_type; + + // + struct Client : public boost::noncopyable + { + //typedef yake::SharedPtr<Client> pointer; + typedef Client* pointer; + net::IncomingPacketDispatcher<>& dispatcher() + { return dispatcher_; } + + Client() + { + std::cout << "app: new Client\n"; + } + ~Client() + { + std::cout << "app: ~Client\n"; + } + private: + net::IncomingPacketDispatcher<> dispatcher_; + }; + + // for services: + typedef server_type::connection_type* connection_ptr; + typedef Client* connection_data; // app data... could be anything. + static net::IncomingPacketDispatcher<>& dispatcher(Client* client) + { + YAKE_ASSERT(client); + return client->dispatcher(); + } + + // + typedef CommServerService<ServerHandler> CommSvc; + CommSvc commSvc; + + // + void onConnection(Client::pointer client,server_type::connection_weakptr conn, const net::Error& e) + { + std::cout << "app:onConnection: " << e.code() << "=" << e.what() << "\n"; + assert( client ); + if (e == net::Error::connected) + { + net::setDecoder<c2sLoginReq>( client->dispatcher(), + boost::bind(&ServerHandler::onLoginReq,this,client,conn,placeholders::error,placeholders::message) ); + } + else if (!e) + { + net::setDecoder<c2sLoginReq>( client->dispatcher(), 0 ); + if (e.code() == net::Error::disconnected) + { + commSvc.onDisconnect( client, conn.lock().get() ); + delete client; //! + } + } + } + void onPacket(Client::pointer client,server_type::connection_weakptr conn, const packet_type& pckt) + { + std::cout << "app: recv'd packet. payload: " << pckt.header().payloadSize << " byte(s)\n"; + assert( client ); + + client->dispatcher().dispatch( pckt ); + } + void onCreateConnection(server_type::ConnectionHandler& connHandler, server_type::PacketHandler& pcktHandler) + { + Client::pointer client = new Client(); + connHandler = boost::bind(&ServerHandler::onConnection,this,client,_1,_2); + pcktHandler = boost::bind(&ServerHandler::onPacket,this,client,_1,_2); + } + // + void onLoginReq(Client::pointer client, server_type::connection_weakptr conn, const net::Error& e, const c2sLoginReq& request) + { + if (!e) + std::cerr << "app: recv'd but FAILED to decode LOGINREQ: " << e << "\n"; + else + { + std::cout << "app: recv'd & decoded LOGINREQ: user=" << request.user << "\n"; + if (conn.lock()) + { + s2cLoginResult out; + out.success = true; + out.reason = "Welcome!"; + net::async_send( *conn.lock(), out ); + + // + commSvc.onNewConnection( client, conn.lock().get() ); + } + } + } +}; +int main(int argc, char* argv[]) +{ + SharedPtr<logging::log_listener> to_stderr( new logging::stderr_listener() ); + logging::addListener( to_stderr.get() ); + + // server + try { + if (argc > 1) + { + YAKE_LOG("demo", "starting server..."); + + net::io_service io; + + ServerHandler serverApp; + + // Create a server object for listening at localhost's port 40000 and + // creating TCPPacketConnection<> objects for each incoming TCP connections. + server_type server(io, + "localhost", // <- throws exception if invalid + 40000, + boost::bind(&ServerHandler::onCreateConnection,&serverApp,_1,_2)); + + // Test access of policy-enriched interface: + net::TCPIncomingConnectionFilter::address_set blackList; + //blackList.insert( net::detail::makeIpAddress("localhost") ); + server.ipFilter().setBlackList(blackList); + + // Run the server processing in a different thread. + // Note that, by subsequently creating additional threads + // running the same io_service::run() method we can increase + // the number of threads for the TCP server. + boost::thread_group netThreads; + + // NB At the moment, only 1 is safe for the current implementation of ServerHandler. + const size_t numThreads = 1; + for (size_t i=0; i<numThreads; ++i) + netThreads.create_thread( boost::bind(&net::io_service::run,&io) ); + + // Wait for the server process to finish. + // @todo At the moment, it only finishes if it fails. + netThreads.join_all(); + } + else + { + YAKE_LOG("demo", "starting client..."); + // The io_service manages the asynchronous operations + net::io_service netIo_; + + // Create a TCPPacketConnection object for connecting to + // a server. + net::TCPPacketConnection<>::pointer c = net::TCPPacketConnection<>::createClientConnection(netIo_); + + // Add compression filter (ZLib): + //c->filters().add( new StatefulZipCompressorFilter() ); + + // Create a dispatcher object for incoming packets. + net::IncomingPacketDispatcher<> pcktDispatcher; + + struct ClientHandler + { + static void onLoginResult(const net::Error& e, const s2cLoginResult& result) + { + if (e) + std::cout << "app: recv'd LOGIN RESULT: ok=" << result.success << " msg=" << result.reason << "\n"; + else + std::cerr << "app: recv'd LOGIN RESULT but something did go wrong...\n"; + } + static void onConnection(const net::Error& e) + { + if (!e) + std::cout << "app: status = " << e << "\n"; + } + static void onMessage(const net::Error& e, const s2cCommMessage& msg) + { + if (!e) + std::cout << "app: status = " << e << "\n"; + else + std::cout << msg.channel << ": " << msg.text << "\n"; + } + static void onCommError(const net::Error& e, const s2cCommError& err) + { + if (!e) + std::cout << "app: status = " << e << "\n"; + else + std::cout << "comm-error: [" << int(err.code) << "]=" << CommError::toString(err.code) << " (" << err.text << ")\n"; + } + }; + + // Subscribe to specific packet ids. + //pcktDispatcher.setHandler( 1, &onRecvPacket ); + net::setDecoder<s2cLoginResult>( pcktDispatcher, + boost::bind(&ClientHandler::onLoginResult,placeholders::error,placeholders::message) ); + net::setDecoder<s2cCommMessage>( pcktDispatcher, + boost::bind(&ClientHandler::onMessage,placeholders::error,placeholders::message) ); + net::setDecoder<s2cCommError>( pcktDispatcher, + boost::bind(&ClientHandler::onCommError,placeholders::error,placeholders::message) ); + + // Start asynchronous connection attempt to server at port 40000. + // * onConnection receives connection related errors and status information. + // * onPacket is called when incoming packets have arrived. + // OR in this case we forward it to the IncomingPacketDispatcher + // * 5 is the maxmimum timeout (in seconds) for the connection attempt. + c->connect("localhost",40000,&ClientHandler::onConnection, + /*&onPacket OR*/ boost::bind(&net::IncomingPacketDispatcher<>::dispatch,&pcktDispatcher,_1), + 50); + + // Start the io_service for the connection in a seperate thread. + // As soon as the connection is closed or in case it couldn't be + // established the thread will be terminated. + boost::thread netThread( boost::bind(&net::io_service::run,&netIo_) ); + + // Send some data (or enqueue, depending on connection state) + net::ArchiveContext arCtx; //<- reuse of context improves performance. + { + c2sLoginReq req; + req.user = "admin"; + req.passhash = "letme"; + net::async_send( *c, req, &ClientHandler::onConnection, arCtx ); + } + // This one will get thrown away as we haven't yet joined the channel: + net::async_send( *c, c2sCommSendMessage("#lobby","Hi there! #1"), &ClientHandler::onConnection, arCtx ); + + net::async_send( *c, c2sCommJoinChannel("#lobby"), &ClientHandler::onConnection, arCtx ); + net::async_send( *c, c2sCommSendMessage("#lobby","Hi there! #2"), &ClientHandler::onConnection, arCtx ); + + // This will result in an error message sent to us because + // this channel does not exist. + net::async_send( *c, c2sCommJoinChannel("#doesnotexist"), &ClientHandler::onConnection, arCtx ); + + // Wait for the connection thread to exit. (timeout or error ...) + netThread.join(); + } + } + catch (boost::asio::error& ex) + { + YAKE_LOG_ERROR("demo",String("ASIO EXCEPTION: ") + ex.what()); + } + catch (std::exception& ex) + { + YAKE_LOG_ERROR("demo",String("EXCEPTION: ") + ex.what()); + } + + return 0; +} + Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-09-25 21:29:30 UTC (rev 1878) +++ trunk/yake/scripts/premake/samples.lua 2007-10-22 15:50:52 UTC (rev 1879) @@ -178,6 +178,12 @@ sampleUsesConsole() useComponent("base") --useComponent("net") + + makeSample("sampleNetMessage2","samples/net2/message2") + sampleUsesConsole() + useComponent("base") + --useComponent("net") + end -------------------------------------- Modified: trunk/yake/yake/net2/async_send.h =================================================================== --- trunk/yake/yake/net2/async_send.h 2007-09-25 21:29:30 UTC (rev 1878) +++ trunk/yake/yake/net2/async_send.h 2007-10-22 15:50:52 UTC (rev 1879) @@ -4,6 +4,7 @@ #include "types.h" #include "packet.h" #include "packet_connection.h" +#include "serialization.h" namespace yake { namespace net { @@ -22,13 +23,12 @@ MessageDecoder<>. */ template<class Mt, class Pt, class Ct, typename Handler> - void async_send(Ct& conn, Pt pckt, const Mt& msg, Handler handler) + void async_send(Ct& conn, Pt pckt, const Mt& msg, Handler handler, ArchiveContext& ctx = ArchiveContext()) { assert( pckt ); - BinaryOutArchive ar( pckt->payload(), Pt::value_type::nMaxPayloadSize ); - ar & const_cast<Mt&>(msg); - pckt->setId(Mt::ID); - pckt->setPayloadSize(ar.curr()); + + detail::serialize_to_packet( *pckt, msg, ctx ); + conn.async_send( pckt, handler ); } /** Serialize and send message asynchronously over the @@ -42,14 +42,13 @@ MessageDecoder<>. */ template<class Mt, class Ct, typename Handler> - void async_send(Ct& conn, const Mt& msg, Handler handler) + void async_send(Ct& conn, const Mt& msg, Handler handler, ArchiveContext& ctx = ArchiveContext()) { typedef typename Ct::packet_type packet_type; typename packet_type::pointer pckt(new packet_type()); - BinaryOutArchive ar( pckt->payload(), packet_type::nMaxPayloadSize ); - ar & const_cast<Mt&>(msg); - pckt->setId(Mt::ID); - pckt->setPayloadSize(ar.curr()); + + detail::serialize_to_packet( *pckt, msg, ctx ); + conn.async_send( pckt, handler ); } /** Serialize and send message asynchronously over the @@ -60,14 +59,13 @@ MessageDecoder<>. */ template<class Mt, class Ct> - void async_send(Ct& conn, const Mt& msg) + void async_send(Ct& conn, const Mt& msg, ArchiveContext& ctx = ArchiveContext()) { typedef typename Ct::packet_type packet_type; typename packet_type::pointer pckt(new packet_type()); - BinaryOutArchive ar( pckt->payload(), packet_type::nMaxPayloadSize ); - ar & const_cast<Mt&>(msg); - pckt->setId(Mt::ID); - pckt->setPayloadSize(ar.curr()); + + detail::serialize_to_packet( *pckt, msg, ctx ); + conn.async_send( pckt ); } Modified: trunk/yake/yake/net2/error.h =================================================================== --- trunk/yake/yake/net2/error.h 2007-09-25 21:29:30 UTC (rev 1878) +++ trunk/yake/yake/net2/error.h 2007-10-22 15:50:52 UTC (rev 1879) @@ -35,7 +35,7 @@ } operator bool() const { - return (code_ == ok); + return (code_ == ok); //@todo shouldn't this be exactly the other way around? if (e) ...error-handling... } bool operator == (const Code code) const { @@ -64,6 +64,11 @@ private: Code code_; }; + inline std::ostream& operator << (std::ostream& out, const Error& rhs) + { + out << "net::error(" << rhs.code() << "=" << rhs.what() << ")"; + return out; + } } // namespace net } // namespace yake Modified: trunk/yake/yake/net2/message_decoder.h =================================================================== --- trunk/yake/yake/net2/message_decoder.h 2007-09-25 21:29:30 UTC (rev 1878) +++ trunk/yake/yake/net2/message_decoder.h 2007-10-22 15:50:52 UTC (rev 1879) @@ -3,7 +3,7 @@ #include "types.h" #include "packet_dispatcher.h" -#include "simple_serialization.h" +#include "serialization.h" namespace yake { namespace net { @@ -28,7 +28,8 @@ Furthermore, the the message type 'Mt' needs to have a default constructor. - see @IncomingMessageDecoderDispatcher::setHandler() + @todo Make MessageDecoder<> use ArchiveContext for optimized deserialization. + @see IncomingMessageDecoderDispatcher::setHandler() */ template<typename Mt, class PacketType = net::Packet<net::DefaultPacketTraits> > struct MessageDecoder : MessageDecoderBase<PacketType> @@ -49,12 +50,25 @@ std::cout << "decoding '" << typeid(message_type).name() << "'\n"; message_type msg; //in try block? - try { - net::BinaryInArchive ar( pckt.payload(), pckt.payloadSize() ); - ::yake::net::serialize(ar,msg); + try + { + namespace archive = boost::archive; + namespace io = boost::iostreams; + const int archive_flags = archive::no_header | archive::no_codecvt | archive::no_tracking; + + io::stream<io::array_source> str( (const char*)pckt.payload(), pckt.payloadSize() ); + boost::archive::binary_iarchive ar(str,archive_flags); + + ar >> msg; + handler_( net::Error::ok, msg ); } + catch (boost::archive::archive_exception& ex) + { + std::cerr << "ser: FAILED to INIT ARCHIVE: " << ex.what() << "\n"; + handler_( net::Error::failed_to_decode, msg ); + } catch (std::exception& ex) { std::cerr << "ser: FAILED to DECODE: " << ex.what() << "\n"; @@ -65,6 +79,7 @@ } private: boost::function<void(const net::Error&,const Mt&)> handler_; + //net::ArchiveContext ctx_; }; /** (Helper) function to create & register a message decoder Modified: trunk/yake/yake/net2/net.h =================================================================== --- trunk/yake/yake/net2/net.h 2007-09-25 21:29:30 UTC (rev 1878) +++ trunk/yake/yake/net2/net.h 2007-10-22 15:50:52 UTC (rev 1879) @@ -8,10 +8,10 @@ #include "packet.h" #include "packet_connection.h" #include "packet_dispatcher.h" -#include "simple_serialization.h" #include "message_decoder.h" #include "utils.h" #include "server.h" +#include "serialization.h" #include "async_send.h" #endif Modified: trunk/yake/yake/net2/packet_connection.h =================================================================== --- trunk/yake/yake/net2/packet_connection.h 2007-09-25 21:29:30 UTC (rev 1878) +++ trunk/yake/yake/net2/packet_connection.h 2007-10-22 15:50:52 UTC (rev 1879) @@ -48,12 +48,12 @@ public: ~TCPPacketConnection() { - //std::cout << "tcp:conn:~dtor()\n"; + std::cout << "tcp:conn:~dtor()\n"; } /** - @note Call blocks until connection is dead (disconnection, failure, ...). - You can run this function in a thread if you need a threaded connection object. - @note Do not run this function more than once before it returns! (For example, in different threads!) + @note Call blocks until connection is dead (disconnection, failure, ...). + You can run this function in a thread if you need a threaded connection object. + @note Do not run this function more than once before it returns! (For example, in different threads!) */ void connect(const std::string& remoteIp, const uint16 remotePort, ErrorHandler handler, PacketHandler packetHandler, const long timeoutSec = 5) @@ -76,7 +76,9 @@ //io_.run(); } - /** @note Do not call directly! */ + /** @note Do not call directly! + @todo refactor out? + */ void startAsServerConnection(ErrorHandler handler, PacketHandler packetHandler) { assert( handler && "need a valid connection handler" ); @@ -97,6 +99,7 @@ start(); } + /** Synchronized: yes */ void async_send(packet_pointer pckt) { /* @@ -105,29 +108,30 @@ */ io_.post( boost::bind(&TCPPacketConnection::doSend,shared_from_this(),pckt) ); } - //template<typename Handler> - //void async_send(packet_pointer pckt, Handler handler) + /** Synchronized: yes */ void async_send(packet_pointer pckt, const boost::function<void(const Error&)>& handler) { io_.post( boost::bind(&TCPPacketConnection::doSend,shared_from_this(),pckt,handler) ); } + /** Synchronized: yes */ void async_send(packet_type* pckt) { this->async_send( packet_pointer(pckt) ); } - //template<typename Handler> - //void async_send(packet_type* pckt, Handler handler) + /** Synchronized: yes */ void async_send(packet_type* pckt, const boost::function<void(const Error&)>& handler) { this->async_send( packet_pointer(pckt), handler ); } + /** Synchronized: yes */ void stop() { io_.post( boost::bind(&TCPPacketConnection::doStop,shared_from_this(),Error::operation_aborted) ); } - //protocol for TcpServer<> only: + /** Synchronized: no */ + //internal protocol for TcpServer<> only: socket_type& socket() { if (!socket_) Modified: trunk/yake/yake/net2/simple_serialization.h =================================================================== --- trunk/yake/yake/net2/simple_serialization.h 2007-09-25 21:29:30 UTC (rev 1878) +++ trunk/yake/yake/net2/simple_serialization.h 2007-10-22 15:50:52 UTC (rev 1879) @@ -1,207 +0,0 @@ -#ifndef NET_SIMPLE_SERIALIZATION_H -#define NET_SIMPLE_SERIALIZATION_H - -#include <boost/static_assert.hpp> -#include "types.h" - -namespace yake { -namespace net { - - struct BinaryOutArchive - { - static const int saving = 1; - BinaryOutArchive(uint8* data, size_t size) : - data_(data), size_(size), curr_(0) - { - assert( data_ ); - assert( size_ > 0 ); - } - void write(const void* data, const size_t size) - { - if (curr_ + size > size_) - throw std::out_of_range("write() out of range"); - memcpy(data_ + curr_, data, size); - curr_ += size; - } - void write(uint8 rhs) - { - write(&rhs,sizeof(rhs)); - } - void write(uint16 rhs) - { - write(&rhs,sizeof(rhs)); - } - void write(uint32 rhs) - { - write(&rhs,sizeof(rhs)); - } - void write(uint64 rhs) - { - write(&rhs,sizeof(rhs)); - } - - template<typename T> - BinaryOutArchive& operator & (T& rhs) - { - ::yake::net::serialize(*this,rhs); - return *this; - } - - size_t curr() const - { - return curr_; - } - private: - uint8* data_; - size_t size_; - - size_t curr_; - }; - struct BinaryInArchive - { - static const int saving = 0; - BinaryInArchive(const uint8* data, size_t size) : - data_(data), size_(size), curr_(0) - { - assert( data_ ); - } - void read(void* data, const size_t size) - { - if (curr_ + size > size_) - throw std::out_of_range("read() out of range"); - memcpy(data, data_ + curr_, size); - curr_ += size; - } - void read(uint8& rhs) - { - read(&rhs,sizeof(rhs)); - } - void read(uint16& rhs) - { - read(&rhs,sizeof(rhs)); - } - void read(uint32& rhs) - { - read(&rhs,sizeof(rhs)); - } - void read(uint64& rhs) - { - read(&rhs,sizeof(rhs)); - } - - template<typename T> - BinaryInArchive& operator & (T& rhs) - { - ::yake::net::serialize(*this,rhs); - return *this; - } - private: - const uint8* data_; - size_t size_; - - size_t curr_; - }; - - template<int n> - struct Int2Type - { - static const int value = n; - }; - - template<class Ar, typename T> - void serialize(Ar& ar, T& rhs) - { - do_serialize(ar,rhs,Int2Type<Ar::saving>()); - } - template<class Ar, typename T> - inline void do_serialize(Ar& ar, T& rhs, Int2Type<0>) - { - ar >> rhs; - } - template<class Ar, typename T> - inline void do_serialize(Ar& ar, T& rhs, Int2Type<1>) - { - ar << rhs; - } - - /////////////////////////////////////////////////////////////////////////// - template<class Ar> - Ar& operator << (Ar& ar, int rhs) - { - ar.write(&rhs,sizeof(int)); - return ar; - } - template<class Ar> - Ar& operator >> (Ar& ar, int& rhs) - { - ar.read(&rhs,sizeof(int)); - return ar; - } - template<class Ar> - Ar& operator << (Ar& ar, const std::string& rhs) - { - BOOST_STATIC_ASSERT( sizeof(size_t) == sizeof(uint32) ); - ar.write( uint32(rhs.size()) ); - ar.write( rhs.c_str(), rhs.size() ); - return ar; - } - template<class Ar> - Ar& operator >> (Ar& ar, std::string& rhs) - { - rhs.clear(); - uint32 size = 0; - ar.read(size); - rhs.resize(size); - ar.read((void*)rhs.data(),size); - return ar; - } - template<class Ar, class _Ty, class _Ax> - Ar& operator << (Ar& ar, const std::vector<_Ty,_Ax>& rhs) - { - typedef std::vector<_Ty,_Ax> ctr_type; - BOOST_STATIC_ASSERT( sizeof(size_t) == sizeof(uint32) ); - ar.write( uint32(rhs.size()) ); - for (size_t i=0;i<rhs.size(); ++i) - ar & rhs.at(i); - return ar; - } - template<class Ar, class _Ty, class _Ax> - Ar& operator >> (Ar& ar, std::vector<_Ty,_Ax>& rhs) - { - rhs.clear(); - uint32 size = 0; - ar.read(size); - rhs.resize(size); - for (size_t i=0; i<size; ++i) - ar & rhs.at(i); - return ar; - } - // Enable for improved performance for containers with integral types. - // Available: vector<int,...> -#if 0 - template<class Ar, class _Ax> - Ar& operator << (Ar& ar, const std::vector<int,_Ax>& rhs) - { - std::cout << "boosted\n"; - typedef std::vector<int,_Ax> ctr_type; - BOOST_STATIC_ASSERT( sizeof(size_t) == sizeof(uint32) ); - ar.write( uint32(rhs.size()) ); - ar.write( &rhs[0], sizeof(int)*rhs.size() ); - return ar; - } - template<class Ar, class _Ax> - Ar& operator >> (Ar& ar, std::vector<int,_Ax>& rhs) - { - rhs.clear(); - uint32 size = 0; - ar.read(size); - rhs.resize(size); - ar.read(&rhs[0],sizeof(int)*size); - return ar; - } -#endif - -} // namespace net -} // namespace yake - -#endif \ 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...> - 2007-09-25 21:29:28
|
Revision: 1878 http://yake.svn.sourceforge.net/yake/?rev=1878&view=rev Author: psyclonist Date: 2007-09-25 14:29:30 -0700 (Tue, 25 Sep 2007) Log Message: ----------- * [vehicle] lib and demo updated to new API (Vector3 vs Point3 etc) Modified Paths: -------------- trunk/yake/samples/vehicle/yakeDemo.cpp trunk/yake/src/vehicle/yakeDotVehicle.cpp trunk/yake/src/vehicle/yakeMountPoint.cpp trunk/yake/src/vehicle/yakeNativeOde.cpp trunk/yake/yake/vehicle/yakeDotVehicle.h trunk/yake/yake/vehicle/yakeInterfaces.h trunk/yake/yake/vehicle/yakeMountPoint.h trunk/yake/yake/vehicle/yakeNativeOde.h trunk/yake/yake/vehicle/yakeTemplates.h Added Paths: ----------- trunk/yake/samples/bin/debug/sampleVehicle.cfg Added: trunk/yake/samples/bin/debug/sampleVehicle.cfg =================================================================== --- trunk/yake/samples/bin/debug/sampleVehicle.cfg (rev 0) +++ trunk/yake/samples/bin/debug/sampleVehicle.cfg 2007-09-25 21:29:30 UTC (rev 1878) @@ -0,0 +1,18 @@ +[resource.sources] # <- evaluated by RAF +file=../../../common/media/scripts/ # <- do NOT forget trialing '/' !! + +#----------------------------------- +[raf.startup.libraries] +# Libraries to be loaded automatically at startup + +graphicsOgre +inputOgreOIS +physicsODE + +#----------------------------------- +[raf.startup.systems] +# System to be created & initialized automatically + +graphics=ogre3d +input=ois +physics=ode Modified: trunk/yake/samples/vehicle/yakeDemo.cpp =================================================================== --- trunk/yake/samples/vehicle/yakeDemo.cpp 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/samples/vehicle/yakeDemo.cpp 2007-09-25 21:29:30 UTC (rev 1878) @@ -96,7 +96,7 @@ // set up camera getDefaultCamera()->setNearClipDistance( 1 ); getDefaultCamera()->setFixedYawAxis(Vector3::kUnitY); - getDefaultCamera()->setPosition(Vector3(7,4,-7)); + getDefaultCamera()->setPosition(Point3(7,4,-7)); // getPhysicalWorld()->setGlobalGravity(Vector3(0,real(-9.81),0)); @@ -113,7 +113,7 @@ pGroundE->setCastsShadow( false ); pGroundSN->attachEntity( pGroundE ); pGroundSN->setScale( Vector3(200,1,200) ); - pGroundSN->setPosition( Vector3(0,groundHeight,0) ); + pGroundSN->setPosition( Point3(0,groundHeight,0) ); model::Graphical* pG = new model::Graphical(); pG->addSceneNode( pGroundSN, "groundSN" ); @@ -229,7 +229,7 @@ struct GoVehicleBase { virtual ~GoVehicleBase() {} - virtual Vector3 getPosition() const = 0; + virtual Point3 getPosition() const = 0; virtual void onEnter(input::ActionMap& actionMap, input::KeyboardDevice* keyboard) = 0; virtual void onExit() { @@ -264,7 +264,7 @@ { destroy(); } - virtual Vector3 getPosition() const + virtual Point3 getPosition() const { YAKE_ASSERT( mVehicle ); return mVehicle->getChassisPosition(); @@ -456,7 +456,7 @@ { destroy(); } - virtual Vector3 getPosition() const + virtual Point3 getPosition() const { YAKE_ASSERT( mVehicle ); return mVehicle->getChassisPosition(); @@ -485,7 +485,7 @@ // - ship body graphics::ISceneNode* pSN = gworld.createSceneNode(); pSN->attachEntity( gworld.createEntity("razor.mesh") ); - pSN->setScale( math::Vector3::kUnitScale * razorMeshScale ); + pSN->setScale( Vector3::kUnitScale * razorMeshScale ); pG->addSceneNode(pSN,"root"); YAKE_LOG( "demo","Creating thruster visuals" ); @@ -645,7 +645,7 @@ graphics::ISceneNode* pSN = gworld.createSceneNode(); graphics::IEntity* pE = gworld.createEntity("sphere_d1.mesh"); pSN->attachEntity( pE ); - const math::Vector3 scale = math::Vector3::kUnitScale * 2.f * mVehicle->getWheelInterface(wheelId)->getRadius(); + const Vector3 scale = Vector3::kUnitScale * 2.f * mVehicle->getWheelInterface(wheelId)->getRadius(); pSN->setScale( scale ); YAKE_ASSERT( mModel ); @@ -707,7 +707,10 @@ class TheApp : public raf::ExampleApplication<TheConfiguration> { public: - TheApp() {} + TheApp() + { + getConfiguration().get().load("sampleVehicle.cfg"); + } protected: virtual raf::MainState* createMainState() { Modified: trunk/yake/src/vehicle/yakeDotVehicle.cpp =================================================================== --- trunk/yake/src/vehicle/yakeDotVehicle.cpp 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/src/vehicle/yakeDotVehicle.cpp 2007-09-25 21:29:30 UTC (rev 1878) @@ -136,11 +136,11 @@ void DotVehicleParser::parseShapeBox( const data::dom::INode& n, const String& matId ) { - math::Vector3 dim; + Vector3 dim; dim.x = StringUtil::parseReal( n.getAttributeValueAs<String>("x") ); dim.y = StringUtil::parseReal( n.getAttributeValueAs<String>("y") ); dim.z = StringUtil::parseReal( n.getAttributeValueAs<String>("z") ); - math::Vector3 pos; + Point3 pos; if (n.getNodeByName("position")) parsePosition( *n.getNodeByName("position"), pos ); mpCurrVehTpl->mChassis.mChassisShapes.push_back( @@ -150,7 +150,7 @@ void DotVehicleParser::parseShapeSphere( const data::dom::INode& n, const String& matId ) { real radius = StringUtil::parseReal( n.getAttributeValueAs<String>("radius") ); - math::Vector3 pos; + Point3 pos; if (n.getNodeByName("position")) parsePosition( *n.getNodeByName("position"), pos ); mpCurrVehTpl->mChassis.mChassisShapes.push_back( @@ -260,17 +260,17 @@ const String thisId = n.getAttributeValueAs<String>("name"); YAKE_ASSERT( !thisId.empty() ); - math::Vector3 position; + Point3 position; SharedPtr<INode> pNode = n.getNodeByName("position"); if (pNode.get()) parsePosition( *pNode, position ); - math::Quaternion orientation; + Quaternion orientation; pNode = n.getNodeByName("orientation"); if (pNode.get()) parseOrientation( *pNode, orientation ); - math::Vector3 direction; + Vector3 direction; pNode = n.getNodeByName("direction"); if (pNode.get()) parseDirection( *pNode, direction ); @@ -321,12 +321,12 @@ return; YAKE_ASSERT( mpCurrVehTpl->mWheels.find( name ) == mpCurrVehTpl->mWheels.end() )( name ).debug("duplicate wheel name. overriding values."); - math::Vector3 position; + Point3 position; SharedPtr<data::dom::INode> pN = n.getNodeByName("position"); if (pN.get()) parsePosition( *pN, position ); - math::Quaternion rotation( math::Quaternion::kIdentity ); + Quaternion rotation( Quaternion::kIdentity ); pN = n.getNodeByName("orientation"); if (pN.get()) parseOrientation( *pN, rotation ); @@ -356,19 +356,19 @@ } - void DotVehicleParser::parsePosition( const data::dom::INode& n, math::Vector3& ret ) + void DotVehicleParser::parsePosition( const data::dom::INode& n, Point3& ret ) { ret.x = StringUtil::parseReal( n.getAttributeValueAs<String>("x") ); ret.y = StringUtil::parseReal( n.getAttributeValueAs<String>("y") ); ret.z = StringUtil::parseReal( n.getAttributeValueAs<String>("z") ); } - void DotVehicleParser::parseDirection( const data::dom::INode& n, math::Vector3& ret ) + void DotVehicleParser::parseDirection( const data::dom::INode& n, Vector3& ret ) { ret.x = StringUtil::parseReal( n.getAttributeValueAs<String>("x") ); ret.y = StringUtil::parseReal( n.getAttributeValueAs<String>("y") ); ret.z = StringUtil::parseReal( n.getAttributeValueAs<String>("z") ); } - void DotVehicleParser::parseOrientation( const data::dom::INode& n, math::Quaternion& ret ) + void DotVehicleParser::parseOrientation( const data::dom::INode& n, Quaternion& ret ) { if ( n.getAttributeValueAs<String>("qx") != "" ) { @@ -379,7 +379,7 @@ } else if ( n.getAttributeValueAs<String>("axisX") != "" ) { - math::Vector3 axis; + Vector3 axis; axis.x = StringUtil::parseReal( n.getAttributeValueAs<String>("axisX") ); axis.y = StringUtil::parseReal( n.getAttributeValueAs<String>("axisY") ); axis.z = StringUtil::parseReal( n.getAttributeValueAs<String>("axisZ") ); @@ -387,7 +387,7 @@ } else if ( n.getAttributeValueAs<String>("angleX") != "" ) { - math::Vector3 axis; + Vector3 axis; axis.x = StringUtil::parseReal( n.getAttributeValueAs<String>("angleX") ); axis.y = StringUtil::parseReal( n.getAttributeValueAs<String>("angleY") ); axis.z = StringUtil::parseReal( n.getAttributeValueAs<String>("angleZ") ); Modified: trunk/yake/src/vehicle/yakeMountPoint.cpp =================================================================== --- trunk/yake/src/vehicle/yakeMountPoint.cpp 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/src/vehicle/yakeMountPoint.cpp 2007-09-25 21:29:30 UTC (rev 1878) @@ -35,8 +35,8 @@ // Class: MountPoint //----------------------------------------------------- MountPoint::MountPoint() : - mPosition(math::Vector3::kZero), - mOrientation(math::Quaternion::kIdentity), + mPosition(Point3::kZero), + mOrientation(Quaternion::kIdentity), mParent(0), mOverrideParent(0) { @@ -91,29 +91,29 @@ mMountables.erase( itFind ); mountable->onDetached(); } - math::Vector3 MountPoint::getDirection() const + Vector3 MountPoint::getDirection() const { // direction in local coordinates // - return mOrientation * math::Vector3::kUnitZ; + return mOrientation * Vector3::kUnitZ; } - void MountPoint::setDirection( const math::Vector3& dir) + void MountPoint::setDirection( const Vector3& dir) { const real tolerance = real(0.001); - const math::Vector3 currDir = getDirection(); - const math::Vector3 newDir = dir.normalisedCopy(); + const Vector3 currDir = getDirection(); + const Vector3 newDir = dir.normalisedCopy(); if ( newDir == currDir ) return; if ( newDir.dotProduct( currDir ) + 1 <= tolerance ) // tolerance check. TODO tolerance globally? for math { - real angle = 0.; - math::Vector3 axis; - mOrientation.ToAngleAxis( angle, axis ); + real angle = 0.; + Vector3 axis; + mOrientation.ToAngleAxis( angle, axis ); // adding another 180 grads - angle += math::Math::PI; + angle += Math::PI; // setting new orientation mOrientation.FromAngleAxis( angle, axis ); @@ -122,23 +122,23 @@ } mOrientation = currDir.getRotationTo( newDir ) * mOrientation; } - void MountPoint::setPosition(const math::Vector3& rPosition) + void MountPoint::setPosition(const Point3& rPosition) { mPosition = rPosition; } - math::Vector3 MountPoint::getPosition() const + Point3 MountPoint::getPosition() const { return mPosition; } - void MountPoint::setOrientation( const math::Quaternion& q ) + void MountPoint::setOrientation( const Quaternion& q ) { mOrientation = q; } - math::Quaternion MountPoint::getOrientation() const + Quaternion MountPoint::getOrientation() const { return mOrientation; } - math::Vector3 MountPoint::getDerivedPosition() const + Point3 MountPoint::getDerivedPosition() const { if (mOverrideParent) return mOverrideParent->getOrientation() * mPosition + mOverrideParent->getPosition(); @@ -146,7 +146,7 @@ return mParent->getDerivedOrientation() * mPosition + mParent->getDerivedPosition(); return mPosition; } - math::Quaternion MountPoint::getDerivedOrientation() const + Quaternion MountPoint::getDerivedOrientation() const { if (mOverrideParent) return mOverrideParent->getOrientation() * mOrientation; Modified: trunk/yake/src/vehicle/yakeNativeOde.cpp =================================================================== --- trunk/yake/src/vehicle/yakeNativeOde.cpp 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/src/vehicle/yakeNativeOde.cpp 2007-09-25 21:29:30 UTC (rev 1878) @@ -221,12 +221,12 @@ return 0; return itFind->second; } - math::Vector3 GenericVehicle::getChassisPosition() const + Point3 GenericVehicle::getChassisPosition() const { YAKE_ASSERT( mpChassis ); return mpChassis->getPosition(); } - math::Quaternion GenericVehicle::getChassisOrientation() const + Quaternion GenericVehicle::getChassisOrientation() const { YAKE_ASSERT( mpChassis ); return mpChassis->getOrientation(); @@ -463,7 +463,7 @@ { pE = GWorld.createEntity("sphere_1d.mesh"); pSN->attachEntity( pE ); - pSN->setScale( math::Vector3::kUnitScale * pShape->getPropertyReal("radius") ); + pSN->setScale( Vector3::kUnitScale * pShape->getPropertyReal("radius") ); } break; default: @@ -498,7 +498,7 @@ { YAKE_SAFE_DELETE( mDebugModel ); } - void GenericVehicle::setPosition(const Vector3& position) + void GenericVehicle::setPosition(const Point3& position) { YAKE_ASSERT( mpChassis ); const Vector3 delta = position - this->getChassisPosition(); @@ -537,7 +537,7 @@ YAKE_ASSERT( chassisObj ); mpWheel = PWorld.createActor( physics::ACTOR_DYNAMIC ); - mpWheel->createShape( physics::IShape::SphereDesc( mRadius, Vector3::kZero, Quaternion::kIdentity, tpl.mMaterial ) ); + mpWheel->createShape( physics::IShape::SphereDesc( mRadius, Point3::kZero, Quaternion::kIdentity, tpl.mMaterial ) ); real mass = tpl.mMassRelativeToChassis ? (tpl.mMass * chassisObj->getBody().getMass()) : tpl.mMass; mpWheel->setPosition( tpl.mPosition ); @@ -554,8 +554,8 @@ { mpJoint = PWorld.createJoint( physics::IJoint::DescHinge2( chassisObj, mpWheel, - tpl.mOrientation * math::Vector3::kUnitY, - tpl.mOrientation * math::Vector3::kUnitX, + tpl.mOrientation * Vector3::kUnitY, + tpl.mOrientation * Vector3::kUnitX, tpl.mPosition ) ); mpJoint->setSpring( tpl.mSuspensionSpring ); @@ -633,10 +633,10 @@ { YAKE_ASSERT( mpChassis ); YAKE_ASSERT( mpWheel ); - const math::Vector3 chassisDir = mpChassis->getOrientation() * math::Vector3::kUnitZ; - const math::Vector3 linVel = mpWheel->getBody().getLinearVelocity(); + const Vector3 chassisDir = mpChassis->getOrientation() * Vector3::kUnitZ; + const Vector3 linVel = mpWheel->getBody().getLinearVelocity(); const real linVelf = linVel.length(); - const math::Vector3 wheelMovementDir = linVel.normalisedCopy(); + const Vector3 wheelMovementDir = linVel.normalisedCopy(); if (linVelf < 0.1) //@todo FIXME should be dependent size... mSkid = 0.; else @@ -651,32 +651,32 @@ { return mRadius; } - void OdeWheel::setPosition(const math::Vector3& pos) + void OdeWheel::setPosition(const Point3& pos) { YAKE_ASSERT( mpWheel ); mpWheel->setPosition( pos ); } - void OdeWheel::setOrientation(const math::Quaternion& o) + void OdeWheel::setOrientation(const Quaternion& o) { YAKE_ASSERT( mpWheel ); mpWheel->setOrientation( o ); } - math::Vector3 OdeWheel::getPosition() const + Point3 OdeWheel::getPosition() const { YAKE_ASSERT( mpWheel ); return mpWheel->getPosition(); } - math::Vector3 OdeWheel::getDerivedPosition() const + Point3 OdeWheel::getDerivedPosition() const { YAKE_ASSERT( mpWheel ); return mpWheel->getDerivedPosition(); } - math::Quaternion OdeWheel::getOrientation() const + Quaternion OdeWheel::getOrientation() const { YAKE_ASSERT( mpWheel ); return mpWheel->getOrientation(); } - math::Quaternion OdeWheel::getDerivedOrientation() const + Quaternion OdeWheel::getDerivedOrientation() const { YAKE_ASSERT( mpWheel ); return mpWheel->getDerivedOrientation(); @@ -684,22 +684,22 @@ void OdeWheel::_applyDriveTq( const real tq ) { //std::cout << "DTQ=" << tq << "\n"; - //_applyTq( math::Vector3::kUnitX * tq ); + //_applyTq( Vector3::kUnitX * tq ); if (mBrakeRatio > 0.01) - _applyBrakeTq( math::Vector3::kUnitX * mBrakeRatio * 1.5 ); + _applyBrakeTq( Vector3::kUnitX * mBrakeRatio * 1.5 ); const real targetVel = tq < 0. ? -40. : 40.; _applyMotor( targetVel, - tq * 0.01/*@todo this is "dt" dependent*/ ); } - void OdeWheel::_applyTq( const math::Vector3& torque ) + void OdeWheel::_applyTq( const Vector3& torque ) { mpWheel->getBody().addTorque( mpWheel->getOrientation() * torque ); } - void OdeWheel::_applyBrakeTq( const math::Vector3 & torque ) + void OdeWheel::_applyBrakeTq( const Vector3 & torque ) { - math::Vector3 linVel = mpWheel->getBody().getLinearVelocity(); - math::Vector3 dir = mpWheel->getOrientation() * math::Vector3::kUnitX; + Vector3 linVel = mpWheel->getBody().getLinearVelocity(); + Vector3 dir = mpWheel->getOrientation() * Vector3::kUnitX; if (dir.dotProduct(linVel) > 0) { std::cout << "BRK+\n"; @@ -774,12 +774,12 @@ } void GenericLinearThruster::updateSimulation( real timeElapsed ) { - real abs_force = getMinimumForce() + math::Math::Abs( mVoltage ) * ( getMaximumForce() - getMinimumForce() ); + real abs_force = getMinimumForce() + Math::Abs( mVoltage ) * ( getMaximumForce() - getMinimumForce() ); if ( abs_force > getMaximumForce() ) abs_force = getMaximumForce(); - setForce( math::Math::Sign( mVoltage )*abs_force ); + setForce( Math::Sign( mVoltage )*abs_force ); } //----------------------------------------------------- @@ -799,9 +799,9 @@ return; const MountPoint* mp = getMountPoint(); - const math::Vector3 pos = mp ? mp->getDerivedPosition() : math::Vector3::kZero; - const math::Quaternion rot = mp ? mp->getDerivedOrientation() : math::Quaternion::kIdentity; - const math::Vector3 f = mThruster->getForce() * ( rot * -math::Vector3::kUnitZ ); + const Point3 pos = mp ? mp->getDerivedPosition() : Point3::kZero; + const Quaternion rot = mp ? mp->getDerivedOrientation() : Quaternion::kIdentity; + const Vector3 f = mThruster->getForce() * ( rot * -Vector3::kUnitZ ); ConstDequeIterator< BodyPtrList > itBody( mTargets ); while (itBody.hasMoreElements()) Modified: trunk/yake/yake/vehicle/yakeDotVehicle.h =================================================================== --- trunk/yake/yake/vehicle/yakeDotVehicle.h 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/yake/vehicle/yakeDotVehicle.h 2007-09-25 21:29:30 UTC (rev 1878) @@ -66,9 +66,9 @@ void parseWheel( const data::dom::INode& n ); void parseEngineTpl( const data::dom::INode& n ); - void parsePosition( const data::dom::INode& n, math::Vector3& ret ); - void parseOrientation( const data::dom::INode& n, math::Quaternion& ret ); - void parseDirection( const data::dom::INode& n, math::Vector3& ret ); + void parsePosition( const data::dom::INode& n, Point3& ret ); + void parseOrientation( const data::dom::INode& n, Quaternion& ret ); + void parseDirection( const data::dom::INode& n, Vector3& ret ); VehicleTemplate* mpCurrVehTpl; }; Modified: trunk/yake/yake/vehicle/yakeInterfaces.h =================================================================== --- trunk/yake/yake/vehicle/yakeInterfaces.h 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/yake/vehicle/yakeInterfaces.h 2007-09-25 21:29:30 UTC (rev 1878) @@ -67,15 +67,15 @@ virtual void setSteering( const uint32 sg, const real ) = 0; virtual real getSteering( const uint32 sg ) const = 0; - virtual math::Vector3 getChassisPosition() const = 0; - virtual math::Quaternion getChassisOrientation() const = 0; + virtual Point3 getChassisPosition() const = 0; + virtual Quaternion getChassisOrientation() const = 0; virtual Movable* getChassisMovable() const = 0; virtual physics::IActorPtr getPhysicalChassis() const = 0; virtual void enableDebugGeometry(graphics::IWorld&) = 0; virtual void disableDebugGeometry() = 0; - virtual void setPosition(const Vector3&) = 0; + virtual void setPosition(const Point3&) = 0; virtual void translate(const Vector3&) = 0; }; Modified: trunk/yake/yake/vehicle/yakeMountPoint.h =================================================================== --- trunk/yake/yake/vehicle/yakeMountPoint.h 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/yake/vehicle/yakeMountPoint.h 2007-09-25 21:29:30 UTC (rev 1878) @@ -87,7 +87,7 @@ typedef Deque< Mountable* > MountablePtrList; MountablePtrList mMountables; Quaternion mOrientation; - Vector3 mPosition; + Point3 mPosition; typedef Deque< std::pair<MountPoint*,bool> > MountPointList; MountPointList mChildren; MountPoint* mParent; Modified: trunk/yake/yake/vehicle/yakeNativeOde.h =================================================================== --- trunk/yake/yake/vehicle/yakeNativeOde.h 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/yake/vehicle/yakeNativeOde.h 2007-09-25 21:29:30 UTC (rev 1878) @@ -98,8 +98,8 @@ virtual IEnginePtrList getEngineInterfaces() const; virtual IWheel* getWheelInterface(const String& id) const; - virtual math::Vector3 getChassisPosition() const; - virtual math::Quaternion getChassisOrientation() const; + virtual Point3 getChassisPosition() const; + virtual Quaternion getChassisOrientation() const; virtual Movable* getChassisMovable() const; virtual physics::IActorPtr getPhysicalChassis() const; @@ -109,7 +109,7 @@ virtual void enableDebugGeometry(graphics::IWorld&); virtual void disableDebugGeometry(); - virtual void setPosition(const Vector3&); + virtual void setPosition(const Point3&); virtual void translate(const Vector3&); void _create(const VehicleTemplate&, physics::IWorld& PWorld, model::Physical& physModel ); @@ -209,12 +209,12 @@ const VehicleTemplate::WheelTpl& tpl, physics::IWorld& PWorld ); - virtual void setPosition(const math::Vector3&); - virtual math::Vector3 getPosition() const; - virtual math::Vector3 getDerivedPosition() const; - virtual void setOrientation(const math::Quaternion&); - virtual math::Quaternion getOrientation() const; - virtual math::Quaternion getDerivedOrientation() const; + virtual void setPosition(const Point3&); + virtual Point3 getPosition() const; + virtual Point3 getDerivedPosition() const; + virtual void setOrientation(const Quaternion&); + virtual Quaternion getOrientation() const; + virtual Quaternion getDerivedOrientation() const; virtual real getRadius() const; @@ -226,8 +226,8 @@ void _applyDriveTq( const real tq ); private: - void _applyTq( const math::Vector3 & torque ); - void _applyBrakeTq( const math::Vector3 & torque ); + void _applyTq( const Vector3 & torque ); + void _applyBrakeTq( const Vector3 & torque ); void _applyMotor( real velocity, real fmax ); void _onPreStepInternal( const real dt ); Modified: trunk/yake/yake/vehicle/yakeTemplates.h =================================================================== --- trunk/yake/yake/vehicle/yakeTemplates.h 2007-09-22 21:23:17 UTC (rev 1877) +++ trunk/yake/yake/vehicle/yakeTemplates.h 2007-09-25 21:29:30 UTC (rev 1878) @@ -41,31 +41,31 @@ typedef AssocVector< String, MountPointTpl > MountPointTplList; struct MountPointTpl { - math::Vector3 mPosition; - math::Quaternion mOrientation; - math::Vector3 mDirection; - bool mUseDirection; + Point3 mPosition; + Quaternion mOrientation; + Vector3 mDirection; + bool mUseDirection; MountPointTplList mChildren; MountPointTpl( - const math::Vector3& pos = math::Vector3::kZero, - const math::Quaternion& rot = math::Quaternion::kIdentity) : + const Point3& pos = Point3::kZero, + const Quaternion& rot = Quaternion::kIdentity) : mPosition(pos), mOrientation(rot), mUseDirection(false) {} MountPointTpl( - const math::Vector3& pos, - const math::Vector3& dir) : + const Point3& pos, + const Vector3& dir) : mPosition(pos), mDirection(dir), mUseDirection(true) {} MountPointTpl& addMountPoint( - const math::Vector3& pos = math::Vector3::kZero, - const math::Quaternion& rot = math::Quaternion::kIdentity); + const Point3& pos = Point3::kZero, + const Quaternion& rot = Quaternion::kIdentity); MountPointTpl& addMountPoint( - const math::Vector3& pos, - const math::Vector3& dir); + const Point3& pos, + const Vector3& dir); }; enum GearMode { @@ -123,14 +123,14 @@ struct ChassisTpl { - math::Vector3 mPosition; // initial position + Point3 mPosition; // initial position real mMass; - ShapeTplList mChassisShapes; + ShapeTplList mChassisShapes; String mGfxReference; // e.g. dotScene file String mPhysicsBody; // e.g. physical body loaded from .xode file ChassisTpl() : - mPosition(math::Vector3::kZero), + mPosition(Point3::kZero), mMass(real(1.6)) // @todo FIXME magic number {} }; @@ -138,8 +138,8 @@ struct WheelTpl { uint32 mAxle; - math::Vector3 mPosition; - math::Quaternion mOrientation; + Point3 mPosition; + Quaternion mOrientation; uint32 mSteeringGroup; real mRadius; real mMass; @@ -150,8 +150,8 @@ //String mGfxReferenceType; // e.g. "dotscene" String mMaterial; WheelTpl( - const math::Vector3& position = math::Vector3::kZero, - const math::Quaternion& orientation = math::Quaternion::kIdentity, + const Point3& position = Point3::kZero, + const Quaternion& orientation = Quaternion::kIdentity, const real radius = real(0.2), const real mass = real(0.018), const bool massRelativeToChassis = true, @@ -178,10 +178,10 @@ // - ChassisTpl mChassis; + ChassisTpl mChassis; MountPointTplList mMountPoints; EngineTplList mEngines; - uint32 mSteeringGroups; + uint32 mSteeringGroups; WheelTplList mWheels; VehicleTemplate() : mSteeringGroups(0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-22 21:23:17
|
Revision: 1877 http://yake.svn.sourceforge.net/yake/?rev=1877&view=rev Author: psyclonist Date: 2007-09-22 14:23:17 -0700 (Sat, 22 Sep 2007) Log Message: ----------- * [demo] raf/lua2: Corrected name to 'VolumeTrigger'. ('Trigger' is the base class.) Modified Paths: -------------- trunk/yake/common/media/scripts/raf2.lua trunk/yake/samples/raf/lua2/demo.cpp Modified: trunk/yake/common/media/scripts/raf2.lua =================================================================== --- trunk/yake/common/media/scripts/raf2.lua 2007-09-22 21:19:42 UTC (rev 1876) +++ trunk/yake/common/media/scripts/raf2.lua 2007-09-22 21:23:17 UTC (rev 1877) @@ -19,7 +19,7 @@ -- demo methods which make creating various objects simpler -------------------------------------- function makeProximityTrigger(radius) - local trigger = objMgr:makeObject("Trigger") + local trigger = objMgr:makeObject("VolumeTrigger") assert( trigger ) trigger.volumes:add( yake.Sphere(radius or 2) ) Modified: trunk/yake/samples/raf/lua2/demo.cpp =================================================================== --- trunk/yake/samples/raf/lua2/demo.cpp 2007-09-22 21:19:42 UTC (rev 1876) +++ trunk/yake/samples/raf/lua2/demo.cpp 2007-09-22 21:23:17 UTC (rev 1877) @@ -131,10 +131,14 @@ ent::RegistrationResult ret = objMgr_.registerClass<ent::Entity>("Entity",params); YAKE_ASSERT( ret.first == object::RC_OK ); - params.set("lua.startup",(MakeStringVector() << "o_trigger2.lua").get()); + params.set("lua.startup",(MakeStringVector() << "o_entity.lua").get()); ret = objMgr_.registerClass<ent::Trigger>("Trigger",params); YAKE_ASSERT( ret.first == object::RC_OK ); + params.set("lua.startup",(MakeStringVector() << "o_trigger2.lua").get()); + ret = objMgr_.registerClass<ent::Trigger>("VolumeTrigger",params); + YAKE_ASSERT( ret.first == object::RC_OK ); + params.set("lua.startup",(MakeStringVector() << "o_ball.lua").get()); ret = objMgr_.registerClass<ent::Entity>("Ball",params); YAKE_ASSERT( ret.first == object::RC_OK ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-22 21:19:38
|
Revision: 1876 http://yake.svn.sourceforge.net/yake/?rev=1876&view=rev Author: psyclonist Date: 2007-09-22 14:19:42 -0700 (Sat, 22 Sep 2007) Log Message: ----------- * [bindings.lua] fixed issue with binding of 'Entity.model' property (reported by BartoloB) * [bindings.lua] fixed trigger script to handle more than one entity Modified Paths: -------------- trunk/yake/common/media/scripts/o_trigger2.lua trunk/yake/src/bindings.lua/detail/model.lua.cpp Modified: trunk/yake/common/media/scripts/o_trigger2.lua =================================================================== --- trunk/yake/common/media/scripts/o_trigger2.lua 2007-09-18 00:53:17 UTC (rev 1875) +++ trunk/yake/common/media/scripts/o_trigger2.lua 2007-09-22 21:19:42 UTC (rev 1876) @@ -4,23 +4,49 @@ assert( sim.objMgr, "no obj mgr" ) local objs = sim.objMgr:getAllObjects() + -- For each object with a 'position' property we check + -- whether it intersects the trigger's volume(s). + -- Note: We suppose that 'position' always means the same + -- thing, namely a point in space (yake.Point3). + -- The script will stop/crash if a position property + -- has a different type! + -- TODO: Check whether the object is derived from 'Entity' + -- because the position property in this case always + -- is of type 'yake.Point3'. + local numIntersects = 0 + local toggled = false for id,ent in pairs(objs) do - if ent and id ~= this.id then -- ignore self, and non-Entity objects - local intersects = this.volumes:intersectsWith( ent.position ) + --TODO: if .. and ent.isA()->isKindOf("Entity") + local pos = ent.position -- pos will be 'nil' if property 'position' does not exist. + if ent and id ~= this.id and pos ~= nil then -- ignore self, and non-positioned objects + local intersects = this.volumes:intersectsWith( pos ) + if intersects then + numIntersects = numIntersects + 1 + end + -- The trigger is switched to 'on' when at least + -- one entity is in its volume. if not this.on and intersects then this:processFsmEvent("toggle") - elseif this.on and not intersects then - this:processFsmEvent("toggle") + toggled = true + break end end end + -- If no entity is in the trigger's volume(s) and the + -- trigger state is currently 'on' then we switch to + -- state 'off'. + -- Note: We check 'not toggled' to not undo the work of the + -- intersection loop above. + if not toggled and this.on and (numIntersects == 0) then + this:processFsmEvent("toggle") + end - --if filter then -- local filter = yake.ObjectFilter() -- filter:add( filterByClass("Player") ) -- filter:add( filterByClass("Entity",IgnoreDerived) ) -- filter.byClass("Player") - --end + -- local objs = objMgr:getAllObjects() + -- filter:apply(objs) end end function main() Modified: trunk/yake/src/bindings.lua/detail/model.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/model.lua.cpp 2007-09-18 00:53:17 UTC (rev 1875) +++ trunk/yake/src/bindings.lua/detail/model.lua.cpp 2007-09-22 21:19:42 UTC (rev 1876) @@ -46,6 +46,16 @@ namespace yake { namespace model { + //------------------------------------------------------------------------- + namespace { + struct AnyConverterIniter + { + AnyConverterIniter() + { + register_any_converter<model::ModelPtr>(); + } + } g_initer; + } // namespace Graphical* Model_createGraphical(Model& m) { Graphical* c = new Graphical(); @@ -62,13 +72,13 @@ YAKE_ASSERT(g); g->addSceneNode( node, path ); } - Model* ModelManager_createModel(ModelManager* mgr, const String& modelName, const String& def) + ModelPtr ModelManager_createModel(ModelManager* mgr, const String& modelName, const String& def) { - return (mgr ? mgr->createModel(modelName,def).get() : 0); + return (mgr ? mgr->createModel(modelName,def) : ModelPtr()); } - Model* ModelManager_createModelFromTemplate(ModelManager* mgr, const String& modelName, const String& tplName) + ModelPtr ModelManager_createModelFromTemplate(ModelManager* mgr, const String& modelName, const String& tplName) { - return (mgr ? mgr->createModelFromTemplate(modelName,tplName).get() : 0); + return (mgr ? mgr->createModelFromTemplate(modelName,tplName) : ModelPtr()); } bool ModelMovableLink_subscribeToPositionChanged(ModelMovableLink* link, const luabind::object& o) { @@ -146,7 +156,7 @@ class_<ModelMovableLink,ModelLink>( "ModelMovableLink" ) .def( "subscribeToPositionChanged", &ModelMovableLink_subscribeToPositionChanged) , - class_<Model>( "Model" ) + class_<Model,ModelPtr>( "Model" ) .def( constructor<>() ) .property( "name", &Model::getName, &Model::setName ) .def( "getName", &Model::getName ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-18 00:53:13
|
Revision: 1875 http://yake.svn.sourceforge.net/yake/?rev=1875&view=rev Author: psyclonist Date: 2007-09-17 17:53:17 -0700 (Mon, 17 Sep 2007) Log Message: ----------- * [raf] fixed define * [vehicle] Vector3 -> Point3 Modified Paths: -------------- trunk/yake/yake/raf/yakePrerequisites.h trunk/yake/yake/vehicle/yakeMountPoint.h Modified: trunk/yake/yake/raf/yakePrerequisites.h =================================================================== --- trunk/yake/yake/raf/yakePrerequisites.h 2007-09-18 00:38:32 UTC (rev 1874) +++ trunk/yake/yake/raf/yakePrerequisites.h 2007-09-18 00:53:17 UTC (rev 1875) @@ -27,6 +27,8 @@ #ifndef YAKE_RAF_PREREQUISITES_H #define YAKE_RAF_PREREQUISITES_H +#include <yake/base/yakePrerequisites.h> + #if defined(YAKE_RAF_EXPORTS) # define YAKE_RAF_API YAKE_EXPORT_API #else @@ -34,7 +36,7 @@ #endif // configuration -#if YAKE_PLATFORM == PLATFORM_WIN32 and YAKE_COMPILER == MSVC //@todo fixme make it work on linux and mingw etc +#if YAKE_PLATFORM == PLATFORM_WIN32 && YAKE_COMPILER == COMPILER_MSVC //@todo fixme make it work on linux and mingw etc # define YAKE_RAF_USES_CEGUI 1 #else # define YAKE_RAF_USES_CEGUI 0 Modified: trunk/yake/yake/vehicle/yakeMountPoint.h =================================================================== --- trunk/yake/yake/vehicle/yakeMountPoint.h 2007-09-18 00:38:32 UTC (rev 1874) +++ trunk/yake/yake/vehicle/yakeMountPoint.h 2007-09-18 00:53:17 UTC (rev 1875) @@ -74,20 +74,20 @@ virtual bool isSuitableFor( const Mountable* mountable ) const; void attach( Mountable* mountable ); void detach( Mountable* mountable ); - void setDirection( const math::Vector3& dir ); - math::Vector3 getDirection() const; - virtual void setOrientation( const math::Quaternion& ); - virtual math::Quaternion getOrientation() const; - virtual void setPosition(const math::Vector3& rPosition ); - virtual math::Vector3 getPosition() const; - math::Vector3 getDerivedPosition() const; - math::Quaternion getDerivedOrientation() const; - void lookAt(const math::Vector3&); + void setDirection( const Vector3& dir ); + Vector3 getDirection() const; + virtual void setOrientation( const Quaternion& ); + virtual Quaternion getOrientation() const; + virtual void setPosition(const Point3& rPosition ); + virtual Point3 getPosition() const; + Point3 getDerivedPosition() const; + Quaternion getDerivedOrientation() const; + void lookAt(const Vector3&); private: typedef Deque< Mountable* > MountablePtrList; MountablePtrList mMountables; - math::Quaternion mOrientation; - math::Vector3 mPosition; + Quaternion mOrientation; + Vector3 mPosition; typedef Deque< std::pair<MountPoint*,bool> > MountPointList; MountPointList mChildren; MountPoint* mParent; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-18 00:38:29
|
Revision: 1874 http://yake.svn.sourceforge.net/yake/?rev=1874&view=rev Author: psyclonist Date: 2007-09-17 17:38:32 -0700 (Mon, 17 Sep 2007) Log Message: ----------- * [bindings.lua] fixed issue caused by Luabind in conjunction with GCC and any_converters: solution is the same as with the shared_ptr fix. -> task.lua.cpp for details. * [bindings.lua] fixed issues with Object::Event bindings Modified Paths: -------------- trunk/yake/src/bindings.lua/detail/ent.lua.cpp Modified: trunk/yake/src/bindings.lua/detail/ent.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) +++ trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-09-18 00:38:32 UTC (rev 1874) @@ -26,16 +26,24 @@ */ #include <yake/config.h> #if YAKE_ENABLE_LUA_ENT == 1 +#include <yake/bindings.lua/prerequisites.h> // Don't forget to include this for proper dllexport! -#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! +// 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/property.lua.h> + +#include <yake/bindings.lua/common/yake.lua.common.h> + #include <yake/base/templates/yakeSmartAssert.h> #include <yake/bindings.lua/bindings.lua.ent.h> -#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <yake/bindings.lua/detail/private.h> -#include <yake/bindings.lua/detail/property.lua.h> #include <luabind/iterator_policy.hpp> #include <luabind/operator.hpp> @@ -43,6 +51,102 @@ namespace yake { namespace ent { + template<typename R> + struct SimpleFunctionWrapper + { + luabind::object fn_; + typedef boost::shared_ptr<SimpleFunctionWrapper> pointer; + R execute() + { + try { + return luabind::call_function<R>(fn_); + } + catch (luabind::cast_failed& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: cast_failed: ") + ex.what()); + return false; + } + catch (luabind::error& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: error: ") + ex.what()); + return false; + } + catch (std::exception& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: unknown: ") + ex.what()); + return false; + } + } + }; + template<> + struct SimpleFunctionWrapper<void> + { + luabind::object fn_; + typedef boost::shared_ptr<SimpleFunctionWrapper> pointer; + void execute() + { + try { + luabind::call_function<void>(fn_); + } + catch (luabind::cast_failed& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: cast_failed: ") + ex.what()); + } + catch (luabind::error& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: error: ") + ex.what()); + } + catch (std::exception& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: unknown: ") + ex.what()); + } + } + }; + template<typename R> + boost::function<R(void)> makeFunctionWrapper(luabind::object o) + { + YAKE_ASSERT( luabind::type(o) == LUA_TFUNCTION ); + typename SimpleFunctionWrapper<R>::pointer p( new SimpleFunctionWrapper<R>() ); + p->fn_ = o; + return boost::bind(&SimpleFunctionWrapper<R>::execute,p); + } + typedef SimpleFunctionWrapper<bool> TriggerConditionWrapper; + //typedef SimpleFunctionWrapper<void> EventCallbackWrapper; + + struct EventCallbackWrapper + { + luabind::object fn_; + typedef boost::shared_ptr<EventCallbackWrapper> pointer; + void execute(const boost::any& a0) + { + lua_State* L = fn_.interpreter(); + try { + if (a0.type() == typeid(void)) + luabind::call_function<void>(fn_); + else + luabind::call_function<void>(fn_,a0); + } + catch (luabind::cast_failed& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: cast_failed: ") + ex.what()); + } + catch (luabind::error& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: error: ") + ex.what()); + } + catch (std::exception& ex) + { + YAKE_LOG_ERROR("ent.lua",String("SimpleFunctionWrapper: unknown: ") + ex.what()); + } + } + static boost::function<void(const boost::any&)> make(luabind::object o) + { + YAKE_ASSERT( luabind::type(o) == LUA_TFUNCTION ); + pointer p( new EventCallbackWrapper() ); + p->fn_ = o; + return boost::bind(&EventCallbackWrapper::execute,p,_1); + } + }; //------------------------------------------------------------------------- namespace { struct AnyConverterIniter @@ -53,7 +157,7 @@ //register_property_value_converter<ObjectId>(); } } g_initer; - } // namespace + } // namespace //------------------------------------------------------------------------- luabind::object ObjectManager_makeObject(ObjectManager& objMgr, const char* clsid, lua_State* L); @@ -89,24 +193,28 @@ return 0; return new Object_NameEventPair(ret); } + static void Object_Event_fire_noparams(Object::Event& evt) { evt.fire(); } - static void Object_Event_fire_1param(Object::Event& evt, const boost::any& a0) + static void Object_Event_fire_1param_any(Object::Event& evt, const boost::any& a0) { evt.fire(a0); } - static bool Object_Event_connect(Object::Event& evt, luabind::object o) + static void Object_Event_connect(Object::Event& evt, luabind::object o) { if (!o || (luabind::type(o) != LUA_TFUNCTION)) { std::cerr << "WARNING: Object::Event::connect: Parameter is not a function!\n"; - return false; + return; } - evt.connect( o ); - return true; + //evt.connect( o ); + //evt.connect( makeFunctionWrapper<void>(o) ); + evt.connect( EventCallbackWrapper::make(o) ); + return; } +#if YAKE_ENABLE_LUA_PROPERTY == 1 template<typename T> T getPropertyValue(Object& o, const PropertyId& id) { @@ -134,7 +242,7 @@ { return o.get( id ).get(); } - static property::NamePropertyPair* Object_PropertyAccess_get_byIndex(Object::PropertyAccess& o, int index) + property::NamePropertyPair* Object_PropertyAccess_get_byIndex(Object::PropertyAccess& o, int index) { index -= 1; // Lua tables usually start with 1 if (index >= int(o.size()) || index < 0) @@ -156,6 +264,7 @@ ret->prop = it->second.get(); return ret; } +#endif // YAKE_ENABLE_LUA_PROPERTY == 1 static Object::EventAccess* getObjectEventsAccessor(Object& o) { Object::EventAccess& x = o.events(); @@ -172,39 +281,11 @@ } return o; } - struct TriggerConditionWrapper - { - luabind::object fn_; - typedef boost::shared_ptr<TriggerConditionWrapper> pointer; - bool execute() - { - try { - return luabind::call_function<bool>(fn_); - } - catch (luabind::cast_failed& ex) - { - YAKE_LOG_ERROR("ent.lua",String("TriggerConditionWrapper: cast_failed: ") + ex.what()); - return false; - } - catch (luabind::error& ex) - { - YAKE_LOG_ERROR("ent.lua",String("TriggerConditionWrapper: error: ") + ex.what()); - return false; - } - catch (std::exception& ex) - { - YAKE_LOG_ERROR("ent.lua",String("TriggerConditionWrapper: unknown: ") + ex.what()); - return false; - } - } - }; static void Trigger_setCondition(Trigger& trigger, luabind::object o) { if (!o || luabind::type(o) != LUA_TFUNCTION) return; - TriggerConditionWrapper::pointer p( new TriggerConditionWrapper() ); - p->fn_ = o; - trigger.setCondition( boost::bind(&TriggerConditionWrapper::execute,p) ); + trigger.setCondition( makeFunctionWrapper<bool>( o ) ); } static bool Trigger_isOn(const Trigger& trigger) { @@ -358,12 +439,11 @@ , class_<Object::Event>("ObjectEvent") .def( constructor<>() ) - .def( "connect", &Object::Event::connect ) .def( "connect", &Object_Event_connect ) //.def( self(Object::Event()) ) // call () operator + .def( "fire", &Object_Event_fire_noparams ) // without params - //.def( "fire", &Object::Event::fire ) // with 1 param - .def( "fire", &Object_Event_fire_1param ) + .def( "fire", &Object_Event_fire_1param_any ) , class_<Object_NameEventPair>("Object_NameEventPair") .def_readonly( "name", &Object_NameEventPair::first) @@ -511,7 +591,7 @@ int ent_event_metatable_index(lua_State* L) { luaL_argcheck(L, lua_islightuserdata(L,lua_upvalueindex(1)), 1, "expected to be lightuserdata (ent::Object*)" ); - ent::Object* ent = (ent::Object*)(lua_touserdata(L,lua_upvalueindex(1))); + Object* ent = (Object*)(lua_touserdata(L,lua_upvalueindex(1))); YAKE_ASSERT( ent ); luaL_argcheck(L, lua_isstring(L,-1), 2, "key expected to be of type string"); const char* key = lua_tostring(L,-1); @@ -521,6 +601,7 @@ lua_pushnil(L); return 1; } + luabind::object ret(L,evt); ret.push(L); return 1; @@ -658,7 +739,7 @@ { class_rep* objCls = obj->crep(); YAKE_ASSERT( objCls ); - + // retrieve base class info for objects with 'dynamic properties': // ent::Object: class_registry* reg = luabind::detail::class_registry::get_registry(L); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-18 00:26:38
|
Revision: 1873 http://yake.svn.sourceforge.net/yake/?rev=1873&view=rev Author: psyclonist Date: 2007-09-17 17:26:38 -0700 (Mon, 17 Sep 2007) Log Message: ----------- * [bindings.lua] fixed issue caused by Luabind in conjunction with GCC and any_converters: solution is the same as with the shared_ptr fix. -> task.lua.cpp for details. Modified Paths: -------------- trunk/yake/scripts/premake/config.lua trunk/yake/src/bindings.lua/bindings.lua.cpp trunk/yake/src/bindings.lua/detail/base.lua.cpp trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp trunk/yake/src/bindings.lua/detail/graphics.lua.cpp trunk/yake/src/bindings.lua/detail/input.lua.cpp trunk/yake/src/bindings.lua/detail/model.lua.cpp trunk/yake/src/bindings.lua/detail/physics.lua.cpp trunk/yake/src/bindings.lua/detail/property.lua.cpp trunk/yake/src/bindings.lua/detail/raf.lua.cpp trunk/yake/src/bindings.lua/detail/res.lua.cpp trunk/yake/src/bindings.lua/detail/task.lua.cpp trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h trunk/yake/yake/bindings.lua/detail/property.lua.h Added Paths: ----------- trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.inl Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/scripts/premake/config.lua 2007-09-18 00:26:38 UTC (rev 1873) @@ -28,7 +28,7 @@ -- Plugins -------------------------------------- --- NB only some of these are implemented: +-- NB only some of these options have effect --PLUGIN_SCRIPTING_LUA = true PLUGIN_AUDIO_OPENAL = true PLUGIN_GRAPHICS_OGRE = true Modified: trunk/yake/src/bindings.lua/bindings.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/bindings.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/bindings.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -28,15 +28,22 @@ #include <yake/scripting/yakeScriptingSystem.h> #include <yake/plugins/scriptingLua/ScriptingSystemLua.h> #include <yake/bindings.lua/bindings.lua.h> + +#define YAKE_EXPORT_LUA_ANY_CONVERTER +// 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/common/yake.lua.any_converter.cpp> + +// #include <yake/bindings.lua/common/lua.helpers.h> #include <yake/bindings.lua/common/lua.helpers.cpp> // define here -#define YAKE_EXPORT_LUA_ANY_CONVERTER -#include <yake/bindings.lua/common/yake.lua.any_converter.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.cpp> - namespace yake { namespace { struct RegisterDefaultAnyConverters @@ -48,11 +55,11 @@ register_any_converter<double>(); register_any_converter<bool>(); register_any_converter<String>(); - + register_any_converter<luabind::object>(); } } g_registerDefaultAnyConverters; - } // namespace + } // namespace void bind_all(lua_State* L) { Modified: trunk/yake/src/bindings.lua/detail/base.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -29,13 +29,16 @@ #include <yake/base/yake.h> -#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! +// 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> -#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <luabind/operator.hpp> #include <luabind/adopt_policy.hpp> Modified: trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -27,14 +27,18 @@ #include <yake/config.h> #if YAKE_ENABLE_LUA_ENT == 1 -#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! +// 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/base/templates/yakeSmartAssert.h> #include <yake/bindings.lua/bindings.lua.ent.h> #include <yake/bindings.lua/bindings.lua.ent.registry.h> -#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <yake/bindings.lua/detail/private.h> #include <yake/bindings.lua/detail/property.lua.h> Modified: trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -27,12 +27,13 @@ #include <yake/config.h> #if YAKE_ENABLE_LUA_ENT == 1 +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> // Always before Luabind includes! + #include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! #include <yake/base/templates/yakeSmartAssert.h> #include <yake/bindings.lua/bindings.lua.ent.registry.h> -#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> #include <yake/bindings.lua/detail/private.h> namespace yake { Modified: trunk/yake/src/bindings.lua/detail/graphics.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/graphics.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/graphics.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -29,11 +29,17 @@ #define YAKE_ENABLE_LUA_GRAPHICS_OGRE 0 #if YAKE_ENABLE_LUA_GRAPHICS == 1 +#include <yake/bindings.lua/prerequisites.h> // Don't forget to include this for proper dllexport! + // See task.lua.cpp +// 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/bindings.lua.h> // Don't forget to include this for proper dllexport! - +// #include <yake/base/templates/yakeSmartAssert.h> #include <yake/base/yake.h> #include <yake/graphics/yakeGraphics.h> @@ -49,7 +55,6 @@ #endif #include <yake/bindings.lua/detail/private.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <luabind/discard_result_policy.hpp> #include <luabind/iterator_policy.hpp> Modified: trunk/yake/src/bindings.lua/detail/input.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/input.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/input.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -27,17 +27,20 @@ #include <yake/config.h> #if YAKE_ENABLE_LUA_INPUT == 1 -// See task.lua.cpp +// 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/bindings.lua.h> // Don't forget to include this for proper dllexport! +// #include <yake/base/templates/yakeSmartAssert.h> #include <yake/base/yake.h> #include <yake/input/yakeInput.h> #include <yake/bindings.lua/detail/private.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <luabind/discard_result_policy.hpp> #include <luabind/iterator_policy.hpp> Modified: trunk/yake/src/bindings.lua/detail/model.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/model.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/model.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -27,13 +27,17 @@ #include <yake/config.h> #if YAKE_ENABLE_LUA_MODEL == 1 -#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! +// 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/base/templates/yakeSmartAssert.h> #include <yake/base/yake.h> #include <yake/model/model.h> -#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <yake/bindings.lua/detail/private.h> #include <luabind/discard_result_policy.hpp> Modified: trunk/yake/src/bindings.lua/detail/physics.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/physics.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/physics.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -29,17 +29,19 @@ #pragma warning(disable:4267) // VC8-32Bit: conversion from 'size_t' to 'unsigned int', possible loss of data -// See task.lua.cpp +// 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/bindings.lua.h> // Don't forget to include this for proper dllexport! - +// #include <yake/base/templates/yakeSmartAssert.h> #include <yake/base/yake.h> #include <yake/physics/yakePhysics.h> #include <yake/bindings.lua/detail/private.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <luabind/discard_result_policy.hpp> #include <luabind/iterator_policy.hpp> Modified: trunk/yake/src/bindings.lua/detail/property.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/property.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/property.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -27,15 +27,17 @@ #include <yake/config.h> #if YAKE_ENABLE_LUA_PROPERTY == 1 +// 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/bindings.lua.h> // Don't forget to include this for proper dllexport! - #include <yake/base/templates/yakeSmartAssert.h> #include <yake/base/yake.h> #include <yake/property/property.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <yake/bindings.lua/detail/private.h> #include <yake/bindings.lua/detail/property.lua.h> Modified: trunk/yake/src/bindings.lua/detail/raf.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/raf.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/raf.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -30,13 +30,18 @@ #include <yake/base/yake.h> #include <yake/raf/yakeRaf.h> -#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! +// 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> -#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> namespace yake { namespace raf { @@ -54,7 +59,7 @@ } */ } g_initer; - } // namespace + } // namespace input::KeyboardDevice* getAppKeyboard(raf::Application* app) { return app ? app->getKeyboard() : 0; Modified: trunk/yake/src/bindings.lua/detail/res.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/res.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/res.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -28,16 +28,20 @@ #if YAKE_ENABLE_LUA_RES == 1 // See task.lua.cpp +// 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/bindings.lua.h> // Don't forget to include this for proper dllexport! +// #include <yake/base/templates/yakeSmartAssert.h> #include <yake/base/yake.h> #include <yake/res/res.h> #include <yake/bindings.lua/detail/private.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <luabind/discard_result_policy.hpp> #include <luabind/iterator_policy.hpp> Modified: trunk/yake/src/bindings.lua/detail/task.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/task.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/src/bindings.lua/detail/task.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -39,16 +39,20 @@ // luabind::get_const_holder(...) catch all handler. // (Source: http://osdir.com/ml/lang.lua.bind.user/2006-02/msg00008.html) // Solution: Include the overloads for our smart pointers PRIOR to any Luabind headers. +// +// Update: Also do the same for any_converters because of is_userdefined(...). +// #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/bindings.lua.h> // Don't forget to include this for proper dllexport! - +// #include <yake/base/templates/yakeSmartAssert.h> #include <yake/bindings.lua/detail/private.h> #include <yake/bindings.lua/common/lua.helpers.h> #include <yake/bindings.lua/common/vminfo.lua.h> -#include <yake/bindings.lua/common/yake.lua.any_converter.h> #include <yake/task/task.h> Modified: trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp =================================================================== --- trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/yake/bindings.lua/common/vminfo.lua.cpp 2007-09-18 00:26:38 UTC (rev 1873) @@ -28,19 +28,19 @@ #include "vminfo.lua.h" // Lua and Luabind includes: -extern "C" { +//extern "C" { #include "lua.h" #include "lualib.h" #include "lauxlib.h" -} +//} #pragma warning(push) #pragma warning(disable: 4251) #include <luabind/luabind.hpp> #pragma warning(pop) // @todo autolink? -#pragma comment(lib,"luad.lib") -#pragma comment(lib,"luabindd.lib") +//#pragma comment(lib,"luad.lib") +//#pragma comment(lib,"luabindd.lib") // namespace yake { Modified: trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.h 2007-09-18 00:26:38 UTC (rev 1873) @@ -31,10 +31,23 @@ #include <yake/base/yakePrerequisites.h> #include <yake/base/type_info.h> #include <yake/bindings.lua/prerequisites.h> -#include <yake/bindings.lua/common/yake.lua.common.h> +//#include <yake/bindings.lua/common/yake.lua.common.h> #include <map> #include <boost/any.hpp> +#include <luabind/detail/yes_no.hpp> // safe. doesn't include luabind/detail/policy.hpp +#include <luabind/detail/primitives.hpp> +struct lua_State; +namespace luabind { + namespace adl { class object; } + using adl::object; +} + +//================ FIXME ========================= +//#undef YAKE_ENABLE_LUA_PROPERTY +//#define YAKE_ENABLE_LUA_PROPERTY 0 +//================ FIXME ========================= + #define YAKE_LUA_ANY_CONVERTER_API YAKE_BINDINGS_LUA_API #define YAKE_LUA_ANY_CONVERTER_POINTERS 0 @@ -53,28 +66,15 @@ typedef std::map<TypeInfo,PropertyFromObjectFn> PropertyFromObjectMap; YAKE_LUA_ANY_CONVERTER_API PropertyFromObjectMap& object_property_creators(); - typedef luabind::class_<PropertyBase> LuabindClass_PropertyBase; - //typedef luabind::class_<PropertyBase,PropertyPtr> LuabindClass_PropertyBase; - - typedef void(*BindSetPropertyFn)(LuabindClass_PropertyBase&); + //typedef luabind::class_<PropertyBase> LuabindClass_PropertyBase; + typedef void* LuabindClass_PropertyBasePtr; + + typedef void(*BindSetPropertyFn)(LuabindClass_PropertyBasePtr); typedef std::vector<BindSetPropertyFn> BindSetPropertyFnList; YAKE_LUA_ANY_CONVERTER_API BindSetPropertyFnList& setPropertyValue_binders(); template<typename T> - bool setPropertyValue_Generic(PropertyBase& prop, const T& value) - { - try { - prop.setAny( value ); - return true; - } - catch (BadCastException&) - { - //@todo report error! throw exception? - std::cerr << ">>> Warning: Type mismatch on setting of property value!\n"; - std::cerr << " value type=" << typeid(T).name() << " expected type=" << prop.type() << "\n"; - return false; - } - } + bool setPropertyValue_Generic(PropertyBase& prop, const T& value); } // namespace property } // namespace yake #endif @@ -91,91 +91,14 @@ template<class T> struct convert_any { - static void convert(lua_State* L, const boost::any& a) - { - //typename luabind::detail::default_policy::template generate_converter<T, luabind::detail::cpp_to_lua>::type conv; - //conv.apply(L, *boost::any_cast<T>(&a)); - luabind::detail::convert_to_lua(L, *boost::any_cast<T>(&a)); - } + static void convert(lua_State* L, const boost::any& a); #if YAKE_ENABLE_LUA_PROPERTY == 1 // extension for yake::property: - static yake::property::PropertyBase* yake_createValuePropertyFromAny(const boost::any& a) - { - try - { - yake::property::Property<T>* prop = yake::property::makeValueProperty<T>( boost::any_cast<T>(a) ); - YAKE_ASSERT( prop ); - return prop; - } - catch (boost::bad_any_cast&) - { - return 0;//@todo report error - } - } - static yake::property::PropertyBase* yake_createValuePropertyFromObject(const luabind::object& a) - { - //int type = luabind::type(a); - boost::optional<T> value = luabind::object_cast_nothrow<T>(a); - if (value) - { - yake::property::Property<T>* prop = yake::property::makeValueProperty<T>( *value ); - YAKE_ASSERT( prop ); - return prop; - } -#if YAKE_LUA_ANY_CONVERTER_POINTERS == 1 - boost::optional<T*> valuePtr = luabind::object_cast_nothrow<T*>(a); - if (valuePtr) - { - T* px = *valuePtr; - if (px) - { - //yake::property::Property<T>* prop = yake::property::makeValueProperty<T>( *px ); - yake::property::Property<T>* prop = yake::property::makePointerProperty<T>( px ); - YAKE_ASSERT( prop ); - return prop; - } - } + static yake::property::PropertyBase* yake_createValuePropertyFromAny(const boost::any& a); + static yake::property::PropertyBase* yake_createValuePropertyFromObject(const luabind::object& a); + static void yake_bind_setPropertyValue(::yake::property::LuabindClass_PropertyBasePtr); #endif - return 0; //@todo report error - } - static void yake_bind_setPropertyValue(::yake::property::LuabindClass_PropertyBase& x) - { - x.def("set",&yake::property::setPropertyValue_Generic<T>); - } -#endif - static bool yake_anyFromObject(const luabind::object& a, boost::any& out) - { - boost::optional<T> value = luabind::object_cast_nothrow<T>(a); - if (value) - { - out = *value; - return true; - } -#if YAKE_LUA_ANY_CONVERTER_POINTERS == 1 - boost::optional<T*> valuePtr = luabind::object_cast_nothrow<T*>(a); - if (valuePtr) - { - T* px = *valuePtr; - if (px) - { - out = *px; - return true; - } - } -#endif - return false; //@todo report error ? - } - static bool yake_tryAnyFromObject(const luabind::object& a) - { - boost::optional<T> value = luabind::object_cast_nothrow<T>(a); - if (value) - return true; -#if YAKE_LUA_ANY_CONVERTER_POINTERS == 1 - boost::optional<T*> valuePtr = luabind::object_cast_nothrow<T*>(a); - if (value) - return true; -#endif - return false; //@todo report error ? - } + static bool yake_anyFromObject(const luabind::object& a, boost::any& out); + static bool yake_tryAnyFromObject(const luabind::object& a); }; typedef std::map<yake::TypeInfo, void(*)(lua_State*, const boost::any&)> any_converter_map; @@ -211,21 +134,18 @@ // This creator is to be used as a last resort only. If it is stored // with all the other creators it may get called before a better option // can be called. - template<> - inline void register_any_converter<luabind::object>() - { - const yake::TypeInfo ti = YAKE_TYPEID(luabind::object); - any_converters()[ti] = convert_any<luabind::object>::convert; -#if YAKE_ENABLE_LUA_PROPERTY == 1 // extension for yake::property: - yake::property::any_property_creators()[ti] = convert_any<luabind::object>::yake_createValuePropertyFromAny; - yake::property::setPropertyValue_binders().push_back( convert_any<luabind::object>::yake_bind_setPropertyValue ); -#endif - } + //template<> + //inline void register_any_converter<luabind::object>(); namespace luabind { namespace converters { + using luabind::detail::yes_t; + using luabind::detail::no_t; + using luabind::detail::by_value; + using luabind::detail::by_const_reference; + yes_t is_user_defined(by_value<boost::any>); yes_t is_user_defined(by_const_reference<boost::any>); Added: trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.inl =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.inl (rev 0) +++ trunk/yake/yake/bindings.lua/common/yake.lua.any_converter.inl 2007-09-18 00:26:38 UTC (rev 1873) @@ -0,0 +1,164 @@ +/* + ------------------------------------------------------------------------------------ + 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_LUA_ANYCONVERTER_INL_H +#define YAKE_LUA_ANYCONVERTER_INL_H + +#if YAKE_ENABLE_LUA_PROPERTY == 1 // extension for yake::property: + namespace yake { + namespace property { + typedef luabind::class_<PropertyBase> LuabindClass_PropertyBase; + + template<typename T> + bool setPropertyValue_Generic(PropertyBase& prop, const T& value) + { + try { + prop.setAny( value ); + return true; + } + catch (BadCastException&) + { + //@todo report error! throw exception? + std::cerr << ">>> Warning: Type mismatch on setting of property value!\n"; + std::cerr << " value type=" << typeid(T).name() << " expected type=" << prop.type() << "\n"; + return false; + } + } + } // namespace property + } // namespace yake +#endif + + + // boost::any bindings + template<class T> + void convert_any<T>::convert(lua_State* L, const boost::any& a) + { + luabind::detail::convert_to_lua(L, *boost::any_cast<T>(&a)); + } +#if YAKE_ENABLE_LUA_PROPERTY == 1 // extension for yake::property: + template<class T> + yake::property::PropertyBase* convert_any<T>::yake_createValuePropertyFromAny(const boost::any& a) + { + try + { + yake::property::Property<T>* prop = yake::property::makeValueProperty<T>( boost::any_cast<T>(a) ); + YAKE_ASSERT( prop ); + return prop; + } + catch (boost::bad_any_cast&) + { + return 0;//@todo report error + } + } + template<class T> + yake::property::PropertyBase* convert_any<T>::yake_createValuePropertyFromObject(const luabind::object& a) + { + //int type = luabind::type(a); + boost::optional<T> value = luabind::object_cast_nothrow<T>(a); + if (value) + { + yake::property::Property<T>* prop = yake::property::makeValueProperty<T>( *value ); + YAKE_ASSERT( prop ); + return prop; + } +#if YAKE_LUA_ANY_CONVERTER_POINTERS == 1 + boost::optional<T*> valuePtr = luabind::object_cast_nothrow<T*>(a); + if (valuePtr) + { + T* px = *valuePtr; + if (px) + { + //yake::property::Property<T>* prop = yake::property::makeValueProperty<T>( *px ); + yake::property::Property<T>* prop = yake::property::makePointerProperty<T>( px ); + YAKE_ASSERT( prop ); + return prop; + } + } +#endif + return 0; //@todo report error + } + template<class T> + void convert_any<T>::yake_bind_setPropertyValue(::yake::property::LuabindClass_PropertyBasePtr xp) + { + yake::property::LuabindClass_PropertyBase& x = *reinterpret_cast<yake::property::LuabindClass_PropertyBase*>(xp); + x.def("set",&yake::property::setPropertyValue_Generic<T>); + } +#endif + template<class T> + bool convert_any<T>::yake_anyFromObject(const luabind::object& a, boost::any& out) + { + boost::optional<T> value = luabind::object_cast_nothrow<T>(a); + if (value) + { + out = *value; + return true; + } +#if YAKE_LUA_ANY_CONVERTER_POINTERS == 1 + boost::optional<T*> valuePtr = luabind::object_cast_nothrow<T*>(a); + if (valuePtr) + { + T* px = *valuePtr; + if (px) + { + out = *px; + return true; + } + } +#endif + return false; //@todo report error ? + } + template<class T> + bool convert_any<T>::yake_tryAnyFromObject(const luabind::object& a) + { + boost::optional<T> value = luabind::object_cast_nothrow<T>(a); + if (value) + return true; +#if YAKE_LUA_ANY_CONVERTER_POINTERS == 1 + boost::optional<T*> valuePtr = luabind::object_cast_nothrow<T*>(a); + if (value) + return true; +#endif + return false; //@todo report error ? + } + + // NB The specialization for luabind::object is required as for + // this type we do not store a creator in object_property_creators(). + // This creator is to be used as a last resort only. If it is stored + // with all the other creators it may get called before a better option + // can be called. + template<> + inline void register_any_converter<luabind::object>() + { + const yake::TypeInfo ti = YAKE_TYPEID(luabind::object); + any_converters()[ti] = convert_any<luabind::object>::convert; +#if YAKE_ENABLE_LUA_PROPERTY == 1 // extension for yake::property: + yake::property::any_property_creators()[ti] = convert_any<luabind::object>::yake_createValuePropertyFromAny; + yake::property::setPropertyValue_binders().push_back( convert_any<luabind::object>::yake_bind_setPropertyValue ); +#endif + } + + +#endif Modified: trunk/yake/yake/bindings.lua/detail/property.lua.h =================================================================== --- trunk/yake/yake/bindings.lua/detail/property.lua.h 2007-09-18 00:21:13 UTC (rev 1872) +++ trunk/yake/yake/bindings.lua/detail/property.lua.h 2007-09-18 00:26:38 UTC (rev 1873) @@ -24,13 +24,13 @@ source code distribution. ------------------------------------------------------------------------------------ */ -#ifndef YAKE_LUA_BINDINGS_PROPERTYLUA_H -#define YAKE_LUA_BINDINGS_PROPERTYLUA_H +#ifndef YAKE_LUA_BINDINGS_PROPERTYLUA__H +#define YAKE_LUA_BINDINGS_PROPERTYLUA__H #include <yake/config.h> #if YAKE_ENABLE_LUA_PROPERTY == 1 -#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! +#include <yake/bindings.lua/prerequisites.h> // Don't forget to include this for proper dllexport! #include <yake/base/yake.h> #include <yake/property/property.h> #include <boost/any.hpp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-18 00:21:10
|
Revision: 1872 http://yake.svn.sourceforge.net/yake/?rev=1872&view=rev Author: psyclonist Date: 2007-09-17 17:21:13 -0700 (Mon, 17 Sep 2007) Log Message: ----------- * [Lua scripts] cleaned up code Modified Paths: -------------- trunk/yake/common/media/scripts/o_ball.lua trunk/yake/common/media/scripts/o_trigger2.lua trunk/yake/common/media/scripts/raf2.lua Modified: trunk/yake/common/media/scripts/o_ball.lua =================================================================== --- trunk/yake/common/media/scripts/o_ball.lua 2007-09-16 00:54:46 UTC (rev 1871) +++ trunk/yake/common/media/scripts/o_ball.lua 2007-09-18 00:21:13 UTC (rev 1872) @@ -1,7 +1,4 @@ -function onTick() -end function main() - this.events.tick:connect( onTick ) this.model = yake.Model() local g = yake.Graphical() Modified: trunk/yake/common/media/scripts/o_trigger2.lua =================================================================== --- trunk/yake/common/media/scripts/o_trigger2.lua 2007-09-16 00:54:46 UTC (rev 1871) +++ trunk/yake/common/media/scripts/o_trigger2.lua 2007-09-18 00:21:13 UTC (rev 1872) @@ -1,6 +1,3 @@ -print("> Starting object script..."); - --- callback each simulation tick: function onTick() if this.volumes and this.volumes.size > 0 then @@ -29,13 +26,11 @@ function main() -- common ent::Object events this.events.tick:connect( onTick ) - - this.events:create("hey") -- ent::Trigger stuff this:setCondition(function() return (this.on) end) - + -- VolumeTrigger stuff this.properties:create("volumes", yake.VolumeContainerRef()) end -print("> Object script up."); + Modified: trunk/yake/common/media/scripts/raf2.lua =================================================================== --- trunk/yake/common/media/scripts/raf2.lua 2007-09-16 00:54:46 UTC (rev 1871) +++ trunk/yake/common/media/scripts/raf2.lua 2007-09-18 00:21:13 UTC (rev 1872) @@ -187,3 +187,4 @@ -- prepare for next frame: activeKeys = {} end + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-16 00:54:42
|
Revision: 1871 http://yake.svn.sourceforge.net/yake/?rev=1871&view=rev Author: psyclonist Date: 2007-09-15 17:54:46 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [bindings.lua] Lua C/C++ API condition Modified Paths: -------------- trunk/yake/yake/bindings.lua/common/yake.lua.common.h Modified: trunk/yake/yake/bindings.lua/common/yake.lua.common.h =================================================================== --- trunk/yake/yake/bindings.lua/common/yake.lua.common.h 2007-09-16 00:52:12 UTC (rev 1870) +++ trunk/yake/yake/bindings.lua/common/yake.lua.common.h 2007-09-16 00:54:46 UTC (rev 1871) @@ -27,12 +27,25 @@ #ifndef YAKE_BINDINGS_LUA_COMMON_H #define YAKE_BINDINGS_LUA_COMMON_H +#include <yake/base/yakePrerequisites.h> + +#if YAKE_COMPILER == COMPILER_MSVC +# define YAKE_USES_LUA_C_API 1 //@todo use 0 ! +#else +# define YAKE_USES_LUA_C_API 0 +#endif + // Lua and Luabind includes: +#if YAKE_USES_LUA_C_API == 1 extern "C" { +#endif #include "lua.h" #include "lualib.h" #include "lauxlib.h" +#if YAKE_USES_LUA_C_API == 1 } +#endif + #pragma warning(push) #pragma warning(disable: 4251) #define LUABIND_NO_HEADERS_ONLY This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-16 00:52:08
|
Revision: 1870 http://yake.svn.sourceforge.net/yake/?rev=1870&view=rev Author: psyclonist Date: 2007-09-15 17:52:12 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [res] FileDataStream uses C API Modified Paths: -------------- trunk/yake/src/res/datastream.cpp trunk/yake/yake/res/datastream.h Modified: trunk/yake/src/res/datastream.cpp =================================================================== --- trunk/yake/src/res/datastream.cpp 2007-09-15 23:46:41 UTC (rev 1869) +++ trunk/yake/src/res/datastream.cpp 2007-09-16 00:52:12 UTC (rev 1870) @@ -36,29 +36,47 @@ DataStreamBase::~DataStreamBase() {} - FileDataStream::FileDataStream(const std::string & fn) : in_(fn.c_str()), size_(0) + FileDataStream::FileDataStream(const std::string & fn) : in_(0), size_(0) { - assert( in_.is_open() ); + //std::ifstream test(fn.c_str()); + //YAKE_ASSERT( test.is_open() ); + //test.close(); - struct stat s; - const int code = ::stat(fn.c_str(), &s); - YAKE_ASSERT(code == 0)(code); // @todo throw exception of ENOENT or ENOTDIR? - size_ = s.st_size; + in_ = fopen(fn.c_str(),"r"); + YAKE_ASSERT( in_ ); + + int succ = fseek(in_, 0, SEEK_END); + YAKE_ASSERT( succ == 0 ).debug("failed to seek to end"); + + size_ = ftell(in_); + std::cout << "file '" << fn << "' has length " << size_ << " byte(s) (ftell)\n"; + + succ = fseek(in_, 0, SEEK_SET); + YAKE_ASSERT( succ == 0 ).debug("failed to seek to begin"); } + FileDataStream::~FileDataStream() + { + close(); + } size_t FileDataStream::read(void * out, size_t size) { - YAKE_ASSERT( in_.is_open() ); - YAKE_ASSERT( !eof() ); - if (eof()) + YAKE_ASSERT( in_ ); + YAKE_ASSERT( !feof(in_) ); + if (feof(in_)) return 0; - // NB use readsome() for async - std::streampos pre = in_.tellg(); - in_.read((char*)(out),std::streampos(size)); //@todo use boost safe numeric cast - return size_t(in_.tellg() - pre); + + size_t succ = fread(out,size,1,in_); + if ((succ != 1) && !feof(in_)) + { + YAKE_ASSERT( succ == 1 )(succ)(size).debug("read not successful"); + return 0; + } + + return size; } bool FileDataStream::eof() const { - return const_cast<std::ifstream&>(in_).is_open() ? in_.eof() : false; + return in_ ? (feof(in_)!=0) : false; } size_t FileDataStream::size() const { @@ -66,8 +84,9 @@ } void FileDataStream::close() { - if (!in_.is_open()) - in_.close(); + if (in_) + fclose(in_); + in_ = 0; } } // namespace res Modified: trunk/yake/yake/res/datastream.h =================================================================== --- trunk/yake/yake/res/datastream.h 2007-09-15 23:46:41 UTC (rev 1869) +++ trunk/yake/yake/res/datastream.h 2007-09-16 00:52:12 UTC (rev 1870) @@ -28,7 +28,7 @@ #define YAKE_RES_DATASTREAM_H #include "prerequisites.h" -#include <fstream> +#include <cstdio> #include <boost/shared_ptr.hpp> namespace yake { @@ -47,20 +47,21 @@ virtual size_t size() const = 0; virtual void close() = 0; }; - typedef boost::shared_ptr<DataStreamBase> DataStreamPtr; + typedef boost::shared_ptr<DataStreamBase> DataStreamPtr; /** Implements the data stream interface for files. */ struct YAKE_RES_API FileDataStream : public DataStreamBase { FileDataStream(const std::string&); + virtual ~FileDataStream(); virtual size_t read(void*,size_t); virtual bool eof() const; virtual size_t size() const; virtual void close(); private: - std::ifstream in_; + FILE* in_; size_t size_; //@todo fails if file is modified during read! }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:46:38
|
Revision: 1869 http://yake.svn.sourceforge.net/yake/?rev=1869&view=rev Author: psyclonist Date: 2007-09-15 16:46:41 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [bindings.lua] improved C++ standard compliance Modified Paths: -------------- trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h Modified: trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h =================================================================== --- trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h 2007-09-15 23:46:16 UTC (rev 1868) +++ trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h 2007-09-15 23:46:41 UTC (rev 1869) @@ -144,7 +144,7 @@ template<class ConcreteT> void registerClass(ThisBinderFn fn) { - index_type idx = traits_type::getIndex<ConcreteT>(); + index_type idx = traits_type::template getIndex<ConcreteT>(); ClassInfo cls; cls.thisBinder = fn; cls.castToDerived.reset( makeCaster<ConcreteT>() ); @@ -155,7 +155,7 @@ YAKE_ASSERT( obj ); YAKE_ASSERT( tbl.is_valid() ); YAKE_ASSERT( luabind::type(tbl) == LUA_TTABLE ); - ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); + typename ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); YAKE_ASSERT( it != classes_.end() ).debug("Cannot lookup ThisBinder through parents, at the moment!"); const ClassInfo& cls = it->second; YAKE_ASSERT( cls.thisBinder ); @@ -165,7 +165,7 @@ { lua_pushstring(L,"__yake_ent_casters"); lua_newtable(L); - YAKE_FOR_EACH(ClassMap::const_iterator,it,classes_) + YAKE_FOR_EACH(typename ClassMap::const_iterator,it,classes_) { it->second.castToDerived->addToTable(L); } @@ -179,7 +179,7 @@ lua_pushnil(L); return 1; } - ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); + typename ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); YAKE_ASSERT( it != classes_.end() ).debug("Cannot lookup ThisBinder through parents, at the moment!"); const ClassInfo& cls = it->second; YAKE_ASSERT( cls.castToDerived ); @@ -197,7 +197,7 @@ YAKE_ASSERT(obj); if (!obj) return false; - ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); + typename ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); YAKE_ASSERT( it != classes_.end() ).debug("Cannot lookup ThisBinder through parents, at the moment!"); const ClassInfo& cls = it->second; YAKE_ASSERT( cls.castToDerived ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:46:12
|
Revision: 1868 http://yake.svn.sourceforge.net/yake/?rev=1868&view=rev Author: psyclonist Date: 2007-09-15 16:46:16 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [base] removed duplicate type definition of 'real' for GCC/Windows combination Modified Paths: -------------- trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h Modified: trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h =================================================================== --- trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h 2007-09-15 23:45:49 UTC (rev 1867) +++ trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h 2007-09-15 23:46:16 UTC (rev 1868) @@ -61,7 +61,6 @@ typedef unsigned int uint32; typedef long long int64; typedef unsigned long long uint64; - typedef float real; } // Stl workarounds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:45:45
|
Revision: 1867 http://yake.svn.sourceforge.net/yake/?rev=1867&view=rev Author: psyclonist Date: 2007-09-15 16:45:49 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [inputOgreOIS] added include Modified Paths: -------------- trunk/yake/src/plugins/inputOgreOIS/InputSystemOgreOIS.cpp Modified: trunk/yake/src/plugins/inputOgreOIS/InputSystemOgreOIS.cpp =================================================================== --- trunk/yake/src/plugins/inputOgreOIS/InputSystemOgreOIS.cpp 2007-09-15 23:45:33 UTC (rev 1866) +++ trunk/yake/src/plugins/inputOgreOIS/InputSystemOgreOIS.cpp 2007-09-15 23:45:49 UTC (rev 1867) @@ -27,6 +27,7 @@ #include <yake/plugins/inputOgreOIS/yakePCH.h> #include <yake/input/yakeInputSystem.h> #include <yake/plugins/inputOgreOIS/InputSystemOgreOIS.h> +#include <yake/base/math/yakeGeometry.h> #include <OIS.h> #include <Ogre.h> @@ -69,7 +70,7 @@ if (button < 0) return false; return mButtons[ button ]; } - + //----------------------------------------------------------------------- math::Vector3 MouseDeviceOgreOIS::getPosition() const { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:45:30
|
Revision: 1866 http://yake.svn.sourceforge.net/yake/?rev=1866&view=rev Author: psyclonist Date: 2007-09-15 16:45:33 -0700 (Sat, 15 Sep 2007) Log Message: ----------- removed comment Modified Paths: -------------- trunk/yake/src/bindings.lua/detail/base.lua.cpp Modified: trunk/yake/src/bindings.lua/detail/base.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-09-15 23:45:20 UTC (rev 1865) +++ trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-09-15 23:45:33 UTC (rev 1866) @@ -106,7 +106,7 @@ //register_any_converter<boost::shared_ptr<VolumeContainer> >(); } } g_initer; - } // namespace + } // namespace //------------------------------------------------------------------------- void bind(lua_State* L) @@ -118,8 +118,6 @@ using namespace luabind; #define YAKE_MATH_MODULE L, "yake" - ///TODO Bind most common operators! - module( YAKE_MATH_MODULE ) [ class_<Color>("Color") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:45:16
|
Revision: 1865 http://yake.svn.sourceforge.net/yake/?rev=1865&view=rev Author: psyclonist Date: 2007-09-15 16:45:20 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [build] more adjustments for MinGW Modified Paths: -------------- trunk/yake/scripts/premake/deps.lua trunk/yake/scripts/premake/tools.lua Modified: trunk/yake/scripts/premake/deps.lua =================================================================== --- trunk/yake/scripts/premake/deps.lua 2007-09-15 23:44:36 UTC (rev 1864) +++ trunk/yake/scripts/premake/deps.lua 2007-09-15 23:45:20 UTC (rev 1865) @@ -20,17 +20,25 @@ defDep("ogre") defDepIncludePath("ogre", "dependencies/ogrenew/include") defDepIncludePath("ogre", "dependencies/ogrenew/samples/include") -defDepLibraryPath("ogre","dependencies/ogrenew/lib") -defDepLibrary("ogre","OgreMain","Release") -defDepLibrary("ogre","OgreMain","ReleaseLib") -defDepLibrary("ogre","OgreMain","ReleaseWithSymbols") -defDepLibrary("ogre","OgreMain_d","Debug") -defDepLibrary("ogre","OgreMain_d","DebugLib") -defDepLibrary("ogre","OgreGUIRenderer","Release") -defDepLibrary("ogre","OgreGUIRenderer","ReleaseLib") -defDepLibrary("ogre","OgreGUIRenderer","ReleaseWithSymbols") -defDepLibrary("ogre","OgreGUIRenderer_d","Debug") -defDepLibrary("ogre","OgreGUIRenderer_d","DebugLib") +defDepLibraryPath("ogre", "dependencies/ogrenew/lib") +do + local ext = "" + local pre = "" + if cb_gcc then + ext = "."..DLL_EXTENSION + pre = rootdir .. "dependencies/ogrenew/lib/" --TODO < why is the lib path above not enough for C:B/MinGW? + end + defDepLibrary("ogre",pre.."OgreMain"..ext,"Release") + defDepLibrary("ogre",pre.."OgreMain"..ext,"ReleaseLib") + defDepLibrary("ogre",pre.."OgreMain"..ext,"ReleaseWithSymbols") + defDepLibrary("ogre",pre.."OgreMain_d"..ext,"Debug") + defDepLibrary("ogre",pre.."OgreMain_d"..ext,"DebugLib") + defDepLibrary("ogre",pre.."OgreGUIRenderer"..ext,"Release") + defDepLibrary("ogre",pre.."OgreGUIRenderer"..ext,"ReleaseLib") + defDepLibrary("ogre",pre.."OgreGUIRenderer"..ext,"ReleaseWithSymbols") + defDepLibrary("ogre",pre.."OgreGUIRenderer_d"..ext,"Debug") + defDepLibrary("ogre",pre.."OgreGUIRenderer_d"..ext,"DebugLib") +end -------------------------------------- -- Dependency package OIS @@ -100,7 +108,7 @@ defDepLibrary("lua","luad","Debug") defDepLibrary("lua","luad","DebugLib") elseif windows and cb_gcc then - defDepLibrary("lua51.dll","lua") + defDepLibrary("lua",rootdir.."dependencies/lua/lib/lua51.dll") else defDepLibrary("lua","lua") end @@ -118,7 +126,7 @@ defDepLibrary("luabind","luabindd","Debug") defDepLibrary("luabind","luabindd","DebugLib") elseif windows and cb_gcc then - defDepLibrary("luabind.dll","luabind") + defDepLibrary("luabind",rootdir.."dependencies/luabind/lib/luabind.dll") else defDepLibrary("luabind","luabind") end Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-09-15 23:44:36 UTC (rev 1864) +++ trunk/yake/scripts/premake/tools.lua 2007-09-15 23:45:20 UTC (rev 1865) @@ -313,6 +313,7 @@ if not lib then return end + assert(deps[name],"dependency with name '"..tostring(name).."' does not exist") if not cfg then tinsert(deps[name].libs,lib) else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:44:36
|
Revision: 1864 http://yake.svn.sourceforge.net/yake/?rev=1864&view=rev Author: psyclonist Date: 2007-09-15 16:44:36 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [demo] res/lua1: cleanup Modified Paths: -------------- trunk/yake/samples/res/lua1/demo.cpp Modified: trunk/yake/samples/res/lua1/demo.cpp =================================================================== --- trunk/yake/samples/res/lua1/demo.cpp 2007-09-15 23:44:18 UTC (rev 1863) +++ trunk/yake/samples/res/lua1/demo.cpp 2007-09-15 23:44:36 UTC (rev 1864) @@ -27,14 +27,6 @@ bind_math(vm.get()); bind_res(vm.get()); - //bind - { - /* - lua_State* L = static_cast<scripting::LuaVM*>(vm_.get())->getLuaState(); - luabind::globals(L)["app"] = &app_; - */ - } - // NB Resource configuration is done in RAF application (via sampleResLua1.cfg). // Load & run script This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:44:14
|
Revision: 1863 http://yake.svn.sourceforge.net/yake/?rev=1863&view=rev Author: psyclonist Date: 2007-09-15 16:44:18 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [demo] physics1: Vector3->Point3 Modified Paths: -------------- trunk/yake/samples/physics/demo/yakeDemo.cpp Modified: trunk/yake/samples/physics/demo/yakeDemo.cpp =================================================================== --- trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-09-15 23:42:12 UTC (rev 1862) +++ trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-09-15 23:44:18 UTC (rev 1863) @@ -80,7 +80,7 @@ } void createSimpleGraphicalObject( Simple & rSimple, const String & rkMesh, - const Vector3 & rkPosition = Vector3::kZero, + const Point3 & rkPosition = Point3::kZero, const Vector3 & rkScale = Vector3(1,1,1)) { rSimple.pSN.reset( mGWorld->createSceneNode() ); @@ -91,9 +91,9 @@ rSimple.pSN->setScale( rkScale ); } void createSimpleActor( SharedPtr<physics::IWorld> pPWorld, - Simple & rSimple, - physics::IShape::Desc & rkDesc, - const Vector3 & rkPosition, + Simple & rSimple, + const physics::IShape::Desc & rkDesc, + const Point3 & rkPosition, const real mass = 2 ) { rSimple.pActor = pPWorld->createActor(physics::ACTOR_DYNAMIC); @@ -106,30 +106,30 @@ rSimple.pActor->subscribeToCollisionEntered( boost::bind(&MiniApp::onCollisionEntered,this)); } - bool createBall( SharedPtr<physics::IWorld> pPWorld, Simple & rSimple, const Vector3 & rkPosition, const real radius ) + bool createBall( SharedPtr<physics::IWorld> pPWorld, Simple & rSimple, const Point3 & rkPosition, const real radius ) { // graphics - createSimpleGraphicalObject( rSimple, "sphere_d1.mesh", Vector3(0,0,0), radius*Vector3(2,2,2) ); + createSimpleGraphicalObject( rSimple, "sphere_d1.mesh", Point3::kZero, radius*Vector3(2,2,2) ); // physics createSimpleActor( pPWorld, rSimple, physics::IShape::SphereDesc(real(radius)), rkPosition ); return true; } - bool createCapsule( SharedPtr<physics::IWorld> pPWorld, Simple & rSimple, const Vector3 & rkPosition, const real height, const real radius ) + bool createCapsule( SharedPtr<physics::IWorld> pPWorld, Simple & rSimple, const Point3 & rkPosition, const real height, const real radius ) { // graphics - createSimpleGraphicalObject( rSimple, "box_1x1x1.mesh", Vector3(0,0,0), Vector3(radius,height,radius) ); + createSimpleGraphicalObject( rSimple, "box_1x1x1.mesh", Point3::kZero, Vector3(radius,height,radius) ); // physics createSimpleActor( pPWorld, rSimple, physics::IShape::CapsuleDesc(real(height), real(radius)), rkPosition ); return true; } - bool createBox( SharedPtr<physics::IWorld> pPWorld, Simple & rSimple, const Vector3 & rkPosition, const Vector3 & rkDimensions ) + bool createBox( SharedPtr<physics::IWorld> pPWorld, Simple & rSimple, const Point3 & rkPosition, const Vector3 & rkDimensions ) { // graphics - createSimpleGraphicalObject( rSimple, "box_1x1x1.mesh", Vector3(0,0,0), 2*rkDimensions ); + createSimpleGraphicalObject( rSimple, "box_1x1x1.mesh", Point3::kZero, 2*rkDimensions ); // physics createSimpleActor( pPWorld, rSimple, physics::IShape::BoxDesc(rkDimensions), rkPosition ); @@ -169,7 +169,7 @@ pE->setCastsShadow( true ); - pSN->setPosition( Vector3(0,0,-100) ); + pSN->setPosition( Point3(0,0,-100) ); } void createPositionedLight() { @@ -179,7 +179,7 @@ mSceneNodes.push_back( pSN ); pL->setType( graphics::ILight::LT_POINT ); pL->setDiffuseColour( Color(1,1,1,1) ); - pSN->setPosition( Vector3(0,50,0) ); + pSN->setPosition( Point3(0,50,0) ); pL->setDiffuseColour(Color(0.35, 0.35, 0.38)); pL->setSpecularColour(Color(0.9, 0.9, 1)); pL->setAttenuation( 8000, 1, 0.0005, 0 ); @@ -205,13 +205,13 @@ graphics::ILight* pL = mGWorld->createLight(); SharedPtr<graphics::ISceneNode> pNode( mGWorld->createSceneNode() ); pNode->attachLight( pL ); - + mSceneNodes.push_back(pNode); pL->setType(ILight::LT_DIRECTIONAL); - pNode->setPosition(Vector3(-1000,1250,500)); + pNode->setPosition(Point3(-1000,1250,500)); Vector3 dir; - dir = -pNode->getPosition(); + dir = -pNode->getPosition().asVector(); dir.normalise(); pL->setDirection(dir); pL->setDiffuseColour(Color(0.35, 0.35, 0.38)); @@ -266,8 +266,8 @@ graphics::ICamera* pC = mGWorld->createCamera(); pC->setNearClipDistance( 1 ); pC->setFarClipDistance( 1000 ); - pC->setPosition( Vector3(0,2,10) ); - pC->lookAt( Vector3(0,4,0) ); + pC->setPosition( Point3(0,2,10) ); + pC->lookAt( Point3(0,4,0) ); graphics::IViewport* pV = mGWorld->createViewport( pC ); pV->setDimensions( 0.7, 0, 0.3, 0.3 ); pV->setZ( 102 ); @@ -281,8 +281,8 @@ graphics::ICamera* pC = mGWorld->createCamera(); pC->setNearClipDistance( 1 ); pC->setFarClipDistance( 1000 ); - pC->setPosition( Vector3(0,10,50) ); - pC->lookAt( Vector3(0,1,0) ); + pC->setPosition( Point3(0,10,50) ); + pC->lookAt( Point3(0,1,0) ); graphics::IViewport* pV = mGWorld->createViewport( pC ); pV->setDimensions( 0, 0, 0.3, 0.3 ); pV->setZ( 101 ); @@ -297,8 +297,8 @@ graphics::ICamera* pC = mGWorld->createCamera(); pC->setNearClipDistance( 1 ); pC->setFarClipDistance( 1000 ); - pC->setPosition( Vector3(25,20,25) ); - pC->lookAt( Vector3(0,1,0) ); + pC->setPosition( Point3(25,20,25) ); + pC->lookAt( Point3(0,1,0) ); graphics::IViewport* pV = mGWorld->createViewport( pC ); pV->setDimensions( 0, 0, 1, 1 ); pV->setZ( 100 ); @@ -318,7 +318,7 @@ DequeIterator<Views> it(mViews.begin(), mViews.end()); while (it.hasMoreElements()) { - SharedPtr<View> & pView = it.getNext(); + SharedPtr<View> pView = it.getNext(); YAKE_ASSERT( pView ); YAKE_SAFE_DELETE( pView->pViewport ); YAKE_SAFE_DELETE( pView->pCamera ); @@ -342,7 +342,7 @@ std::ostream& operator << (std::ostream & o, const physics::IActor & rhs) { - Vector3 pos = rhs.getPosition(); + Point3 pos = rhs.getPosition(); o << "(" << pos.x << ", " << pos.y << ", " << pos.z << ")"; return o; } @@ -435,19 +435,19 @@ SharedPtr<physics::IWorld> pPWorld = mPWorld1; #endif // spawn the object - const Vector3 spawnOffset = bUseWorldOne ? Vector3(-5,0,0) : Vector3(5,0,0); - const Vector3 spawnPos = spawnOffset + Vector3(randomiser.randReal()*0.5,10,randomiser.randReal()*0.5); + const Point3 spawnOffset = bUseWorldOne ? Point3(-5,0,0) : Point3(5,0,0); + const Point3 spawnPos = spawnOffset + Vector3(randomiser.randReal()*0.5,10,randomiser.randReal()*0.5); objs.push_back( SharedPtr<Simple>( new Simple( pPWorld ) ) ); SharedPtr<Simple> last = objs.back(); std::cout << randomiser.randReal() << "\n"; if (randomiser.randReal() < 0.5) - createBox( pPWorld, *objs.back(), + createBox( pPWorld, *objs.back(), spawnPos, // position Vector3(randomiser.randReal()*3,1,randomiser.randReal()*2) ); // dimensions else - createBall( pPWorld, *objs.back(), + createBall( pPWorld, *objs.back(), spawnPos, // position randomiser.randReal()*2 ); //dimension/radius This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |