OSDN Git Service

moftmp
authoro_ggy <yasutomo@santos.(none)>
Wed, 21 Jul 2010 20:56:46 +0000 (13:56 -0700)
committersantos <yasutomo@santos.(none)>
Wed, 21 Jul 2010 20:56:46 +0000 (13:56 -0700)
279 files changed:
moftmp/AbstractScene.cpp [new file with mode: 0755]
moftmp/AmbientLight.cpp [new file with mode: 0755]
moftmp/AmbientLight.hpp [new file with mode: 0755]
moftmp/Application.cpp [new file with mode: 0755]
moftmp/Application.hpp [new file with mode: 0755]
moftmp/Board.cpp [new file with mode: 0755]
moftmp/Board.hpp [new file with mode: 0755]
moftmp/CSVFile.cpp [new file with mode: 0755]
moftmp/CSVFile.h [new file with mode: 0755]
moftmp/Camera.cpp [new file with mode: 0755]
moftmp/Camera.hpp [new file with mode: 0755]
moftmp/Captor.cpp [new file with mode: 0755]
moftmp/Captor.hpp [new file with mode: 0755]
moftmp/Color.cpp [new file with mode: 0755]
moftmp/Color.hpp [new file with mode: 0755]
moftmp/ColorComponent.hpp [new file with mode: 0755]
moftmp/Component2D.cpp [new file with mode: 0755]
moftmp/Component2D.h [new file with mode: 0755]
moftmp/Component2D.hpp [new file with mode: 0755]
moftmp/Component3D.cpp [new file with mode: 0755]
moftmp/Component3D.hpp [new file with mode: 0755]
moftmp/ConsoleIO.cpp [new file with mode: 0755]
moftmp/ConsoleIO.hpp [new file with mode: 0755]
moftmp/Container2D.cpp [new file with mode: 0755]
moftmp/Container2D.h [new file with mode: 0755]
moftmp/Container3D.cpp [new file with mode: 0755]
moftmp/Container3D.h [new file with mode: 0755]
moftmp/DataRow.cpp [new file with mode: 0755]
moftmp/DataRow.h [new file with mode: 0755]
moftmp/DataTable.cpp [new file with mode: 0755]
moftmp/DataTable.h [new file with mode: 0755]
moftmp/Deleter.hpp [new file with mode: 0755]
moftmp/DeviceInputReceiver.cpp [new file with mode: 0755]
moftmp/DirectionalLight.cpp [new file with mode: 0755]
moftmp/DirectionalLight.h [new file with mode: 0755]
moftmp/Drawable.hpp [new file with mode: 0755]
moftmp/EventCondition.hpp [new file with mode: 0755]
moftmp/EventScheduler.cpp [new file with mode: 0755]
moftmp/EventScheduler.hpp [new file with mode: 0755]
moftmp/FactoryMethod.hpp [new file with mode: 0755]
moftmp/FilePath.cpp [new file with mode: 0755]
moftmp/FilePath.hpp [new file with mode: 0755]
moftmp/FileTextureBuilder.cpp [new file with mode: 0755]
moftmp/Finalizer.hpp [new file with mode: 0755]
moftmp/Font.cpp [new file with mode: 0755]
moftmp/Font.hpp [new file with mode: 0755]
moftmp/Graphics3D.hpp [new file with mode: 0755]
moftmp/GraphicsDevice.cpp [new file with mode: 0755]
moftmp/GraphicsDevice.hpp [new file with mode: 0755]
moftmp/GraphicsObject.cpp [new file with mode: 0755]
moftmp/GraphicsSchedule.cpp [new file with mode: 0755]
moftmp/GraphicsSchedule.h [new file with mode: 0755]
moftmp/GraphicsUnit.hpp [new file with mode: 0755]
moftmp/InputDevice.cpp [new file with mode: 0755]
moftmp/InputDevice.hpp [new file with mode: 0755]
moftmp/InputEventCondition.cpp [new file with mode: 0755]
moftmp/InputEventCondition.hpp [new file with mode: 0755]
moftmp/InputReceiver.hpp [new file with mode: 0755]
moftmp/InstructionSet.hpp [new file with mode: 0755]
moftmp/Interpolation.hpp [new file with mode: 0755]
moftmp/Interpreter.cpp [new file with mode: 0755]
moftmp/Interpreter.hpp [new file with mode: 0755]
moftmp/KeyPressedEventCondition.cpp [new file with mode: 0755]
moftmp/KeyPressedEventCondition.hpp [new file with mode: 0755]
moftmp/Light.cpp [new file with mode: 0755]
moftmp/Light.hpp [new file with mode: 0755]
moftmp/Line3D.cpp [new file with mode: 0755]
moftmp/Line3D.h [new file with mode: 0755]
moftmp/LoggedInputReceiver.cpp [new file with mode: 0755]
moftmp/LoggedInputReceiver.hpp [new file with mode: 0755]
moftmp/LoggingInputReceiver.cpp [new file with mode: 0755]
moftmp/LoggingInputReceiver.hpp [new file with mode: 0755]
moftmp/LuaScript.cpp [new file with mode: 0755]
moftmp/LuaScript.hpp [new file with mode: 0755]
moftmp/Material.hpp [new file with mode: 0755]
moftmp/MaterialBuilder.cpp [new file with mode: 0755]
moftmp/MaterialBuilder.hpp [new file with mode: 0755]
moftmp/Matrix2D.cpp [new file with mode: 0755]
moftmp/Matrix2D.hpp [new file with mode: 0755]
moftmp/Matrix3D.cpp [new file with mode: 0755]
moftmp/Matrix3D.hpp [new file with mode: 0755]
moftmp/Mesh.cpp [new file with mode: 0755]
moftmp/MeshBuilder.cpp [new file with mode: 0755]
moftmp/MeshBuilder.hpp [new file with mode: 0755]
moftmp/MeshResource.h [new file with mode: 0755]
moftmp/OnceEventCondition.cpp [new file with mode: 0755]
moftmp/OnceEventCondition.hpp [new file with mode: 0755]
moftmp/PixelMap.hpp [new file with mode: 0755]
moftmp/PixelMapTextureBuilder.cpp [new file with mode: 0755]
moftmp/PlainWidgetView.cpp [new file with mode: 0755]
moftmp/PlainWidgetView.hpp [new file with mode: 0755]
moftmp/Rectangle.hpp [new file with mode: 0755]
moftmp/ResourceManager.hpp [new file with mode: 0755]
moftmp/SceneGraph.hpp [new file with mode: 0755]
moftmp/SelectionModel.cpp [new file with mode: 0755]
moftmp/SelectionModel.h [new file with mode: 0755]
moftmp/Sprite.cpp [new file with mode: 0755]
moftmp/Sprite.hpp [new file with mode: 0755]
moftmp/TextCompiler.cpp [new file with mode: 0755]
moftmp/TextCompiler.hpp [new file with mode: 0755]
moftmp/TextView.cpp [new file with mode: 0755]
moftmp/TextView.hpp [new file with mode: 0755]
moftmp/Texture.cpp [new file with mode: 0755]
moftmp/Texture.hpp [new file with mode: 0755]
moftmp/TextureComponent.hpp [new file with mode: 0755]
moftmp/TextureResource.h [new file with mode: 0755]
moftmp/Timer.cpp [new file with mode: 0755]
moftmp/Timer.hpp [new file with mode: 0755]
moftmp/Vector2D.cpp [new file with mode: 0755]
moftmp/Vector2D.hpp [new file with mode: 0755]
moftmp/Vector3D.cpp [new file with mode: 0755]
moftmp/Vector3D.hpp [new file with mode: 0755]
moftmp/VertexBuffer.cpp [new file with mode: 0755]
moftmp/VertexBuffer.hpp [new file with mode: 0755]
moftmp/VertexTypes.hpp [new file with mode: 0755]
moftmp/Window.cpp [new file with mode: 0755]
moftmp/Window.hpp [new file with mode: 0755]
moftmp/graphics/utilities.hpp [new file with mode: 0755]
moftmp/graphics/utilities.hpp~ [new file with mode: 0755]
moftmp/mofGraphics.hpp [new file with mode: 0755]
moftmp/mofInput.hpp [new file with mode: 0755]
moftmp/moflib.vcproj [new file with mode: 0755]
moftmp/moflib.vcproj.TOMOHIRO.TomohiroYasuda.user [new file with mode: 0755]
moftmp/private/DeviceInputReceiver.hpp [new file with mode: 0755]
moftmp/private/DirectInput.hpp [new file with mode: 0755]
moftmp/private/FileTextureBuilder.cpp [new file with mode: 0755]
moftmp/private/FileTextureBuilder.hpp [new file with mode: 0755]
moftmp/private/GraphicsDeviceImpl.hpp [new file with mode: 0755]
moftmp/private/Interpreter.hpp [new file with mode: 0755]
moftmp/private/Interpreter.hpp~ [new file with mode: 0755]
moftmp/private/Mesh.hpp [new file with mode: 0755]
moftmp/private/MeshDisposer.hpp [new file with mode: 0755]
moftmp/private/PixelMapTextureBuilder.hpp [new file with mode: 0755]
moftmp/private/TextureBuilder.hpp [new file with mode: 0755]
moftmp/private/TextureImpl.hpp [new file with mode: 0755]
moftmp/private/VertexFVF.hpp [new file with mode: 0755]
moftmp/private/commands.hpp~ [new file with mode: 0755]
moftmp/private/message.cpp~ [new file with mode: 0755]
moftmp/private/regist.cpp [new file with mode: 0755]
moftmp/private/regist.cpp~ [new file with mode: 0755]
moftmp/private/regist.hpp [new file with mode: 0755]
moftmp/private/regist.hpp~ [new file with mode: 0755]
moftmp/real.hpp [new file with mode: 0755]
moftmp/stream/Animation.hpp~ [new file with mode: 0755]
moftmp/stream/AnimationPlayer.hpp [new file with mode: 0755]
moftmp/stream/AnimationPlayer.hpp~ [new file with mode: 0755]
moftmp/stream/AnimationScheduler.cpp [new file with mode: 0755]
moftmp/stream/BoundsAnimation.hpp [new file with mode: 0755]
moftmp/stream/BoundsAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/Cache.cpp [new file with mode: 0755]
moftmp/stream/Cache.cpp~ [new file with mode: 0755]
moftmp/stream/Cache.hpp [new file with mode: 0755]
moftmp/stream/Cache.hpp~ [new file with mode: 0755]
moftmp/stream/Cascade.hpp [new file with mode: 0755]
moftmp/stream/Cascade.hpp~ [new file with mode: 0755]
moftmp/stream/CascadeAnimation.cpp [new file with mode: 0755]
moftmp/stream/CascadingAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/Constant.hpp [new file with mode: 0755]
moftmp/stream/Constant.hpp~ [new file with mode: 0755]
moftmp/stream/DataBasedAnimation.cpp [new file with mode: 0755]
moftmp/stream/DataBasedAnimation.h [new file with mode: 0755]
moftmp/stream/DefaultAnimationPlayer.cpp [new file with mode: 0755]
moftmp/stream/DefaultAnimationPlayer.hpp [new file with mode: 0755]
moftmp/stream/DefaultAnimationPlayer.hpp~ [new file with mode: 0755]
moftmp/stream/Filter.hpp [new file with mode: 0755]
moftmp/stream/Filter.hpp~ [new file with mode: 0755]
moftmp/stream/Joint.hpp [new file with mode: 0755]
moftmp/stream/Joint.hpp~ [new file with mode: 0755]
moftmp/stream/JointAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/KeyFrameAnimation.hpp [new file with mode: 0755]
moftmp/stream/KeyFrameAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/Loop.hpp [new file with mode: 0755]
moftmp/stream/Loop.hpp~ [new file with mode: 0755]
moftmp/stream/LoopAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/Manipulator.hpp [new file with mode: 0755]
moftmp/stream/Manipulator.hpp~ [new file with mode: 0755]
moftmp/stream/Offset.hpp [new file with mode: 0755]
moftmp/stream/Offset.hpp~ [new file with mode: 0755]
moftmp/stream/OffsetAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/ParametricAnimation.hpp [new file with mode: 0755]
moftmp/stream/ParametricAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/Reference.hpp [new file with mode: 0755]
moftmp/stream/Reference.hpp~ [new file with mode: 0755]
moftmp/stream/ReferenceWrapper.hpp [new file with mode: 0755]
moftmp/stream/ReferenceWrapper.hpp~ [new file with mode: 0755]
moftmp/stream/Rotation2D.hpp [new file with mode: 0755]
moftmp/stream/Rotation2D.hpp~ [new file with mode: 0755]
moftmp/stream/RotationAnimation2D.hpp~ [new file with mode: 0755]
moftmp/stream/RotationAnimation3D.hpp [new file with mode: 0755]
moftmp/stream/RotationAnimation3D.hpp~ [new file with mode: 0755]
moftmp/stream/Scaling2D.hpp [new file with mode: 0755]
moftmp/stream/Scaling2D.hpp~ [new file with mode: 0755]
moftmp/stream/ScalingAnimation2D.hpp~ [new file with mode: 0755]
moftmp/stream/ScalingAnimation3D.hpp [new file with mode: 0755]
moftmp/stream/ScalingAnimation3D.hpp~ [new file with mode: 0755]
moftmp/stream/Stream.hpp~ [new file with mode: 0755]
moftmp/stream/Translation2D.hpp [new file with mode: 0755]
moftmp/stream/Translation2D.hpp~ [new file with mode: 0755]
moftmp/stream/TranslationAnimation2D.hpp~ [new file with mode: 0755]
moftmp/stream/TranslationAnimation3D.hpp [new file with mode: 0755]
moftmp/stream/TranslationAnimation3D.hpp~ [new file with mode: 0755]
moftmp/stream/TypeStream.hpp [new file with mode: 0755]
moftmp/stream/TypeStream.hpp~ [new file with mode: 0755]
moftmp/stream/UniformAnimation.hpp [new file with mode: 0755]
moftmp/stream/UniformAnimation.hpp~ [new file with mode: 0755]
moftmp/stream/mofAnimations.hpp~ [new file with mode: 0755]
moftmp/stream/utilities.cpp [new file with mode: 0755]
moftmp/stream/utilities.cpp~ [new file with mode: 0755]
moftmp/stream/utilities.hpp [new file with mode: 0755]
moftmp/stream/utilities.hpp~ [new file with mode: 0755]
moftmp/streams.hpp [new file with mode: 0755]
moftmp/tests/Alltests.cpp [new file with mode: 0755]
moftmp/tests/SceneGraphTest.cpp [new file with mode: 0755]
moftmp/tests/TimerTest.cpp [new file with mode: 0755]
moftmp/tstring.hpp [new file with mode: 0755]
moftmp/utilities.hpp [new file with mode: 0755]
moftmp/widget/ButtonWidgetView.hpp~ [new file with mode: 0755]
moftmp/widget/Container.cpp [new file with mode: 0755]
moftmp/widget/Container.cpp~ [new file with mode: 0755]
moftmp/widget/Container.hpp [new file with mode: 0755]
moftmp/widget/Container.hpp~ [new file with mode: 0755]
moftmp/widget/ContainerWidgetView.cpp~ [new file with mode: 0755]
moftmp/widget/ContainerWidgetView.hpp~ [new file with mode: 0755]
moftmp/widget/Effect.cpp [new file with mode: 0755]
moftmp/widget/Effect.cpp~ [new file with mode: 0755]
moftmp/widget/Effect.hpp [new file with mode: 0755]
moftmp/widget/Effect.hpp~ [new file with mode: 0755]
moftmp/widget/Frame.cpp [new file with mode: 0755]
moftmp/widget/Frame.cpp~ [new file with mode: 0755]
moftmp/widget/Frame.hpp [new file with mode: 0755]
moftmp/widget/Frame.hpp~ [new file with mode: 0755]
moftmp/widget/FrameBuilder.hpp [new file with mode: 0755]
moftmp/widget/FrameBuilder.hpp~ [new file with mode: 0755]
moftmp/widget/GridLayout.cpp [new file with mode: 0755]
moftmp/widget/GridLayout.cpp~ [new file with mode: 0755]
moftmp/widget/GridLayout.hpp [new file with mode: 0755]
moftmp/widget/GridLayout.hpp~ [new file with mode: 0755]
moftmp/widget/ImageView.cpp [new file with mode: 0755]
moftmp/widget/ImageView.cpp~ [new file with mode: 0755]
moftmp/widget/ImageView.hpp [new file with mode: 0755]
moftmp/widget/ImageView.hpp~ [new file with mode: 0755]
moftmp/widget/ImageWidgetView.cpp~ [new file with mode: 0755]
moftmp/widget/ImageWidgetView.hpp~ [new file with mode: 0755]
moftmp/widget/Layout.hpp [new file with mode: 0755]
moftmp/widget/Layout.hpp~ [new file with mode: 0755]
moftmp/widget/LayoutManager.cpp~ [new file with mode: 0755]
moftmp/widget/LayoutManager.hpp~ [new file with mode: 0755]
moftmp/widget/Menu.cpp [new file with mode: 0755]
moftmp/widget/Menu.cpp~ [new file with mode: 0755]
moftmp/widget/Menu.hpp [new file with mode: 0755]
moftmp/widget/Menu.hpp~ [new file with mode: 0755]
moftmp/widget/MenuWidget.cpp~ [new file with mode: 0755]
moftmp/widget/MenuWidget.hpp~ [new file with mode: 0755]
moftmp/widget/Message.hpp [new file with mode: 0755]
moftmp/widget/Message.hpp~ [new file with mode: 0755]
moftmp/widget/MessageWidget.cpp [new file with mode: 0755]
moftmp/widget/MessageWidget.cpp20090811 [new file with mode: 0755]
moftmp/widget/MessageWidget.cpp~ [new file with mode: 0755]
moftmp/widget/MessageWidget.hpp [new file with mode: 0755]
moftmp/widget/MessageWidget.hpp~ [new file with mode: 0755]
moftmp/widget/OverlapLayout.cpp [new file with mode: 0755]
moftmp/widget/OverlapLayout.cpp~ [new file with mode: 0755]
moftmp/widget/OverlapLayout.hpp [new file with mode: 0755]
moftmp/widget/OverlapLayout.hpp~ [new file with mode: 0755]
moftmp/widget/Page.hpp~ [new file with mode: 0755]
moftmp/widget/Pager.cpp [new file with mode: 0755]
moftmp/widget/Pager.cpp~ [new file with mode: 0755]
moftmp/widget/Pager.hpp [new file with mode: 0755]
moftmp/widget/Pager.hpp~ [new file with mode: 0755]
moftmp/widget/Widget.hpp [new file with mode: 0755]
moftmp/widget/Widget.hpp~ [new file with mode: 0755]
moftmp/widget/WidgetView.hpp [new file with mode: 0755]
moftmp/widget/WidgetView.hpp~ [new file with mode: 0755]
moftmp/widget/[ [new file with mode: 0755]
moftmp/widget/utilities.cpp [new file with mode: 0755]
moftmp/widget/utilities.cpp~ [new file with mode: 0755]
moftmp/widget/utilities.hpp [new file with mode: 0755]
moftmp/widget/utilities.hpp~ [new file with mode: 0755]
moftmp/widgets.hpp [new file with mode: 0755]

diff --git a/moftmp/AbstractScene.cpp b/moftmp/AbstractScene.cpp
new file mode 100755 (executable)
index 0000000..f036553
--- /dev/null
@@ -0,0 +1,112 @@
+#include "mof/AbstractScene.h"\r
+#include "mof/ConsoleIO.h"\r
+\r
+\r
+\r
+\r
+mof::AbstractScene::AbstractScene() {\r
+       //m_state = mof::AbstractScene::UNINITIALIZED;\r
+       //m_beginEffect = NULL;\r
+       //m_endEffect = NULL;\r
+       m_active = true;\r
+       //m_initialized = false;\r
+}\r
+\r
+\r
+mof::AbstractScene::~AbstractScene(){\r
+       //delete m_beginEffect;\r
+       //delete m_endEffect;\r
+       \r
+}\r
+/*\r
+bool mof::AbstractScene::isInitialized(){\r
+       return (m_state != mof::AbstractScene::UNINITIALIZED);\r
+}*/\r
+\r
+\r
+bool mof::AbstractScene::isActive(){\r
+       return m_active;//(m_state == mof::AbstractScene::ACTIVE || m_state == mof::AbstractScene::OPENING || m_state == mof::AbstractScene::CLOSING);\r
+}\r
+\r
+/*\r
+bool mof::AbstractScene::isClosing(){\r
+       return m_state == mof::AbstractScene::CLOSING;\r
+}\r
+\r
+\r
+bool mof::AbstractScene::isOpening(){\r
+       return m_state == mof::AbstractScene::OPENING;\r
+}*/\r
+/*\r
+void mof::AbstractScene::setBeginEffect(Effect* effect){\r
+       delete m_beginEffect;\r
+       m_beginEffect = effect;\r
+       if(effect != NULL)effect->addEffectListener(this);\r
+}\r
+\r
+mof::Effect* mof::AbstractScene::getBeginEffect(){\r
+       return m_beginEffect;\r
+}\r
+\r
+\r
+void mof::AbstractScene::setEndEffect(Effect* effect){\r
+       delete m_endEffect;\r
+       m_endEffect = effect;\r
+       if(effect != NULL)effect->addEffectListener(this);\r
+}\r
+\r
+mof::Effect* mof::AbstractScene::getEndEffect(){\r
+       return m_endEffect;\r
+}*/\r
+\r
+/*\r
+bool mof::AbstractScene::initialize(){\r
+       m_state = mof::AbstractScene::INITIALIZED;\r
+       //Activate(true);\r
+       return true;\r
+}*/\r
+\r
+void mof::AbstractScene::activate(bool activate){\r
+       m_active = activate;\r
+       /*if(activate){\r
+               m_state = mof::AbstractScene::ACTIVE;\r
+               //playBeginEffect();\r
+               //InputCore::getInstance()->addListener(this);\r
+       }\r
+       else {\r
+               m_state = mof::AbstractScene::UNACTIVE;\r
+               //playEndEffect();\r
+               ////InputCore::getInstance()->removeListener(this);\r
+               \r
+       }*/\r
+}\r
+\r
+/*\r
+void mof::AbstractScene::notifyEffectEvent(EffectEvent& effectEvent){\r
+       if(effectEvent.object == m_beginEffect && effectEvent.type == EffectEvent::FINISHED){\r
+               m_state = mof::AbstractScene::ACTIVE;\r
+       }\r
+       if(effectEvent.object == m_endEffect && effectEvent.type == EffectEvent::FINISHED){\r
+               m_state = mof::AbstractScene::UNACTIVE;\r
+       }\r
+}\r
+\r
+\r
+void mof::AbstractScene::playBeginEffect(){\r
+       if(m_beginEffect == NULL){\r
+               m_state = mof::AbstractScene::ACTIVE;\r
+               return;\r
+       }\r
+       m_state = mof::AbstractScene::OPENING;\r
+       m_beginEffect->play();\r
+}\r
+\r
+\r
+void mof::AbstractScene::playEndEffect(){\r
+       if(m_endEffect == NULL){\r
+               m_state = mof::AbstractScene::UNACTIVE;\r
+               return;\r
+       }\r
+       m_state = mof::AbstractScene::CLOSING;\r
+       m_endEffect->play();\r
+}*/\r
diff --git a/moftmp/AmbientLight.cpp b/moftmp/AmbientLight.cpp
new file mode 100755 (executable)
index 0000000..ec78af5
--- /dev/null
@@ -0,0 +1,74 @@
+#include "mof/AmbientLight.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+\r
+struct mof::AmbientLight::Impl{\r
+       mof::Color lastAmbient;\r
+       bool enable;\r
+\r
+       Impl();\r
+       ~Impl();\r
+       void reflect( mof::Color color , bool force = false);\r
+};\r
+\r
+mof::AmbientLight::Impl::Impl()\r
+: enable(true)\r
+{\r
+}\r
+\r
+mof::AmbientLight::Impl::~Impl(){\r
+       \r
+}\r
+\r
+mof::AmbientLight::AmbientLight( mof::Color4f color )\r
+: m_pImpl( new Impl() ) , mof::Light() \r
+{\r
+       setDiffuseColor(color);\r
+       m_pImpl->reflect( m_diffuseColor->getValue(m_frame).toColorCode() , true);\r
+}\r
+\r
+\r
+mof::AmbientLight::~AmbientLight(){\r
+       try{\r
+               setEnable(false);//\97á\8aO\82ð\93\8a\82°\82é\82©\82à\r
+       }catch(std::exception& ){\r
+       }\r
+}\r
+\r
+void mof::AmbientLight::setFrameNumber(mof::FrameNumber frame){\r
+       m_frame = frame;\r
+       m_pImpl->reflect(  m_diffuseColor->getValue(m_frame).toColorCode() );\r
+       \r
+}\r
+\r
+void mof::AmbientLight::nextFrame(){\r
+       setFrameNumber(m_frame + 1);\r
+}\r
+\r
+void mof::AmbientLight::prevFrame(){\r
+       if(m_frame > 0)setFrameNumber(m_frame - 1);\r
+}\r
+\r
+\r
+void mof::AmbientLight::setEnable(bool enable){\r
+       if(!m_pImpl->enable && enable){\r
+               m_pImpl->enable = enable;\r
+               m_pImpl->reflect(  m_diffuseColor->getValue(m_frame).toColorCode() );\r
+       }\r
+       else if(m_pImpl->enable && !enable){\r
+               m_pImpl->enable = enable;\r
+               m_pImpl->reflect( m_diffuseColor->getValue(m_frame).toColorCode() );\r
+       }\r
+}\r
+\r
+\r
+void mof::AmbientLight::Impl::reflect(mof::Color color , bool force){\r
+       //\95¡\90\94\82Ì\83A\83\93\83r\83G\83\93\83g\82ð\83T\83|\81[\83g\82·\82é\82×\82«\r
+       mof::Color ambient = color;\r
+       if(!enable)ambient = mof::createColor(0 , 0 , 0);\r
+\r
+       if(ambient != lastAmbient || force){\r
+               mof::GraphicsDevice::getRawDevice()->SetRenderState(D3DRS_AMBIENT , ambient);\r
+               lastAmbient = ambient;\r
+       }\r
+}\r
diff --git a/moftmp/AmbientLight.hpp b/moftmp/AmbientLight.hpp
new file mode 100755 (executable)
index 0000000..901b738
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef MOF_AMBIENT_LIGHT\r
+#define MOF_AMBIENT_LIGHT\r
+\r
+#include "mof/Light.hpp"\r
+#include "mof/Color.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+\r
+namespace mof{\r
+\r
+\r
+\r
+class AmbientLight : public Light{\r
+       struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+public:\r
+       AmbientLight( mof::Color4f color = mof::Color4f(1 , 1 , 1));\r
+       virtual ~AmbientLight();\r
+\r
+       virtual void setEnable(bool enable);\r
+\r
+       virtual void setFrameNumber(mof::FrameNumber frame);\r
+       virtual void nextFrame();\r
+       virtual void prevFrame();\r
+\r
+};\r
+\r
+}\r
+\r
+\r
+#endif\r
diff --git a/moftmp/Application.cpp b/moftmp/Application.cpp
new file mode 100755 (executable)
index 0000000..206cdc5
--- /dev/null
@@ -0,0 +1,111 @@
+#include "mof/Application.hpp"\r
+#include "mof/GraphicsDevice.hpp"\r
+#include "mof/Window.hpp"\r
+#include "mof/SceneGraph.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/Timer.hpp"\r
+#include <stdexcept>\r
+#include "mof/Captor.hpp"\r
+#include "mof/InputDevice.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/Finalizer.hpp"\r
+\r
+namespace \r
+{\r
+    int m_frameInterval;\r
+    int m_nUpdatingPerFrame;\r
+    mof::Window* m_pWindow = NULL;\r
+}\r
+\r
+namespace mof\r
+{\r
+    void Application::initialize\r
+       ( \r
+           const mof::tstring& appname , \r
+           int width , \r
+           int height ,\r
+           bool fullscreen ,\r
+           int frameInterval , \r
+           int nUpdatingPerFrame\r
+       )\r
+    {\r
+        m_frameInterval = frameInterval;\r
+        m_nUpdatingPerFrame = nUpdatingPerFrame;  \r
+        m_pWindow = new mof::Window( appname , width , height , fullscreen );\r
+        mof::GraphicsDevice::initialize( *m_pWindow ,  width , height , fullscreen );\r
+           mof::InputDevice::initialize( );\r
\r
+    }\r
+    \r
+    void Application::finalize( )\r
+    {\r
+        mof::GraphicsDevice::finalize();\r
+        mof::InputDevice::finalize();\r
+        delete m_pWindow;\r
+    }\r
+    \r
+    \r
+    void Application::run( Scene& scene ) \r
+    {\r
+        scene.initialize();\r
+        mof::Finalizer finalizer( scene.finalize ); //run\82ð\94²\82¯\82é\82Æ\82«\82É\89ð\95ú\8f\88\97\9d\82ð\8ds\82¤\r
+           MSG msg;\r
+        ZeroMemory( &msg, sizeof(msg) );\r
+           mof::Timer timer;\r
+           mof::Timer fpsTimer;\r
+           int frameCount = 0;\r
+\r
+       mof::Captor Captor( _T("output"));\r
+       int sleepingTime = 0;\r
+        for( ; ; )\r
+        {\r
+            while( PeekMessage( &msg, NULL, 0U, 0U, PM_NOREMOVE ) )\r
+            {\r
+                       if( msg.message == WM_QUIT )return;\r
+                       GetMessage( &msg , NULL , 0 , 0 );\r
+                TranslateMessage( &msg );\r
+                DispatchMessage( &msg );\r
+            }\r
+               \r
+                   for( int i = 0 ; i < m_nUpdatingPerFrame ; i++ )scene.update();//\83V\81[\83\93\82Ì\8f\88\97\9d\r
+\r
+               \r
+                   mof::GraphicsDevice::beginScene();\r
+                   scene.draw();//\83V\81[\83\93\82Ì\95`\89æ\r
+                   //Captor.capture();\r
+                   mof::GraphicsDevice::endScene();\r
+    \r
+               \r
+\r
+                   //FPS\82Ì\8cv\91ª\r
+                   int frameTime = timer.getTime();\r
+                   if(m_frameInterval > frameTime)\r
+                   {\r
+                           Sleep(m_frameInterval - frameTime);\r
+                           sleepingTime += m_frameInterval - frameTime;\r
+                   }\r
+                   \r
+                   timer.reset();\r
+                   \r
+                   if(++frameCount % 500 == 0)\r
+                   {\r
+                           float fps = 500.0f / static_cast<float>(fpsTimer.getTime() - sleepingTime) * 1000;\r
+                           fpsTimer.reset();\r
+                           sleepingTime = 0;\r
+                           DEBUG_PRINT( "FPS --- " << fps );\r
+                       }\r
+           } // for\r
+               \r
+\r
+    } // function run\r
+       \r
+    void Application::quit( )\r
+    {\r
+           PostQuitMessage(0);\r
+    }\r
+\r
+\r
+}\r
+\r
+\r
diff --git a/moftmp/Application.hpp b/moftmp/Application.hpp
new file mode 100755 (executable)
index 0000000..c6dbe02
--- /dev/null
@@ -0,0 +1,34 @@
+#pragma once\r
+#include "mof/tstring.hpp"\r
+\r
+namespace mof{\r
+\r
+    struct Scene\r
+    {\r
+        void ( *initialize ) ();\r
+        void ( *finalize ) ();\r
+        void ( *update ) ();\r
+        void ( *draw ) ();\r
+    };\r
+   \r
+       namespace Application\r
+       {\r
+           //private\r
+           \r
+           //public\r
+           void initialize\r
+           ( \r
+               const mof::tstring& appname , \r
+               int width , \r
+               int height ,\r
+               bool fullscreen ,\r
+               int frameInterval , \r
+               int nUpdatingPerFrame\r
+           );\r
+           void finalize();\r
+           void run( Scene& scene );\r
+           void quit();\r
+       }\r
+\r
+\r
+}\r
diff --git a/moftmp/Board.cpp b/moftmp/Board.cpp
new file mode 100755 (executable)
index 0000000..e1e6ca3
--- /dev/null
@@ -0,0 +1,110 @@
+#include "mof/Board.hpp"\r
+#include "mof/Camera.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/Constant.hpp"\r
+\r
+struct mof::Board::Impl{\r
+       boost::shared_ptr<mof::Texture> pTexture;\r
+       mof::Animation<mof::Matrix3D>::Handler worldMatrix;\r
+       mof::Animation<mof::Color4f>::Handler color;\r
+       mof::Animation<mof::Rectangle<float>>::Handler textureCoordinates;\r
+\r
+       Impl( )\r
+               : \r
+               worldMatrix(mof::makeConstantHandler(mof::Matrix3D::createIdentity())) ,\r
+               textureCoordinates(mof::makeConstantHandler(mof::Rectangle<float>(0 , 0 , 1 , 1))) ,\r
+               color(mof::makeConstantHandler(mof::Color4f(1 , 1 , 1)))\r
+       {\r
+       }\r
+\r
+       ~Impl(){}\r
+};\r
+\r
+\r
+\r
+mof::Board::Board() : m_pImpl(new Impl()){\r
+}\r
+\r
+mof::Board::~Board(){\r
+}\r
+       \r
+\r
+\r
+\r
+void mof::Board::setWorldMatrix(const mof::Animation<mof::Matrix3D>::Handler& handler){\r
+       m_pImpl->worldMatrix = handler;\r
+\r
+}\r
+\r
+\r
+\r
+void mof::Board::setColor(const mof::Animation<mof::Color4f>::Handler& handler){\r
+       m_pImpl->color = handler;\r
+}\r
+\r
+\r
+\r
+\r
+void mof::Board::setTextureCoordinates(const mof::Animation<mof::Rectangle<float>>::Handler& handler){\r
+       m_pImpl->textureCoordinates = handler;\r
+}\r
+\r
+void mof::Board::setTextureCoordinates(const mof::Rectangle<float>& coordinates){\r
+       setTextureCoordinates(mof::makeConstantHandler(coordinates));\r
+}\r
+\r
+void mof::Board::setTexture( const boost::shared_ptr<mof::Texture>& pTexture ){\r
+       m_pImpl->pTexture = pTexture;\r
+}\r
+\r
+\r
+bool mof::Board::isVisible() const{\r
+       return true;\r
+}\r
+\r
+void mof::Board::update(){\r
+       nextFrame();\r
+}\r
+\r
+void mof::Board::draw() const{\r
+       mof::FrameNumber frame = m_frame;\r
+       mof::Rectangle<float> textureCoordinates = m_pImpl->textureCoordinates->getValue(frame);\r
+       mof::Color color = m_pImpl->color->getValue(frame).toColorCode();\r
+       static mof::VertexXYZCUV vertices[4];\r
+       vertices[0].x = -0.5f;\r
+       vertices[0].y = 0.5f;\r
+       vertices[0].z = 0;\r
+       vertices[0].color = color;\r
+       vertices[0].tu = textureCoordinates.beginX;\r
+       vertices[0].tv = textureCoordinates.beginY;\r
+\r
+       vertices[1].x = 0.5f;\r
+       vertices[1].y = 0.5f;\r
+       vertices[1].z = 0;\r
+       vertices[1].color = color;\r
+       vertices[1].tu = textureCoordinates.endX;\r
+       vertices[1].tv = textureCoordinates.beginY;\r
+\r
+       vertices[2].x = -0.5f;\r
+       vertices[2].y = -0.5f;\r
+       vertices[2].z = 0;\r
+       vertices[2].color = color;\r
+       vertices[2].tu = textureCoordinates.beginX;\r
+       vertices[2].tv = textureCoordinates.endY;\r
+\r
+       vertices[3].x = 0.5f;\r
+       vertices[3].y = -0.5f;\r
+       vertices[3].z = 0;\r
+       vertices[3].color = color;\r
+       vertices[3].tu = textureCoordinates.endX;\r
+       vertices[3].tv = textureCoordinates.endY;\r
+\r
+       mof::GraphicsDevice::setTexture(m_pImpl->pTexture.get());\r
+       mof::GraphicsDevice::setWorldTransform(m_pImpl->worldMatrix->getValue(frame));\r
+       mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , PRIMITIVE_TYPE_TRIANGLESTRIP);\r
+\r
+       \r
+}\r
+\r
+\r
diff --git a/moftmp/Board.hpp b/moftmp/Board.hpp
new file mode 100755 (executable)
index 0000000..1ff23d7
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef BILLBOARD_HPP\r
+#define BILLBOARD_HPP\r
+\r
+#include "mof/Component3D.hpp"\r
+#include "mof/SceneGraph.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/Texture.hpp"\r
+#include "mof/DefaultAnimationPlayer.hpp"\r
+\r
+namespace mof{\r
+       \r
+\r
+class Camera;\r
+\r
+class Board : public Component3D , public SceneGraph , public DefaultAnimationPlayer{\r
+       struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+public :\r
+       \r
+       Board( );\r
+       virtual ~Board();\r
+\r
+       \r
+       virtual void setWorldMatrix(const mof::Animation<mof::Matrix3D>::Handler& handler);\r
+       virtual void setTextureCoordinates(const mof::Animation<mof::Rectangle<float>>::Handler& handler);\r
+       virtual void setTextureCoordinates(const mof::Rectangle<float>& coordinates);\r
+       virtual void setTexture( const boost::shared_ptr<mof::Texture>& pTexture );\r
+\r
+       void setColor(const mof::Animation<mof::Color4f>::Handler& handler);\r
+\r
+       virtual bool isVisible() const;\r
+       virtual void update();\r
+       virtual void draw() const;\r
+};\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/CSVFile.cpp b/moftmp/CSVFile.cpp
new file mode 100755 (executable)
index 0000000..6dcd62e
--- /dev/null
@@ -0,0 +1,177 @@
+#include "mof/CSVFile.h"\r
+#include <exception>\r
+#include <stdlib.h>\r
+#include "mof/ConsoleIO.h"\r
+\r
+mof::CSVFile::CSVFile(mof::tstring& filename)\r
+: m_ifs(filename.c_str() , std::ios::in) , m_bufferSize(1024){\r
+       if(!m_ifs)throw std::invalid_argument("can't open file");\r
+       m_buffer = new TCHAR[m_bufferSize+1];//\92Ç\89Á\83k\83\8b\95\8e\9a\82Ì\82½\82ß\82É\82P\82Â\97]\95ª\82É\8am\95Û\r
+       m_buffer[m_bufferSize] = '\0';\r
+       m_topOfBuffer = m_bufferSize-1;\r
+       m_hasBufferedValue = false;\r
+       m_ignoreNL = true;\r
+       m_pBufferedValue = NULL;\r
+       nextLine();\r
+}\r
+\r
+\r
+\r
+mof::CSVFile::CSVFile(const TCHAR* filename)\r
+: m_ifs(filename , std::ios::in) , m_bufferSize(1024){\r
+       if(!m_ifs)throw std::invalid_argument("can't open file");\r
+       m_buffer = new TCHAR[m_bufferSize+1];//\92Ç\89Á\83k\83\8b\95\8e\9a\82Ì\82½\82ß\82É\82P\82Â\97]\95ª\82É\8am\95Û\r
+       m_buffer[m_bufferSize] = '\0';\r
+       m_topOfBuffer = m_bufferSize-1;\r
+       m_hasBufferedValue = false;\r
+       m_ignoreNL = true;\r
+       m_pBufferedValue = NULL;\r
+\r
+\r
+       nextLine();\r
+}\r
+\r
+\r
+mof::CSVFile::~CSVFile(){\r
+       delete[] m_buffer;\r
+       \r
+}\r
+\r
+bool mof::CSVFile::hasNextValue(){\r
+       if(m_hasBufferedValue)return true;//Value\82Ì\83o\83b\83t\83@\82ª\82 \82é\r
+       \r
+       //if(m_topOfBuffer == m_bufferSize && !nextLine())return false;//\82±\82ê\82ª\82È\82¢\82Æ\83o\83O\82é\82ª\81A\89º\82Ì\83\8b\81[\83`\83\93\82Æ\88ê\96{\89»\82Å\82«\82È\82¢\82©\r
+\r
+       while(!updateNextValue() && m_ignoreNL){\r
+               if( m_topOfBuffer >= m_bufferSize ||  m_buffer[m_topOfBuffer] == '\0'){\r
+                       //\83o\83b\83t\83@\82ð\93Ç\82Ý\8d\9e\82Þ\r
+                       m_topOfBuffer = m_ifs.getline(m_buffer , m_bufferSize) ? 0 : m_bufferSize;\r
+                       if(m_topOfBuffer >= m_bufferSize)return false;\r
+               }\r
+       }\r
+       return m_pBufferedValue != NULL;\r
+\r
+       //if(m_topOfBuffer == m_bufferSize)\r
+}\r
+\r
+\r
+\r
+const TCHAR* mof::CSVFile::getNextValue(){\r
+       if(m_hasBufferedValue && hasNextValue()){//Value\82Ì\83o\83b\83t\83@\82ª\82 \82ê\82Î\82»\82ê\82ð\8eg\82¤\r
+               m_hasBufferedValue = false;\r
+               return m_pBufferedValue;\r
+       }\r
+\r
+       //\8e\9f\82Ì\92l\82ª\82È\82¢\8fê\8d\87\r
+       return NULL;\r
+\r
+}\r
+\r
+\r
+\r
+\r
+bool mof::CSVFile::nextLine(){\r
+       m_hasBufferedValue = false;\r
+       m_topOfBuffer = m_ifs.getline(m_buffer , m_bufferSize) ? 0 : m_bufferSize;\r
+       return m_topOfBuffer == 0;\r
+}\r
+\r
+\r
+void mof::CSVFile::setIgnoreNL(bool ignore){\r
+       m_ignoreNL = ignore;\r
+}\r
+\r
+\r
+\r
+bool mof::CSVFile::updateNextValue(){\r
+\r
+       if(m_topOfBuffer == m_bufferSize){\r
+                       //\92l\82È\82µ\r
+                       m_pBufferedValue = NULL;\r
+                       m_hasBufferedValue = false;\r
+                       return false;\r
+       }\r
+\r
+       enum{\r
+               ISPACE , ICOMMA , IQUOTE , IWORD , IEOF\r
+       };\r
+       enum{\r
+               S , NQV , QV , NQE , QE , QVQ ,\r
+               //\8f\89\8aú\8fó\91Ô\81A\94ñ\83N\83H\81[\83g\92l\81A\83N\83H\81[\83g\92l\81A\94ñ\83N\83H\81[\83g\83G\83X\83P\81[\83v\81A\83N\83H\81[\83g\83G\83X\83P\81[\83v\81A\83N\83H\81[\83g\82Å\88Í\82Ü\82ê\82½\92l\r
+               _NULL , _EMP , _V , _ERR , _QVQ\r
+               //\92l\82È\82µ\81A\8bó\95\8e\9a\97ñ\81A\92l\81A\83G\83\89\81[\81A\83N\83H\81[\83g\82Å\88Í\82Ü\82ê\82½\92l\r
+       };\r
+       static const int stateChangeTable[][5] = {\r
+               { S , _EMP , QV , NQV , _NULL } ,\r
+               { NQV , _V , NQE , NQV , _V} ,\r
+               { QV , QV , QE , QV , _ERR} ,\r
+               { _ERR , _ERR , NQV , _ERR , _ERR} ,\r
+               { QVQ , _QVQ , QV , _ERR , _QVQ} ,\r
+               { QVQ , _QVQ , _ERR , _ERR , _QVQ}\r
+               \r
+       };\r
+       \r
+\r
+       int state = S;\r
+       int lastInput = IEOF;\r
+       int begin = m_topOfBuffer;\r
+       while( state < _NULL ){//\8fI\97¹\8fó\91Ô\82É\82È\82Á\82½\82ç\94²\82¯\82é\r
+               lastInput = IWORD;\r
+               if( m_buffer[m_topOfBuffer] == '\0'){\r
+                       lastInput = IEOF;\r
+               }\r
+               else if( m_buffer[m_topOfBuffer] == ' ')lastInput = ISPACE;\r
+               else if(m_buffer[m_topOfBuffer] == '"')lastInput = IQUOTE;\r
+               else if(m_buffer[m_topOfBuffer] == ',')lastInput = ICOMMA;\r
+               state = stateChangeTable[state][lastInput];\r
+               m_topOfBuffer++;\r
+       }\r
+       m_hasBufferedValue = true;\r
+\r
+       if(state == _NULL){\r
+               //\92l\82È\82µ\r
+               m_pBufferedValue = NULL;\r
+               m_topOfBuffer = m_bufferSize;\r
+               m_hasBufferedValue = false;\r
+               return false;\r
+       }\r
+       else if(state == _EMP){\r
+               m_pBufferedValue = "";\r
+               return true;\r
+       }\r
+       else if(state == _V || state == _QVQ){\r
+               int end = m_topOfBuffer-2;\r
+               //\91O\8cã\82©\82ç\83g\83\8a\83~\83\93\83O\r
+               while(m_buffer[begin] == ' ')begin++;\r
+               while(m_buffer[end] == ' ' )end--;\r
+\r
+               if(state == _QVQ){\r
+                       //\97¼\92[\82Ì\81h\82ð\8f\9c\8b\8e\r
+                       begin++;\r
+                       end--;\r
+               }\r
+       \r
+               //"\82Ì\83G\83X\83P\81[\83v\8f\88\97\9d\r
+               //\8cã\82ë\82©\82ç\8c©\82Ä\82¢\82Á\82Ä"\82ª\82 \82ê\82Î\83R\83s\81[\82·\82é\r
+               m_buffer[end+1] = '\0';\r
+               for(int tmp = end ; begin < tmp ; tmp--){\r
+                       if(m_buffer[tmp] == '"'){\r
+                               memmove(m_buffer + tmp-1 , m_buffer+ tmp , sizeof(TCHAR)*(end-tmp+2));\r
+                               tmp--;\r
+                       }\r
+\r
+               }\r
+               m_pBufferedValue = m_buffer + begin;\r
+               return true;\r
+       }\r
+       else {\r
+               //\83G\83\89\81[(\8e\9f\82Ì,\82Ü\82Å\93Ç\82Ý\90i\82ß\82é) m_buffer\82Ì\96\96\94ö\82Í\83k\83\8b\95\8e\9a\82È\82Ì\82Å\95K\82¸\92â\8e~\82·\82é\r
+               while(lastInput != ',' && lastInput != '\0'){\r
+                       lastInput = m_buffer[++m_topOfBuffer];\r
+               }\r
+               m_topOfBuffer++;\r
+               m_pBufferedValue = "ERROR";\r
+               return true;\r
+       }\r
+       \r
+}\r
diff --git a/moftmp/CSVFile.h b/moftmp/CSVFile.h
new file mode 100755 (executable)
index 0000000..f3b3cc5
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once\r
+#include "mof/tstring.h"\r
+#include <fstream>\r
+\r
+namespace mof{\r
+\r
+       class CSVFile{\r
+               //bool m_trimming;\r
+               std::basic_ifstream<TCHAR> m_ifs;\r
+               TCHAR* m_buffer;\r
+               const int m_bufferSize;\r
+               int m_topOfBuffer;\r
+               bool m_hasBufferedValue;\r
+               TCHAR* m_pBufferedValue;\r
+               bool m_ignoreNL;\r
+               bool updateNextValue();\r
+       public:\r
+               CSVFile(mof::tstring& filename);\r
+               CSVFile(const TCHAR* filename);\r
+               ~CSVFile();\r
+               \r
+               bool hasNextValue();\r
+               const TCHAR* getNextValue();\r
+               bool nextLine();\r
+               void setIgnoreNL(bool ignore);\r
+       };\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/Camera.cpp b/moftmp/Camera.cpp
new file mode 100755 (executable)
index 0000000..9355ba7
--- /dev/null
@@ -0,0 +1,108 @@
+#include "mof/Camera.hpp"\r
+#include "mof/Constant.hpp"\r
+#include <d3d9.h>\r
+\r
+struct mof::Camera::Impl{\r
+       mof::Animation<mof::Vector3D>::Handler eye;\r
+       mof::Animation<mof::Vector3D>::Handler center;\r
+       mof::Animation<mof::Vector3D>::Handler up;\r
+       mof::FrameNumber frame;\r
+\r
+       Impl(\r
+               const mof::Animation<mof::Vector3D>::Handler& eye_ ,\r
+               const mof::Animation<mof::Vector3D>::Handler& center_ ,\r
+               const mof::Animation<mof::Vector3D>::Handler& up_ \r
+               ) : eye(eye_) , center(center_) , up(up_) , frame(0){}\r
+\r
+       ~Impl(){}\r
+};\r
+\r
+\r
+mof::Camera::Camera(\r
+       const mof::Animation<mof::Vector3D>::Handler& eye , \r
+       const mof::Animation<mof::Vector3D>::Handler& center ,\r
+       const mof::Animation<mof::Vector3D>::Handler& up \r
+       ) : m_pImpl(new Impl(eye , center , up)){\r
+}\r
+\r
+mof::Camera::Camera(\r
+       const mof::Vector3D& eye , \r
+       const mof::Vector3D& center , \r
+       const mof::Vector3D& up\r
+       ) : m_pImpl(new Impl(\r
+               mof::makeConstantHandler(eye) ,\r
+               mof::makeConstantHandler(center) ,\r
+               mof::makeConstantHandler(up) \r
+               )){\r
+}\r
+\r
+mof::Camera::~Camera(){\r
+}\r
+\r
+mof::Matrix3D mof::Camera::getViewMatrix() const{\r
+       return mof::Matrix3D::createLookAtLH(\r
+               m_pImpl->eye->getValue(m_pImpl->frame) ,\r
+               m_pImpl->center->getValue(m_pImpl->frame) ,\r
+               m_pImpl->up->getValue(m_pImpl->frame) \r
+               );\r
+}\r
+\r
+void mof::Camera::setEye(const mof::Animation<mof::Vector3D>::Handler& eye){\r
+       m_pImpl->eye = eye;\r
+}\r
+\r
+\r
+void mof::Camera::setEye(const mof::Vector3D& eye){\r
+       m_pImpl->eye = mof::makeConstantHandler(eye);\r
+}\r
+\r
+void mof::Camera::setCenter(const mof::Animation<mof::Vector3D>::Handler& center){\r
+       m_pImpl->center = center;\r
+}\r
+\r
+\r
+void mof::Camera::setCenter(const mof::Vector3D& center){\r
+       m_pImpl->center = mof::makeConstantHandler(center);\r
+}\r
+\r
+\r
+void mof::Camera::setUp(const mof::Animation<mof::Vector3D>::Handler& up){\r
+       m_pImpl->up = up;\r
+}\r
+\r
+\r
+void mof::Camera::setUp(const mof::Vector3D& up){\r
+       m_pImpl->up = mof::makeConstantHandler(up);\r
+}\r
+\r
+               \r
+mof::Vector3D mof::Camera::getEye() const{\r
+       return m_pImpl->eye->getValue(m_pImpl->frame);\r
+}\r
+\r
+               \r
+mof::Vector3D mof::Camera::getCenter() const{\r
+       return m_pImpl->center->getValue(m_pImpl->frame);\r
+}\r
+\r
+               \r
+mof::Vector3D mof::Camera::getUp() const{\r
+       return m_pImpl->up->getValue(m_pImpl->frame);\r
+}\r
+\r
+\r
+\r
+\r
+void mof::Camera::setFrameNumber(mof::FrameNumber frame){\r
+       m_pImpl->frame = frame;\r
+}\r
+\r
+\r
+void mof::Camera::nextFrame(){\r
+       m_pImpl->frame++;\r
+}\r
+\r
+void mof::Camera::prevFrame(){\r
+       if(m_pImpl->frame > 0)m_pImpl->frame--;\r
+}\r
+\r
diff --git a/moftmp/Camera.hpp b/moftmp/Camera.hpp
new file mode 100755 (executable)
index 0000000..9c6d196
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef MOF_CAMERA_HPP\r
+#define mOF_CAMERA_HPP\r
+#include "mof/Vector3D.hpp"\r
+#include "mof/AnimationPlayer.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/Matrix3D.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+       class Camera : public mof::AnimationPlayer{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+       public:\r
+               Camera(\r
+                       const mof::Animation<mof::Vector3D>::Handler& eye , \r
+                       const mof::Animation<mof::Vector3D>::Handler& center ,\r
+                       const mof::Animation<mof::Vector3D>::Handler& up );\r
+               Camera(const mof::Vector3D& eye , const mof::Vector3D& center , const mof::Vector3D& up);\r
+               virtual ~Camera();\r
+\r
+               mof::Matrix3D getViewMatrix() const;\r
+\r
+               void setEye(const mof::Animation<mof::Vector3D>::Handler& eye);\r
+               void setEye(const mof::Vector3D& eye);\r
+               void setCenter(const mof::Animation<mof::Vector3D>::Handler& center);\r
+               void setCenter(const mof::Vector3D& center);\r
+               void setUp(const mof::Animation<mof::Vector3D>::Handler& up);\r
+               void setUp(const mof::Vector3D& up);\r
+\r
+               mof::Vector3D getEye() const; \r
+               mof::Vector3D getCenter() const; \r
+               mof::Vector3D getUp() const; \r
+\r
+               virtual void setFrameNumber(mof::FrameNumber frame);\r
+               virtual void nextFrame();\r
+               virtual void prevFrame();\r
+\r
+       };\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/Captor.cpp b/moftmp/Captor.cpp
new file mode 100755 (executable)
index 0000000..7421825
--- /dev/null
@@ -0,0 +1,48 @@
+#include "mof/Captor.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/FilePath.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include <sstream>\r
+\r
+\r
+mof::Captor::Captor(const mof::tstring& output)\r
+: m_output(output) \r
+{\r
+       m_num = 0;\r
+}\r
+\r
+mof::Captor::~Captor(){\r
+\r
+}\r
+\r
+bool mof::Captor::capture(){\r
+       mof::otstringstream os;\r
+       os << m_output.c_str() << _T("/") << m_num << _T(".bmp");\r
+       return capture(os.str().c_str());\r
+}\r
+\r
+\r
+\r
+bool mof::Captor::capture(const mof::tstring& filename){\r
+       \r
+       LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();\r
+       \r
+       LPDIRECT3DSURFACE9 pBackBuffer;\r
+       HRESULT hr = pDevice->GetBackBuffer(0 , 0 , D3DBACKBUFFER_TYPE_MONO , &pBackBuffer);\r
+       if(FAILED(hr))throw std::runtime_error("Failed --- GetBackBuffer");\r
+       D3DSURFACE_DESC desc;\r
+       pBackBuffer->GetDesc(&desc);\r
+\r
+       hr = D3DXSaveSurfaceToFile(\r
+               filename.c_str() , D3DXIFF_BMP , pBackBuffer ,\r
+               NULL , NULL);\r
+       pBackBuffer->Release();\r
+       if(FAILED(hr)){\r
+               \r
+               throw std::runtime_error("Failed -- D3DXSaveSurfaceToFile");\r
+       }\r
+       m_num++;\r
+       return true;\r
+       \r
+\r
+}\r
diff --git a/moftmp/Captor.hpp b/moftmp/Captor.hpp
new file mode 100755 (executable)
index 0000000..9e5de20
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once\r
+#include "mof/tstring.hpp"\r
+\r
+namespace mof{\r
+\r
+    class Captor\r
+    {\r
+       mof::tstring m_output;\r
+       int m_num;\r
+\r
+        public :\r
+       Captor( const mof::tstring& output);\r
+       ~Captor();\r
+       bool capture();\r
+       bool capture(const mof::tstring& filename);\r
+\r
+    };\r
+\r
+}\r
diff --git a/moftmp/Color.cpp b/moftmp/Color.cpp
new file mode 100755 (executable)
index 0000000..461aa27
--- /dev/null
@@ -0,0 +1,155 @@
+#include "mof/Color.hpp"\r
+#include <d3dx9.h>\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/tstring.hpp"\r
+\r
+\r
+mof::Color4f::Color4f() : \r
+       alpha(0) , red(1) , green(1) , blue(1)\r
+{\r
+}\r
+\r
+mof::Color4f::Color4f(float alpha_ , float red_ , float green_ , float blue_) : \r
+       alpha(alpha_) , red(red_) , green(green_) , blue(blue_)\r
+{\r
+}\r
+\r
+mof::Color4f::Color4f( float red_ , float green_ , float blue_) :      \r
+       alpha(1) , red(red_) , green(green_) , blue(blue_)              \r
+{\r
+}\r
+\r
+mof::Color4f::Color4f(mof::Color color) : \r
+       alpha(static_cast<float>(getAlpha(color)) / 255) ,\r
+       red(static_cast<float>(getRed(color)) / 255) , \r
+       green(static_cast<float>(getGreen(color)) / 255) ,\r
+       blue(static_cast<float>(getBlue(color)) / 255 )\r
+{\r
+}\r
+\r
+mof::Color mof::Color4f::toColorCode() const{\r
+       return createColor(\r
+               static_cast<ColorChannel>(alpha * 255) ,\r
+               static_cast<ColorChannel>(red * 255) ,\r
+               static_cast<ColorChannel>(green * 255) ,\r
+               static_cast<ColorChannel>(blue * 255) \r
+               );\r
+}\r
+\r
+mof::Color4f mof::Color4f::operator +(const mof::Color4f& rhs) const{\r
+       return mof::Color4f(\r
+               alpha + rhs.alpha , \r
+               red + rhs.red ,\r
+               green + rhs.green ,\r
+               blue + rhs.blue );\r
+}\r
+\r
+mof::Color4f mof::Color4f::operator -(const mof::Color4f& rhs) const{\r
+       return mof::Color4f(\r
+               alpha - rhs.alpha , \r
+               red - rhs.red ,\r
+               green - rhs.green ,\r
+               blue - rhs.blue );\r
+}\r
+\r
+mof::Color4f mof::Color4f::operator *(const Color4f& color ) const\r
+{\r
+       return mof::Color4f(color.alpha * alpha , color.red * red , color.green * green , color.blue * blue );\r
+}\r
+\r
+mof::Color4f mof::operator *(const Color4f& color , float f){\r
+       return mof::Color4f(color.alpha * f , color.red * f , color.green * f , color.blue * f);\r
+}\r
+               \r
+mof::Color4f mof::operator *(float f ,  const mof::Color4f & color){\r
+       return mof::Color4f(color.alpha * f , color.red * f , color.green * f , color.blue * f);\r
+}\r
+\r
+\r
+\r
+unsigned char hex2Decimal(const TCHAR* code){\r
+       unsigned char a = *code;\r
+       if(a < '0')return 0;//error\r
+       else if( a <= '9')return a - '0';\r
+       else if( a < 'A')return 0;//error\r
+       else if( a <=  'Z')return a - 'A'+10;\r
+       else if( a < 'a')return 0;//error\r
+       else if( a <= 'z')return a - 'a'+10;\r
+       else return 0;//error\r
+}\r
+\r
+char decimal2hex(unsigned char n){\r
+       if( n >= 16)return '-';//error\r
+       return "0123456789abcdef"[n];\r
+}\r
+\r
+mof::Color mof::createColor(unsigned char r , unsigned char g , unsigned char b){\r
+       return D3DCOLOR_XRGB(r , g , b);\r
+}\r
+\r
+mof::Color mof::createColor(unsigned char a , unsigned char r , unsigned char g , unsigned char b){\r
+       return D3DCOLOR_ARGB(a , r , g , b);\r
+}\r
+\r
+\r
+mof::Color mof::createColor(const mof::tstring& code){\r
+       const TCHAR* pBuffer = code.c_str();\r
+       unsigned char a , r , g , b;\r
+       if(code.size() == 8)a = ( hex2Decimal(pBuffer++) << 4 ) + hex2Decimal(pBuffer++);\r
+       else if(code.size() != 6)return 0;//error\r
+       else a = 0xff;\r
+       r = (hex2Decimal(pBuffer++) << 4)  + hex2Decimal(pBuffer++);\r
+       g = (hex2Decimal(pBuffer++) << 4)  + hex2Decimal(pBuffer++);\r
+       b = (hex2Decimal(pBuffer++) << 4)  + hex2Decimal(pBuffer++);\r
+       return createColor(a , r , g , b);\r
+}\r
+\r
+unsigned char mof::getAlpha(const mof::Color& color){\r
+       return (unsigned char)((color >> 24) & 0xff);\r
+}\r
+\r
+\r
+unsigned char mof::getRed(const mof::Color& color){\r
+       return (unsigned char)((color >> 16) & 0xff);\r
+}\r
+\r
+unsigned char mof::getGreen(const mof::Color& color){\r
+       return (unsigned char)((color >> 8) & 0xff);\r
+}\r
+\r
+\r
+unsigned char mof::getBlue(const mof::Color& color){\r
+       return (unsigned char)(color & 0xff);\r
+}\r
+\r
+\r
+mof::Color mof::blendColor( mof::Color a , mof::Color b , float rate ){\r
+       return createColor(\r
+               static_cast<unsigned char>(getAlpha(a) * rate + getAlpha(b) * (1 - rate)) , //alpha\r
+               static_cast<unsigned char>(getRed(a) * rate + getRed(b) * (1 - rate)) , //red\r
+               static_cast<unsigned char>(getGreen(a) * rate + getGreen(b) * (1 - rate)) , //green\r
+               static_cast<unsigned char>(getBlue(a) * rate + getBlue(b) * (1 - rate)) ); //blue\r
+}\r
+\r
+mof::Color mof::inverseColor(mof::Color src){\r
+       return createColor(\r
+               255 - getAlpha(src)  , //alpha\r
+               255 - getRed(src)  , //red\r
+               255 - getGreen(src)  , //green\r
+               255 - getBlue(src) ); //blue\r
+}\r
+\r
+\r
+mof::tstring mof::toColorCode(mof::Color color){\r
+       mof::otstringstream os;\r
+       unsigned char a = getAlpha(color);\r
+       unsigned char r = getRed(color);\r
+       unsigned char g = getGreen(color);\r
+       unsigned char b = getBlue(color);\r
+       os  << decimal2hex(a >> 4) << decimal2hex(a & 0x0f) \r
+               << decimal2hex(r >> 4) << decimal2hex(r & 0x0f) \r
+               << decimal2hex(g >> 4) << decimal2hex(g & 0x0f) \r
+               << decimal2hex(b >> 4) << decimal2hex(b & 0x0f) ;\r
+       return os.str();\r
+\r
+}\r
diff --git a/moftmp/Color.hpp b/moftmp/Color.hpp
new file mode 100755 (executable)
index 0000000..8cfb697
--- /dev/null
@@ -0,0 +1,43 @@
+#pragma once\r
+#include "mof/tstring.hpp"\r
+#include "mof/real.hpp"\r
+\r
+namespace mof{\r
+       typedef unsigned int Color;\r
+       typedef unsigned char ColorChannel;\r
+       Color createColor(ColorChannel r , ColorChannel g , ColorChannel b);\r
+       Color createColor(ColorChannel a , ColorChannel r , ColorChannel g , ColorChannel b);\r
+       Color createColor(const mof::tstring& code);\r
+       ColorChannel getRed(const Color& color);\r
+       ColorChannel getGreen(const Color& color);\r
+       ColorChannel getBlue(const Color& color);\r
+       ColorChannel getAlpha(const Color& color);\r
+       Color blendColor( Color a , Color b , real rate );\r
+       Color inverseColor( Color color );\r
+       mof::tstring toColorCode( Color color );\r
+\r
+       struct Color4f{\r
+               real red;\r
+               real green;\r
+               real blue;\r
+               real alpha;\r
+\r
+               Color4f();\r
+               Color4f(real alpha_ , real red_ , real green_ , real blue_);\r
+               Color4f( real red_ , real green_ , real blue_);\r
+               explicit Color4f(mof::Color color);\r
+               mof::Color toColorCode() const;\r
+\r
+               mof::Color4f operator +( const mof::Color4f& rhs ) const ;\r
+               mof::Color4f operator -( const mof::Color4f& rhs ) const ;\r
+        mof::Color4f operator *( const Color4f& rhs ) const;\r
+\r
+               friend mof::Color4f operator *(const Color4f& color , real f);\r
+               friend mof::Color4f operator *(real f ,  const mof::Color4f & color);\r
+\r
+       };\r
+\r
+       \r
+\r
+       \r
+};\r
diff --git a/moftmp/ColorComponent.hpp b/moftmp/ColorComponent.hpp
new file mode 100755 (executable)
index 0000000..467fd0b
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once\r
+#include "mof/stream/utilities.hpp"\r
+\r
+namespace mof\r
+{\r
+\r
+    class ColorComponent\r
+    {\r
+    public:\r
+        virtual ~ColorComponent( ){}\r
+\r
+        virtual void setColorStream( const ColorStream& stream )\r
+        {\r
+            m_colorStream = stream;\r
+        }\r
+\r
+        virtual const ColorStream& getColorStream( ) const\r
+        {\r
+            return m_colorStream;\r
+        }\r
+        \r
+        virtual ColorStream& getColorStream( )\r
+        {\r
+            return m_colorStream;\r
+        }\r
+\r
+        \r
+    protected:\r
+        ColorStream m_colorStream;\r
+\r
+        ColorComponent( )\r
+        : \r
+            m_colorStream( makeConstantHandler( Color4f( 1 , 1 , 1 ) ) ) \r
+        {\r
+        }\r
+        \r
+        ColorComponent( const Color4f& color )\r
+        : \r
+            m_colorStream( makeConstantHandler( color ) ) \r
+        {\r
+        }\r
+\r
+        ColorComponent( const ColorStream& stream )\r
+        : \r
+            m_colorStream( stream ) \r
+        {\r
+        }\r
+\r
+    };\r
+} // namespace mof\r
diff --git a/moftmp/Component2D.cpp b/moftmp/Component2D.cpp
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/moftmp/Component2D.h b/moftmp/Component2D.h
new file mode 100755 (executable)
index 0000000..5493633
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+#include "mof/RectangleModel.h"\r
+#include "mof/Vector2D.h"\r
+#include "mof/GraphicsObject.h"\r
+\r
+namespace mof{\r
+\r
+       class Component2D : public GraphicsObject\r
+       {\r
+               \r
+       public:\r
+               Component2D(void);\r
+               virtual ~Component2D(void);\r
+       \r
+               virtual void setPosition(Vector2D& position) = 0;\r
+               virtual int getWidth() = 0;\r
+               virtual int getHeight() = 0;\r
+               virtual mof::Vector2D getPosition() = 0;\r
+               \r
+               virtual void setVisible(bool visible) = 0;\r
+               virtual RectangleModel getBounds() = 0;\r
+       };\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/Component2D.hpp b/moftmp/Component2D.hpp
new file mode 100755 (executable)
index 0000000..f5546d4
--- /dev/null
@@ -0,0 +1,104 @@
+#pragma once\r
+#include "mof/stream/utilities.hpp"\r
+\r
+namespace mof\r
+{\r
+\r
+    class Component2D\r
+    {\r
+    public:\r
+        virtual ~Component2D( ){}\r
+\r
+        /** コンポーネントの左上の位置を指定する\r
+         *  @note   このメソッドで指定するハンドラとgetPosition()で\r
+         *          得られるハンドラは同一であると扱える\r
+         *  @retval このウィジェットの左上の位置を得るためのハンドラ \r
+         */\r
+        /*virtual void setPositionStream( const Vector2DStream& stream )\r
+        {\r
+            m_positionStream = stream;\r
+        }*/\r
+\r
+        /** コンポーネントの左上の位置を得る\r
+         *  @note   このメソッドで得られるハンドラとsetPosition()で\r
+         *          指定したハンドラは同一であると扱える\r
+         *  @retval このウィジェットの左上の位置を得るためのハンドラ \r
+         */\r
+        virtual const Vector2DStream& getPositionStream( ) const\r
+        {\r
+            return m_positionStream;\r
+        }\r
+        \r
+        /** コンポーネントの左上の位置を得る\r
+         *  @note   このメソッドで得られるハンドラとsetPosition()で\r
+         *          指定したハンドラは同一であると扱える\r
+         *  @retval このウィジェットの左上の位置を得るためのハンドラ \r
+         */\r
+        virtual Vector2DStream& getPositionStream( ) \r
+        {\r
+            return m_positionStream;\r
+        }\r
+\r
+\r
+        /** コンポーネントの左上の位置を指定する\r
+         *  @note   このメソッドで指定するハンドラとgetPosition()で\r
+         *          得られるハンドラは同一であると扱える\r
+         *  @retval このウィジェットの左上の位置を得るためのハンドラ \r
+         */\r
+        /*virtual void setSizeStream( const Vector2DStream& stream )\r
+        {\r
+            m_sizeStream = stream;\r
+        }*/\r
+        \r
+        /** コンポーネントの大きさを得る\r
+         *  @note   このメソッドで得られるハンドラとsetSize()で\r
+         *          指定したハンドラは同一であると扱える\r
+         *  @retval このウィジェットの大きさを得るためのハンドラ \r
+         */\r
+        virtual const Vector2DStream& getSizeStream( ) const\r
+        {\r
+            return m_sizeStream;\r
+        }\r
+        \r
+        /** コンポーネントの大きさを得る\r
+         *  @note   このメソッドで得られるハンドラとsetSize()で\r
+         *          指定したハンドラは同一であると扱える\r
+         *  @retval このウィジェットの大きさを得るためのハンドラ \r
+         */\r
+        virtual Vector2DStream& getSizeStream( ) \r
+        {\r
+            return m_sizeStream;\r
+        }\r
+\r
+\r
+    protected:\r
+        Vector2DStream m_positionStream;\r
+        Vector2DStream m_sizeStream;\r
+\r
+        Component2D( )\r
+        : \r
+            m_positionStream( makeConstantHandler( Vector2D( 0 , 0 ) ) ) ,\r
+            m_sizeStream( makeConstantHandler( Vector2D( 0 , 0 ) ) ) \r
+        {\r
+        }\r
+        \r
+        Component2D( const Rectangle< int >& region )\r
+        : \r
+            m_positionStream\r
+            (\r
+                makeConstantHandler\r
+                ( \r
+                    Vector2D(region.beginX , region.beginY)\r
+                )\r
+            ) ,\r
+            m_sizeStream\r
+            (\r
+                makeConstantHandler\r
+                (\r
+                    Vector2D(region.getWidth() , region.getHeight())\r
+                )\r
+            ) \r
+        {}\r
+\r
+    };\r
+} // namespace mof\r
diff --git a/moftmp/Component3D.cpp b/moftmp/Component3D.cpp
new file mode 100755 (executable)
index 0000000..1c747a1
--- /dev/null
@@ -0,0 +1,7 @@
+#include "mof/Component3D.hpp"\r
+#include "mof/Constant.hpp"\r
+#include "mof/Matrix3D.hpp"\r
+\r
+void mof::Component3D::setWorldMatrix(const mof::Matrix3D& matrix){\r
+       setWorldMatrix(mof::makeConstantHandler(matrix));\r
+}\r
diff --git a/moftmp/Component3D.hpp b/moftmp/Component3D.hpp
new file mode 100755 (executable)
index 0000000..ce0a282
--- /dev/null
@@ -0,0 +1,22 @@
+\r
+//#include "mof/Matrix3D.hpp"\r
+\r
+#include "mof/Vector3D.hpp"\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof{\r
+class Matrix3D;\r
+\r
+class Component3D {\r
+       \r
+public:\r
+       ~Component3D(){}\r
+\r
+       virtual void setWorldMatrix(const mof::Animation<mof::Matrix3D>::Handler& handler) = 0;\r
+       virtual void setWorldMatrix(const mof::Matrix3D& matrix);\r
+       //TODO \83R\83\8a\83W\83\87\83\93\r
+};\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/ConsoleIO.cpp b/moftmp/ConsoleIO.cpp
new file mode 100755 (executable)
index 0000000..3a3b085
--- /dev/null
@@ -0,0 +1,3 @@
+#include "mof/ConsoleIO.hpp"\r
+\r
+ConsoleOut* ConsoleOut::obj = NULL;
\ No newline at end of file
diff --git a/moftmp/ConsoleIO.hpp b/moftmp/ConsoleIO.hpp
new file mode 100755 (executable)
index 0000000..60fb739
--- /dev/null
@@ -0,0 +1,80 @@
+\r
+#ifndef CONSOLE_H\r
+#define CONSOLE_H\r
+\r
+#include <iostream>\r
+#include <windows.h>\r
+#include <tchar.h>\r
+\r
+//--------------------------------------------\r
+// class ConsoleIO\r
+//\r
+// \83R\83\93\83\\81[\83\8b\82ð\8cÄ\82Ñ\8fo\82µ\81A\93ü\8fo\97Í\82ð\8ds\82¤\81B\r
+// C++\82Ì\93ü\8fo\97Í\83X\83g\83\8a\81[\83\80\83N\83\89\83X\81Astd::basic_stream\r
+// \82ð\8cp\8f³\82·\82é\81B\r
+//--------------------------------------------\r
+template <class CharT , class Tr = std::char_traits<CharT> >\r
+class ConsoleIO : public std::basic_streambuf<CharT , Tr>{\r
+\r
+protected:\r
+    std::streampos seekoff( \r
+        std::streamoff off, \r
+        std::ios::seek_dir dir, \r
+        int nMode = std::ios::in | std::ios::out ){\r
+        return EOF;\r
+       }\r
+    \r
+    std::streampos seekpos( std::streampos , int   ){\r
+        return EOF;\r
+    }\r
+\r
+    int_type overflow( int_type nCh = EOF ){\r
+        DWORD size;\r
+       WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),(WCHAR*)&nCh,1,&size,NULL);\r
+        return 0;\r
+       }\r
+\r
+    int_type underflow(void){\r
+        return EOF;\r
+    }\r
+\r
+\r
+public:\r
+    ConsoleIO(){\r
+        setbuf(0,0);\r
+        AllocConsole();\r
+       }\r
+       \r
+    ~ConsoleIO(){\r
+        FreeConsole();\r
+       }\r
+\r
+};\r
+\r
+\r
+\r
+//--------------------------------------------\r
+// class ConsoleOut\r
+//\r
+// \83R\83\93\83\\81[\83\8b\8fo\97Í\82É\82Í\81A\82±\82Ì\83N\83\89\83X\82Ì\83I\83u\83W\83F\83N\83g\82ð\8dì\82é\r
+//--------------------------------------------\r
+class ConsoleOut : public std::basic_iostream<TCHAR> {\r
+    static ConsoleOut* obj;\r
+       \r
+       ConsoleOut(void) \r
+        : std::basic_iostream<TCHAR>(new ConsoleIO<TCHAR>() ){\r
+    }\r
+\r
+public:\r
+       static ConsoleOut* getInstance(){\r
+               if(obj == NULL)obj = new ConsoleOut();\r
+               return obj;\r
+       }\r
+\r
+\r
+};\r
+\r
+#define DEBUG_PRINT(x) (*ConsoleOut::getInstance() << x << std::endl)\r
+//#define DEBUG_PRINT(x)\r
+\r
+#endif \r
diff --git a/moftmp/Container2D.cpp b/moftmp/Container2D.cpp
new file mode 100755 (executable)
index 0000000..142ab97
--- /dev/null
@@ -0,0 +1,162 @@
+#include "mof/Container2D.h"\r
+#include "mof/ConsoleIO.h"\r
+\r
+\r
+\r
+mof::Container2D::Container2D(int nColumns)\r
+: mof::Component2D()  , m_margin(0) , m_paddingX(0) , m_paddingY(0)\r
+{\r
+       m_nColumns = nColumns;\r
+}\r
+\r
+\r
+mof::Container2D::~Container2D(){\r
+\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               delete m_children.at(i);\r
+       }\r
+}\r
+\r
+bool mof::Container2D::update(){\r
+\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               m_children.at(i)->update();\r
+       }\r
+\r
+\r
+       //setPosition(getAnimationSet()->getPosition(getPosition()));\r
+       setPosition(getAnimationSet()->getPosition());\r
+       getAnimationSet()->update();\r
+       return true;\r
+}\r
+\r
+\r
+bool mof::Container2D::draw(){\r
+       \r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               m_children.at(i)->draw();\r
+       }\r
+       return true;\r
+}\r
+\r
+\r
+/*\r
+bool mof::Container2D::draw(mof::Matrix3D& transform){\r
+       transform = m_worldTransform * transform;\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               m_children.at(i)->draw(transform);\r
+       }\r
+       return true;\r
+}*/\r
+\r
+\r
+void mof::Container2D::add(mof::Component2D* component){\r
+       m_children.push_back(component);\r
+}\r
+\r
+bool mof::Container2D::remove(mof::Component2D* component){\r
+       for(std::vector<mof::Component2D*>::iterator itr = m_children.begin() ; itr !=m_children.end() ; ++itr){\r
+               if((*itr) == component){\r
+                       delete component;\r
+                       return true;\r
+               }\r
+       }\r
+       return false;\r
+}\r
+\r
+int mof::Container2D::indexOf(mof::Component2D* component){\r
+       for(int i = 0 ; i < m_children.size() ; ++i){\r
+               if(m_children.at(i) == component)return i;\r
+       }\r
+       return -1;\r
+}\r
+\r
+void mof::Container2D::set(int index , mof::Component2D* component){\r
+       delete m_children.at(index);\r
+       m_children.at(index) = component;\r
+}\r
+\r
+mof::Component2D* mof::Container2D::get(int index){\r
+       return m_children.at(index);\r
+}\r
+\r
+mof::Vector2D mof::Container2D::getPositionOf(int index){\r
+       return get(index)->getPosition();/* * m_worldTransform;*/\r
+       //return get(index)->getPosition();\r
+}\r
+\r
+void mof::Container2D::setPosition(Vector2D& _position){\r
+       mof::Vector2D position = _position;\r
+       m_position = position;\r
+       position.x += m_margin;\r
+       position.y += m_margin;\r
+       \r
+       int* maxWidthArray = new int[m_nColumns];\r
+       \r
+       //\97ñ\96\88\82É\8dÅ\91å\95\9d\82ð\8b\81\82ß\82é\r
+       for(int i = 0 ; i < m_nColumns ; i++){\r
+               maxWidthArray[i] = 0 ;\r
+               for(int j = i ; j < m_children.size() ; j += m_nColumns){\r
+                       int width = get(j)->getWidth();\r
+                       if(maxWidthArray[i] < width)maxWidthArray[i] = width;\r
+               }\r
+       }\r
+\r
+       for(int i = 0 ; i < m_children.size() ; i++){\r
+               get(i)->setPosition(position);\r
+               if(i % m_nColumns == m_nColumns -1){\r
+                       position.y += get(i)->getHeight() + m_paddingY;\r
+                       position.x = m_position.x + m_margin;\r
+               }\r
+               else position.x += maxWidthArray[i % m_nColumns] + m_paddingX;\r
+       }\r
+       \r
+       delete[] maxWidthArray;\r
+}\r
+\r
+mof::Vector2D mof::Container2D::getPosition(){\r
+       return m_position;\r
+}\r
+               \r
+void mof::Container2D::setVisible(bool visible){\r
+\r
+\r
+}\r
+\r
+int mof::Container2D::getWidth(){\r
+       int* maxWidthArray = new int[m_nColumns];\r
+       //\97ñ\96\88\82É\8dÅ\91å\95\9d\82ð\8b\81\82ß\82é\r
+       for(int i = 0 ; i < m_nColumns ; i++){\r
+               maxWidthArray[i] = 0 ;\r
+               for(int j = i ; j < m_children.size() ; j += m_nColumns){\r
+                       int width = get(j)->getWidth();\r
+                       if(maxWidthArray[i] < width)maxWidthArray[i] = width;\r
+               }\r
+       }\r
+       int sumWidth = 0;\r
+       for(int i = 0 ; i < m_nColumns ; i++)sumWidth += maxWidthArray[i];\r
+       delete[] maxWidthArray;\r
+       return sumWidth + (m_nColumns-1)* m_paddingX + getMargin()*2;\r
+}\r
+\r
+int mof::Container2D::getHeight(){\r
+       int sumHeight = 0;\r
+       for(int i = 0 ; i < m_children.size() ; i++){\r
+               if(i % m_nColumns == 0)sumHeight += m_children.at(i)->getHeight() + m_paddingY;\r
+       }\r
+       return sumHeight + getMargin() *2;\r
+}\r
+               \r
+\r
+mof::RectangleModel mof::Container2D::getBounds(){\r
+       return mof::RectangleModel(getPosition().x , getPosition().y , getWidth() , getHeight());\r
+}\r
+\r
+void mof::Container2D::setLayout(){\r
+       mof::Vector2D position = getPosition();\r
+       position.x += m_margin;\r
+       position.y += m_margin;\r
+       //DEBUG_PRINT(position.x << _T(",") << position.y);\r
+       setPosition(getPosition());\r
+}\r
+               
\ No newline at end of file
diff --git a/moftmp/Container2D.h b/moftmp/Container2D.h
new file mode 100755 (executable)
index 0000000..a4ccedb
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once\r
+#include "mof/Component2D.h"\r
+#include <vector>\r
+\r
+namespace mof{\r
+       \r
+       class Container2D : public Component2D{\r
+               std::vector<mof::Component2D*> m_children;\r
+               mof::Vector2D m_position;\r
+               int m_margin;\r
+               int m_paddingX;\r
+               int m_paddingY;\r
+               int m_nColumns;\r
+       public:\r
+               Container2D(int nColumns = 1);\r
+               ~Container2D();\r
+\r
+               virtual bool update();\r
+               virtual bool draw();\r
+       \r
+               void add(mof::Component2D* component);\r
+               bool remove(mof::Component2D* component);\r
+               mof::Component2D* get(int index);\r
+               void set(int index , mof::Component2D* component);\r
+               int indexOf(mof::Component2D* component);\r
+               int size(){return m_children.size();}\r
+               \r
+               mof::Vector2D getPositionOf(int index);\r
+               \r
+               virtual void setPosition(Vector2D& position);\r
+               void setMargin(int margin){m_margin = margin;}\r
+               void setColumn(int nColumns){m_nColumns = nColumns;}\r
+               void setPaddingX(int paddingX){m_paddingX = paddingX;}\r
+               void setPaddingY(int paddingY){m_paddingY = paddingY;}\r
+               int getMargin(){return m_margin;}\r
+               virtual mof::Vector2D getPosition();\r
+               virtual int getWidth();\r
+               virtual int getHeight();\r
+               \r
+               virtual void setVisible(bool visible);\r
+               virtual RectangleModel getBounds();\r
+               virtual void setLayout();\r
+               \r
+       };\r
+};
\ No newline at end of file
diff --git a/moftmp/Container3D.cpp b/moftmp/Container3D.cpp
new file mode 100755 (executable)
index 0000000..2034f77
--- /dev/null
@@ -0,0 +1,62 @@
+#include "mof/Container3D.h"\r
+\r
+\r
+\r
+mof::Container3D::Container3D()\r
+: mof::Component3D() \r
+{\r
+}\r
+\r
+\r
+mof::Container3D::~Container3D(){\r
+\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               delete m_children.at(i);\r
+       }\r
+}\r
+\r
+bool mof::Container3D::draw(){\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               if(m_children.at(i) == NULL)continue;\r
+               m_children.at(i)->draw(m_worldTransform);\r
+       }\r
+       return true;\r
+}\r
+\r
+\r
+bool mof::Container3D::draw(mof::Matrix3D& transform){\r
+       transform = m_worldTransform * transform;\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               if(m_children.at(i) == NULL)continue;\r
+               m_children.at(i)->draw(transform);\r
+       }\r
+       return true;\r
+}      \r
+\r
+bool mof::Container3D::update(){\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               if(m_children.at(i) == NULL)continue;\r
+               m_children.at(i)->update();\r
+       }\r
+       return mof::Component3D::update();\r
+}\r
+\r
+\r
+void mof::Container3D::add(mof::Component3D* component){\r
+       for(int i = 0 ; i < m_children.size() ; i ++){\r
+               if(m_children.at(i) == NULL){\r
+                       m_children.at(i) = component;\r
+                       return;\r
+               }\r
+       }\r
+       m_children.push_back(component);\r
+}\r
+\r
+mof::Component3D* mof::Container3D::get(int index){\r
+       return m_children.at(index);\r
+}\r
+\r
+mof::Vector3D mof::Container3D::getPositionOf(int index){\r
+       return get(index)->getPosition() * m_worldTransform;\r
+       //return get(index)->getPosition();\r
+}
\ No newline at end of file
diff --git a/moftmp/Container3D.h b/moftmp/Container3D.h
new file mode 100755 (executable)
index 0000000..9b8682b
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+#include "mof/Component3D.h"\r
+#include <vector>\r
+\r
+namespace mof{\r
+       \r
+       class Container3D : public Component3D{\r
+       protected:\r
+               std::vector<mof::Component3D*> m_children;\r
+       public:\r
+               Container3D();\r
+               ~Container3D();\r
+\r
+               \r
+               virtual bool draw();\r
+               virtual bool draw(mof::Matrix3D& transform);\r
+               virtual bool update();\r
+               \r
+               void add(mof::Component3D* component);\r
+               mof::Component3D* get(int index);\r
+               \r
+               mof::Vector3D getPositionOf(int index);\r
+               \r
+               //void deleteAll();\r
+               \r
+       };\r
+};
\ No newline at end of file
diff --git a/moftmp/DataRow.cpp b/moftmp/DataRow.cpp
new file mode 100755 (executable)
index 0000000..4fcd9b0
--- /dev/null
@@ -0,0 +1,12 @@
+#include "DataRow.h"\r
+\r
+mof::DataRow::DataRow( const DataResource& data , const TCHAR* const pRowName)\r
+: m_data(data){\r
+       m_rowIndex = m_data->getRowIndex(pRowName);\r
+}\r
+\r
+mof::DataRow::DataRow( const DataResource& data , int index)\r
+: m_data(data) , m_rowIndex(index){\r
+       \r
+}\r
+\r
diff --git a/moftmp/DataRow.h b/moftmp/DataRow.h
new file mode 100755 (executable)
index 0000000..1fc1d7a
--- /dev/null
@@ -0,0 +1,47 @@
+#pragma once\r
+#include "mof/DataTable.h"\r
+\r
+namespace mof{\r
+       class DataRow\r
+       {\r
+               int m_rowIndex;\r
+               DataResource m_data;\r
+       public:\r
+               DataRow(){;}\r
+               DataRow( const DataResource& data , const TCHAR * const pRowName);\r
+               DataRow( const DataResource& data , int index);\r
+\r
+               inline mof::tstring& getData( const TCHAR * const pColumnName);\r
+               inline mof::tstring& getData( int columnIndex);\r
+\r
+               inline int getIntegerData( const TCHAR * const pColumnName);\r
+               inline int getIntegerData( int columnIndex);\r
+       };\r
+\r
+\r
+}\r
+\r
+\r
+mof::tstring& mof::DataRow::getData( const TCHAR * const pColumnName){\r
+       return m_data->getData(m_rowIndex , pColumnName);\r
+}\r
+\r
+\r
+\r
+mof::tstring& mof::DataRow::getData( int columnIndex){\r
+       return m_data->getData(m_rowIndex , columnIndex);\r
+}\r
+\r
+\r
+\r
+int mof::DataRow::getIntegerData( const TCHAR * const pColumnName){\r
+       return m_data->getIntegerData(m_rowIndex , pColumnName);\r
+}\r
+\r
+\r
+\r
+int mof::DataRow::getIntegerData( int columnIndex){\r
+       return m_data->getIntegerData(m_rowIndex , columnIndex);\r
+}\r
+\r
+\r
diff --git a/moftmp/DataTable.cpp b/moftmp/DataTable.cpp
new file mode 100755 (executable)
index 0000000..5270eba
--- /dev/null
@@ -0,0 +1,104 @@
+#include "mof/ConsoleIO.h"\r
+#include "mof/DataTable.h"\r
+#include "mof/CSVFile.h"\r
+#include <boost/lexical_cast.hpp>\r
+#include <assert.h>\r
+#include <stdexcept>\r
+\r
+mof::DataTable::DataTable(tstring& name )\r
+       : mof::Resource(name){\r
+}\r
+\r
+mof::DataTable::DataTable(const TCHAR * const name)\r
+       : mof::Resource(mof::tstring(name)){\r
+}\r
+\r
+       \r
+void mof::DataTable::load(){\r
+       if(isAvailable())return;\r
+       //CVS\83t\83@\83C\83\8b\82©\82ç\83f\81[\83^\82ð\83\8d\81[\83h\r
+       mof::CSVFile csvFile(getName().c_str());\r
+       csvFile.setIgnoreNL(false);\r
+\r
+       //column\8fî\95ñ\82Ì\83\8d\81[\83h\r
+       for(int i = 0 ; csvFile.hasNextValue() ; i++){\r
+               m_columnMap.insert(std::pair<mof::tstring , int>( mof::tstring(csvFile.getNextValue()) , i));\r
+       }\r
+       \r
+       while(csvFile.nextLine()){\r
+               m_dataList.push_back(std::vector<mof::tstring>());\r
+               while(csvFile.hasNextValue()){\r
+                       m_dataList.back().push_back(mof::tstring(csvFile.getNextValue()));\r
+               }\r
+       \r
+       }\r
+       setAvailable(true);\r
+       \r
+}\r
+\r
+void mof::DataTable::unload(){\r
+               if(!isAvailable())return;\r
+               m_dataList.clear();\r
+               m_columnMap.clear();\r
+               setAvailable(false);\r
+       }\r
+\r
+\r
+int mof::DataTable::getRowIndex(const TCHAR * const pRowName){\r
+       if(!isAvailable())load();\r
+       for(int i = 0 ; i < m_dataList.size() ; ++i){\r
+               if(!m_dataList.at(i).empty() && m_dataList.at(i).at(0) == pRowName)return i;\r
+       }\r
+       return -1;\r
+}\r
+\r
+\r
+int mof::DataTable::getColumnIndex(const TCHAR * const pColumnName){\r
+       if(!isAvailable())load();\r
+       mof::tstring tmp(pColumnName);\r
+       std::map<mof::tstring , int>::iterator itr = m_columnMap.find(tmp);\r
+       return itr != m_columnMap.end() ? itr->second : -1;\r
+}\r
+\r
+\r
+mof::tstring& mof::DataTable::getData(const TCHAR * const pRowName , const TCHAR * const pColumnName){\r
+       if(!isAvailable())load();\r
+       int columnIndex = getColumnIndex(pColumnName);\r
+       int rowIndex = getRowIndex(pRowName);\r
+       return m_dataList.at(rowIndex).at(columnIndex);\r
+       \r
+}\r
+\r
+\r
+mof::tstring& mof::DataTable::getData(int rowIndex , const TCHAR *const pColumnName){\r
+       if(!isAvailable())load();\r
+       int columnIndex = getColumnIndex(pColumnName);\r
+       return m_dataList.at(rowIndex).at(columnIndex);\r
+}\r
+\r
+\r
+mof::tstring& mof::DataTable::getData(int rowIndex , int columnIndex){\r
+       if(!isAvailable())load();\r
+       return m_dataList.at(rowIndex).at(columnIndex);\r
+}\r
+\r
+int mof::DataTable::getIntegerData(const TCHAR *const pRowName ,const TCHAR * const pColumnName){\r
+       if(!isAvailable())load();\r
+       return boost::lexical_cast<int>(getData(pRowName , pColumnName));\r
+}\r
+\r
+int mof::DataTable::getIntegerData(int rowIndex , const TCHAR *const pColumnName){\r
+       if(!isAvailable())load();\r
+       return boost::lexical_cast<int>(getData(rowIndex , pColumnName));\r
+}\r
+\r
+int mof::DataTable::getIntegerData(int rowIndex , int columnIndex){\r
+       if(!isAvailable())load();\r
+       return boost::lexical_cast<int>(getData(rowIndex , columnIndex));\r
+}\r
+\r
+\r
+int mof::DataTable::getNumberOfRows(){\r
+       if(!isAvailable())load();\r
+       return m_dataList.size();\r
+}
\ No newline at end of file
diff --git a/moftmp/DataTable.h b/moftmp/DataTable.h
new file mode 100755 (executable)
index 0000000..da42f97
--- /dev/null
@@ -0,0 +1,41 @@
+#pragma once\r
+#include "mof/Resource.h"\r
+#include "mof/tstring.h"\r
+#include <vector>\r
+#include <map>\r
+#include "mof/ResourceManager.h"\r
+\r
+\r
+namespace mof{\r
+\r
+       \r
+       class DataTable : public Resource\r
+       {\r
+               std::map<mof::tstring , int> m_columnMap;\r
+               std::vector<std::vector<mof::tstring>> m_dataList;\r
+\r
+       public:\r
+               DataTable(tstring& name );\r
+               DataTable(const TCHAR * const name);\r
+               \r
+               virtual void load();\r
+               virtual void unload();\r
+\r
+               int getRowIndex(const TCHAR * const pRowName);\r
+               int getColumnIndex(const TCHAR * const pRowName);\r
+               mof::tstring& getData(const TCHAR * const pRowName , const TCHAR * const pColumnName);\r
+               mof::tstring& getData(int rowIndex , const TCHAR * const pColumnName);\r
+               mof::tstring& getData(int rowIndex , int columnIndex);\r
+\r
+               int getIntegerData(const TCHAR * const pRowName , const TCHAR * const pColumnName);\r
+               int getIntegerData(int rowIndex , const TCHAR * const pColumnName);\r
+               int getIntegerData(int rowIndex , int columnIndex);\r
+               \r
+               int getNumberOfRows();\r
+       };\r
+\r
+\r
+\r
+       typedef mof::ResourceManager<DataTable> DataResourceManager;\r
+       typedef boost::shared_ptr<DataTable> DataResource;\r
+};\r
diff --git a/moftmp/Deleter.hpp b/moftmp/Deleter.hpp
new file mode 100755 (executable)
index 0000000..2ca215a
--- /dev/null
@@ -0,0 +1,23 @@
+#include <boost/shared_ptr.hpp>\r
+#include <boost/weak_ptr.hpp>\r
+#include "mof/EventScheduler.hpp"\r
+\r
+namespace mof{\r
+       \r
+       template <class T>\r
+       class Deleter{\r
+               boost::shared_ptr<T> m_p;\r
+       public:\r
+               Deleter(T* p) : m_p(p) {}\r
+               Deleter( typename boost::shared_ptr<T>& p) : m_p(p) {}\r
+\r
+               void operator ()(){\r
+                       m_p = boost::shared_ptr<T>();\r
+               }\r
+\r
+               boost::weak_ptr<T> getWeak(){\r
+                       return m_p;\r
+               }\r
+       };\r
+\r
+};\r
diff --git a/moftmp/DeviceInputReceiver.cpp b/moftmp/DeviceInputReceiver.cpp
new file mode 100755 (executable)
index 0000000..462298d
--- /dev/null
@@ -0,0 +1,133 @@
+#include "mof/private/DirectInput.hpp"\r
+#include "mof/private/DeviceInputReceiver.hpp"\r
+#include "mof/InputDevice.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/InputEventCondition.hpp"\r
+\r
+\r
+mof::DeviceInputReceiver::DeviceInputReceiver()\r
+: mof::InputReceiver(){\r
+       m_pKeyStates = new bool[mof::DeviceInputReceiver::END];\r
+       for(int i = 0 ; i < mof::DeviceInputReceiver::END ; i++)m_pKeyStates[i] = false;\r
+}\r
+\r
+mof::DeviceInputReceiver::~DeviceInputReceiver(){\r
+       delete[] m_pKeyStates;\r
+       \r
+}\r
+\r
+bool mof::DeviceInputReceiver::testKeyState(mof::InputReceiver::Key key){\r
+\r
+       return m_pKeyStates[key];\r
+       \r
+}\r
+\r
+void mof::DeviceInputReceiver::update(){\r
+       mof::InputDevice::update();\r
+}\r
+\r
+\r
+void mof::DeviceInputReceiver::notifyInputEvent(mof::InputEvent& inputEvent){\r
+       mof::DeviceInputReceiver::Key key;\r
+\r
+    \r
+       switch(inputEvent.dwOfs){\r
+               case DIK_UP :\r
+                       key = mof::DeviceInputReceiver::UP;\r
+                       break;\r
+               case DIK_DOWN :\r
+                       key = mof::DeviceInputReceiver::DOWN;\r
+                       break;\r
+               case DIK_LEFT :\r
+                       key = mof::DeviceInputReceiver::LEFT;\r
+                       break;\r
+               case DIK_RIGHT :\r
+                       key = mof::DeviceInputReceiver::RIGHT;\r
+                       break;\r
+        case DIK_A :\r
+                       key = mof::DeviceInputReceiver::A;\r
+                       break;\r
+        case DIK_B :\r
+                       key = mof::DeviceInputReceiver::B;\r
+                       break;\r
+        case DIK_C :\r
+                       key = mof::DeviceInputReceiver::C;\r
+                       break;\r
+        case DIK_D :\r
+                       key = mof::DeviceInputReceiver::D;\r
+                       break;\r
+        case DIK_E :\r
+                       key = mof::DeviceInputReceiver::E;\r
+                       break;\r
+        case DIK_F :\r
+                       key = mof::DeviceInputReceiver::F;\r
+                       break;\r
+        case DIK_G :\r
+                       key = mof::DeviceInputReceiver::G;\r
+                       break;\r
+        case DIK_H :\r
+                       key = mof::DeviceInputReceiver::H;\r
+                       break;\r
+        case DIK_I :\r
+                       key = mof::DeviceInputReceiver::I;\r
+                       break;\r
+        case DIK_J :\r
+                       key = mof::DeviceInputReceiver::J;\r
+                       break;\r
+        case DIK_K :\r
+                       key = mof::DeviceInputReceiver::K;\r
+                       break;\r
+        case DIK_L :\r
+                       key = mof::DeviceInputReceiver::L;\r
+                       break;\r
+        case DIK_M :\r
+                       key = mof::DeviceInputReceiver::M;\r
+                       break;\r
+        case DIK_N :\r
+                       key = mof::DeviceInputReceiver::N;\r
+                       break;\r
+        case DIK_O :\r
+                       key = mof::DeviceInputReceiver::O;\r
+                       break;\r
+        case DIK_P :\r
+                       key = mof::DeviceInputReceiver::P;\r
+                       break;\r
+        case DIK_Q :\r
+                       key = mof::DeviceInputReceiver::Q;\r
+                       break;\r
+        case DIK_R :\r
+                       key = mof::DeviceInputReceiver::R;\r
+                       break;\r
+        case DIK_S :\r
+                       key = mof::DeviceInputReceiver::S;\r
+                       break;\r
+        case DIK_T :\r
+                       key = mof::DeviceInputReceiver::T;\r
+                       break;\r
+        case DIK_U :\r
+                       key = mof::DeviceInputReceiver::U;\r
+                       break;\r
+        case DIK_V :\r
+                       key = mof::DeviceInputReceiver::V;\r
+                       break;\r
+        case DIK_W :\r
+                       key = mof::DeviceInputReceiver::W;\r
+                       break;\r
+        case DIK_X :\r
+                       key = mof::DeviceInputReceiver::X;\r
+                       break;\r
+        case DIK_Y :\r
+                       key = mof::DeviceInputReceiver::Y;\r
+                       break;\r
+        case DIK_Z :\r
+                       key = mof::DeviceInputReceiver::Z;\r
+                       break;\r
+               case DIK_ESCAPE :\r
+                       key = mof::DeviceInputReceiver::ESCAPE;\r
+                       break;\r
+               default : \r
+            return;\r
+       }\r
+       m_pKeyStates[key] = (inputEvent.dwData & 0x80) != 0;\r
+       \r
+}\r
diff --git a/moftmp/DirectionalLight.cpp b/moftmp/DirectionalLight.cpp
new file mode 100755 (executable)
index 0000000..670bc5a
--- /dev/null
@@ -0,0 +1,44 @@
+#include "mof/DirectionalLight.h"\r
+#include <d3dx9.h>\r
+#include "GraphicsDevice.h"\r
+\r
+\r
+mof::DirectionalLight::DirectionalLight(mof::Color diffuse , mof::Color ambient , mof::Vector3D& direction)\r
+: mof::Light()\r
+{\r
+       setDiffuseColor(diffuse);\r
+       setAmbientColor(ambient);\r
+       setDirection(direction);\r
+\r
+}\r
+\r
+\r
+void mof::DirectionalLight::update(){\r
+       //mof::Animation* pAnimation = getAnimation();\r
+       //if(pAnimation == NULL)return;\r
+       //pAnimation->update();\r
+       //mof::Color color = pAnimation->get();\r
+       //set(pAnimation->getColor());\r
+}\r
+\r
+void mof::DirectionalLight::reflect(){\r
+       GRAPHICS_DEVICE pDevice = mof::GraphicsDevice::getInstance()->getGraphicsDevice();\r
+       D3DLIGHT9 light;\r
+       ZeroMemory(&light , sizeof(light));\r
+       light.Type = D3DLIGHT_DIRECTIONAL;\r
+       light.Diffuse.a = (float)mof::getAlpha(m_diffuse) / 255.0f;\r
+       light.Diffuse.r = (float)mof::getRed(m_diffuse) / 255.0f;\r
+       light.Diffuse.g = (float)mof::getGreen(m_diffuse) / 255.0f;\r
+       light.Diffuse.b = (float)mof::getBlue(m_diffuse) / 255.0f;\r
+\r
+       light.Ambient.a = (float)mof::getAlpha(m_ambient) / 255.0f;\r
+       light.Ambient.r = (float)mof::getRed(m_ambient) / 255.0f;\r
+       light.Ambient.g = (float)mof::getGreen(m_ambient) / 255.0f;\r
+       light.Ambient.b = (float)mof::getBlue(m_ambient) / 255.0f;\r
+\r
+       light.Direction = D3DXVECTOR3(m_direction.x , m_direction.y , m_direction.z);\r
+       \r
+       \r
+       pDevice->SetLight(0 , &light);\r
+       pDevice->LightEnable(0 , TRUE);\r
+}\r
diff --git a/moftmp/DirectionalLight.h b/moftmp/DirectionalLight.h
new file mode 100755 (executable)
index 0000000..5a5c0a6
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once\r
+#include "mof/Light.h"\r
+#include "mof/Color.h"\r
+\r
+namespace mof{\r
+\r
+       class DirectionalLight : public Light{\r
+               mof::Color m_diffuse;\r
+               mof::Color m_ambient;\r
+               mof::Vector3D m_direction;\r
+       public:\r
+               DirectionalLight(mof::Color diffuse , mof::Color ambient , mof::Vector3D& direction);\r
+               void setDiffuseColor(mof::Color diffuse){m_diffuse = diffuse;}\r
+               void setAmbientColor(mof::Color ambient){m_ambient = ambient;}\r
+               void setDirection(mof::Vector3D& direction){m_direction = direction;}\r
+\r
+               virtual void update();\r
+               virtual void reflect();\r
+\r
+       };\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/Drawable.hpp b/moftmp/Drawable.hpp
new file mode 100755 (executable)
index 0000000..d20ba2d
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+\r
+namespace mof\r
+{\r
+    class Drawable\r
+    {\r
+    public:\r
+        virtual ~Drawable(){}\r
+        virtual void draw() const = 0;\r
+    };\r
+}\r
diff --git a/moftmp/EventCondition.hpp b/moftmp/EventCondition.hpp
new file mode 100755 (executable)
index 0000000..881d877
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once\r
+\r
+namespace mof{\r
+\r
+       class EventCondition{\r
+       public:\r
+               virtual ~EventCondition(){}\r
+               virtual bool test() = 0;\r
+               virtual void update() = 0;\r
+               virtual bool isDisposable() = 0;\r
+       };\r
+\r
+}\r
+\r
diff --git a/moftmp/EventScheduler.cpp b/moftmp/EventScheduler.cpp
new file mode 100755 (executable)
index 0000000..5cd2277
--- /dev/null
@@ -0,0 +1,83 @@
+#include "mof/EventScheduler.hpp"\r
+#include "mof/EventCondition.hpp"\r
+#include <list>\r
+#include <utility>\r
+#include "mof/utilities.hpp"\r
+\r
+\r
+class TimeEventCondition : public mof::EventCondition{\r
+       mof::FrameNumber limit;\r
+       mof::FrameNumber count;\r
+\r
+public:\r
+       TimeEventCondition(mof::FrameNumber limit)\r
+               : limit(limit) , count(0)\r
+       {\r
+       }\r
+\r
+       virtual ~TimeEventCondition(){}\r
+\r
+       virtual bool test(){\r
+               return count == limit;\r
+       }\r
+\r
+       virtual bool isDisposable(){\r
+               return count > limit;\r
+       }\r
+\r
+       virtual void update(){\r
+               if(limit >= count)count++;\r
+       }\r
+};\r
+\r
+struct mof::EventScheduler::Impl{\r
+       typedef std::pair<mof::EventCondition* , boost::function0<void>> Schedule; \r
+       typedef std::list<std::pair<mof::EventCondition* , boost::function0<void>>> EventList; \r
+       EventList eventList;\r
+\r
+       Impl(){\r
+       }\r
+\r
+       ~Impl(){\r
+               foreach( Impl::Schedule &value , eventList ){\r
+                       delete value.first;\r
+               }\r
+       }\r
+\r
+};\r
+\r
+mof::EventScheduler::EventScheduler()\r
+: m_pImpl(new Impl())\r
+{\r
+}\r
+\r
+mof::EventScheduler::~EventScheduler(){\r
+       \r
+}\r
+\r
+void mof::EventScheduler::addEvent( mof::EventCondition* pCondition , const boost::function0<void> &action){\r
+       m_pImpl->eventList.push_back(std::pair<mof::EventCondition* , boost::function0<void>>(pCondition , action));\r
+}\r
+\r
+void mof::EventScheduler::addEvent(mof::FrameNumber frame, const boost::function0<void> &action){\r
+       addEvent(new TimeEventCondition(frame) , action);\r
+}\r
+\r
+void mof::EventScheduler::update(){\r
+       for( Impl::EventList::iterator itr = m_pImpl->eventList.begin() ;\r
+               itr != m_pImpl->eventList.end() ; \r
+               ){\r
+                       itr->first->update();\r
+                       if(itr->first->test()){\r
+                               itr->second();\r
+                       }\r
+                       if(itr->first->isDisposable()){\r
+                               delete itr->first;\r
+                               itr = m_pImpl->eventList.erase(itr);\r
+                       }\r
+                       else ++itr;\r
+       }\r
+}\r
+\r
+\r
+\r
diff --git a/moftmp/EventScheduler.hpp b/moftmp/EventScheduler.hpp
new file mode 100755 (executable)
index 0000000..bc7cd13
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef MOF_EVENT_SCHEDULER_HPP\r
+#define MOF_EVENT_SCHEDULER_HPP\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/function/function0.hpp>\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof{\r
+\r
+class EventCondition;\r
+\r
+class EventScheduler{\r
+       struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+public:\r
+       typedef boost::function0<void> Action;\r
+       EventScheduler();\r
+       ~EventScheduler();\r
+\r
+       void addEvent(mof::EventCondition* pCondition , const Action& action);\r
+       void addEvent(mof::FrameNumber interval , const Action& action);\r
+       void update();\r
+};\r
+\r
+}\r
+\r
+\r
+\r
+\r
+#endif\r
diff --git a/moftmp/FactoryMethod.hpp b/moftmp/FactoryMethod.hpp
new file mode 100755 (executable)
index 0000000..f52554d
--- /dev/null
@@ -0,0 +1,137 @@
+#pragma once\r
+#include <boost/function/function0.hpp>\r
+\r
+namespace mof\r
+{\r
+    //TODO タイプリストとかで、そのままのインタフェースでより汎用的にする\r
+    //非const参照を渡したい場合は?(constructorにそれはありえない)\r
+\r
+\r
+//{{{ FactoryMethod\r
+    template < class T > \r
+    class FactoryMethod\r
+    {\r
+    public: \r
+        FactoryMethod( const boost::function<T* (void)>& factory)\r
+            : m_factory(factory){}\r
+\r
+        T* operator() () const{ return m_factory(); }\r
+        \r
+        template<class T>\r
+        operator FactoryMethod<T>( ) const\r
+        {\r
+            return FactoryMethod<T>(m_factory); \r
+        }\r
+\r
+\r
+\r
+    private: \r
+        boost::function<T* (void)> m_factory;\r
+    };\r
+\r
+        \r
+//}}}\r
+//{{{ Constructor0\r
+    template < class T > \r
+    class Constructor0\r
+    {\r
+    public: \r
+        T* operator() ( ) const {return new T();}\r
+    };\r
+//}}}\r
+//{{{ Constructor1\r
+    template <class T , class P1> \r
+    class Constructor1 : protected Constructor0<T>\r
+    {\r
+    protected:\r
+        P1 p1;\r
+    public: \r
+        Constructor1(const P1& p1_)\r
+            : p1(p1_)\r
+        {}\r
+\r
+        T* operator() ( ) const {return new T(p1);}\r
+    };\r
+//}}}\r
+//{{{ Constructor2\r
+    template <class T , class P1 , class P2> \r
+    class Constructor2 : protected Constructor1<T , P1>\r
+    {\r
+    protected:\r
+        P2 p2;\r
+    public: \r
+        Constructor2(const P1& p1_ , const P2& p2_)\r
+            : Constructor1(p1_) , p2(p2_)\r
+        {}\r
+\r
+        T* operator() ( ) const {return new T(p1 , p2);}\r
+    };\r
+//}}}\r
+//{{{ Constructor3\r
+    template <class T , class P1 , class P2 , class P3> \r
+    class Constructor3 : protected Constructor2<T , P1 , P2>\r
+    {\r
+    protected:\r
+        P3 p3;\r
+    public: \r
+        Constructor3(const P1& p1_ , const P2& p2_ , const P3& p3_)\r
+            : Constructor2(p1_ , p2_) , p3(p3_)\r
+        {}\r
+\r
+        T* operator() ( ) const {return new T(p1 , p2 , p3);}\r
+    };\r
+//}}}\r
+//{{{ Constructor4\r
+    template <class T , class P1 , class P2 , class P3 , class P4> \r
+    class Constructor4 : protected Constructor3<T , P1 , P2 , P3>\r
+    {\r
+    protected:\r
+        P4 p4;\r
+    public: \r
+        Constructor4(const P1& p1_ , const P2& p2_ , const P3& p3_ , const P4& p4_)\r
+            : Constructor2(p1_ , p2_ , p3_) , p4(p4_)\r
+        {}\r
+\r
+        T* operator() ( ) const {return new T(p1 , p2 , p3 , p4);}\r
+    };\r
+//}}}\r
\r
+//{{{ makeFactoryMethod\r
+    template<class T>\r
+    FactoryMethod<T>\r
+    makeFactoryMethod()\r
+    {\r
+        return FactoryMethod<T>( Constructor0<T>() );\r
+    }\r
+        \r
+    template<class T , class P1>\r
+    FactoryMethod<T>\r
+    makeFactoryMethod(const P1& p1)\r
+    {\r
+        return FactoryMethod<T>( Constructor1<T , P1>(p1) );\r
+    }\r
+    \r
+    template<class T , class P1 , class P2>\r
+    FactoryMethod<T>\r
+    makeFactoryMethod(const P1& p1 , const P2& p2)\r
+    {\r
+        return FactoryMethod<T>( Constructor2<T , P1 , P2>(p1 , p2) );\r
+    }\r
+    \r
+    template<class T , class P1 , class P2 , class P3>\r
+    FactoryMethod<T>\r
+    makeFactoryMethod(const P1& p1 , const P2& p2 , const P3& p3)\r
+    {\r
+        return FactoryMethod<T>( Constructor3<T , P1 , P2 , P3>(p1 , p2 , p3) );\r
+    }\r
+        \r
+    template<class T , class P1 , class P2 , class P3 , class P4>\r
+    FactoryMethod<T>\r
+    makeFactoryMethod(const P1& p1 , const P2& p2 , const P3& p3 , const P4& p4)\r
+    {\r
+        return FactoryMethod<T>( Constructor4<T , P1 , P2 , P3 , P4>(p1 , p2 , p3 , p4) );\r
+    }\r
+//}}}\r
+\r
+\r
+}\r
diff --git a/moftmp/FilePath.cpp b/moftmp/FilePath.cpp
new file mode 100755 (executable)
index 0000000..68a5ed7
--- /dev/null
@@ -0,0 +1,68 @@
+#include "mof/FilePath.hpp"\r
+#include <boost/regex.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+\r
+mof::FilePath::FilePath(const mof::tstring& path){\r
+       m_path = path;\r
+}\r
+\r
+\r
+mof::tstring mof::FilePath::getFormat(){\r
+       try {\r
+               boost::regex regex("(.*)\\.(.*)");//name . format\r
+               boost::smatch match;\r
+               //\8a¿\8e\9a\82É\82Í\91Î\89\9e\82µ\82Ä\82¢\82È\82¢\r
+               if(!boost::regex_search(m_path , match , regex)){\r
+                       DEBUG_PRINT(_T("FormatError --- ") << m_path);\r
+                       return mof::tstring();\r
+               }\r
+               return match.str(2);    \r
+       }\r
+       catch (std::exception &e) {\r
+               throw e;\r
+       }\r
+       return mof::tstring();\r
+}\r
+               \r
+\r
+mof::tstring& mof::FilePath::getPath(){\r
+       return m_path;\r
+}\r
+\r
+mof::tstring mof::FilePath::dir(){\r
+       try {\r
+               boost::regex regex("(.*)/[^/]*\\.(.*)");//name . format\r
+               boost::smatch match;\r
+               //\8a¿\8e\9a\82É\82Í\91Î\89\9e\82µ\82Ä\82¢\82È\82¢\r
+               if(!boost::regex_search(m_path , match , regex)){\r
+                       DEBUG_PRINT(_T("FormatError --- ") << m_path);\r
+                       return mof::tstring();\r
+               }\r
+               return match.str(1);    \r
+       }\r
+       catch (std::exception &e) {\r
+               throw e;\r
+       }\r
+       return mof::tstring();\r
+\r
+}\r
+               \r
+mof::tstring mof::FilePath::basename(){\r
+       try {\r
+               boost::regex regex("(.*)/([^/]*)");//name . format\r
+               boost::smatch match;\r
+               //\8a¿\8e\9a\82É\82Í\91Î\89\9e\82µ\82Ä\82¢\82È\82¢\r
+               if(!boost::regex_search(m_path , match , regex)){\r
+                       DEBUG_PRINT(_T("FormatError --- ") << m_path);\r
+                       return mof::tstring();\r
+               }\r
+               return match.str(2);    \r
+       }\r
+       catch (std::exception &e) {\r
+               throw e;\r
+       }\r
+       return mof::tstring();\r
+\r
+}\r
+\r
diff --git a/moftmp/FilePath.hpp b/moftmp/FilePath.hpp
new file mode 100755 (executable)
index 0000000..2522ee0
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef MOF_FILE_PATH_HPP\r
+#define MOF_FILE_PATH_HPP\r
+\r
+#include "mof/tstring.hpp"\r
+\r
+namespace mof{\r
+\r
+class FilePath{\r
+       mof::tstring m_path;\r
+\r
+public:\r
+       FilePath(const mof::tstring& path);\r
+\r
+       mof::tstring getFormat();\r
+       mof::tstring& getPath();\r
+       mof::tstring dir();\r
+       mof::tstring basename();\r
+};\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/FileTextureBuilder.cpp b/moftmp/FileTextureBuilder.cpp
new file mode 100755 (executable)
index 0000000..e3b83d9
--- /dev/null
@@ -0,0 +1,37 @@
+\r
+#include "mof/FileTextureBuilder.h"\r
+#include <d3dx9.h>\r
+#include <dxerr9.h>\r
+#include "GraphicsDevice.h"\r
+#include "mof/ConsoleIO.h"\r
+\r
+mof::FileTextureBuilder::FileTextureBuilder(mof::tstring& path)\r
+{\r
+       m_path = path;\r
+}\r
+\r
+mof::FileTextureBuilder::~FileTextureBuilder(void)\r
+{\r
+}\r
+\r
+\r
+mof::TextureRecord mof::FileTextureBuilder::create(){\r
+       LPDIRECT3DTEXTURE9 texture;\r
+       mof::GRAPHICS_DEVICE pDevice = mof::GraphicsDevice::getInstance()->getGraphicsDevice();\r
+       HRESULT hr = D3DXCreateTextureFromFileEx(pDevice , m_path.c_str() , \r
+                       0 , 0 , 1 , 0/*RENDER*/ , D3DFMT_UNKNOWN , D3DPOOL_MANAGED ,\r
+                       D3DX_DEFAULT , D3DX_DEFAULT , mof::createColor(0 , 0 , 0) , NULL , NULL , &texture);\r
+\r
+       if(FAILED(hr)){\r
+               *ConsoleOut::getInstance() << "CreateTexture --- " << DXGetErrorDescription9(hr) << std::endl;\r
+               TextureRecord record;\r
+               record.pTexture = NULL;\r
+               return record;\r
+               }\r
+\r
+       TextureRecord record;\r
+       record.pTexture = texture;\r
+       record.validRect = mof::RectangleModel(0 , 0 , 0 , 0);//\91S\94Í\88Í\r
+       return record;\r
+\r
+}
\ No newline at end of file
diff --git a/moftmp/Finalizer.hpp b/moftmp/Finalizer.hpp
new file mode 100755 (executable)
index 0000000..bb5eb8f
--- /dev/null
@@ -0,0 +1,53 @@
+#pragma once\r
+\r
+\r
+namespace mof\r
+{\r
+    \r
+    \r
+    //TODO \83R\83\93\83e\83i\82É\91ã\93ü\82Å\82«\82È\82¢\82æ\82¤\82É\82·\82é\r
+    class Finalizer \r
+    {\r
+        mutable void (*m_finalize)( );\r
+        \r
+        public:\r
+        Finalizer( )\r
+        : m_finalize(NULL)\r
+        {\r
+            // do nothing\r
+        }\r
+        \r
+        Finalizer( void (*finalize_)() )\r
+        : m_finalize(finalize_)\r
+        {\r
+            // do nothing\r
+        }\r
+        \r
+        Finalizer( const Finalizer& obj){\r
+            if( this == &obj)return;\r
+            m_finalize = obj.m_finalize;\r
+            obj.m_finalize = NULL;\r
+        }\r
+        \r
+        ~Finalizer( )\r
+        {\r
+            if( m_finalize )m_finalize();\r
+        }\r
+        \r
+        void cancel( )\r
+        {\r
+            m_finalize = NULL;\r
+        }\r
+        \r
+        Finalizer& operator = ( const Finalizer& obj )\r
+        {\r
+            if( this == &obj)return *this;\r
+            if( m_finalize )m_finalize();\r
+            m_finalize = obj.m_finalize;\r
+            obj.m_finalize = NULL;\r
+            return *this;\r
+        }\r
+        \r
+        \r
+    };\r
+}
\ No newline at end of file
diff --git a/moftmp/Font.cpp b/moftmp/Font.cpp
new file mode 100755 (executable)
index 0000000..a53527d
--- /dev/null
@@ -0,0 +1,183 @@
+#include "mof/Font.hpp"\r
+#include <list>\r
+#include <windows.h>\r
+#include "mof/ConsoleIO.hpp"\r
+#include <vector>\r
+#include "mof/utilities.hpp"\r
+\r
+const TCHAR* mof::Font::MS_GOTHIC = _T("\82l\82\83S\83V\83b\83N");\r
+const TCHAR* mof::Font::MS_P_GOTHIC = _T("\82l\82\82o\83S\83V\83b\83N");\r
+\r
+\r
+namespace\r
+{\r
+    struct FontManager \r
+    {\r
+        std::vector<mof::tstring> additionalFontResources;\r
+        \r
+        ~FontManager()\r
+        {\r
+            foreach( mof::tstring& filename , additionalFontResources )\r
+            {\r
+                RemoveFontResource( filename.c_str() );\r
+            }\r
+        }\r
+    } g_fontManager;\r
+}\r
+\r
+struct GlyphData{\r
+    int iOfs_x , iOfs_y , iBmp_w , iBmp_h , level , width;\r
+    BYTE* pBmpBuffer;\r
+    bool valid;\r
+\r
+   GlyphData(GLYPHMETRICS& GM , TEXTMETRIC& TM , int _level , int bufSize){\r
+        iOfs_x = GM.gmptGlyphOrigin.x;\r
+        iOfs_y = TM.tmAscent - GM.gmptGlyphOrigin.y;\r
+        iBmp_w = GM.gmBlackBoxX + (4-(GM.gmBlackBoxX%4))%4;\r
+        iBmp_h = GM.gmBlackBoxY;\r
+        level = _level;\r
+        width =  GM.gmCellIncX;\r
+        pBmpBuffer = new BYTE[bufSize];\r
+        valid = true;\r
+   }\r
+\r
+   ~GlyphData(){\r
+        delete[] pBmpBuffer;\r
+   }\r
+};\r
+\r
+struct mof::Font::Impl{\r
+    HFONT hFont;\r
+    size_t fontSize;\r
+\r
+    Impl(size_t fontSize_)\r
+        : hFont(NULL) ,fontSize(fontSize_)\r
+    {\r
+    }\r
+\r
+    ~Impl(){\r
+        DeleteObject(hFont);\r
+    }\r
+\r
+};\r
+\r
+mof::Font::Font(const TCHAR* fontName , size_t size)\r
+: m_pImpl(new Impl(size))\r
+{\r
+    LOGFONT lf = {m_pImpl->fontSize , 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, OUT_TT_ONLY_PRECIS,\r
+        CLIP_DEFAULT_PRECIS , PROOF_QUALITY, FIXED_PITCH | FF_MODERN , "" };\r
+    strcpy_s(lf.lfFaceName , fontName );\r
+\r
+    if(!(m_pImpl->hFont = CreateFontIndirect(&lf))){\r
+       throw std::runtime_error("Failed --- CreateFontIndirect");\r
+    }\r
+\r
+    \r
+\r
+}\r
+\r
+mof::Font::~Font(){\r
+    \r
+}\r
+\r
+   \r
+\r
+mof::PixelMap* mof::Font::createText(const mof::tstring& text) const{\r
+\r
+    // \83f\83o\83C\83X\83R\83\93\83e\83L\83X\83g\8eæ\93¾\r
+    // \83f\83o\83C\83X\82É\83t\83H\83\93\83g\82ð\8e\9d\82½\82¹\82È\82¢\82ÆGetGlyphOutline\8aÖ\90\94\82Í\83G\83\89\81[\82Æ\82È\82é\r
+    HDC hdc = GetDC(NULL);\r
+    HFONT oldFont = static_cast<HFONT>(SelectObject(hdc , m_pImpl->hFont));\r
+    TEXTMETRIC TM;\r
+    GetTextMetrics( hdc, &TM );\r
+\r
+    int sumWidth = 0;\r
+    int maxHeight = 0;\r
+    typedef std::list<GlyphData*>::iterator GDITR;\r
+    std::list<GlyphData*> glyphDataList;\r
+    for(int i = 0 ; text.c_str()[i] ; ){\r
+\r
+\r
+        // \95\8e\9a\83R\81[\83h\8eæ\93¾\r
+        UINT code = 0;\r
+        #if _UNICODE\r
+            // unicode\82Ì\8fê\8d\87\81A\95\8e\9a\83R\81[\83h\82Í\92P\8f\83\82É\83\8f\83C\83h\95\8e\9a\82ÌUINT\95Ï\8a·\82Å\82·\r
+            code = (UINT)str[i++];\r
+        #else\r
+            // \83}\83\8b\83`\83o\83C\83g\95\8e\9a\82Ì\8fê\8d\87\81A\r
+            // 1\83o\83C\83g\95\8e\9a\82Ì\83R\81[\83h\82Í1\83o\83C\83g\96Ú\82ÌUINT\95Ï\8a·\81A\r
+            // 2\83o\83C\83g\95\8e\9a\82Ì\83R\81[\83h\82Í[\90æ\93±\83R\81[\83h]*256 + [\95\8e\9a\83R\81[\83h]\82Å\82·\r
+            if(IsDBCSLeadByte(text[i])){\r
+                code = (text[i] << 8) | (text[i+1] & 0xff); // \95\8e\9a\r
+                code &= 0x0000ffff;\r
+                i += 2;\r
+            }\r
+            else{\r
+                code = text[i++];\r
+            }\r
+        #endif\r
+\r
+        unsigned int spaceCode = (_T(" ")[0]);\r
+        unsigned int wSpaceCode = (_T("\81@")[0] << 8) | (_T("\81@")[1] & 0xff);\r
+        wSpaceCode &= 0x0000ffff;\r
+\r
+\r
+        // \83t\83H\83\93\83g\83r\83b\83g\83}\83b\83v\8eæ\93¾\r
+        GLYPHMETRICS GM;\r
+        CONST MAT2 Mat = {{0,1},{0,0},{0,0},{0,1}};\r
+        DWORD size = GetGlyphOutline(hdc, code , GGO_GRAY8_BITMAP, &GM, 0, NULL, &Mat);\r
+        GlyphData* pGD = new GlyphData(GM , TM , 65 , size);\r
+        GetGlyphOutline(hdc, code, GGO_GRAY8_BITMAP, &GM, size, pGD->pBmpBuffer , &Mat);\r
+\r
+        if(code == spaceCode || code == wSpaceCode){\r
+            //\8bó\94\92\82Í\89½\8cÌ\82©\82¤\82Ü\82­\8f\91\82«\8d\9e\82ß\82È\82¢\82±\82Æ\82Ö\82Ì\91Î\8f\88\r
+            pGD->valid = false;\r
+        }\r
+        glyphDataList.push_back(pGD);\r
+        sumWidth += pGD->width;//\91S\91Ì\82Ì\95\9d\r
+        maxHeight = max(maxHeight , TM.tmHeight);\r
+    }\r
+    \r
+    // \83f\83o\83C\83X\83R\83\93\83e\83L\83X\83g\82Æ\83t\83H\83\93\83g\83n\83\93\83h\83\8b\82Ì\8aJ\95ú\r
+    SelectObject(hdc, oldFont);\r
+    ReleaseDC(NULL, hdc);\r
+\r
+    typedef mof::PixelMap::size_type size_type;\r
+    boost::array<size_type , 2> sizes = {{ sumWidth , maxHeight }};\r
+    mof::PixelMap* pPixelMap = new mof::PixelMap(sizes);\r
+\r
+    // \83t\83H\83\93\83g\8fî\95ñ\82Ì\8f\91\82«\8d\9e\82Ý\r
+    // iOfs_x, iOfs_y : \8f\91\82«\8fo\82µ\88Ê\92u(\8d\8fã)\r
+    // iBmp_w, iBmp_h : \83t\83H\83\93\83g\83r\83b\83g\83}\83b\83v\82Ì\95\9d\8d\82\r
+    // Level : \83¿\92l\82Ì\92i\8aK (GGO_GRAY4_BITMAP\82È\82Ì\82Å17\92i\8aK)\r
+\r
+    DWORD Alpha, Color;\r
+    int hoseiX = 0;\r
+    for(int y = 0 ; y < maxHeight ; y++){\r
+        for(int x = 0 ; x < sumWidth ; x++){\r
+            (*pPixelMap)[x][y] = 0;\r
+        }\r
+    }\r
+    for(GDITR itr = glyphDataList.begin() ; itr != glyphDataList.end() ; ++itr){\r
+       for(int y = (*itr)->iOfs_y ;  y < (*itr)->iOfs_y + (*itr)->iBmp_h ;  y++){\r
+            if(!(*itr)->valid)break;//\8bó\94\92\95\8e\9a\82È\82ç\8f\91\82«\8d\9e\82Ý\82ð\96³\8e\8b\82·\82é\r
+            for(int x = (*itr)->iOfs_x + hoseiX ; x < (*itr)->iOfs_x + (*itr)->iBmp_w + hoseiX && x < sumWidth ;  x++){\r
+                Alpha = (255 * (*itr)->pBmpBuffer[x - ((*itr)->iOfs_x + hoseiX) + (*itr)->iBmp_w * ( y - (*itr)->iOfs_y ) ] ) / ((*itr)->level-1);\r
+                Color = 0x00ffffff | (Alpha<<24);\r
+                \r
+                (*pPixelMap)[x][y] = Color;\r
+                \r
+            }\r
+       }\r
+       hoseiX += (*itr)->width;\r
+       delete *itr;\r
+   }\r
+\r
+    return pPixelMap;\r
+}\r
+\r
+\r
+bool mof::Font::addFontResource(const mof::tstring& filename ){\r
+    g_fontManager.additionalFontResources.push_back(filename);\r
+    return AddFontResource( filename.c_str() ) ? true : false ;\r
+}\r
diff --git a/moftmp/Font.hpp b/moftmp/Font.hpp
new file mode 100755 (executable)
index 0000000..518431a
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef MOF_FONT_HPP\r
+#define MOF_FONT_HPP\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/tstring.hpp"\r
+#include "mof/PixelMap.hpp"\r
+\r
+namespace mof{\r
+\r
+class Font{\r
+       struct Impl;\r
+       boost::shared_ptr<Impl> m_pImpl;\r
+\r
+public:\r
+       Font(const TCHAR* fontName , size_t size);\r
+       ~Font();\r
+\r
+       mof::PixelMap* createText(const mof::tstring& text) const;\r
+\r
+       static const TCHAR* MS_GOTHIC;\r
+       static const TCHAR* MS_P_GOTHIC;\r
+       \r
+       static bool addFontResource(const mof::tstring& filename );\r
+};\r
+\r
+}\r
+\r
+\r
+\r
+#endif\r
diff --git a/moftmp/Graphics3D.hpp b/moftmp/Graphics3D.hpp
new file mode 100755 (executable)
index 0000000..87c2ef1
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef MOF_GRAPHICS3D_HPP\r
+#define MOF_GRAPHICS3D_HPP\r
+#include "mof/Component3D.hpp"\r
+#include "mof/SceneGraph.hpp"\r
+#include "mof/Texture.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+class Graphics3D : public Component3D , public SceneGraph {\r
+public :\r
+       virtual ~Graphics3D(){}\r
+       //virtual const mof::GraphicsUnit& getUnit() = 0;\r
+       virtual void setTexture( \r
+               unsigned int num , const boost::shared_ptr<mof::Texture>& pTexture) = 0;\r
+\r
+};\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/GraphicsDevice.cpp b/moftmp/GraphicsDevice.cpp
new file mode 100755 (executable)
index 0000000..1ea5be7
--- /dev/null
@@ -0,0 +1,506 @@
+\r
+\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include <list>\r
+#include <stdexcept>\r
+#include "mof/private/VertexFVF.hpp"\r
+#include "mof/Material.hpp"\r
+#include "mof/private/TextureImpl.hpp"\r
+#include "mof/Window.hpp"\r
+\r
+namespace \r
+{\r
+       \r
+       HWND m_hWnd = NULL;\r
+       int m_width;\r
+       int m_height;\r
+       LPDIRECT3DDEVICE9       m_pDevice = NULL;\r
+       LPDIRECT3D9     m_pD3D = NULL;\r
+       D3DPRESENT_PARAMETERS* m_pParam = NULL;\r
+       IDirect3DStateBlock9* m_pNormalBlendingBlock = NULL;\r
+       IDirect3DStateBlock9* m_pAddBlendingBlock = NULL;\r
+       IDirect3DStateBlock9* m_pAlphaBlendingBlock = NULL;\r
+       int m_currentStateBlock;\r
+       mof::Matrix3D m_worldTransform;\r
+       mof::Matrix3D m_viewTransform;\r
+       mof::Matrix3D m_projectionTransform;\r
+       bool m_flagActive;\r
+       bool m_flagDeviceLost;\r
+}\r
+\r
+\r
+inline bool isOK(HRESULT hr){\r
+       return hr == S_OK;\r
+}\r
+\r
+\r
+namespace mof\r
+{\r
+    template void GraphicsDevice::drawVertexArray( const VertexXYZRHWCUV& , const VertexXYZRHWCUV& , PRIMITIVE_TYPE );\r
+    template void GraphicsDevice::drawVertexArray( const VertexXYZRHWC& , const VertexXYZRHWC& , PRIMITIVE_TYPE);\r
+    template void GraphicsDevice::drawVertexArray( const VertexXYZCUV& , const VertexXYZCUV& , PRIMITIVE_TYPE);\r
+    template void GraphicsDevice::drawVertexArray( const VertexXYZNUV& , const VertexXYZNUV& , PRIMITIVE_TYPE);\r
+    template void GraphicsDevice::drawVertexArray( const VertexXYZC& , const VertexXYZC& , PRIMITIVE_TYPE);\r
+\r
+\r
+\r
+    //TODO \8aÖ\90\94\95ª\8a\84\r
+    void GraphicsDevice::initialize( const mof::Window& window , int width , int height , bool fullscreen )\r
+    {\r
+    \r
+           HRESULT     hr;\r
+           m_hWnd = window.getHandler();\r
+           m_width = width;\r
+           m_height = height;\r
+\r
+           if( NULL == ( m_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )\r
+           {\r
+                   throw std::runtime_error( "Failed --- Direct3DCreate9" );\r
+       }\r
+\r
+           m_pParam = new D3DPRESENT_PARAMETERS;\r
+        ZeroMemory( m_pParam, sizeof(D3DPRESENT_PARAMETERS) );\r
+           m_pParam->Windowed = (fullscreen)? FALSE : TRUE;            //TRUE=Window,FALSE=FULLSCREEN\r
+           m_pParam->BackBufferCount = 1;\r
+           m_pParam->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;\r
+\r
+           if( fullscreen )\r
+           {\r
+                   //\83t\83\8b\83X\83N\83\8a\81[\83\93\8e\9e\82Í\83o\83b\83N\83o\83b\83t\83@\82Ì\95\9d\81A\8d\82\82³\82ð\8dÄ\8ew\92è\r
+                   m_pParam->BackBufferWidth = width;          //\95\9d\r
+                   m_pParam->BackBufferHeight = height;                //\8d\82\82³\r
+                   m_pParam->BackBufferFormat = D3DFMT_X8R8G8B8;       //16bit\r
+                   //m_pParam->BackBufferFormat = D3DFMT_R5G6B5;       //16bit\r
+                   m_pParam->FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;\r
+           }\r
+           else\r
+           {\r
+                   m_pParam->BackBufferFormat = D3DFMT_UNKNOWN;        //\8c»\8dÝ\82Ì\89æ\96Ê\83\82\81[\83h\82ð\97\98\97p\r
+           }\r
+        m_pParam->SwapEffect = D3DSWAPEFFECT_DISCARD;\r
+           // Z \83o\83b\83t\83@\82Ì\8e©\93®\8dì\90¬\r
+           m_pParam->EnableAutoDepthStencil = 1;\r
+           m_pParam->AutoDepthStencilFormat = D3DFMT_D16;\r
+    \r
+\r
+           \r
+\r
+           //HAL(pure vp)\r
+           if\r
+           ( \r
+               FAILED\r
+               ( \r
+                   hr = \r
+                   m_pD3D->CreateDevice\r
+                       (\r
+                          0 , D3DDEVTYPE_HAL , m_hWnd ,\r
+                              D3DCREATE_HARDWARE_VERTEXPROCESSING , m_pParam , &m_pDevice\r
+                           )\r
+                   )\r
+               )\r
+           {\r
+               //HAL(soft vp)\r
+               if\r
+               (\r
+                   FAILED\r
+                   ( \r
+                       hr =\r
+                       m_pD3D->CreateDevice\r
+                           (\r
+                               0 , D3DDEVTYPE_HAL , m_hWnd ,\r
+                               D3DCREATE_SOFTWARE_VERTEXPROCESSING , m_pParam , &(m_pDevice) \r
+                           )\r
+                       )\r
+                   )\r
+                   {\r
+                           //REF\r
+                       if\r
+                       ( \r
+                           FAILED(\r
+                               hr = \r
+                               m_pD3D->CreateDevice\r
+                               (\r
+                                   0 , D3DDEVTYPE_REF , m_hWnd ,\r
+                                       D3DCREATE_HARDWARE_VERTEXPROCESSING , m_pParam , &m_pDevice\r
+                                   )\r
+                               )\r
+                       )\r
+                       {\r
+                               delete m_pParam;\r
+                               m_pD3D->Release();\r
+                               throw std::runtime_error(std::string("Failed --- CreateDevice"));\r
+                           }\r
+                   } // if\r
+           } // if\r
+    \r
+           setViewport( mof::Rectangle<int>(0 , 0 , width , height) );\r
+       \r
+        //\r
+        m_pDevice->SetSamplerState(0 , D3DSAMP_MAGFILTER , D3DTEXF_LINEAR ); //D3DTEXF_POINT \r
+        m_pDevice->SetSamplerState(0 , D3DSAMP_MINFILTER , D3DTEXF_LINEAR ); //D3DTEXF_POINT \r
+       \r
+       \r
+           m_pDevice->BeginStateBlock( );\r
+           m_pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE , TRUE );\r
+           m_pDevice->SetRenderState( D3DRS_SRCBLEND,D3DBLEND_SRCALPHA );\r
+           m_pDevice->SetRenderState( D3DRS_DESTBLEND,D3DBLEND_ONE );\r
+           m_pDevice->SetTextureStageState( 0 , D3DTSS_ALPHAOP,D3DTOP_MODULATE ); //ARG1\82ÆARG2\82Ì\83¿\92l\82ð\8fæ\8eZ\82µ\82Ä\83¿\92l\82ð\8eæ\93¾\82µ\82Ü\82·\81B\r
+           m_pDevice->SetTextureStageState( 0 , D3DTSS_ALPHAARG1,D3DTA_DIFFUSE ); //\83e\83N\83X\83`\83\83\82Ì\83¿\92l\r
+           m_pDevice->SetTextureStageState( 0 , D3DTSS_ALPHAARG2,D3DTA_TEXTURE ); //\92¸\93_\82Ì\83¿\r
+           m_pDevice->SetTextureStageState( 0 , D3DTSS_COLOROP,D3DTOP_MODULATE ); //ARG1\82ÆARG2\82Ì\83J\83\89\81[\82Ì\92l\82ð\8fæ\8eZ\82µ\82Ü\82·\81B\r
+           m_pDevice->SetTextureStageState( 0 , D3DTSS_COLORARG1,D3DTA_TEXTURE ); //\83e\83N\83X\83`\83\83\82Ì\83J\83\89\81[\r
+           m_pDevice->SetTextureStageState( 0 , D3DTSS_COLORARG2,D3DTA_DIFFUSE ); //\92¸\93_\82Ì\83J\83\89\81[*/\r
+           m_pDevice->EndStateBlock( &m_pAddBlendingBlock );\r
+\r
+           m_pDevice->BeginStateBlock( );\r
+           m_pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE , TRUE );\r
+           m_pDevice->SetRenderState( D3DRS_SRCBLEND , D3DBLEND_SRCALPHA );\r
+           m_pDevice->SetRenderState( D3DRS_DESTBLEND , D3DBLEND_INVSRCALPHA );\r
+       m_pDevice->SetTextureStageState( 0 ,D3DTSS_ALPHAOP , D3DTOP_SELECTARG2 ); //ARG1\82ÆARG2\82Ì\83¿\92l\82ð\8fæ\8eZ\82µ\82Ä\83¿\92l\82ð\8eæ\93¾\82µ\82Ü\82·\81B\r
+       m_pDevice->SetTextureStageState( 0 ,D3DTSS_ALPHAARG1 , D3DTA_DIFFUSE ); //\83e\83N\83X\83`\83\83\82Ì\83¿\92l\r
+       m_pDevice->SetTextureStageState( 0 ,D3DTSS_ALPHAARG2 , D3DTA_TEXTURE ); //\92¸\93_\82Ì\83¿\92l\r
+       m_pDevice->SetTextureStageState( 0 ,D3DTSS_COLOROP , D3DTOP_MODULATE ); //ARG1\82ÆARG2\82Ì\83J\83\89\81[\82Ì\92l\82ð\8fæ\8eZ\82µ\82Ü\82·\81B\r
+       m_pDevice->SetTextureStageState( 0 ,D3DTSS_COLORARG1 , D3DTA_DIFFUSE ); //\83e\83N\83X\83`\83\83\82Ì\83J\83\89\81[\r
+       m_pDevice->SetTextureStageState( 0 ,D3DTSS_COLORARG2 , D3DTA_TEXTURE ); //\92¸\93_\82Ì\83J\83\89\81[*/\r
+       m_pDevice->EndStateBlock( &m_pNormalBlendingBlock );\r
+\r
+           m_pDevice->BeginStateBlock( );\r
+           m_pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE , TRUE );\r
+           m_pDevice->SetRenderState( D3DRS_SRCBLEND , D3DBLEND_SRCALPHA );\r
+           m_pDevice->SetRenderState( D3DRS_DESTBLEND , D3DBLEND_INVSRCALPHA );\r
+           m_pDevice->SetTextureStageState( 0,D3DTSS_ALPHAOP , D3DTOP_MODULATE ); //ARG1\82ÆARG2\82Ì\83¿\92l\82ð\8fæ\8eZ\82µ\82Ä\83¿\92l\82ð\8eæ\93¾\82µ\82Ü\82·\81B\r
+           m_pDevice->SetTextureStageState( 0,D3DTSS_ALPHAARG1 , D3DTA_DIFFUSE ); //\83e\83N\83X\83`\83\83\82Ì\83¿\92l\r
+           m_pDevice->SetTextureStageState( 0,D3DTSS_ALPHAARG2 , D3DTA_TEXTURE ); //\92¸\93_\82Ì\83¿\92l\r
+           m_pDevice->SetTextureStageState( 0,D3DTSS_COLOROP , D3DTOP_MODULATE ); //ARG1\82ÆARG2\82Ì\83J\83\89\81[\82Ì\92l\82ð\8fæ\8eZ\82µ\82Ü\82·\81B\r
+           m_pDevice->SetTextureStageState( 0,D3DTSS_COLORARG1 , D3DTA_DIFFUSE ); //\83e\83N\83X\83`\83\83\82Ì\83J\83\89\81[\r
+           m_pDevice->SetTextureStageState( 0,D3DTSS_COLORARG2 , D3DTA_TEXTURE ); //\92¸\93_\82Ì\83J\83\89\81[*/\r
+           m_pDevice->EndStateBlock( &m_pAlphaBlendingBlock );\r
+       \r
+           setProjectionTransform(0.1f , 100);\r
+    } // function initialize\r
+\r
+\r
+\r
+    void GraphicsDevice::finalize( )\r
+    {\r
+           m_pAddBlendingBlock->Release();\r
+           m_pNormalBlendingBlock->Release();\r
+           m_pAlphaBlendingBlock->Release();\r
+           if(m_pDevice != NULL)m_pDevice->Release();\r
+           if(m_pD3D != NULL)m_pD3D->Release();\r
+           delete m_pParam;\r
+    }\r
+\r
+\r
+\r
+\r
+    void GraphicsDevice::beginScene( )\r
+    {\r
+       \r
+\r
+           if(true == m_flagDeviceLost)\r
+           { \r
+               Sleep(100);     // 0.1\95b\91Ò\82Â\r
+               if(/*m_flagActive == true &&*/ m_pDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET )\r
+               {\r
+                           //---\83f\83o\83C\83X\95\9c\8bA\82ð\8e\8e\82Ý\82é\r
+               \r
+                       if( FAILED( m_pDevice->Reset( m_pParam) ) )return;\r
+                               \r
+                       //\83f\83o\83C\83X\82Ì\95\9c\8bA\82É\90¬\8c÷\r
+                       m_flagDeviceLost = false;\r
+                       //---\83X\83e\81[\83g\82ð\95\9c\8bA\r
+                       DEBUG_PRINT( "DeviceRecovered!" );\r
+                   }\r
+                   else return;\r
+               }\r
+       \r
+       \r
+\r
+           if( !isOK( m_pDevice->BeginScene( ) ) )\r
+           {\r
+               throw std::runtime_error("Failed --- BeginScene");\r
+           }\r
+\r
+\r
+    } // function beginScene\r
+       \r
+\r
+\r
+\r
+    void GraphicsDevice::endScene( )\r
+    {\r
+               \r
+           if( !isOK( m_pDevice->EndScene() ) )\r
+           {\r
+                   throw std::runtime_error("Failed --- EndScene");\r
+           }\r
+\r
+           //\83o\83b\83N\83o\83b\83t\83@\82©\82ç\83v\83\89\83C\83}\83\8a\83o\83b\83t\83@\82Ö\93]\91\97\r
+           HRESULT hr = m_pDevice->Present( NULL, NULL, NULL, NULL );\r
+       \r
+           if( hr == D3DERR_DEVICELOST && false == m_flagDeviceLost )\r
+           {\r
+                       DEBUG_PRINT( "DeviceLost!" );\r
+                       m_flagDeviceLost = true;\r
+                       //\83\8a\83\\81[\83X\82Ì\89ð\95ú\8f\88\97\9d\r
+\r
+               }\r
+\r
+       \r
+           if( !isOK( hr ) )throw std::runtime_error("Present");\r
+       \r
+\r
+    } // function endScene\r
+\r
+\r
+\r
+\r
+    void GraphicsDevice::setWorldTransform( const mof::Matrix3D& matrix )\r
+    {\r
+       m_worldTransform = matrix;\r
+       D3DXMATRIX mat;\r
+       for(int i = 0 ; i < 4 ; ++i ){\r
+               for(int j = 0 ; j < 4 ; ++j){\r
+                       mat(i , j) = matrix.at(i , j);\r
+               }\r
+       }\r
+       m_pDevice->SetTransform( D3DTS_WORLD, &mat );\r
+    }\r
+\r
+\r
+\r
+    void GraphicsDevice::setProjectionTransform( real min , real max )\r
+    {\r
+           D3DXMATRIX matProj;\r
+           D3DXMatrixPerspectiveFovLH\r
+           ( \r
+               &matProj, D3DX_PI / 4.0f, \r
+               static_cast<float>(getViewportWidth()) / static_cast<float>(getViewportHeight()) , min, max\r
+           );\r
+\r
+           mof::Matrix3D::Array arry;\r
+           for(int i = 0 ; i < 4 ; ++i ){\r
+               for(int j = 0 ; j < 4 ; ++j){\r
+                       arry.elements[i][j] = matProj( i , j );\r
+               }\r
+           }\r
+           m_projectionTransform = mof::Matrix3D( arry );\r
+           m_pDevice->SetTransform( D3DTS_PROJECTION , &matProj );\r
+\r
+    } \r
+\r
+\r
+\r
+    void GraphicsDevice::setViewTransform( const mof::Matrix3D& matrix )\r
+    {\r
+       m_viewTransform = matrix;\r
+       D3DXMATRIX mat;\r
+           for(int i = 0 ; i < 4 ; ++i ){\r
+                   for(int j = 0 ; j < 4 ; ++j){\r
+                       mat(i , j) = matrix.at(i , j);\r
+                   }\r
+           }\r
+           m_pDevice->SetTransform( D3DTS_VIEW , &mat );\r
+    }\r
+\r
+\r
+\r
+\r
+    const mof::Matrix3D& GraphicsDevice::getWorldTransform( ) \r
+    {\r
+           return m_worldTransform;\r
+    }\r
+\r
+\r
+               \r
+    const mof::Matrix3D& GraphicsDevice::getProjectionTransform() \r
+    {\r
+           return m_projectionTransform;\r
+    }\r
+       \r
+\r
+\r
+    const mof::Matrix3D& GraphicsDevice::getViewTransform()\r
+    {\r
+       return m_viewTransform;\r
+    }\r
+\r
+       \r
+\r
+    void GraphicsDevice::setZBuffer( bool available )\r
+    {\r
+           if( available )m_pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );\r
+           else m_pDevice->SetRenderState( D3DRS_ZENABLE , D3DZB_FALSE );          \r
+    }\r
+\r
+\r
+\r
+    void GraphicsDevice::lightEnable( bool available )\r
+    {\r
+           m_pDevice->SetRenderState( D3DRS_LIGHTING , available );\r
+    }\r
+\r
+\r
+\r
+    void GraphicsDevice::clearZBuffer()\r
+    {\r
+           m_pDevice->Clear( 0 , NULL , D3DCLEAR_ZBUFFER , 0 , 1.0f, 0 );\r
+    }\r
+\r
+\r
+\r
+    void GraphicsDevice::clearRenderTarget( mof::Color color )\r
+    {\r
+           m_pDevice->Clear( 0 , 0 , D3DCLEAR_TARGET , color ,  0 , 0 );\r
+    }\r
+\r
+\r
+\r
+    void GraphicsDevice::setAlphaBlendingMode( const int flag )\r
+    {\r
+       if(flag == m_currentStateBlock )return;\r
+\r
+       if( flag == mof::GraphicsDevice::BLENDING_MODE_ADD ){\r
+               m_pAddBlendingBlock->Apply();\r
+       }\r
+           else if(flag == mof::GraphicsDevice::BLENDING_MODE_BASIC)\r
+           {\r
+                   m_pNormalBlendingBlock->Apply();\r
+           }\r
+           else if( flag == mof::GraphicsDevice::BLENDING_MODE_ALPHA )\r
+           {\r
+                   m_pAlphaBlendingBlock->Apply();\r
+           }\r
+\r
+           m_currentStateBlock = flag;\r
+    }\r
+\r
+\r
+\r
+    Vector2D GraphicsDevice::to2DPosition( const mof::Vector3D& position )\r
+    {\r
+           mof::Matrix3D matrix = m_worldTransform;\r
+           matrix = m_viewTransform * m_projectionTransform;\r
+           int hWidth = getViewportWidth() / 2;\r
+           int hHeight = getViewportHeight() / 2;\r
+           mof::Vector3D tmpPosition =  position * matrix;\r
+        \r
+           return mof::Vector2D\r
+           (\r
+               static_cast<int>(tmpPosition.x * hWidth + hWidth ) , \r
+                       static_cast<int>(-tmpPosition.y * hHeight + hHeight)\r
+               );\r
+    }\r
+\r
+\r
+    void GraphicsDevice::setViewport( const mof::Rectangle<int>& area )\r
+    {\r
+       D3DVIEWPORT9 vp;\r
+       vp.X = area.beginX;\r
+       vp.Y = area.beginY;\r
+       vp.Width = area.getWidth( );\r
+       vp.Height = area.getHeight( );\r
+       vp.MinZ = 0.0f;\r
+       vp.MaxZ = 1.0f;\r
+       if( FAILED( m_pDevice->SetViewport( &vp ) ) )\r
+       {\r
+                   throw std::runtime_error( "Failed --- SetViewport" );\r
+           }\r
+    }\r
+\r
+    int GraphicsDevice::getViewportWidth( ) \r
+    {\r
+           D3DVIEWPORT9 vp;\r
+           if( FAILED(m_pDevice->GetViewport( &vp ) ) )\r
+           {\r
+               throw std::runtime_error("Failed --- getViewportWidth");\r
+           }\r
+           return vp.Width;\r
+    }\r
+\r
+\r
+    int GraphicsDevice::getViewportHeight() {\r
+           D3DVIEWPORT9 vp;\r
+           if( FAILED( m_pDevice->GetViewport( &vp ) ) )\r
+           {\r
+               throw std::runtime_error("Failed --- getViewportHeight");\r
+           }\r
+           return vp.Height;\r
+    }\r
+\r
+\r
+\r
+\r
+    template <class T>\r
+    void GraphicsDevice::drawVertexArray( const T& front , const T& last , mof::PRIMITIVE_TYPE type )\r
+    {\r
+           HRESULT hr = E_FAIL;\r
+           if(&last < &front)return;\r
+           int length = &last - &front + 1; //\92¸\93_\90\94\r
+\r
+           m_pDevice->SetFVF( mof::getFVF<T>() );\r
+\r
+           if(type == mof::PRIMITIVE_TYPE_TRIANGLESTRIP)\r
+           {\r
+               hr = m_pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP , length > 3 ? length - 2 : 1 , (const void*)&front , sizeof(T) );\r
+           }\r
+       else if( type == PRIMITIVE_TYPE_TRIANGLELIST )\r
+       {\r
+               hr = m_pDevice->DrawPrimitiveUP( D3DPT_TRIANGLELIST , length / 3 , (const void*)&front , sizeof(T) );\r
+           }\r
+           else if( type == mof::PRIMITIVE_TYPE_LINELIST )\r
+           {\r
+               hr = m_pDevice->DrawPrimitiveUP(D3DPT_LINELIST , length / 2 , (const void*)&front , sizeof(T) );\r
+       }\r
+       \r
+           if( FAILED( hr ) )\r
+           {\r
+                   throw std::runtime_error("Failed -- DrawPrimitiveUP");\r
+           }\r
+\r
+    } // function drawVertexArray\r
+\r
+\r
+\r
+    void GraphicsDevice::setMaterial(const mof::Material& material){\r
+           D3DMATERIAL9 mat;\r
+\r
+           memcpy(static_cast<void*>(&mat) , static_cast<const void*>(&material) , sizeof(D3DMATERIAL9));\r
+\r
+           if( FAILED( m_pDevice->SetMaterial( &mat ) ) )\r
+           {\r
+                   throw std::runtime_error("Faild --- SetMaterial");\r
+           }\r
+    }\r
+\r
+\r
+    void GraphicsDevice::setTexture( const mof::Texture* pTexture )\r
+    {\r
+           if( pTexture == NULL )m_pDevice->SetTexture( 0 , NULL );\r
+           else m_pDevice->SetTexture( 0 , pTexture->m_pImpl->pTexture );\r
+    }\r
+\r
+\r
+    mof::Rectangle<int> GraphicsDevice::getClientRegion() \r
+    {\r
+       \r
+\r
+           RECT rect;\r
+           GetWindowRect(m_hWnd , &rect);\r
+           POINT point;\r
+           point.x = rect.left;\r
+           point.y = rect.top;\r
+           ScreenToClient(m_hWnd , &point);\r
+           int beginX = rect.left - point.x;\r
+           int beginY = rect.top - point.y;\r
+           return mof::Rectangle<int>(beginX , beginY , beginX + m_width , beginY + m_height);\r
+    }\r
+    \r
+    LPDIRECT3DDEVICE9 GraphicsDevice::getRawDevice( )\r
+    {\r
+        return m_pDevice;\r
+    }\r
+    \r
+} // namespace GraphicsDevice\r
diff --git a/moftmp/GraphicsDevice.hpp b/moftmp/GraphicsDevice.hpp
new file mode 100755 (executable)
index 0000000..711e671
--- /dev/null
@@ -0,0 +1,56 @@
+#pragma once\r
+#include "mof/real.hpp"\r
+#include "mof/Color.hpp"\r
+#include "mof/Matrix3D.hpp"\r
+#include "mof/VertexTypes.hpp"\r
+#include <boost/utility.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/Rectangle.hpp"\r
+\r
+\r
+\r
+namespace mof{\r
+    struct Material;\r
+    class Texture;\r
+\r
+    namespace GraphicsDevice \r
+    {\r
+\r
+        // public \r
+        \r
+           enum BlendingMode\r
+           {\r
+                   BLENDING_MODE_ADD ,\r
+                   BLENDING_MODE_BASIC ,\r
+                   BLENDING_MODE_ALPHA\r
+           };\r
+       \r
+           void setWorldTransform( const mof::Matrix3D& matrix );\r
+           void setProjectionTransform( real min , real max );\r
+           void setViewTransform( const mof::Matrix3D& matrix );\r
+           const mof::Matrix3D& getWorldTransform( );\r
+           const mof::Matrix3D& getProjectionTransform( );\r
+           const mof::Matrix3D& getViewTransform( );\r
+           void setZBuffer( bool flag );\r
+           void lightEnable( bool enable );\r
+           void clearZBuffer( );\r
+           void clearRenderTarget( mof::Color color );\r
+           void setAlphaBlendingMode( const int flag );\r
+           mof::Vector2D to2DPosition( const mof::Vector3D& position );\r
+           void setViewport( const mof::Rectangle<int>& area );\r
+           int getViewportWidth( );\r
+           int getViewportHeight( );\r
+\r
+           template <class T> void drawVertexArray\r
+           (\r
+               const T& front , const T& last , \r
+               mof::PRIMITIVE_TYPE type = PRIMITIVE_TYPE_TRIANGLELIST \r
+           ); \r
+           void setMaterial( const mof::Material& material );\r
+           void setTexture( const mof::Texture* pTexture );\r
+           mof::Rectangle<int> getClientRegion( );\r
+           \r
+    } // namespace GraphicsDevice\r
+\r
+\r
+} // namespace mof\r
diff --git a/moftmp/GraphicsObject.cpp b/moftmp/GraphicsObject.cpp
new file mode 100755 (executable)
index 0000000..ce24629
--- /dev/null
@@ -0,0 +1,15 @@
+\r
+#include "mof/GraphicsObject.h"\r
+#include <iostream>\r
+\r
+mof::GraphicsObject::GraphicsObject(void)\r
+: m_pAnimations( new mof::CascadeAnimation())\r
+{\r
+       \r
+}\r
+\r
+mof::GraphicsObject::~GraphicsObject(void)\r
+{\r
+\r
+}\r
+\r
diff --git a/moftmp/GraphicsSchedule.cpp b/moftmp/GraphicsSchedule.cpp
new file mode 100755 (executable)
index 0000000..9205b47
--- /dev/null
@@ -0,0 +1,66 @@
+#include "mof/GraphicsSchedule.h"\r
+#include "mof/ConsoleIO.h"\r
+\r
+\r
+\r
+\r
+\r
+mof::GraphicsSchedule::GraphicsSchedule(){\r
+       m_key = 0;\r
+\r
+}\r
+\r
+mof::GraphicsSchedule::~GraphicsSchedule(){\r
+       \r
+}\r
+\r
+void mof::GraphicsSchedule::update(){\r
+       \r
+       std::pair<MapItr , MapItr> range = m_map.equal_range(m_key);\r
+       for(MapItr itr = range.first ; itr != range.second ; ++itr){\r
+               if((*itr).second.pAnimation.get() != NULL){\r
+                       (*itr).second.pObject->setAnimation(0 , (*itr).second.pAnimation);\r
+                       (*itr).second.pAnimation->start();\r
+               }\r
+       }\r
+       \r
+       m_key++;\r
+}\r
+\r
+void mof::GraphicsSchedule::add(int index , mof::GraphicsModelPtr& pObject , mof::AnimationResource& pAnimation){\r
+       if(pObject.get() == NULL)return;\r
+       if(pAnimation.get() != NULL)pAnimation->stop();\r
+       mof::GraphicsSchedule::Element element = {pObject , pAnimation };\r
+       m_modelList.push_back(pObject);\r
+       m_map.insert(std::multimap<mof::AnimationKey , mof::GraphicsSchedule::Element>::value_type(index , element));\r
+}\r
+               \r
+std::list<mof::GraphicsModelPtr>& mof::GraphicsSchedule::appendModelList( std::list<mof::GraphicsModelPtr>& modelList){\r
+       modelList.insert(modelList.end() , m_modelList.begin() , m_modelList.end());\r
+       return modelList;\r
+}\r
+               \r
+\r
+\r
+               \r
+bool mof::GraphicsSchedule::isFinalized(){\r
+       if(m_map.size() == 0)return true;\r
+       for(MapItr itr = m_map.begin() ; itr != m_map.end() ; ++itr){\r
+               if(!itr->second.pAnimation->isFinalized() )return false;\r
+       }\r
+       return true;\r
+}\r
+\r
+               \r
+bool mof::GraphicsSchedule::isPlaying(){\r
+       for(MapItr itr = m_map.begin() ; itr != m_map.end() ; ++itr){\r
+               if(itr->second.pAnimation->isPlaying() || itr->second.pAnimation->isFinalized())return true;\r
+       }\r
+       return false;\r
+}\r
+\r
+\r
+void mof::GraphicsSchedule::clear(){\r
+       m_key = 0;\r
+       m_map.clear();\r
+}
\ No newline at end of file
diff --git a/moftmp/GraphicsSchedule.h b/moftmp/GraphicsSchedule.h
new file mode 100755 (executable)
index 0000000..c3b8416
--- /dev/null
@@ -0,0 +1,37 @@
+#pragma once\r
+#include "mof/GraphicsObject.h"\r
+#include <map>\r
+#include <list>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof{\r
+\r
+       typedef boost::shared_ptr<mof::GraphicsObject> GraphicsModelPtr;\r
+\r
+       class GraphicsSchedule{\r
+               \r
+               struct Element{\r
+                       mof::GraphicsModelPtr pObject;\r
+                       mof::AnimationResource pAnimation;\r
+               };\r
+               typedef std::multimap<int , mof::GraphicsSchedule::Element>::iterator MapItr;\r
+\r
+               std::multimap<int , Element> m_map;\r
+               std::list<mof::GraphicsModelPtr> m_modelList;\r
+               int m_key;\r
+       public:\r
+               GraphicsSchedule();\r
+               ~GraphicsSchedule();\r
+\r
+               void update();\r
+               void add(int index , mof::GraphicsModelPtr& pObject , mof::AnimationResource& pAnimation);\r
+               bool isFinalized();\r
+               bool isPlaying();\r
+               void clear();\r
+               bool isEmpty(){return m_map.empty();}\r
+\r
+               std::list<mof::GraphicsModelPtr>& appendModelList( std::list<mof::GraphicsModelPtr>& modelList);\r
+\r
+       };\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/GraphicsUnit.hpp b/moftmp/GraphicsUnit.hpp
new file mode 100755 (executable)
index 0000000..5fdfa65
--- /dev/null
@@ -0,0 +1,17 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/Material.hpp"\r
+#include "mof/Texture.hpp"\r
+#include "mof/VertexBuffer.hpp"\r
+#include "mof/VertexTypes.hpp"\r
+\r
+namespace mof{\r
+\r
+    struct GraphicsUnit\r
+    {\r
+       boost::shared_ptr<mof::Material> pMaterial;\r
+       boost::shared_ptr<mof::Texture> pTexture;\r
+       boost::shared_ptr<mof::VertexBuffer<mof::VertexXYZNUV> > pModel;\r
+    };\r
+\r
+}\r
diff --git a/moftmp/InputDevice.cpp b/moftmp/InputDevice.cpp
new file mode 100755 (executable)
index 0000000..4cab3a9
--- /dev/null
@@ -0,0 +1,310 @@
+#include "mof/private/DirectInput.hpp"\r
+#include <vector>\r
+#include "mof/InputReceiver.hpp"\r
+#include "mof/InputDevice.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/private/DeviceInputReceiver.hpp"\r
+#include "boost/shared_ptr.hpp"\r
+\r
+namespace {\r
+       LPDIRECTINPUT8 pInput;\r
+       LPDIRECTINPUTDEVICE8A pDevice;\r
+       boost::shared_ptr<mof::InputReceiver> pInputReceiver;//\8aO\95\94\82É\93n\82·\82½\82ß\r
+       mof::DeviceInputReceiver* pDeviceInputReceiver;//\8fã\8bL\82Æ\93¯\82\83C\83\93\83X\83^\83\93\83X\r
+}\r
+\r
+//--- \83v\83\8d\83g\83^\83C\83v\90é\8c¾\r
+BOOL CALLBACK enumJoyCallback(const DIDEVICEINSTANCE* pInstance , VOID* pContext);\r
+\r
+/**\r
+ * mof::InputDevice::initialize\r
+ *\r
+ */\r
+void mof::InputDevice::initialize( ){\r
+    HINSTANCE hInst = GetModuleHandle(NULL);\r
+       HRESULT hr;\r
+       hr = DirectInput8Create(hInst , DIRECTINPUT_VERSION ,IID_IDirectInput8 , (void**)&pInput , NULL);\r
+       if(FAILED(hr)){\r
+               switch(hr){\r
+                       case DIERR_BETADIRECTINPUTVERSION :\r
+                               DEBUG_PRINT("DIERR_BETADIRECTINPUTVERSION");\r
+                               break;\r
+                       case DIERR_INVALIDPARAM :\r
+                               DEBUG_PRINT("DIERR_INVALIDPARAM");\r
+                               break;\r
+                       case DIERR_OLDDIRECTINPUTVERSION : \r
+                               DEBUG_PRINT("DIERR_OLDDIRECTINPUTVERSION");\r
+                               break;\r
+                       case DIERR_OUTOFMEMORY :\r
+                               DEBUG_PRINT("DIERR_OUTOFMEMORY");\r
+                               break;\r
+               }\r
+               throw std::runtime_error("Failed --- create direct input");\r
+       }\r
+       \r
+       LPCDIDATAFORMAT dataFmt = &c_dfDIJoystick;//\83W\83\87\83C\83X\83e\83B\83b\83N\82ª\8eæ\93¾\82Å\82«\82½\82Æ\89¼\92è\r
+       //---\83f\83o\83C\83X\82Ì\90Ý\92è\r
+       //\83Q\81[\83\80\83p\83b\83h\83f\83o\83C\83X\82ð\92T\82·\r
+       hr = pInput->EnumDevices(DI8DEVCLASS_GAMECTRL , enumJoyCallback , NULL , DIEDFL_ATTACHEDONLY);\r
+       if(FAILED(hr) || pDevice == NULL){\r
+               //\83Q\81[\83\80\83p\83b\83h\82ª\82È\82¯\82ê\82Î\83L\81[\83{\81[\83h\r
+               hr = pInput->CreateDevice(GUID_SysKeyboard , &pDevice , NULL);\r
+               if(FAILED(hr)){\r
+                               pInput->Release();\r
+                               pInput = NULL;\r
+                               throw std::runtime_error("Failed --- create device");\r
+               }\r
+               dataFmt = &c_dfDIKeyboard;//\83L\81[\83{\81[\83h\82ð\83f\83o\83C\83X\82Æ\82µ\82Ä\8eæ\93¾\r
+               DEBUG_PRINT("Select --- keyboard as input device");\r
+       }\r
+       else DEBUG_PRINT("Select --- joystick as input device");\r
+       \r
+       hr = pDevice->SetDataFormat(dataFmt);\r
+       if(FAILED(hr)){\r
+               pDevice->Release();\r
+               pDevice = NULL;\r
+               pInput->Release();\r
+               pInput = NULL;\r
+               throw std::runtime_error("Failed --- set data format");\r
+       }\r
+\r
+\r
+       DIPROPDWORD diprop;\r
+       diprop.diph.dwSize = sizeof(diprop);\r
+       diprop.diph.dwHeaderSize = sizeof(diprop.diph);\r
+       diprop.diph.dwObj = 0;\r
+       diprop.diph.dwHow = DIPH_DEVICE;\r
+       diprop.dwData = 1000;\r
+       pDevice->SetProperty(DIPROP_BUFFERSIZE , &diprop.diph);\r
+       setActivation(true);\r
+       \r
+       pDeviceInputReceiver = new mof::DeviceInputReceiver();\r
+       pInputReceiver = boost::shared_ptr<mof::InputReceiver>(pDeviceInputReceiver);\r
+}\r
+\r
+\r
+\r
+/**\r
+ * mof::InputDevice::finalize\r
+ *\r
+ */\r
+void mof::InputDevice::finalize(void)\r
+{\r
+       mof::InputDevice::setActivation(false);\r
+    if(pDevice != NULL)pDevice->Release();\r
+       if(pInput != NULL)pInput->Release();\r
+}\r
+\r
+\r
+void mof::InputDevice::setActivation(bool active){\r
+       if(pDevice == NULL)return;\r
+\r
+       if(active == false)pDevice->Unacquire();\r
+       else pDevice->Acquire();\r
+}\r
+\r
+\r
+\r
+BOOL CALLBACK enumJoyCallback(const DIDEVICEINSTANCE* pInstance , VOID* /*pContext*/ ){\r
+       HRESULT hr;\r
+       \r
+       hr = pInput->CreateDevice(pInstance->guidInstance , &(pDevice) , NULL);\r
+       if(FAILED(hr))return DIENUM_CONTINUE;\r
+\r
+       DIDEVICEINSTANCE deviceInstance;\r
+       deviceInstance.dwSize = sizeof(DIDEVCAPS);\r
+       hr = pDevice->GetCapabilities((LPDIDEVCAPS)&deviceInstance);\r
+       if(FAILED(hr)){\r
+               pDevice->Release();\r
+               pDevice = NULL;\r
+               return DIENUM_CONTINUE;\r
+       }\r
+\r
+       *ConsoleOut::getInstance() << "Found InputDevice --- " << deviceInstance.tszInstanceName \r
+               << ":" << deviceInstance.tszProductName << std::endl;\r
+       return DIENUM_STOP;//\89½\82Å\82à\82¢\82¢\82©\82ç\8dÌ\97p\r
+}\r
+\r
+       \r
+void mof::InputDevice::update(){\r
+       \r
+       HRESULT hr;\r
+       while(true){\r
+               DIDEVICEOBJECTDATA od;\r
+               DWORD dwItems = 1;\r
+               hr = pDevice->GetDeviceData(sizeof(DIDEVICEOBJECTDATA) , &od , &dwItems , 0);\r
+               if(hr == DIERR_INPUTLOST)pDevice->Acquire();\r
+               else if(FAILED(hr) || dwItems == 0)return;\r
+               \r
+               InputEvent iEvent(od.dwOfs , od.dwData);\r
+               //inputSignal(iEvent);\r
+               pDeviceInputReceiver->notifyInputEvent(iEvent);\r
+\r
+               /*for(int i = 0 ; i < listenerList.size() ; ++i){\r
+                       int tmpSize = listenerList.size();\r
+                       listenerList.at(i)->notifyInputEvent(iEvent);\r
+                       if(tmpSize != listenerList.size())i--;//NotifyInputEvent\82ÅRemove\82³\82ê\82½\82©\82ð\83`\83F\83b\83N\r
+               }*/\r
+       \r
+       }\r
+\r
+\r
+}\r
+\r
+\r
+\r
+boost::shared_ptr<mof::InputReceiver> mof::InputDevice::getInputReceiver(){\r
+       return pInputReceiver;\r
+}\r
+\r
+\r
+/*\r
+namespace mof{\r
+\r
+       class DeviceInputReceiver;\r
+\r
+       class InputDevice\r
+       {\r
+               \r
+\r
+               std::vector<DeviceInputReceiver*> listenerList;\r
+               \r
+               void addReceiver(DeviceInputReceiver* pReceiver);\r
+       public:\r
+               InputDevice(void);\r
+               ~InputDevice(void);\r
+               \r
+\r
+               bool initialize( HINSTANCE hInst);\r
+               static BOOL CALLBACK enumJoyCallback(const DIDEVICEINSTANCE* pInstance , VOID* pContext);\r
+\r
+               void activate(bool);\r
+               void updateInputData();\r
+               InputReceiver* getInputReceiver();\r
+               void removeReceiver(DeviceInputReceiver* pReceiver);\r
+               //void clearListenerList();\r
+\r
+\r
+       };\r
+\r
+};\r
+\r
+typedef std::vector<mof::DeviceInputReceiver*>::iterator LISTENERITR;\r
+\r
+mof::InputDevice::InputDevice(void)\r
+{\r
+        m_pInput = NULL;\r
+        m_pDevice = NULL;\r
+}\r
+\r
+mof::InputDevice::~InputDevice(void)\r
+{\r
+       activate(false);\r
+       if(m_pDevice != NULL)m_pDevice->Release();\r
+       if(m_pInput != NULL)m_pInput->Release();\r
+}\r
+\r
+\r
+bool mof::InputDevice::initialize( HINSTANCE hInst){\r
+       HRESULT hr;\r
+       hr = DirectInput8Create(hInst , DIRECTINPUT_VERSION ,IID_IDirectInput8 , (void**)&m_pInput , NULL);\r
+       if(FAILED(hr))return false;\r
+       \r
+       LPCDIDATAFORMAT dataFmt = &c_dfDIJoystick;//\83W\83\87\83C\83X\83e\83B\83b\83N\82ª\8eæ\93¾\82Å\82«\82½\82Æ\89¼\92è\r
+       //---\83f\83o\83C\83X\82Ì\90Ý\92è\r
+       //\83Q\81[\83\80\83p\83b\83h\83f\83o\83C\83X\82ð\92T\82·\r
+       hr = m_pInput->EnumDevices(DI8DEVCLASS_GAMECTRL , enumJoyCallback , NULL , DIEDFL_ATTACHEDONLY);\r
+       if(FAILED(hr) || m_pDevice == NULL){\r
+               //\83Q\81[\83\80\83p\83b\83h\82ª\82È\82¯\82ê\82Î\83L\81[\83{\81[\83h\r
+               hr = m_pInput->CreateDevice(GUID_SysKeyboard , &m_pDevice , NULL);\r
+               if(FAILED(hr)){\r
+                               m_pInput->Release();\r
+                               m_pInput = NULL;\r
+                               return false;\r
+               }\r
+               else dataFmt = &c_dfDIKeyboard;//\83L\81[\83{\81[\83h\82ð\83f\83o\83C\83X\82Æ\82µ\82Ä\8eæ\93¾\r
+       }\r
+\r
+       \r
+       hr = m_pDevice->SetDataFormat(dataFmt);\r
+       if(FAILED(hr)){\r
+               *ConsoleOut::getInstance() << "SetDataFormat --- ERROR" << std::endl;\r
+               m_pDevice->Release();\r
+               m_pDevice = NULL;\r
+               m_pInput->Release();\r
+               m_pInput = NULL;\r
+               return false;\r
+       }\r
+\r
+       //m_pDevice->SetCooperativeLevel( hWnd , DISCL_FOREGROUND);\r
+\r
+       DIPROPDWORD diprop;\r
+       diprop.diph.dwSize = sizeof(diprop);\r
+       diprop.diph.dwHeaderSize = sizeof(diprop.diph);\r
+       diprop.diph.dwObj = 0;\r
+       diprop.diph.dwHow = DIPH_DEVICE;\r
+       diprop.dwData = 1000;\r
+       m_pDevice->SetProperty(DIPROP_BUFFERSIZE , &diprop.diph);\r
+       activate(true);\r
+       return true;\r
+}\r
+       \r
+\r
+void mof::InputDevice::activate(bool active){\r
+       if(m_pDevice == NULL)return;\r
+\r
+       if(active == false)m_pDevice->Unacquire();\r
+       else m_pDevice->Acquire();\r
+}\r
+\r
+void mof::InputDevice::updateInputData(){\r
+       \r
+       HRESULT hr;\r
+       while(true){\r
+               DIDEVICEOBJECTDATA od;\r
+               DWORD dwItems = 1;\r
+               hr = m_pDevice->GetDeviceData(sizeof(DIDEVICEOBJECTDATA) , &od , &dwItems , 0);\r
+               if(hr == DIERR_INPUTLOST)m_pDevice->Acquire();\r
+               else if(FAILED(hr) || dwItems == 0)return;\r
+               \r
+               InputEvent iEvent(od.dwOfs , od.dwData);\r
+               //inputSignal(iEvent);\r
+               \r
+               for(int i = 0 ; i < listenerList.size() ; ++i){\r
+                       int tmpSize = listenerList.size();\r
+                       listenerList.at(i)->notifyInputEvent(iEvent);\r
+                       if(tmpSize != listenerList.size())i--;//NotifyInputEvent\82ÅRemove\82³\82ê\82½\82©\82ð\83`\83F\83b\83N\r
+               }\r
+       \r
+       }\r
+\r
+\r
+}\r
+\r
+\r
+\r
+mof::InputReceiver* mof::InputDevice::getInputReceiver(){\r
+       mof::DeviceInputReceiver* pReceiver = new mof::DeviceInputReceiver();\r
+       addReceiver(pReceiver);\r
+       return pReceiver;\r
+\r
+}\r
+\r
+\r
+void mof::InputDevice::addReceiver(mof::DeviceInputReceiver* pReceiver){\r
+       for(LISTENERITR itr = listenerList.begin() ; itr != listenerList.end() ; ++itr){\r
+               if((*itr) == pReceiver)return;//\8aù\82É\93o\98^\8dÏ\82Ý\r
+       }\r
+       listenerList.push_back(pReceiver);\r
+}\r
+\r
+void mof::InputDevice::removeReceiver(mof::DeviceInputReceiver* pReceiver){\r
+       for(LISTENERITR itr = listenerList.begin() ; itr != listenerList.end() ; ++itr){\r
+               if((*itr) == pReceiver){\r
+                       listenerList.erase(itr);\r
+                       return;\r
+               }\r
+       }\r
+       \r
+}\r
+*/\r
diff --git a/moftmp/InputDevice.hpp b/moftmp/InputDevice.hpp
new file mode 100755 (executable)
index 0000000..d861cf0
--- /dev/null
@@ -0,0 +1,23 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+#include <windows.h>\r
+\r
+//TODO private\82Í\95Ê\83t\83@\83C\83\8b\82É\r
+namespace mof {\r
+       class InputReceiver;\r
+\r
+       namespace InputDevice{\r
+\r
+               // --- private\r
+               void initialize();\r
+               void finalize();\r
+               void setActivation(bool active);\r
+               void update();\r
+\r
+               // -- public\r
+               boost::shared_ptr<mof::InputReceiver> getInputReceiver();\r
+               \r
+\r
+       \r
+       }\r
+}
\ No newline at end of file
diff --git a/moftmp/InputEventCondition.cpp b/moftmp/InputEventCondition.cpp
new file mode 100755 (executable)
index 0000000..d20a428
--- /dev/null
@@ -0,0 +1,24 @@
+#include "mof/InputEventCondition.hpp"\r
+\r
+mof::InputEventCondition::InputEventCondition(\r
+       mof::InputReceiver::Key key, \r
+       const boost::shared_ptr<mof::InputReceiver> &pInputReceiver)\r
+       : m_key(key) , m_pInputReceiver(pInputReceiver)\r
+{\r
+       update();\r
+}\r
+\r
+mof::InputEventCondition::~InputEventCondition(){\r
+}\r
+\r
+bool mof::InputEventCondition::test(){\r
+       return m_state;\r
+}\r
+\r
+void mof::InputEventCondition::update(){\r
+       m_state = m_pInputReceiver->testKeyState(m_key);\r
+}\r
+\r
+bool mof::InputEventCondition::isDisposable(){\r
+       return false;\r
+}\r
diff --git a/moftmp/InputEventCondition.hpp b/moftmp/InputEventCondition.hpp
new file mode 100755 (executable)
index 0000000..709740e
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+#include "mof/EventCondition.hpp"\r
+#include "mof/InputReceiver.hpp"\r
+#include "boost/shared_ptr.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+       class InputEventCondition : public EventCondition{\r
+               mof::InputReceiver::Key m_key;\r
+               boost::shared_ptr<mof::InputReceiver> m_pInputReceiver;\r
+               bool m_state;\r
+       public:\r
+               InputEventCondition(\r
+                       mof::InputReceiver::Key key , \r
+                       const boost::shared_ptr<mof::InputReceiver>& pInputReceiver\r
+                       );\r
+\r
+               virtual ~InputEventCondition();\r
+               virtual bool test();\r
+               virtual void update();\r
+               virtual bool isDisposable();\r
+       };\r
+\r
+\r
+}\r
+\r
diff --git a/moftmp/InputReceiver.hpp b/moftmp/InputReceiver.hpp
new file mode 100755 (executable)
index 0000000..7765ace
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once\r
+\r
+\r
+namespace mof{\r
+       \r
+       class InputReceiver{\r
+       public:\r
+               typedef enum{\r
+                       UP = 0 , DOWN , LEFT , RIGHT ,\r
+            A , B , C , D , E , F , G , H , I ,\r
+            J , K , L , M , N , O , P , Q , R ,\r
+            S , T , U , V , W , X , Y , Z ,\r
+            ESCAPE ,\r
+                       END //\8dÅ\8cã\82Í\95K\82¸\82±\82ê\82Å\8fI\82í\82é\82æ\82¤\82É\r
+               } Key;\r
+\r
+       \r
+               virtual ~InputReceiver(){}\r
+               virtual bool testKeyState(Key key) = 0;\r
+\r
+               /**\r
+                * \95s\93Á\92è\91½\90\94\82Ì\83I\83u\83W\83F\83N\83g\82ª\82±\82Ì\83\81\83\\83b\83h\82ð\8cÄ\82Ñ\8fo\82·\82Æ\81A\r
+                * \88Ó\90}\82µ\82½\93ü\97Í\8f\88\97\9d\82ª\82Å\82«\82È\82¢\89Â\94\\90«\82ª\82 \82è\82Ü\82·\81B\r
+                */\r
+               virtual void update() = 0;\r
+               \r
+       };\r
+};\r
diff --git a/moftmp/InstructionSet.hpp b/moftmp/InstructionSet.hpp
new file mode 100755 (executable)
index 0000000..bb1480c
--- /dev/null
@@ -0,0 +1,47 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+//#include "mof/MessageWidget.hpp"\r
+#include "mof/tstring.hpp"\r
+    \r
+namespace mof\r
+{\r
+    class MessageWidget;\r
+\r
+    class InstructionSet\r
+    {\r
+    public:\r
+        /** \r
+         * @brief     \83\81\83b\83Z\81[\83W\83E\83B\83\93\83h\83E\82ð\90\90¬\82·\82é\82½\82ß\82Ì\83R\81[\83\8b\83o\83b\83N\r
+         * @return    \90\90¬\82µ\82½\83\81\83b\83Z\81[\83W\83E\83B\83\93\83h\83E\r
+         */\r
+        virtual boost::shared_ptr< MessageWidget > createMessageWidget( ) = 0;\r
+        \r
+        /** \r
+         * @brief     \83\81\83b\83Z\81[\83W\83E\83B\83\93\83h\83E\82É\83y\81[\83W\82ð\92Ç\89Á\82·\82é\82½\82ß\82Ì\83R\81[\83\8b\83o\83b\83N\r
+         * @param[in] \83\81\83b\83Z\81[\83W\82Ì\83^\83C\83g\83\8b\r
+         * @param[in] \83\81\83b\83Z\81[\83W\93à\97e\r
+         * @return    \90\90¬\82µ\82½\83\81\83b\83Z\81[\83W\83E\83B\83\93\83h\83E\r
+         */\r
+        virtual int addMessageWidgetPage\r
+        ( \r
+            boost::shared_ptr<MessageWidget>& message ,\r
+            const tstring& title ,\r
+            const tstring& text \r
+        ) = 0;\r
+       \r
+\r
+\r
+        /** \r
+         * @brief     \83N\83\89\83C\83A\83\93\83g\91¤\82Å\88ø\82«\91±\82«\83\8a\83\\81[\83X\82ð\97\98\97p\82·\82é\82½\82ß\82Ì\83R\81[\83\8b\83o\83b\83N\r
+         * @note      \88ø\90\94\82Å\93n\82³\82ê\82½\83\8a\83\\81[\83X\82ª\82±\82Ì\83N\83\89\83X\82Ì\83I\83u\83W\83F\83N\83g\82É\82æ\82è\8d¡\8cã\8eQ\8fÆ\82³\82ê\82é\82±\82Æ\82Í\82È\82¢\r
+         * @param[in] \95s\97v\82Æ\82È\82Á\82½\83\8a\83\\81[\83X\r
+         */\r
+        virtual void inactive( boost::shared_ptr<MessageWidget>& message )  = 0;\r
+     \r
+        virtual ~InstructionSet(){}\r
+\r
+    };\r
+\r
+}\r
+\r
+\r
diff --git a/moftmp/Interpolation.hpp b/moftmp/Interpolation.hpp
new file mode 100755 (executable)
index 0000000..ae9390c
--- /dev/null
@@ -0,0 +1,79 @@
+ #pragma once\r
+ #include "mof/Vector2D.hpp"\r
+ #include "mof/stream/Manipulator.hpp"\r
+ #include <map>\r
+ #include <algorithm>\r
\r
+ namespace mof{\r
\r
+       template <typename T>\r
+       T stepInterpolate(const std::map<mof::FrameNumber , T>& map , mof::FrameNumber current ){\r
+               if(map.empty())throw std::invalid_argument("the map is empty");\r
+               for(\r
+                       typename std::map<mof::FrameNumber , T>::const_reverse_iterator itr = map.rbegin() ;\r
+                       itr != map.rend() ; \r
+                       ++itr\r
+               ){\r
+                       if(itr->first <= current)return itr->second;\r
+               }\r
+               return map.begin()->second;//default\r
+       }\r
+  \r
+       template<class T> inline\r
+       T calcLinerInterpolationValue( float blending , const T& prevObj , const T& nextObj){\r
+               return (1 - blending) * prevObj + blending * nextObj;\r
+       }       \r
+   \r
+    //\8cë\8d·\92á\8c¸\82Ì\82½\82ß\82Ì\93Á\8eê\89»\r
+    /*template<> inline\r
+       Vector2D calcLinerInterpolationValue( float blending , const Vector2D& prev , const Vector2D& next )\r
+    {\r
+               return mof::Vector2D\r
+        (\r
+             prev.x != next.x ? (1 - blending) * prev.x + blending * next.x : prev.x , \r
+             prev.y != next.y ? (1 - blending) * prev.y + blending * next.y : prev.y  \r
+        );\r
+       }*/     \r
+\r
+       template <typename T>\r
+       T linerInterpolate(const std::map<mof::FrameNumber , T>& map , mof::FrameNumber current ){\r
+               if(map.empty())throw std::invalid_argument("the map is empty");\r
+               typename std::map<mof::FrameNumber , T>::const_iterator n = map.find(current);\r
+               if(n != map.end())return n->second;// just key frame\r
+               \r
+               //\92¼\91O\81A\92¼\8cã\82Ì\83L\81[\82ð\8c\9f\8dõ\r
+               mof::FrameNumber prevKeyFrame = current;\r
+               bool foundPrev = false;\r
+               T prevObj;\r
+               mof::FrameNumber nextKeyFrame = current;\r
+               bool foundNext = false;\r
+               T nextObj;\r
+               \r
+               for(\r
+                               typename std::map<mof::FrameNumber , T>::const_iterator itr = map.begin() ;\r
+                               itr != map.end() ;\r
+                               ++itr\r
+                       ){\r
+                       if(itr->first < current && (!foundPrev || itr->first > prevKeyFrame)){\r
+                               foundPrev = true;\r
+                               prevKeyFrame = itr->first;\r
+                               prevObj = itr->second;\r
+                       }\r
+                       else if(itr->first > current && (!foundNext || itr->first < nextKeyFrame)){\r
+                               foundNext = true;\r
+                               nextKeyFrame = itr->first;\r
+                               nextObj = itr->second;\r
+                       }\r
+                       \r
+               }\r
+               \r
+               assert(foundPrev || foundNext);\r
+               if(!foundPrev && foundNext)return nextObj;//\92¼\91O\82Ì\83L\81[\82Í\8c©\82Â\82©\82ç\82È\82©\82Á\82½\r
+               else if(foundPrev && !foundNext)return prevObj;//\92¼\8cã\82Ì\83L\81[\82Í\8c©\82Â\82©\82ç\82È\82©\82Á\82½\r
+               float blending = static_cast<float>(current - prevKeyFrame) / static_cast<float>(nextKeyFrame - prevKeyFrame);\r
+               return calcLinerInterpolationValue<T>(blending , prevObj ,  nextObj);\r
+       }\r
\r
+ } //namespace mof\r
\r
\r
diff --git a/moftmp/Interpreter.cpp b/moftmp/Interpreter.cpp
new file mode 100755 (executable)
index 0000000..c66a117
--- /dev/null
@@ -0,0 +1,167 @@
+#include "mof/Interpreter.hpp"\r
+#include "mof/private/Interpreter.hpp"\r
+#include "mof/private/regist.hpp"\r
+#include "mof/EventScheduler.hpp"\r
+#include "mof/OnceEventCondition.hpp"\r
+#include "mof/InputReceiver.hpp"\r
+#include "mof/MessageWidget.hpp"\r
+#include "mof/LuaScript.hpp"\r
+#include "mof/KeyPressedEventCondition.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/utilities.hpp"\r
+#include <boost/bind.hpp>\r
+   \r
+typedef boost::shared_ptr< mof::MessageWidget > MessageWidgetHandler;\r
+\r
+//{{{ \83\82\83W\83\85\81[\83\8b\95Ï\90\94\r
+namespace\r
+{\r
+   \r
+     std::vector<MessageWidgetHandler> m_messages;\r
+     mof::EventScheduler m_scheduler;\r
+     mof::LuaScript* m_pLua;\r
+     boost::shared_ptr<mof::InputReceiver> m_pInput;\r
+     mof::InstructionSet* m_pInstructionSet;\r
+     mof::Interpreter::State m_state;\r
+} // namepsace \r
+//}}}\r
+namespace mof\r
+{\r
+//{{{ _setState\r
+    void _setState( Interpreter::State state )\r
+    {\r
+        m_state = state;\r
+        /*switch( m_state )\r
+        {\r
+            case mof::Interpreter::WAITING : \r
+                throw std::runtime_error("waiting on taskFinished");//\82±\82±\82É\97\88\82é\82±\82Æ\82Í\82 \82è\82¦\82È\82¢\r
+                break;\r
+            case mof::Interpreter::RUNNING :\r
+                m_state = mof::Interpreter::WAITING;\r
+                break;\r
+            case mof::Interpreter::BUSY :\r
+                m_state = mof::Interpreter::RUNNING;\r
+                mof::Interpreter::doNextCommand();\r
+                break;\r
+            case mof::Interpreter::FREE :\r
+                throw std::runtime_error("waiting on taskFinished");//\82±\82±\82É\97\88\82é\82±\82Æ\82Í\82 \82è\82¦\82È\82¢\r
+                break;\r
+        }*/\r
+    }\r
+//}}}      \r
+//{{{ _createMessageWidget    \r
+    int Interpreter::_createMessageWidget()\r
+    {\r
+        m_messages.push_back( m_pInstructionSet->createMessageWidget( ) );\r
+        return m_messages.size() -1;\r
+    }\r
+//}}}\r
+//{{{ _addMessageWidgetPage     \r
+    int Interpreter::_addMessageWidgetPage\r
+    ( \r
+        int id ,\r
+        const mof::tstring& title ,\r
+        const mof::tstring& text \r
+    )\r
+    {\r
+        int frame = m_pInstructionSet->addMessageWidgetPage( m_messages.at(id) , title , text ) ;\r
+        m_messages.at(id)->nextPage();\r
+        return frame;\r
+    }\r
+//}}}\r
+//{{{ _hideMessageWidget\r
+    int Interpreter::_hideMessageWidget( int id ){\r
+        m_messages.at( id )->close();\r
+        return 10;\r
+    }\r
+//}}}\r
+//{{{ _waitKey\r
+    void Interpreter::_waitKey( const mof::tstring& keystring ){\r
+        mof::InputReceiver::Key key;\r
+        if( keystring == "z" || keystring == "Z")key = mof::InputReceiver::Z;\r
+        else return;\r
+\r
+        m_scheduler.addEvent\r
+        (\r
+            new mof::OnceEventCondition( new mof::KeyPressedEventCondition( key , m_pInput ) ) , \r
+            boost::bind( &mof::_setState , mof::Interpreter::WAITING )\r
+        );\r
+        _setState( mof::Interpreter::RUNNING );\r
+    }\r
+//}}}\r
+//{{{ _waitFrame\r
+    void Interpreter::_waitFrame( int frame ){\r
+        m_scheduler.addEvent\r
+        (\r
+            frame , \r
+            boost::bind( &mof::_setState , mof::Interpreter::WAITING )\r
+        );\r
+        _setState( mof::Interpreter::RUNNING );\r
+    }\r
+//}}}\r
+//{{{ initialize    \r
+        void Interpreter::initialize\r
+        ( \r
+           const boost::shared_ptr<mof::InputReceiver>& pInput ,\r
+           InstructionSet& implementation \r
+        )\r
+        {\r
+            m_pLua = NULL;\r
+            m_pInput = pInput;\r
+            m_pInstructionSet = &implementation;\r
+            m_state = WAITING;\r
+        \r
+        }\r
+//}}}    \r
+//{{{ finalize\r
+    void Interpreter::finalize()        \r
+    {\r
+        mof::safe_delete( m_pLua );\r
+    }    \r
+//}}}    \r
+//{{{ getState\r
+    Interpreter::State Interpreter::getState( )  \r
+    {\r
+        return m_state;\r
+    }\r
+//}}}\r
+//{{{ doNextCommand\r
+    void Interpreter::doNextCommand( )\r
+    {\r
+        switch( m_state )\r
+        {\r
+            case WAITING : \r
+                m_pLua->nextCommand();\r
+                break;\r
+            case RUNNING :\r
+                m_state = BUSY;\r
+                break;\r
+            case BUSY :\r
+                break;\r
+            case FREE :\r
+                break;\r
+        }\r
+    }\r
+//}}}  \r
+//{{{ open   \r
+    void Interpreter::open( const tstring& filename )\r
+    {\r
+        if( !m_pLua )m_pLua = new LuaScript(filename);\r
+        //---\8aÖ\90\94\82Ì\8a\84\82è\93\96\82Ä\r
+        mof::regist::registMessage( m_pLua->getLuaState() );\r
+        mof::regist::registWait( m_pLua->getLuaState() );\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void Interpreter::update()\r
+    {\r
+    \r
+        m_scheduler.update();\r
+\r
+        foreach( MessageWidgetHandler& handler , m_messages )\r
+        {\r
+            if( handler.get() )handler->update();\r
+        }\r
+    }\r
+//}}} \r
+} //namespace mof\r
diff --git a/moftmp/Interpreter.hpp b/moftmp/Interpreter.hpp
new file mode 100755 (executable)
index 0000000..d2dc48f
--- /dev/null
@@ -0,0 +1,63 @@
+#pragma once\r
+#include "mof/InstructionSet.hpp"\r
+\r
+namespace mof\r
+{\r
+    class InputReceiver;\r
+    \r
+    namespace Interpreter\r
+    {\r
+        enum State\r
+        {\r
+            WAITING , /** doNextCommand\82Å\8e\9f\82Ì\83R\83}\83\93\83h\82ð\89ð\90Í\82·\82é */\r
+            BUSY ,    /** \83R\83}\83\93\83h\82ð\8f\88\97\9d\92\86(doNextCommand\82Í\8cÄ\82Î\82ê\82Ä\82¢\82é) */\r
+            RUNNING , /** \83R\83}\83\93\83h\82ð\8f\88\97\9d\92\86(doNextCommand\82Í\8cÄ\82Î\82ê\82Ä\82¢\82È\82¢) */\r
+            FREE      /** \83X\83N\83\8a\83v\83g\82ð\8dÅ\8cã\82Ü\82Å\8f\88\97\9d\82µ\82½ */\r
+        };\r
+        \r
+        /**\r
+         * @note      \88ø\90\94\82Å\93n\82µ\82½\93ü\97Í\83\8c\83V\81[\83o\82É\82æ\82Á\82Ä\81A\83R\83}\83\93\83h\82Ì\8f\88\97\9d\82ª\8ds\82í\82ê\82é\r
+         * @param[in] \83R\83}\83\93\83h\8f\88\97\9d\97p\83C\83\93\83v\83b\83g\83\8c\83V\81[\83o\r
+         * @param[in] \96½\97ß\82Ì\8eÀ\91\95\r
+         */\r
+        void initialize\r
+        ( \r
+            const boost::shared_ptr<InputReceiver> & pInput ,\r
+            InstructionSet& implementation\r
+         );\r
+\r
+        void finalize( );\r
+        \r
+        \r
+        /**\r
+         * @brief     \82±\82Ì\83N\83\89\83X\82Ì\83I\83u\83W\83F\83N\83g\82É\82æ\82è\89ð\90Í\82³\82ê\82é\83X\83N\83\8a\83v\83g\82ð\92Ç\89Á\82·\82é\r
+         * @param[in] \83X\83N\83\8a\83v\83g\83t\83@\83C\83\8b\96¼\r
+         */\r
+        void open( const tstring& filename );\r
+        \r
+        /**\r
+         * @brief  \8c»\8dÝ\82Ì\83C\83\93\83^\83v\83\8a\83^\82Ì\8fó\91Ô\82ð\93¾\82é\r
+         * @return \8c»\8dÝ\82Ì\8fó\91Ô\r
+         */\r
+        State getState();\r
+        \r
+        /**\r
+         * @brief \83R\83}\83\93\83h\82Ì\8f\88\97\9d\82ð\8ds\82¤\r
+         * @note  create\8cn\83\81\83\\83b\83h\82Å\90\90¬\82³\82ê\82½\83\8a\83\\81[\83X\82Ì\8dX\90V\83\81\83\\83b\83h\82ª\8cÄ\82Î\82ê\82é\81B\r
+         * @note  \82½\82¾\82µ\81Ainactive\8cn\83\81\83\\83b\83h\82Å\93n\82³\82ê\82½\83\8a\83\\81[\83X\82É\82Â\82¢\82Ä\82Í\82±\82Ì\8cÀ\82è\82Å\82È\82¢\81B\r
+         */\r
+        void update();\r
+        \r
+        /**\r
+         * @brief \83C\83\93\83^\83v\83\8a\83^\82É\8e\9f\82Ì\83R\83}\83\93\83h\82Ì\8eÀ\8ds\82ð\91£\82·\r
+         * @note  \83C\83\93\83^\83v\83\8a\83^\82ªWAITING\8fó\91Ô\82Ì\8fê\8d\87\81A\92¼\82¿\82É\8e\9f\82Ì\83R\83}\83\93\83h\82ª\89ð\90Í\82³\82ê\82é\81BRUNNING\81ABUSY\8fó\91Ô\r
+         * @note  \82Ì\8fê\8d\87\82Íupdate\8cÄ\82Ñ\8fo\82µ\82É\82æ\82è\83C\83\93\83^\83v\83\8a\83^\82ª\8c»\8dÝ\82Ì\83R\83}\83\93\83h\82Ì\8f\88\97\9d\82ð\8a®\97¹\82µ\82½\8cã\82Å\8e\9f\82Ì\r
+         * @note  \89ð\90Í\82ª\8aJ\8en\82³\82ê\82é\81B\r
+         */\r
+        void doNextCommand();\r
+        \r
+        \r
+    };\r
+\r
+}\r
+\r
diff --git a/moftmp/KeyPressedEventCondition.cpp b/moftmp/KeyPressedEventCondition.cpp
new file mode 100755 (executable)
index 0000000..01e4322
--- /dev/null
@@ -0,0 +1,29 @@
+#include "mof/KeyPressedEventCondition.hpp"\r
+\r
+mof::KeyPressedEventCondition::KeyPressedEventCondition\r
+(\r
+       mof::InputReceiver::Key key, \r
+       const boost::shared_ptr<mof::InputReceiver> &pInputReceiver \r
+)\r
+: m_key(key) , m_pInputReceiver(pInputReceiver) , m_currentState(false) \r
+{\r
+       update();\r
+}\r
+\r
+mof::KeyPressedEventCondition::~KeyPressedEventCondition(){\r
+}\r
+\r
+bool mof::KeyPressedEventCondition::test(){\r
+       return m_oldState == false &&  m_currentState == true ;\r
+}\r
+\r
+void mof::KeyPressedEventCondition::update(){\r
+       m_oldState = m_currentState;\r
+       m_currentState = m_pInputReceiver->testKeyState(m_key);\r
+}\r
+\r
+bool mof::KeyPressedEventCondition::isDisposable(){\r
+       return false;\r
+}\r
+\r
+\r
diff --git a/moftmp/KeyPressedEventCondition.hpp b/moftmp/KeyPressedEventCondition.hpp
new file mode 100755 (executable)
index 0000000..4f365e2
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once\r
+#include "mof/EventCondition.hpp"\r
+#include "mof/InputReceiver.hpp"\r
+#include "boost/shared_ptr.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+    class KeyPressedEventCondition : public EventCondition{\r
+        mof::InputReceiver::Key m_key;\r
+        boost::shared_ptr<mof::InputReceiver> m_pInputReceiver;\r
+        bool m_oldState;\r
+        bool m_currentState;\r
+    public:\r
+        KeyPressedEventCondition\r
+        (\r
+            mof::InputReceiver::Key key , \r
+            const boost::shared_ptr<mof::InputReceiver>& pInputReceiver \r
+        );\r
+\r
+        virtual ~KeyPressedEventCondition();\r
+        virtual bool test();\r
+        virtual void update();\r
+        virtual bool isDisposable();\r
+    };\r
+\r
+\r
+}\r
+\r
diff --git a/moftmp/Light.cpp b/moftmp/Light.cpp
new file mode 100755 (executable)
index 0000000..86a1128
--- /dev/null
@@ -0,0 +1,22 @@
+#include "mof/Light.hpp"\r
+#include "mof/Constant.hpp"\r
+\r
+mof::Light::Light()\r
+: m_diffuseColor(mof::makeConstantHandler(mof::Color4f(1 , 1 , 1))) , m_frame(0){\r
+       \r
+}\r
+\r
+\r
+mof::Light::~Light(){\r
+}\r
+\r
+void mof::Light::setDiffuseColor(mof::Color4f color){\r
+       mof::Animation<mof::Color4f>::Handler f = mof::makeConstantHandler(color);\r
+       setDiffuseColor(f);\r
+}\r
+\r
+void mof::Light::setDiffuseColor(const mof::Animation<mof::Color4f>::Handler& f){\r
+       m_diffuseColor = f;\r
+       m_frame = 0;\r
+}\r
+\r
diff --git a/moftmp/Light.hpp b/moftmp/Light.hpp
new file mode 100755 (executable)
index 0000000..e70ce69
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef MOF_ANIMATION\r
+#define MOF_ANIMATION\r
+#include <boost/utility.hpp>\r
+#include "mof/Color.hpp"\r
+\r
+namespace mof{\r
+\r
+class Light : public  boost::noncopyable{\r
+               \r
+protected:\r
+       mof::Manipulator<mof::Color4f>::Handler m_diffuseColor;\r
+       FrameNumber m_frame;\r
+public:\r
+       Light();\r
+       virtual ~Light();\r
+       void setDiffuseColor(mof::Color4f color);\r
+       void setDiffuseColor(const Manipulator<mof::Color4f>::Handler& f);\r
+\r
+       virtual void setEnable(bool enable) = 0;\r
+\r
+};\r
+\r
+};\r
+\r
+#endif\r
diff --git a/moftmp/Line3D.cpp b/moftmp/Line3D.cpp
new file mode 100755 (executable)
index 0000000..f681279
--- /dev/null
@@ -0,0 +1,20 @@
+#include "Line3D.h"\r
+\r
+mof::Line3D::Line3D(float beginX , float beginY , float beginZ , float endX , float endY , float endZ)\r
+{\r
+       m_begin = mof::Vector3D(beginX , beginY , beginZ);\r
+       m_end = mof::Vector3D(endX , endY , endZ);\r
+}\r
+\r
+\r
+mof::Line3D::Line3D(mof::Vector3D& begin , mof::Vector3D& end){\r
+       m_begin = begin;\r
+       m_end = end;\r
+}\r
+\r
+mof::Line3D::~Line3D(void)\r
+{\r
+}\r
+\r
+       \r
+\r
diff --git a/moftmp/Line3D.h b/moftmp/Line3D.h
new file mode 100755 (executable)
index 0000000..aaac8ee
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once\r
+#include "mof/Vector3D.h"\r
+\r
+namespace mof{\r
+       class Line3D\r
+       {\r
+\r
+               mof::Vector3D m_begin;\r
+               mof::Vector3D m_end;\r
+       public:\r
+               Line3D(float beginX , float beginY , float beginZ ,  float endX , float endY , float endZ);\r
+               Line3D(mof::Vector3D& begin , mof::Vector3D& end);\r
+               ~Line3D(void);\r
+\r
+               mof::Vector3D& getBegin(){return m_begin;}\r
+               mof::Vector3D& getEnd(){return m_end;}\r
+\r
+               \r
+       };\r
+\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/LoggedInputReceiver.cpp b/moftmp/LoggedInputReceiver.cpp
new file mode 100755 (executable)
index 0000000..f68c713
--- /dev/null
@@ -0,0 +1,21 @@
+#include "mof/LoggedInputReceiver.hpp"\r
+#include "mof/InputDevice.hpp"\r
+\r
+mof::LoggedInputReceiver::LoggedInputReceiver(TCHAR* filename )\r
+: mof::InputReceiver() , m_log(filename){\r
+}\r
+\r
+mof::LoggedInputReceiver::~LoggedInputReceiver(){\r
+       \r
+}\r
+\r
+bool mof::LoggedInputReceiver::testKeyState(mof::InputReceiver::Key){\r
+       bool result = false;\r
+       m_log >> result;\r
+       return result;\r
+       \r
+}\r
+\r
+void mof::LoggedInputReceiver::update(){\r
+}\r
+\r
diff --git a/moftmp/LoggedInputReceiver.hpp b/moftmp/LoggedInputReceiver.hpp
new file mode 100755 (executable)
index 0000000..3d596e1
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+#include "mof/InputReceiver.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <fstream>\r
+\r
+\r
+\r
+namespace mof{\r
+       \r
+\r
+       class LoggedInputReceiver : public InputReceiver\r
+       {\r
+               std::ifstream m_log;\r
+               \r
+       public:\r
+               \r
+               LoggedInputReceiver(TCHAR* filename );\r
+               virtual ~LoggedInputReceiver();\r
+               virtual bool testKeyState(mof::InputReceiver::Key key);\r
+               virtual void update();\r
+               \r
+       };\r
+\r
+};\r
diff --git a/moftmp/LoggingInputReceiver.cpp b/moftmp/LoggingInputReceiver.cpp
new file mode 100755 (executable)
index 0000000..77589f7
--- /dev/null
@@ -0,0 +1,33 @@
+#include "mof/LoggingInputReceiver.hpp"\r
+#include "mof/InputDevice.hpp"\r
+#include <fstream>\r
+\r
+\r
+mof::LoggingInputReceiver::LoggingInputReceiver(TCHAR* filename )\r
+: m_filename(filename){\r
+}\r
+\r
+mof::LoggingInputReceiver::~LoggingInputReceiver(){\r
+       output();\r
+}\r
+\r
+bool mof::LoggingInputReceiver::testKeyState(mof::InputReceiver::Key key){\r
+       bool result = mof::InputDevice::getInputReceiver()->testKeyState(key);\r
+       m_log.push_back(result);\r
+       return result;\r
+       \r
+}\r
+\r
+void mof::LoggingInputReceiver::update(){\r
+       mof::InputDevice::getInputReceiver()->update();\r
+}\r
+\r
+\r
+\r
+void mof::LoggingInputReceiver::output(){\r
+       std::ofstream ofs( m_filename.c_str() );\r
+       for(std::list<bool>::iterator itr = m_log.begin() ; itr != m_log.end() ; ++itr){\r
+               ofs << *itr << std::endl;\r
+       }\r
+\r
+}
\ No newline at end of file
diff --git a/moftmp/LoggingInputReceiver.hpp b/moftmp/LoggingInputReceiver.hpp
new file mode 100755 (executable)
index 0000000..e1fba33
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once\r
+#include "mof/InputReceiver.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <list>\r
+\r
+namespace mof{\r
+       \r
+\r
+       class LoggingInputReceiver : public InputReceiver\r
+       {\r
+               std::list<bool> m_log;\r
+               mof::tstring m_filename;\r
+       public:\r
+               \r
+               LoggingInputReceiver(TCHAR* filename );\r
+               virtual ~LoggingInputReceiver();\r
+               virtual bool testKeyState(Key key);\r
+               virtual void update();\r
+               void output();\r
+       };\r
+\r
+};\r
diff --git a/moftmp/LuaScript.cpp b/moftmp/LuaScript.cpp
new file mode 100755 (executable)
index 0000000..6bc9beb
--- /dev/null
@@ -0,0 +1,67 @@
+#include "mof/LuaScript.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include <lua.hpp>\r
+#include "luabind/luabind.hpp"\r
+#include "mof/utilities.hpp"\r
+\r
+\r
+struct mof::LuaScript::Impl{\r
+       lua_State *l;\r
+       lua_State *co;\r
+\r
+\r
+\r
+       Impl()\r
+               : l(NULL) \r
+       {\r
+       }\r
+\r
+       ~Impl(){\r
+               if(l)lua_close(l);\r
+       }\r
+       \r
+       \r
+\r
+};\r
+\r
+\r
+\r
+mof::LuaScript::LuaScript(const mof::tstring& filename )\r
+: m_pImpl(new Impl()){\r
+       m_pImpl->l = lua_open();\r
+       luaL_openlibs(m_pImpl->l);\r
+       luabind::open(m_pImpl->l);\r
+\r
+       \r
+       \r
+       \r
+    \r
+       int error = luaL_dofile(m_pImpl->l , filename.c_str());\r
+       //error = luaL_dofile(m_pImpl->l , "script/test2.lua");\r
+       if(error){\r
+               DEBUG_PRINT(_T("ERROR-") << lua_tostring(m_pImpl->l , -1));\r
+               throw std::runtime_error("Failed --- start lua script");\r
+       }\r
+       m_pImpl->co = lua_newthread(m_pImpl->l);\r
+       if(!m_pImpl->co){\r
+               DEBUG_PRINT(_T("ERROR-Failed lua_newthread") );\r
+               throw std::runtime_error("Failed --- start lua script");\r
+       }\r
+       lua_getglobal(m_pImpl->co , "main");\r
+       \r
+}\r
+\r
+mof::LuaScript::~LuaScript(){\r
+\r
+}\r
+\r
+\r
+void mof::LuaScript::nextCommand(){\r
+       lua_resume(m_pImpl->co , 0);\r
+       \r
+\r
+}\r
+\r
+lua_State* mof::LuaScript::getLuaState() const{\r
+    return m_pImpl->l;\r
+}\r
diff --git a/moftmp/LuaScript.hpp b/moftmp/LuaScript.hpp
new file mode 100755 (executable)
index 0000000..2121373
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef _LUASCRIPT_HPP\r
+#define _LUASCRIPT_HPP\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/tstring.hpp"\r
+#include <lua.hpp>\r
+\r
+namespace mof{\r
+       class MessageWidget;\r
+       \r
+\r
+       class LuaScript{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       public :\r
+               LuaScript(const mof::tstring& filename );\r
+               ~LuaScript();\r
+\r
+               void nextCommand();\r
+               lua_State * getLuaState() const;\r
+       };\r
+\r
+}\r
+\r
+\r
+#endif\r
diff --git a/moftmp/Material.hpp b/moftmp/Material.hpp
new file mode 100755 (executable)
index 0000000..baa8458
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef MOF_MATERIAL_HPP\r
+#define MOF_MATERIAL_HPP\r
+#include "Color.hpp"\r
+\r
+namespace mof{\r
+\r
+struct Material{\r
+       mof::Color4f diffuseColor;\r
+       mof::Color4f ambientColor;\r
+       mof::Color4f specularColor;\r
+       float power;\r
+       mof::Color4f emissiveColor;\r
+\r
+       Material()\r
+               : ambientColor(0 , 0 , 0) , \r
+                 diffuseColor(0 , 0 , 0) ,\r
+                 specularColor(0 , 0 , 0),\r
+                 power(0),\r
+                 emissiveColor(0 , 0 , 0)\r
+       {\r
+               \r
+       }\r
+\r
+       Material(\r
+               mof::Color4f ambient_ ,\r
+               mof::Color4f diffuse_ ,\r
+               mof::Color4f specular_ ,\r
+               real power_ ,\r
+               mof::Color4f emissive_\r
+               )\r
+               : ambientColor(ambient_) , \r
+                 diffuseColor(diffuse_) ,\r
+                 specularColor(specular_),\r
+                 power(power_),\r
+                 emissiveColor(emissive_)\r
+       {\r
+               \r
+       }\r
+\r
+\r
+};\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/MaterialBuilder.cpp b/moftmp/MaterialBuilder.cpp
new file mode 100755 (executable)
index 0000000..8780e08
--- /dev/null
@@ -0,0 +1,134 @@
+#include "mof/MaterialBuilder.hpp"\r
+#include "mof/Material.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/Constant.hpp"\r
+\r
+struct mof::MaterialBuilder::Impl{\r
+\r
+       Impl(\r
+               const mof::Animation<mof::Color4f>::Handler& ambient_ ,\r
+               const mof::Animation<mof::Color4f>::Handler& diffuse_ ,\r
+               const mof::Animation<mof::Color4f>::Handler& specular_ ,\r
+               const mof::Animation<float>::Handler& specularPower_ ,\r
+               const mof::Animation<mof::Color4f>::Handler& emissive_)\r
+       : diffuse(diffuse_) , ambient(ambient_) , specular(specular_) ,\r
+       specularPower(specularPower_) , emissive(emissive_) , pMaterial(NULL) , frame(0) {\r
+       }\r
+\r
+       ~Impl(){\r
+               delete pMaterial;\r
+       }\r
+\r
+       mof::Material* pMaterial;\r
+       FrameNumber frame;\r
+       mof::Animation<mof::Color4f>::Handler diffuse;\r
+       mof::Animation<mof::Color4f>::Handler ambient;\r
+       mof::Animation<mof::Color4f>::Handler specular;\r
+       mof::Animation<float>::Handler specularPower;\r
+       mof::Animation<mof::Color4f>::Handler emissive;\r
+\r
+       \r
+};\r
+\r
+\r
+\r
+       \r
+mof::MaterialBuilder::MaterialBuilder( )\r
+: m_pImpl(new Impl( \r
+                 mof::makeConstantHandler(mof::Color4f(0 , 0 , 0)) ,\r
+                 mof::makeConstantHandler(mof::Color4f(0 , 0 , 0)) ,\r
+                 mof::makeConstantHandler(mof::Color4f(0 , 0 , 0)) ,\r
+                 mof::makeConstantHandler(0.0f) , \r
+                 mof::makeConstantHandler(mof::Color4f(0 , 0 , 0)) \r
+                 ) )\r
+{\r
+       m_pImpl->pMaterial = new Material;\r
+}\r
+\r
+\r
+mof::MaterialBuilder::MaterialBuilder( mof::Color4f ambient )\r
+: m_pImpl(new Impl( \r
+                 mof::makeConstantHandler(ambient) ,\r
+                 mof::makeConstantHandler(mof::Color4f(0 , 0 , 0)) ,\r
+                 mof::makeConstantHandler(mof::Color4f(0 , 0 , 0)) ,\r
+                 mof::makeConstantHandler(0.0f) , \r
+                 mof::makeConstantHandler(mof::Color4f(0 , 0 , 0)) ))\r
+{\r
+       m_pImpl->pMaterial = new Material;\r
+       construct();\r
+}\r
+\r
+\r
+mof::MaterialBuilder::MaterialBuilder( mof::Color4f ambient , mof::Color4f diffuse , \r
+                                                                          mof::Color4f specular , float power , mof::Color4f emissive )\r
+: m_pImpl(new Impl(\r
+                 mof::makeConstantHandler(ambient) ,\r
+                 mof::makeConstantHandler(diffuse) ,\r
+                 mof::makeConstantHandler(specular) ,\r
+                 mof::makeConstantHandler(power) , \r
+                 mof::makeConstantHandler(emissive) ))\r
+{\r
+       m_pImpl->pMaterial = new Material;\r
+       construct();\r
+}\r
+\r
+mof::MaterialBuilder::MaterialBuilder(\r
+                       const mof::Animation<mof::Color4f>::Handler& ambient_ , \r
+                       const mof::Animation<mof::Color4f>::Handler& diffuse_ ,\r
+                       const mof::Animation<mof::Color4f>::Handler& specular_ ,\r
+                       const mof::Animation<float>::Handler& power_ ,\r
+                       const mof::Animation<mof::Color4f>::Handler& emissive_ )\r
+: m_pImpl(new Impl( ambient_ , diffuse_ , specular_ , power_ , emissive_ ))\r
+{\r
+       m_pImpl->pMaterial = new Material;\r
+       construct();\r
+}\r
+\r
+mof::MaterialBuilder::~MaterialBuilder(){\r
+}\r
+\r
+void mof::MaterialBuilder::setFrameNumber(mof::FrameNumber frame){\r
+       m_pImpl->frame = frame;\r
+}\r
+\r
+void mof::MaterialBuilder::nextFrame(){\r
+       setFrameNumber(m_pImpl->frame + 1 );\r
+}\r
+\r
+void mof::MaterialBuilder::prevFrame(){\r
+       if(m_pImpl->frame > 0)setFrameNumber(m_pImpl->frame - 1);\r
+}\r
+\r
+\r
+\r
+mof::Color4f mof::MaterialBuilder::getDiffuseColor() const{\r
+       return m_pImpl->diffuse->getValue(m_pImpl->frame);\r
+}\r
+\r
+mof::Color4f mof::MaterialBuilder::getAmbientColor() const{\r
+       return m_pImpl->ambient->getValue(m_pImpl->frame);\r
+}\r
+\r
+mof::Color4f mof::MaterialBuilder::getSpecularColor() const{\r
+       return m_pImpl->specular->getValue(m_pImpl->frame);\r
+}\r
+\r
+mof::Color4f mof::MaterialBuilder::getEmissiveColor() const{\r
+       return m_pImpl->emissive->getValue(m_pImpl->frame);\r
+}\r
+\r
+float mof::MaterialBuilder::getSpecularPower() const{\r
+       return m_pImpl->specularPower->getValue(m_pImpl->frame);\r
+}\r
+\r
+\r
+const mof::Material& mof::MaterialBuilder::construct() const{\r
+       \r
+       m_pImpl->pMaterial->diffuseColor = m_pImpl->diffuse->getValue(m_pImpl->frame);\r
+       m_pImpl->pMaterial->ambientColor = m_pImpl->ambient->getValue(m_pImpl->frame);\r
+       m_pImpl->pMaterial->specularColor = m_pImpl->specular->getValue(m_pImpl->frame);\r
+       m_pImpl->pMaterial->power = m_pImpl->specularPower->getValue(m_pImpl->frame);\r
+       m_pImpl->pMaterial->emissiveColor = m_pImpl->emissive->getValue(m_pImpl->frame);\r
+\r
+       return *(m_pImpl->pMaterial);\r
+}\r
diff --git a/moftmp/MaterialBuilder.hpp b/moftmp/MaterialBuilder.hpp
new file mode 100755 (executable)
index 0000000..67b2c5a
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef MOF_MATERIAL_BUILDER_HPP\r
+#define MOF_MATERIAL_BUILDER_HPP\r
+\r
+#include "mof/Color.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/utility.hpp>\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+//struct _D3DMATERIAL9;\r
+//typedef _D3DMATERIAL9 D3DMATERIAL9;\r
+namespace mof{\r
+\r
+\r
+struct Material;\r
+\r
+class MaterialBuilder : boost::noncopyable{\r
+\r
+       struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+public:\r
+       MaterialBuilder();\r
+       MaterialBuilder( mof::Color4f ambient );\r
+       MaterialBuilder( mof::Color4f ambient , mof::Color4f diffuse , mof::Color4f specular , float power , mof::Color4f emissive );\r
+       MaterialBuilder\r
+       (\r
+               const mof::Animation<mof::Color4f>::Handler& ambient , \r
+               const mof::Animation<mof::Color4f>::Handler& diffuse ,\r
+               const mof::Animation<mof::Color4f>::Handler& specular ,\r
+               const mof::Animation<float>::Handler& power ,\r
+               const mof::Animation<mof::Color4f>::Handler& emissive \r
+       );\r
+       ~MaterialBuilder();\r
+\r
+       void setFrameNumber(mof::FrameNumber frame);\r
+       void nextFrame();\r
+       void prevFrame();\r
+\r
+       mof::Color4f getDiffuseColor() const;\r
+       mof::Color4f getAmbientColor() const;\r
+       mof::Color4f getSpecularColor() const;\r
+       float getSpecularPower() const;\r
+       mof::Color4f getEmissiveColor() const;\r
+\r
+       const mof::Material& construct() const;\r
+};\r
+\r
+}\r
+\r
+#endif \r
diff --git a/moftmp/Matrix2D.cpp b/moftmp/Matrix2D.cpp
new file mode 100755 (executable)
index 0000000..3bb0bc4
--- /dev/null
@@ -0,0 +1,175 @@
+#include <d3dx9.h>\r
+#include <string.h>\r
+#include "mof/Matrix2D.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+const int DIMENSION = 2;\r
+\r
+\r
+mof::Matrix2D::Matrix2D()\r
+: m_pImpl(new Array)\r
+{\r
+       for(int i = 0 ; i <= DIMENSION ; ++i){\r
+               for(int j = 0 ; j <= DIMENSION ; ++j){\r
+                       if(i == j)m_pImpl->elements[i][j] = 1;\r
+                       else m_pImpl->elements[i][j] = 0;\r
+               }\r
+       }\r
+}\r
+\r
+mof::Matrix2D::Matrix2D(const Matrix2D& obj )\r
+: m_pImpl(new Array)\r
+{\r
+       *m_pImpl = *obj.m_pImpl;\r
+}\r
+\r
+mof::Matrix2D::Matrix2D(const mof::Matrix2D::Array & arr)\r
+: m_pImpl(new Array)\r
+{\r
+       *m_pImpl = arr;\r
+}\r
+\r
+\r
+mof::Matrix2D::~Matrix2D(){\r
+}\r
+\r
+\r
+mof::real mof::Matrix2D::at(int row , int column) const{\r
+       return m_pImpl->elements[row][column];\r
+}\r
+\r
+mof::Matrix2D::Array mof::Matrix2D::getArray() const{\r
+       return *m_pImpl;\r
+}\r
+\r
+\r
+mof::Matrix2D mof::Matrix2D::createIdentity(){\r
+       return mof::Matrix2D();\r
+}\r
+\r
+\r
+mof::Matrix2D mof::Matrix2D::createTransposed(mof::Matrix2D& matrix){\r
+       Matrix2D transposed;\r
+       for(int i = 0 ; i <= DIMENSION ; i++){\r
+               for(int j = 0 ; j <= DIMENSION ; j++){\r
+                       transposed.m_pImpl->elements[j][i] = matrix.m_pImpl->elements[i][j];\r
+               }\r
+       }\r
+       return transposed;\r
+}\r
+\r
+\r
+\r
+mof::Matrix2D mof::Matrix2D::createRotation(const mof::Vector2D& position){\r
+       Matrix2D matrix;\r
+       matrix.m_pImpl->elements[DIMENSION][0] = position.x;\r
+       matrix.m_pImpl->elements[DIMENSION][1] = position.y;\r
+       return matrix;\r
+}\r
+\r
+\r
+mof::Matrix2D mof::Matrix2D::createTranslation(const mof::Vector2D& position){\r
+       Matrix2D matrix;\r
+       matrix.m_pImpl->elements[DIMENSION][0] = position.x;\r
+       matrix.m_pImpl->elements[DIMENSION][1] = position.y;\r
+       return matrix;\r
+}\r
+\r
+mof::Matrix2D mof::Matrix2D::createScaling(const mof::Vector2D& scaling){\r
+       Matrix2D matrix;\r
+       matrix.m_pImpl->elements[0][0] = scaling.x;\r
+       matrix.m_pImpl->elements[1][1] = scaling.y;\r
+       return matrix;\r
+}\r
+\r
+\r
+mof::Vector2D mof::Matrix2D::getTranslation(const mof::Matrix2D& matrix){\r
+       return mof::Vector2D(\r
+               matrix.m_pImpl->elements[DIMENSION][0] ,\r
+               matrix.m_pImpl->elements[DIMENSION][1]\r
+               );\r
+}\r
+\r
+mof::Vector2D mof::Matrix2D::getDiagonal() const{\r
+       return mof::Vector2D(\r
+               m_pImpl->elements[0][0] ,\r
+               m_pImpl->elements[1][1]\r
+               );\r
+}\r
+\r
+               \r
+mof::Matrix2D mof::Matrix2D::operator *(const mof::Matrix2D& matrix) const{\r
+       mof::Matrix2D multiplied;\r
+       for(int i = 0 ; i <= DIMENSION ; i++){\r
+               for(int j = 0 ; j <= DIMENSION ; j++){\r
+                       mof::real sum = 0;\r
+                       for(int k = 0 ; k <= DIMENSION ; k++){\r
+                               sum += m_pImpl->elements[i][k] * matrix.m_pImpl->elements[k][j];\r
+                       }\r
+                       multiplied.m_pImpl->elements[i][j] = sum;\r
+               }\r
+       }\r
+       return multiplied;\r
+}\r
+\r
+\r
+mof::Matrix2D mof::Matrix2D::operator +(const mof::Matrix2D& matrix) const{\r
+       mof::Matrix2D result;\r
+       for(int i = 0 ; i <= DIMENSION ; i++){\r
+               for(int j = 0 ; j <= DIMENSION ; j++){\r
+                       result.m_pImpl->elements[i][j] = \r
+                               m_pImpl->elements[i][j] + matrix.m_pImpl->elements[i][j];\r
+               }\r
+       }\r
+       return result;\r
+}\r
+\r
+\r
+mof::Matrix2D mof::Matrix2D::operator -(const mof::Matrix2D& matrix) const{\r
+       mof::Matrix2D result;\r
+       for(int i = 0 ; i <= DIMENSION ; i++){\r
+               for(int j = 0 ; j <= DIMENSION ; j++){\r
+                       result.m_pImpl->elements[i][j] = \r
+                               m_pImpl->elements[i][j] - matrix.m_pImpl->elements[i][j];\r
+               }\r
+       }\r
+       return result;\r
+}\r
+\r
+\r
+mof::Matrix2D mof::operator *(const mof::Matrix2D& matrix , mof::real f){\r
+       mof::Matrix2D result;\r
+       for(int i = 0 ; i <= DIMENSION ; i++){\r
+               for(int j = 0 ; j <= DIMENSION ; j++){\r
+                       result.m_pImpl->elements[i][j] = \r
+                               matrix.m_pImpl->elements[i][j] * f;\r
+               }\r
+       }\r
+       return result;\r
+}\r
+               \r
+mof::Matrix2D mof::operator *(mof::real f , mof::Matrix2D const& matrix){\r
+       return matrix * f;\r
+}\r
+\r
+\r
+mof::Vector2D mof::operator *(const mof::Vector2D& vec , const mof::Matrix2D& matrix) {\r
+       mof::real input[3] = {vec.x , vec.y , 1};\r
+       mof::real output[3];\r
+       for(int i = 0 ; i < DIMENSION ; i++){\r
+               mof::real sum = 0;\r
+               for(int k = 0 ; k <= DIMENSION ; k++){\r
+                       sum += input[k] * matrix.at(k , i);\r
+               }\r
+               output[i] = sum;\r
+               \r
+       }\r
+       return mof::Vector2D(output[0] , output[1]);\r
+}\r
+\r
+\r
+mof::Rectangle<int> mof::Matrix2D::toBoundingBox(){\r
+       mof::Vector2D begin = mof::Vector2D(0 , 0) * (*this);\r
+       mof::Vector2D end = mof::Vector2D(1 , 1) * (*this);\r
+       return mof::Rectangle<int>( (int)begin.x , (int)begin.y , (int)end.x , (int)end.y );\r
+}\r
diff --git a/moftmp/Matrix2D.hpp b/moftmp/Matrix2D.hpp
new file mode 100755 (executable)
index 0000000..54639d1
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef MATRIX2D_HPP\r
+#define MATRIX2D_HPP\r
+#include <mof/real.hpp>\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include <boost/shared_ptr.hpp>\r
+\r
+\r
+namespace mof{\r
+       class Matrix2D{\r
+       public:\r
+               struct Array{\r
+                       real elements[3][3];\r
+               };\r
+       private:\r
+               boost::shared_ptr<Array> m_pImpl;\r
+       public:\r
+               \r
+               Matrix2D();\r
+               Matrix2D(const Matrix2D& );\r
+               explicit Matrix2D(const mof::Matrix2D::Array &);\r
+               ~Matrix2D();\r
+               real at(int row , int column) const;\r
+               Array getArray() const;\r
+\r
+               static Matrix2D createIdentity();\r
+               static Matrix2D createTransposed(Matrix2D& matrix);\r
+               static Matrix2D createRotation(const mof::Vector2D& angle);\r
+               static Matrix2D createTranslation(const mof::Vector2D& position);\r
+               static Matrix2D createScaling(const mof::Vector2D& scale);\r
+               static Vector2D getTranslation(const mof::Matrix2D& matrix);\r
+               Vector2D getDiagonal() const;\r
+\r
+\r
+               Matrix2D operator *(const mof::Matrix2D& matrix ) const;\r
+               Matrix2D operator +(const mof::Matrix2D& matrix ) const;\r
+               Matrix2D operator -(const mof::Matrix2D& matrix ) const;\r
+\r
+               friend Vector2D operator *(const mof::Vector2D& vec , const mof::Matrix2D& matrix);\r
+               friend Matrix2D operator *(const mof::Matrix2D& matrix , real f);\r
+               friend Matrix2D operator *(real f ,  const mof::Matrix2D & matrix);\r
+\r
+               mof::Rectangle<int> toBoundingBox();\r
+       \r
+               \r
+       };\r
+} // namespace mof\r
+\r
+\r
+#endif\r
diff --git a/moftmp/Matrix3D.cpp b/moftmp/Matrix3D.cpp
new file mode 100755 (executable)
index 0000000..30a76c5
--- /dev/null
@@ -0,0 +1,227 @@
+#include <string.h>\r
+#include <iostream>\r
+#include "mof/Matrix3D.hpp"\r
+#include "mof/utilities.hpp"\r
+#include <d3dx9.h>\r
+\r
+const int DIMENSION = 3;\r
+\r
+\r
+mof::Matrix3D::Matrix3D()\r
+: m_pImpl(new Array)\r
+{\r
+    for(int i = 0 ; i <= DIMENSION ; ++i){\r
+        for(int j = 0 ; j <= DIMENSION ; ++j){\r
+            if(i == j)m_pImpl->elements[i][j] = 1;\r
+            else m_pImpl->elements[i][j] = 0;\r
+        }\r
+    }\r
+}\r
+\r
+mof::Matrix3D::Matrix3D(const mof::Matrix3D::Array & arr)\r
+: m_pImpl(new Array)\r
+{\r
+    *m_pImpl = arr;\r
+}\r
+\r
+\r
+mof::Matrix3D::~Matrix3D(){\r
+}\r
+\r
+\r
+mof::real mof::Matrix3D::at(int row , int column) const{\r
+    return m_pImpl->elements[row][column];\r
+}\r
+\r
+mof::Matrix3D::Array mof::Matrix3D::getArray() const{\r
+    return *m_pImpl;\r
+}\r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::createIdentity(){\r
+    return mof::Matrix3D();\r
+}\r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::createTransposed(const mof::Matrix3D& matrix){\r
+    Matrix3D transposed;\r
+    for(int i = 0 ; i <= DIMENSION ; i++){\r
+        for(int j = 0 ; j <= DIMENSION ; j++){\r
+            transposed.m_pImpl->elements[j][i] = matrix.m_pImpl->elements[i][j];\r
+        }\r
+    }\r
+    return transposed;\r
+}\r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::createRotation(const mof::Vector3D& radians){\r
+    mof::real cosx = cosf(radians.x);\r
+    mof::real sinx = sinf(radians.x);\r
+    mof::real cosy = cosf(radians.y);\r
+    mof::real siny = sinf(radians.y);\r
+    mof::real cosz = cosf(radians.z);\r
+    mof::real sinz = sinf(radians.z);\r
+    mof::Matrix3D::Array x = \r
+    {{\r
+        { 1.f , 0.f   , 0.f   , 0.f } ,\r
+        { 0.f , cosx  , sinx  , 0.f } ,\r
+        { 0.f , -sinx , cosx  , 0.f } ,\r
+        { 0.f , 0.f   , 0.f   , 1.f }  \r
+    }};\r
+    mof::Matrix3D::Array y = \r
+    {{\r
+        { cosy , 0.f , -siny , 0.f } ,\r
+        { 0.f  , 1.f , 0.f   , 0.f } ,\r
+        { siny , 0.f , cosy  , 0.f } ,\r
+        { 0.f  , 0.f , 0.f   , 1.f }\r
+    }};\r
+    mof::Matrix3D::Array z = \r
+    {{\r
+        { cosz  , sinz , 0.f , 0.f } ,\r
+        { -sinz , cosz , 0.f , 0.f } ,\r
+        { 0.f   , 0.f  , 1.f , 0.f } ,\r
+        { 0.f   , 0.f  , 0.f , 1.f }  \r
+    }};\r
+    return mof::Matrix3D(x) * mof::Matrix3D(y) * mof::Matrix3D(z); //TODO \90Ï\82ð\83n\81[\83h\83R\81[\83f\83B\83\93\83O\r
+}\r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::createTranslation(const mof::Vector3D& position){\r
+    Matrix3D matrix;\r
+    matrix.m_pImpl->elements[DIMENSION][0] = position.x;\r
+    matrix.m_pImpl->elements[DIMENSION][1] = position.y;\r
+    matrix.m_pImpl->elements[DIMENSION][2] = position.z;\r
+    return matrix;\r
+}\r
+\r
+mof::Matrix3D mof::Matrix3D::createScaling(const mof::Vector3D& scaling){\r
+    Matrix3D matrix;\r
+    matrix.m_pImpl->elements[0][0] = scaling.x;\r
+    matrix.m_pImpl->elements[1][1] = scaling.y;\r
+    matrix.m_pImpl->elements[2][2] = scaling.z;\r
+    return matrix;\r
+}\r
+\r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::createLookAtLH\r
+(\r
+    const mof::Vector3D& eye ,\r
+    const mof::Vector3D& lookAt ,\r
+    const mof::Vector3D& up\r
+)\r
+{\r
+    D3DXVECTOR3 vEye(eye.x , eye.y , eye.z);\r
+    D3DXVECTOR3 vLookAt(lookAt.x , lookAt.y , lookAt.z);\r
+    D3DXVECTOR3 vUp(up.x , up.y , up.z);\r
+    D3DXMATRIX   m;\r
+    mof::Matrix3D::Array array;\r
+    D3DXMatrixLookAtLH( &m , &vEye , &vLookAt , &vUp );\r
+    for( int i = 0 ; i < DIMENSION ; i++ )\r
+    {\r
+        for( int j = 0 ; j < DIMENSION ; j++ )\r
+        {\r
+            array.elements[i][j] = m.m[i][j];\r
+        }\r
+    }\r
+    return mof::Matrix3D( array );\r
+}\r
+\r
+mof::Vector3D mof::Matrix3D::getTranslation(const mof::Matrix3D& matrix){\r
+    return mof::Vector3D(\r
+        matrix.m_pImpl->elements[DIMENSION][0] ,\r
+        matrix.m_pImpl->elements[DIMENSION][1] ,\r
+        matrix.m_pImpl->elements[DIMENSION][2]\r
+        );\r
+}\r
+        \r
+mof::Vector3D mof::Matrix3D::getDiagonal() const{\r
+    return mof::Vector3D(\r
+        m_pImpl->elements[0][0] ,\r
+        m_pImpl->elements[1][1] ,\r
+        m_pImpl->elements[2][2]\r
+        );\r
+}\r
+        \r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::operator *(const mof::Matrix3D& matrix) const{\r
+    mof::Matrix3D multiplied;\r
+    for(int i = 0 ; i <= DIMENSION ; i++){\r
+        for(int j = 0 ; j <= DIMENSION ; j++){\r
+            mof::real sum = 0;\r
+            for(int k = 0 ; k <= DIMENSION ; k++){\r
+                sum += m_pImpl->elements[i][k] * matrix.m_pImpl->elements[k][j];\r
+            }\r
+            multiplied.m_pImpl->elements[i][j] = sum;\r
+        }\r
+    }\r
+    return multiplied;\r
+}\r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::operator +(const mof::Matrix3D& matrix) const{\r
+    mof::Matrix3D result;\r
+    for(int i = 0 ; i <= DIMENSION ; i++){\r
+        for(int j = 0 ; j <= DIMENSION ; j++){\r
+            result.m_pImpl->elements[i][j] = \r
+                m_pImpl->elements[i][j] + matrix.m_pImpl->elements[i][j];\r
+        }\r
+    }\r
+    return result;\r
+}\r
+\r
+\r
+mof::Matrix3D mof::Matrix3D::operator -(const mof::Matrix3D& matrix) const{\r
+    mof::Matrix3D result;\r
+    for(int i = 0 ; i <= DIMENSION ; i++){\r
+        for(int j = 0 ; j <= DIMENSION ; j++){\r
+            result.m_pImpl->elements[i][j] = \r
+                m_pImpl->elements[i][j] - matrix.m_pImpl->elements[i][j];\r
+        }\r
+    }\r
+    return result;\r
+}\r
+\r
+\r
+mof::Matrix3D mof::operator *(const mof::Matrix3D& matrix , mof::real f){\r
+    mof::Matrix3D result;\r
+    for(int i = 0 ; i <= DIMENSION ; i++){\r
+        for(int j = 0 ; j <= DIMENSION ; j++){\r
+            result.m_pImpl->elements[i][j] = \r
+                matrix.m_pImpl->elements[i][j] * f;\r
+        }\r
+    }\r
+    return result;\r
+}\r
+        \r
+mof::Matrix3D mof::operator *(mof::real f , mof::Matrix3D const& matrix){\r
+    return matrix * f;\r
+}\r
+\r
+\r
+mof::Vector3D mof::operator *(const mof::Vector3D& vec , const mof::Matrix3D& matrix) {\r
+    mof::real input[4] = {vec.x , vec.y , vec.z , 1};\r
+    mof::real output[4];\r
+    for(int i = 0 ; i < DIMENSION ; i++){\r
+        mof::real sum = 0;\r
+        for(int k = 0 ; k <= DIMENSION ; k++){\r
+            sum += input[k] * matrix.at(k , i);\r
+        }\r
+        output[i] = sum;\r
+        \r
+    }\r
+    return mof::Vector3D(output[0] , output[1] , output[2]);\r
+}\r
+\r
+\r
+std::ostream& mof::operator <<(std::ostream& os , const mof::Matrix3D& mat){\r
+    for(int i = 0 ; i <= DIMENSION ; i++){\r
+        for(int j = 0 ; j <= DIMENSION ; j++){\r
+            if(j != 0)os << " , ";\r
+            os << mat.m_pImpl->elements[i][j];\r
+        }\r
+        os << '\n';\r
+    }\r
+    return os;\r
+}\r
diff --git a/moftmp/Matrix3D.hpp b/moftmp/Matrix3D.hpp
new file mode 100755 (executable)
index 0000000..24d614b
--- /dev/null
@@ -0,0 +1,49 @@
+#pragma once\r
+#include "mof/Vector3D.hpp"\r
+#include <mof/real.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+\r
+namespace mof{\r
+\r
+    class Matrix3D\r
+    {\r
+    public:\r
+        struct Array\r
+        {\r
+            real elements[4][4];\r
+        };\r
+    private:\r
+        boost::shared_ptr<Array> m_pImpl;\r
+    public:\r
+        \r
+        Matrix3D();\r
+        explicit Matrix3D(const Array &);\r
+        ~Matrix3D();\r
+        real at(int row , int column) const;\r
+        Array getArray() const;\r
+\r
+        static Matrix3D createIdentity();\r
+        static Matrix3D createTransposed(const Matrix3D& matrix);\r
+        static Matrix3D createRotation(const mof::Vector3D& angle);\r
+        static Matrix3D createTranslation(const mof::Vector3D& position);\r
+        static Matrix3D createScaling(const mof::Vector3D& scale);\r
+        static Matrix3D createLookAtLH( const Vector3D& eye , const Vector3D& lookAt , const Vector3D& up );\r
+        static Vector3D getTranslation(const mof::Matrix3D& matrix);\r
+        Vector3D getDiagonal() const;\r
+\r
+\r
+        Matrix3D operator *(const mof::Matrix3D& matrix ) const;\r
+        Matrix3D operator +(const mof::Matrix3D& matrix ) const;\r
+        Matrix3D operator -(const mof::Matrix3D& matrix ) const;\r
+\r
+        friend Vector3D operator *(const mof::Vector3D& vec , const mof::Matrix3D& matrix);\r
+        friend Matrix3D operator *(const mof::Matrix3D& matrix , real f);\r
+        friend Matrix3D operator *(real f ,  const mof::Matrix3D & matrix);\r
+        friend std::ostream& operator <<(std::ostream& os , const mof::Matrix3D& mat);\r
+    }; // class Matrix3D\r
+        \r
+    std::ostream& operator <<(std::ostream& os , const mof::Matrix3D& mat);\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/Mesh.cpp b/moftmp/Mesh.cpp
new file mode 100755 (executable)
index 0000000..c0ea8f0
--- /dev/null
@@ -0,0 +1,91 @@
+#include "mof/private/Mesh.hpp"\r
+#include "mof/GraphicsDevice.hpp"\r
+#include "mof/private/MeshDisposer.hpp"\r
+#include "mof/Constant.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+struct mof::Mesh::Impl{\r
+       \r
+       boost::shared_ptr<mof::MeshDisposer> pMeshDisposer;\r
+       unsigned long nMaterials;\r
+       boost::shared_ptr<Material>* materials; \r
+       boost::shared_ptr<Texture>* textures;\r
+       mof::Animation<mof::Matrix3D>::Handler worldMatrix;\r
+       \r
+\r
+       Impl(\r
+               boost::shared_ptr<mof::MeshDisposer> pMeshDisposer_ ,\r
+               unsigned long nMaterials_ \r
+               ) : \r
+               pMeshDisposer(pMeshDisposer_) , \r
+               nMaterials(nMaterials_) , materials(NULL) , textures(NULL) ,\r
+               worldMatrix(mof::makeConstantHandler(mof::Matrix3D::createIdentity()))\r
+               {}\r
+\r
+       ~Impl(){\r
+               delete[] materials;\r
+               delete[] textures;\r
+               }\r
+}; \r
+\r
+mof::Mesh::Mesh(\r
+       boost::shared_ptr<mof::MeshDisposer> pMeshDisposer ,\r
+       unsigned long nMaterials ,\r
+       const boost::shared_ptr<Material>* materials , \r
+       const boost::shared_ptr<Texture>* textures \r
+       ) : m_pImpl(new Impl(pMeshDisposer , nMaterials )){\r
+\r
+       m_pImpl->materials = new boost::shared_ptr<mof::Material>[nMaterials];\r
+       m_pImpl->textures = new boost::shared_ptr<mof::Texture>[nMaterials];    \r
+\r
+       for(unsigned long i = 0 ; i < nMaterials ; i++ ){\r
+               m_pImpl->materials[i] = materials[i];\r
+               m_pImpl->textures[i] = textures[i];\r
+       }\r
+}\r
+\r
+mof::Mesh::~Mesh(){\r
+}\r
+       \r
+\r
+\r
+void mof::Mesh::setWorldMatrix(const mof::Animation<mof::Matrix3D>::Handler& handler){\r
+       m_pImpl->worldMatrix = handler;\r
+}\r
+\r
+\r
+\r
+\r
+\r
+void mof::Mesh::setTexture( \r
+               unsigned int num ,\r
+               const boost::shared_ptr<mof::Texture>& pTexture){\r
+\r
+       if(num < m_pImpl->nMaterials)m_pImpl->textures[num] = pTexture; \r
+\r
+}\r
+\r
+\r
+bool mof::Mesh::isVisible() const{\r
+       return true;\r
+}\r
+\r
+\r
+void mof::Mesh::update(){\r
+       nextFrame();\r
+}\r
+\r
+void mof::Mesh::draw() const{\r
+       \r
+\r
+       for( DWORD i = 0;  i < m_pImpl->nMaterials ; i++ )\r
+       {\r
+       mof::GraphicsDevice::setMaterial(*m_pImpl->materials[i].get()); \r
+               mof::GraphicsDevice::setTexture(m_pImpl->textures[i].get());\r
+               mof::GraphicsDevice::setWorldTransform(m_pImpl->worldMatrix->getValue(m_frame));\r
+\r
+               HRESULT hr = m_pImpl->pMeshDisposer->pMesh->DrawSubset( i );\r
+               if(FAILED(hr))throw std::runtime_error("Failed --- DrawSubset");\r
+       }\r
+}\r
+\r
diff --git a/moftmp/MeshBuilder.cpp b/moftmp/MeshBuilder.cpp
new file mode 100755 (executable)
index 0000000..b91df59
--- /dev/null
@@ -0,0 +1,115 @@
+#include "MeshBuilder.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include <stdexcept>\r
+#include "mof/private/MeshDisposer.hpp"\r
+#include <boost/shared_ptr.hpp>\r
+#include <stdlib.h>\r
+#include "mof/FilePath.hpp"\r
+#include "mof/private/VertexFVF.hpp"\r
+#include "mof/Material.hpp"\r
+#include "mof/Texture.hpp"\r
+#include "mof/private/Mesh.hpp"\r
+\r
+struct mof::MeshBuilder::Impl{\r
+       boost::shared_ptr<mof::MeshDisposer> pMeshDisposer;\r
+       unsigned long nMaterials;\r
+       boost::shared_ptr<Material>* materials;\r
+       boost::shared_ptr<Texture>* textures;\r
+\r
+\r
+       Impl()\r
+               : pMeshDisposer() , nMaterials(0) ,\r
+                 materials(NULL) , textures(NULL){\r
+       }\r
+\r
+       ~Impl(){\r
+               delete[] materials;\r
+               delete[] textures;\r
+       }\r
+\r
+};\r
+\r
+mof::MeshBuilder::MeshBuilder(const mof::tstring& path )\r
+: m_pImpl(new Impl())\r
+{\r
+\r
+       LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();\r
+       HRESULT hr;\r
+       LPD3DXBUFFER pD3DXMtrlBuffer;   //\83}\83e\83\8a\83A\83\8b\97p\83o\83b\83t\83@\r
+       m_pImpl->pMeshDisposer = boost::shared_ptr<mof::MeshDisposer>( new mof::MeshDisposer() );\r
+\r
+       //\83t\83@\83C\83\8b\83\8d\81[\83h\r
+       hr = D3DXLoadMeshFromX(path.c_str() , D3DXMESH_MANAGED, pDevice,\r
+               &(m_pImpl->pMeshDisposer->pAdjacency) ,\r
+               &pD3DXMtrlBuffer , NULL, \r
+               &(m_pImpl->nMaterials) , \r
+               &(m_pImpl->pMeshDisposer->pMesh) );\r
+       if(hr != D3D_OK)throw std::invalid_argument("Failed --- D3DXLoadMeshFromX");\r
+\r
+       //\8ae\8eí\83C\83\93\83X\83^\83\93\83X\8eæ\93¾\r
+       D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)pD3DXMtrlBuffer->GetBufferPointer();\r
+       try{\r
+               m_pImpl->materials = new boost::shared_ptr<mof::Material>[m_pImpl->nMaterials];\r
+               m_pImpl->textures = new boost::shared_ptr<mof::Texture>[m_pImpl->nMaterials];\r
+               \r
+       \r
+               for( DWORD i = 0; i< m_pImpl->nMaterials; i++ )\r
+                       {\r
+                       //\83}\83e\83\8a\83A\83\8b\82Ì\83R\83s\81[\r
+                       D3DMATERIAL9 mat = d3dxMaterials[i].MatD3D;\r
+                       mat.Ambient = mat.Diffuse;\r
+                       mof::Material tmp;\r
+                       memcpy(\r
+                               static_cast<void*>(&tmp) , \r
+                               static_cast<const void*>(&mat) ,\r
+                               sizeof(D3DMATERIAL9)\r
+                               );\r
+                       \r
+                       boost::shared_ptr<mof::Material> p(new mof::Material(tmp));\r
+                       m_pImpl->materials[i] = p;\r
+\r
+                       //\83e\83N\83X\83`\83\83\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý\r
+                  if( d3dxMaterials[i].pTextureFilename != NULL && \r
+                     lstrlen(d3dxMaterials[i].pTextureFilename) > 0 )\r
+                       {\r
+                               mof::otstringstream os;\r
+                               mof::FilePath path(path);\r
+                               os << path.dir().c_str() << _T("/") << d3dxMaterials[i].pTextureFilename;\r
+                               m_pImpl->textures[i] = boost::shared_ptr<mof::Texture>(new mof::Texture( os.str()));\r
+                       }\r
+               }\r
+\r
+       }\r
+       catch( std::exception& e){\r
+               pD3DXMtrlBuffer->Release();     //\83o\83b\83t\83@\89ð\95ú\r
+               throw e;\r
+       }\r
+       pD3DXMtrlBuffer->Release();     //\83o\83b\83t\83@\89ð\95ú\r
+\r
+       LPD3DXMESH pMesh = NULL;\r
+       if(m_pImpl->pMeshDisposer->pMesh->GetFVF() != mof::getFVF<VertexXYZNUV>())\r
+       {\r
+               //\83\81\83b\83V\83\85\82É\96@\90ü\82ª\82È\82¢\8fê\8d\87\8f\91\82«\8d\9e\82Þ\r
+               m_pImpl->pMeshDisposer->pMesh->CloneMeshFVF(\r
+                       m_pImpl->pMeshDisposer->pMesh->GetOptions() ,\r
+                       mof::getFVF<VertexXYZNUV>() ,\r
+                       pDevice , &pMesh );\r
+       \r
+               LPD3DXMESH tmp = m_pImpl->pMeshDisposer->pMesh;\r
+               m_pImpl->pMeshDisposer->pMesh = pMesh;\r
+               tmp->Release();\r
+       }\r
+\r
+}\r
+       \r
+mof::MeshBuilder::~MeshBuilder(){}\r
+\r
+mof::Graphics3D* mof::MeshBuilder::construct() const{\r
+       return new mof::Mesh(\r
+               m_pImpl->pMeshDisposer ,\r
+               m_pImpl->nMaterials , \r
+               m_pImpl->materials ,\r
+               m_pImpl->textures \r
+               );\r
+}\r
diff --git a/moftmp/MeshBuilder.hpp b/moftmp/MeshBuilder.hpp
new file mode 100755 (executable)
index 0000000..5af1c8a
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef MOF_MESH_BUILDER_HPP\r
+#define MOF_MESH_BUILDER_HPP\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/utility.hpp>\r
+#include "mof/tstring.hpp"\r
+\r
+\r
+namespace mof{\r
+       class Graphics3D;\r
+       \r
+       class MeshBuilder : boost::noncopyable\r
+       {\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       public:\r
+               \r
+               MeshBuilder( const mof::tstring& path );\r
+               ~MeshBuilder();\r
+\r
+               mof::Graphics3D* construct() const;\r
+       };\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/MeshResource.h b/moftmp/MeshResource.h
new file mode 100755 (executable)
index 0000000..44b595c
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once\r
+\r
+#include "mof/ResourceManager.h"\r
+#include "mof/Mesh.h"\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof{\r
+       \r
+       typedef boost::shared_ptr<mof::Mesh> MeshResource;\r
+       typedef mof::ResourceManager<mof::Mesh> MeshManager;\r
+       \r
+};
\ No newline at end of file
diff --git a/moftmp/OnceEventCondition.cpp b/moftmp/OnceEventCondition.cpp
new file mode 100755 (executable)
index 0000000..7da37fb
--- /dev/null
@@ -0,0 +1,36 @@
+#include "mof/OnceEventCondition.hpp"\r
+#include "mof/utilities.hpp"\r
+\r
+namespace mof\r
+{\r
+    OnceEventCondition::OnceEventCondition( EventCondition* pBody )\r
+    : m_disposable( false ) , m_pBody( pBody )\r
+    {\r
+    }\r
+\r
+    OnceEventCondition::~OnceEventCondition( )\r
+    {\r
+        mof::safe_delete( m_pBody );\r
+    }\r
+\r
+    bool OnceEventCondition::test( )\r
+    {\r
+        bool result = m_pBody->test();\r
+        if( !m_disposable && result )m_disposable = true;\r
+        return result;\r
+    }\r
+\r
+    void OnceEventCondition::update( )\r
+    {\r
+        m_pBody->update();\r
+    }\r
+\r
+    bool OnceEventCondition::isDisposable( )\r
+    {\r
+        return m_disposable;\r
+    }\r
+\r
+\r
+\r
+}\r
+\r
diff --git a/moftmp/OnceEventCondition.hpp b/moftmp/OnceEventCondition.hpp
new file mode 100755 (executable)
index 0000000..0db35c3
--- /dev/null
@@ -0,0 +1,20 @@
+#pragma once\r
+#include "mof/EventCondition.hpp"\r
+\r
+namespace mof\r
+{\r
+\r
+    class OnceEventCondition : public EventCondition\r
+    {\r
+        bool m_disposable;\r
+        EventCondition* m_pBody;\r
+    public:\r
+        OnceEventCondition( EventCondition* pBody );\r
+        virtual ~OnceEventCondition();\r
+        virtual bool test();\r
+        virtual void update();\r
+        virtual bool isDisposable();\r
+    };\r
+\r
+}\r
+\r
diff --git a/moftmp/PixelMap.hpp b/moftmp/PixelMap.hpp
new file mode 100755 (executable)
index 0000000..9ebeae0
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef MOF_PIXEL_MAP_HPP\r
+#define MOF_PIXEL_MAP_HPP\r
+\r
+#include "mof/Color.hpp"\r
+#include <boost/multi_array.hpp>\r
+\r
+namespace mof{\r
+       typedef boost::multi_array<mof::Color , 2> PixelMap;\r
+}\r
+\r
+#endif \r
diff --git a/moftmp/PixelMapTextureBuilder.cpp b/moftmp/PixelMapTextureBuilder.cpp
new file mode 100755 (executable)
index 0000000..4886292
--- /dev/null
@@ -0,0 +1,70 @@
+#include "mof/private/PixelMapTextureBuilder.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include <list>\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/Font.hpp"\r
+\r
+\r
+mof::PixelMapTextureBuilder::PixelMapTextureBuilder( const boost::shared_ptr<mof::PixelMap>& pixelMap)\r
+: m_pPixelMap(pixelMap)\r
+{\r
+}\r
+\r
+mof::PixelMapTextureBuilder::~PixelMapTextureBuilder(void)\r
+{\r
+       \r
+}\r
+\r
+\r
+LPDIRECT3DTEXTURE9 mof::PixelMapTextureBuilder::create(){\r
+       HRESULT hr;\r
+       LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();\r
+\r
+       unsigned int tWidth = 2;\r
+       while(tWidth < m_pPixelMap->shape()[0])tWidth *= 2;\r
+       unsigned int tHeight = 2;\r
+       while(tHeight < m_pPixelMap->shape()[1])tHeight *= 2;\r
+       \r
+  \r
+       // \83e\83N\83X\83`\83\83\8dì\90¬\r
+       LPDIRECT3DTEXTURE9 texture;\r
+       if\r
+    (\r
+        FAILED\r
+        (\r
+            hr = D3DXCreateTexture\r
+                (\r
+                    pDevice , tWidth , tHeight ,\r
+                    1 , D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, \r
+                    D3DPOOL_DEFAULT, &texture\r
+                )\r
+        )\r
+    )\r
+    {\r
+               throw std::runtime_error("Failed --- D3DXCreateTexture");\r
+       }\r
+\r
+   \r
+\r
+       // \83e\83N\83X\83`\83\83\82É\83t\83H\83\93\83g\83r\83b\83g\83}\83b\83v\8f\91\82«\8d\9e\82Ý\r
+       D3DLOCKED_RECT LockedRect;\r
+       if(FAILED(hr = texture->LockRect(0, &LockedRect, NULL, D3DLOCK_DISCARD))){\r
+               throw std::runtime_error("Failed --- LockRect");\r
+       }\r
+\r
+       // \83t\83H\83\93\83g\8fî\95ñ\82Ì\8f\91\82«\8d\9e\82Ý\r
+       \r
+       FillMemory(LockedRect.pBits , LockedRect.Pitch * tHeight , 0);\r
+       for(unsigned int y = 0 ; y < m_pPixelMap->shape()[1] ; y++){\r
+               for(unsigned int x = 0 ; x < m_pPixelMap->shape()[0] ; x++){\r
+                       memcpy((BYTE*)LockedRect.pBits + LockedRect.Pitch * y + 4 * x , &((*m_pPixelMap)[x][y]) , sizeof(DWORD));\r
+               }\r
+       }\r
+\r
+       \r
+       texture->UnlockRect(0);\r
+       return texture;\r
+\r
+\r
+}\r
+\r
diff --git a/moftmp/PlainWidgetView.cpp b/moftmp/PlainWidgetView.cpp
new file mode 100755 (executable)
index 0000000..74959f9
--- /dev/null
@@ -0,0 +1,128 @@
+#include "mof/PlainWidgetView.hpp"\r
+#include "mof/GraphicsDevice.hpp"\r
+#include "mof/Sprite.hpp"\r
+#include "mof/mofAnimations.hpp"\r
+#include "mof/Font.hpp"\r
+\r
+\r
+struct mof::PlainWidgetView::Impl{\r
+    mof::Animation<mof::Matrix2D>::Handler transform;\r
+    mof::Animation<bool>::Handler visible;\r
+    mof::FrameNumber frame;\r
+    mof::Rectangle<int> bounds;\r
+    mof::Sprite* pCaption;\r
+    \r
+\r
+    Impl()\r
+        :  frame(0) , \r
+        bounds(mof::Rectangle<int>(0 , 0 , 0 , 0)) , pCaption(NULL)\r
+    {\r
+    }\r
+\r
+    ~Impl(){\r
+        delete pCaption;\r
+    }\r
+};\r
+\r
+\r
+mof::PlainWidgetView::PlainWidgetView\r
+(\r
+    mof::Color begin , mof::Color end\r
+)\r
+: m_pImpl( new Impl( ) )\r
+{\r
+\r
+    \r
+    //m_pImpl->pFrame = new mof::Frame(m_pImpl->pGraphicsDevice , pTexture);\r
+    m_pImpl->transform = mof::makeConstantHandler(mof::Matrix2D::createIdentity());\r
+    {\r
+        //visible\82Ì\90Ý\92è\r
+        m_pImpl->visible = mof::makeConstantHandler(false);\r
+    }\r
+\r
+    //m_pImpl->pCaption = mof::Sprite::createTextSprite(pGraphicsDevice ,  mof::Font(mof::Font::MS_P_GOTHIC , 25) , title );\r
+}\r
+        \r
+mof::PlainWidgetView::~PlainWidgetView(){\r
+\r
+}\r
+\r
+\r
+\r
+void mof::PlainWidgetView::setBounds(const mof::Rectangle<int>& bounds){\r
+    m_pImpl->bounds = bounds;\r
+}\r
+\r
+mof::Rectangle<int> mof::PlainWidgetView::getBounds() const{\r
+    return m_pImpl->transform->getValue(m_pImpl->frame).toBoundingBox();\r
+}\r
+\r
+\r
+\r
+void mof::PlainWidgetView::focus(){\r
+\r
+}\r
+        \r
+void mof::PlainWidgetView::blur(){\r
+\r
+}\r
+\r
+\r
+void mof::PlainWidgetView::show(){\r
+    const int width = m_pImpl->bounds.endX - m_pImpl->bounds.beginX;\r
+    const int height = m_pImpl->bounds.endY - m_pImpl->bounds.beginY;\r
+\r
+    mof::Animation<mof::Matrix2D>::Handler list[] = {\r
+        mof::Animation<mof::Matrix2D>::Handler(mof::makeConstantHandler(mof::Matrix2D::createScaling(mof::Vector2D(width , height)))) ,\r
+        mof::Animation<mof::Matrix2D>::Handler(mof::makeConstantHandler(\r
+            mof::Matrix2D::createTranslation(mof::Vector2D(m_pImpl->bounds.beginX , m_pImpl->bounds.beginY))\r
+            )) \r
+    };\r
+    m_pImpl->transform = mof::Animation<mof::Matrix2D>::Handler(new mof::CascadingAnimation<mof::Matrix2D>(list[0] , list[1]));\r
+    \r
+    {\r
+        //visible\82Ì\90Ý\92è\r
+        m_pImpl->visible = mof::makeConstantHandler(true);\r
+    }\r
+    m_pImpl->frame = 0;\r
+\r
+}\r
+        \r
+void mof::PlainWidgetView::close(){\r
+    const int width = m_pImpl->bounds.endX - m_pImpl->bounds.beginX;\r
+    const int height = m_pImpl->bounds.endY - m_pImpl->bounds.beginY;\r
+\r
+    mof::Animation<mof::Matrix2D>::Handler list[] = {\r
+        mof::Animation<mof::Matrix2D>::Handler(mof::makeConstantHandler(mof::Matrix2D::createScaling(mof::Vector2D(width , height)))) ,\r
+        mof::Animation<mof::Matrix2D>::Handler(mof::makeConstantHandler(\r
+            mof::Matrix2D::createTranslation(mof::Vector2D(m_pImpl->bounds.beginX , m_pImpl->bounds.beginY))\r
+            )) \r
+    };\r
+    m_pImpl->transform = mof::Animation<mof::Matrix2D>::Handler(new mof::CascadingAnimation<mof::Matrix2D>(list[0] , list[1]));\r
+    \r
+    {\r
+        //visible\82Ì\90Ý\92è\r
+        mof::KeyFrameAnimation<bool>::KeyFrame keyFrames[] = {\r
+            mof::makeKeyFrame(0 , true) ,\r
+            mof::makeKeyFrame(20 , false) \r
+        };\r
+        m_pImpl->visible = mof::Animation<bool>::Handler(\r
+            new mof::KeyFrameAnimation<bool>(keyFrames[0] , keyFrames[1] , &mof::stepInterpolate<bool> )\r
+            );\r
+    }\r
+    m_pImpl->frame = 0;\r
+}\r
+\r
+\r
+\r
+void mof::PlainWidgetView::update(){\r
+    m_pImpl->frame++;\r
+    //m_pImpl->pCaption->update();\r
+    \r
+}\r
+        \r
+void mof::PlainWidgetView::draw(){\r
+    if(m_pImpl->visible->getValue(m_pImpl->frame)){\r
+        //m_pImpl->pCaption->draw();\r
+    }\r
+}\r
diff --git a/moftmp/PlainWidgetView.hpp b/moftmp/PlainWidgetView.hpp
new file mode 100755 (executable)
index 0000000..ddd8609
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/WidgetView.hpp"\r
+#include "mof/tstring.hpp"\r
+#include "mof/Color.hpp"\r
+\r
+namespace mof{\r
+       \r
+               \r
+       class PlainWidgetView : public WidgetView{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       public:\r
+               PlainWidgetView( mof::Color begin , mof::Color end);\r
+               ~PlainWidgetView();\r
+\r
+               virtual void setBounds(const mof::Rectangle<int>& bounds);\r
+               virtual mof::Rectangle<int> getBounds() const;\r
+\r
+               virtual void show();\r
+               virtual void close();\r
+               virtual void focus();\r
+               virtual void blur();\r
+\r
+               virtual void update();\r
+               virtual void draw();\r
+       };\r
+\r
+}\r
diff --git a/moftmp/Rectangle.hpp b/moftmp/Rectangle.hpp
new file mode 100755 (executable)
index 0000000..8c642da
--- /dev/null
@@ -0,0 +1,72 @@
+#pragma once\r
+#include <iostream>\r
+\r
+namespace mof\r
+{\r
+       template<typename E>\r
+       struct Rectangle\r
+       {\r
+               E beginX;\r
+               E beginY;\r
+               E endX;\r
+               E endY;\r
+\r
+               Rectangle(){}\r
+\r
+        template< typename T >\r
+        Rectangle(const Rectangle<T>& obj)\r
+        {   \r
+            beginX = obj.beginX;\r
+            beginY = obj.beginY;\r
+            endX   = obj.endX;\r
+            endY   = obj.endY;\r
+        }\r
+\r
+               Rectangle(const E& beginX_ , const E& beginY_ , const E& endX_ , const E& endY_)\r
+                       : beginX(beginX_) , beginY(beginY_) , endX(endX_) , endY(endY_)\r
+               {\r
+               }\r
+        \r
+        template< typename T >\r
+        Rectangle& operator = ( const Rectangle<T>& obj )\r
+        {   \r
+            beginX = obj.beginX;\r
+            beginY = obj.beginY;\r
+            endX   = obj.endX;\r
+            endY   = obj.endY;\r
+            return *this;\r
+        }\r
+\r
+        E getWidth( ) const\r
+        {\r
+            E width = endX - beginX;\r
+            return width < 0 ? -width : width;\r
+        }\r
+        \r
+        E getHeight( ) const\r
+        {\r
+            E height = endY - beginY;\r
+            return height < 0 ? -height : height;\r
+        }\r
+\r
+\r
+               bool operator ==(const mof::Rectangle<E>& rect){\r
+                       if(\r
+                               beginX == rect.beginX &&\r
+                               beginY == rect.beginY &&\r
+                               endX == rect.endX &&\r
+                               endY == rect.endY )return true;\r
+                       else return false;\r
+               }\r
+\r
+       \r
+       };\r
+\r
+       template<typename E>\r
+       std::ostream& operator <<(std::ostream& os , const mof::Rectangle<E>& rect){\r
+               os << '(' << rect.beginX << ',' << rect.beginY << ','\r
+                       << rect.endX << ',' << rect.endY << ')';\r
+               return os;      \r
+       }\r
+       \r
+}\r
diff --git a/moftmp/ResourceManager.hpp b/moftmp/ResourceManager.hpp
new file mode 100755 (executable)
index 0000000..34b810b
--- /dev/null
@@ -0,0 +1,134 @@
+#pragma once\r
+#include "mof/tstring.hpp"\r
+#include <map>\r
+#include <list>\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+namespace mof{\r
+       \r
+       \r
+\r
+       /** \83\8a\83\\81[\83X\82Ì\83v\81[\83\8b\81A\92x\89\84\83\8d\81[\83h\8b@\94\\82ð\92ñ\8b\9f\82·\82é\83e\83\93\83v\83\8c\81[\83g\r
+        *\r
+        *\r
+       */\r
+       template <class T >\r
+       class ResourceManager\r
+       {\r
+               typedef std::list<boost::shared_ptr<ResourceManager<T > > > MANAGER_LIST;\r
+               typedef std::map<mof::tstring , boost::shared_ptr<T>> RESOURCE_MAP;\r
+               \r
+\r
+        ResourceManager<T>* m_pParent;\r
+               RESOURCE_MAP m_resources;\r
+               MANAGER_LIST m_children;\r
+       \r
+               static boost::shared_ptr<T> nullPtr;\r
+               //void addResouce(Resouce* pResource);\r
+       public:\r
+               ResourceManager();\r
+               virtual ~ResourceManager(void);\r
+\r
+               boost::shared_ptr<T>& getResource(tstring& name );\r
+               boost::shared_ptr<T>& getResource(const TCHAR * const name );\r
+               void addResource(const TCHAR * const name , boost::shared_ptr<T>& resource);\r
+        boost::shared_ptr< ResourceManager<T> > createChild();\r
+       };\r
+\r
+\r
+\r
+       template <class T>\r
+       boost::shared_ptr<T> ResourceManager<T>::nullPtr = boost::shared_ptr<T>();\r
+\r
+\r
+\r
+       /** \90e\82È\82µ\82Æ\82µ\82Ä\83I\83u\83W\83F\83N\83g\90\90¬\r
+        *\r
+        */\r
+       template <class T >\r
+       ResourceManager<T >::ResourceManager( ){\r
+               m_pParent = NULL;\r
+       }\r
+\r
+       /** \8e©\90g\82Ì\83\8a\83\\81[\83X\82Æ\8eq\82ð\89ð\95ú\82µ\81A\90e\82Ì\8eq\83\8a\83X\83g\82©\82ç\8e©\90g\82ð\8dí\8f\9c\r
+        */\r
+       template <class T  >\r
+       ResourceManager<T >::~ResourceManager(){\r
+               //\8e©\90g\82Ì\8aÇ\97\9d\82·\82é\83\8a\83\\81[\83X\82ð\83A\83\93\83\8d\81[\83h\r
+        m_resources.clear();\r
+\r
+               //\8eq\83I\83u\83W\83F\83N\83g\82ð\8dí\8f\9c\r
+        m_children.clear();\r
+                       \r
+               //\90e\82©\82ç\8e©\90g\82ð\8dí\8f\9c\r
+               if(m_pParent != NULL){\r
+                       for(MANAGER_LIST::iterator itr = m_pParent->m_children.begin() ; itr != m_pParent->m_children.end() ; ++itr){\r
+                               if(this == itr->get() ){\r
+                                       m_pParent->m_children.erase(itr);\r
+                                       return;\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       \r
+\r
+       /** \90V\82½\82È\8eq\82ð\92Ç\89Á\82µ\81A\95Ô\82·\r
+        * @return \90\90¬\82µ\82½\8eq\r
+        */\r
+       template <class T  >\r
+       boost::shared_ptr< ResourceManager<T> > ResourceManager<T >::createChild(){\r
+        boost::shared_ptr< ResourceManager<T > > manager(new ResourceManager<T>( ));\r
+               manager->m_pParent = this;\r
+               m_children.push_back(manager);\r
+               return manager;\r
+       }\r
+\r
+       \r
+       /** \96Ø\8d\\91¢\91S\91Ì\82©\82ç\8ew\92è\82³\82ê\82½\96¼\91O\82Ì\83\8a\83\\81[\83X\82ð\8c\9f\8dõ\81E\8eæ\93¾<br>\r
+        * \8c©\82Â\82©\82ç\82È\82¯\82ê\82Î\81A\88ø\90\94\82ð\8c³\82É\90V\82½\82É\90\90¬\82·\82é\81B\r
+        * @param name \83\8a\83\\81[\83X\96¼\r
+        * @param parameter \83\8a\83\\81[\83X\8dì\90¬\8e\9e\82Ì\88ø\90\94\81i\8ew\92è\82µ\82È\82­\82Ä\82à\82æ\82¢\81\r
+        * @return \97v\8b\81\82³\82ê\82½\83\8a\83\\81[\83X\r
+        */\r
+       template <class T >\r
+       boost::shared_ptr<T>& ResourceManager<T >::getResource(mof::tstring& name){\r
+               //\8e©\95ª\82Ì\83\8a\83X\83g\82©\82ç\92T\82·\r
+               RESOURCE_MAP::const_iterator n = m_resources.find(name);\r
+               if (n != m_resources.end()){\r
+                       return (boost::shared_ptr<T>&)n->second;\r
+               }\r
+               \r
+               //\8eq\82Ì\83\8a\83X\83g\82©\82ç\92T\82·\r
+\r
+               //\90e\82Ì\83\8a\83X\83g\82©\82ç\92T\82·\r
+\r
+               //\82È\82¯\82ê\82Î\8dì\90¬\82·\82é\r
+               boost::shared_ptr<T> resource( new T( name ) );\r
+               //DEBUG_PRINT(resource->getName() << _T("\82ª\90\90¬\82³\82ê\82Ü\82µ\82½") );\r
+               m_resources.insert(RESOURCE_MAP::value_type(name , resource));\r
+               n = m_resources.find(name);\r
+               return (boost::shared_ptr<T>&)n->second;\r
+       }\r
+\r
+       \r
+\r
+       template <class T >\r
+       boost::shared_ptr<T>& ResourceManager<T >::getResource(const TCHAR* const name){\r
+               return getResource(mof::tstring(name));\r
+       }\r
+       \r
+       template <class T>\r
+       void ResourceManager<T>::addResource(const TCHAR* const name , boost::shared_ptr<T>& resource){\r
+               m_resources.insert(RESOURCE_MAP::value_type(mof::tstring(name) , resource));\r
+       }\r
+\r
+\r
+       /*template <class T , typename K >\r
+       boost::shared_ptr<T>& ResourceManager<T , K>::findResource(mof::tstring& name , K parameter){\r
+\r
+       }*/\r
+\r
+\r
+};\r
diff --git a/moftmp/SceneGraph.hpp b/moftmp/SceneGraph.hpp
new file mode 100755 (executable)
index 0000000..8cc3161
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef SCENE_GRAPH_HPP\r
+#define SCENE_GRAPH_HPP\r
+\r
+\r
+\r
+namespace mof{\r
+\r
+\r
+\r
+class SceneGraph \r
+{\r
+public:\r
+       virtual ~SceneGraph(){}\r
+       virtual bool isVisible() const = 0;\r
+       virtual void update() = 0;\r
+       virtual void draw() const = 0;\r
+       //virtual bool isDisposable() const = 0;\r
+\r
+};\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/SelectionModel.cpp b/moftmp/SelectionModel.cpp
new file mode 100755 (executable)
index 0000000..6941b78
--- /dev/null
@@ -0,0 +1,73 @@
+#include "mof/SelectionModel.h"\r
+#include "mof/ConsoleIO.h"\r
+\r
+mof::SelectionModel::SelectionModel( std::vector<mof::Window*>& selectables , mof::AnimationResource& pMenuAnimation , int nColumns)\r
+{\r
+       m_nColumns = nColumns;\r
+       m_pMenuAnimation = pMenuAnimation;\r
+       m_selectables = selectables;\r
+       m_selectingIndex = 0;\r
+       m_selectables.at(m_selectingIndex)->setFocused(true);\r
+\r
+}\r
+\r
+mof::SelectionModel::~SelectionModel(){\r
+       \r
+}\r
+\r
+void mof::SelectionModel::next(){\r
+       if(m_pMenuAnimation.get() != NULL && !m_pMenuAnimation->isFinalized())return;\r
+       m_selectables.at(m_selectingIndex)->setFocused(false);\r
+       m_selectingIndex = (m_selectingIndex+1)%m_selectables.size();\r
+       m_selectables.at(m_selectingIndex)->setFocused(true);\r
+}\r
+\r
+void mof::SelectionModel::previous(){\r
+       if(m_pMenuAnimation.get() != NULL && !m_pMenuAnimation->isFinalized())return;\r
+       m_selectables.at(m_selectingIndex)->setFocused(false);\r
+       m_selectingIndex = (m_selectingIndex == 0)? m_selectables.size()-1 : m_selectingIndex-1;\r
+       m_selectables.at(m_selectingIndex)->setFocused(true);\r
+\r
+}\r
+\r
+void mof::SelectionModel::up(){\r
+       if(m_pMenuAnimation.get() != NULL && !m_pMenuAnimation->isFinalized())return;\r
+       m_selectables.at(m_selectingIndex)->setFocused(false);\r
+       m_selectingIndex = (m_selectingIndex - m_nColumns);\r
+       if(m_selectingIndex < 0)m_selectingIndex += m_selectables.size();\r
+       m_selectables.at(m_selectingIndex)->setFocused(true);\r
+}\r
+\r
+void mof::SelectionModel::down(){\r
+       if(m_pMenuAnimation.get() != NULL && !m_pMenuAnimation->isFinalized())return;\r
+       m_selectables.at(m_selectingIndex)->setFocused(false);\r
+       m_selectingIndex = (m_selectingIndex + m_nColumns)% m_selectables.size();\r
+       m_selectables.at(m_selectingIndex)->setFocused(true);\r
+}\r
+\r
+void mof::SelectionModel::left(){\r
+       if(m_pMenuAnimation.get() != NULL && !m_pMenuAnimation->isFinalized())return;\r
+       m_selectables.at(m_selectingIndex)->setFocused(false);\r
+       m_selectingIndex += (m_selectingIndex % m_nColumns == 0)?  m_nColumns-1 : -1;\r
+       m_selectables.at(m_selectingIndex)->setFocused(true);\r
+}\r
+\r
+void mof::SelectionModel::right(){\r
+       if(m_pMenuAnimation.get() != NULL && !m_pMenuAnimation->isFinalized())return;\r
+       m_selectables.at(m_selectingIndex)->setFocused(false);\r
+       m_selectingIndex += (m_selectingIndex % m_nColumns == m_nColumns-1)?  -(m_selectingIndex % m_nColumns) : 1;\r
+       m_selectables.at(m_selectingIndex)->setFocused(true);\r
+}\r
+\r
+\r
+int mof::SelectionModel::getSelectingIndex(){\r
+       return m_selectingIndex;\r
+}\r
+\r
+mof::Window* mof::SelectionModel::getSelectingItem(){\r
+       return m_selectables.at(m_selectingIndex);\r
+}\r
+\r
+void mof::SelectionModel::setMenuAnimation(mof::AnimationResource& pMenuAnimation){\r
+       m_pMenuAnimation = pMenuAnimation;\r
+}\r
diff --git a/moftmp/SelectionModel.h b/moftmp/SelectionModel.h
new file mode 100755 (executable)
index 0000000..1f48f30
--- /dev/null
@@ -0,0 +1,34 @@
+#pragma once\r
+#include "mof/Window.h"\r
+#include <vector>\r
+\r
+namespace mof{\r
+       \r
+       class SelectionModel {\r
+       \r
+               mof::AnimationResource m_pMenuAnimation;\r
+               std::vector<mof::Window*> m_selectables;\r
+               int m_selectingIndex;\r
+               int m_nColumns;\r
+       public:\r
+               SelectionModel( std::vector<mof::Window*>& selectables , mof::AnimationResource& pOpenedAnimation , int nColumn = 1);\r
+               ~SelectionModel();\r
+\r
+\r
+               void next();\r
+               void previous();\r
+\r
+               void up();\r
+               void down();\r
+               void left();\r
+               void right();\r
+\r
+               int getSelectingIndex();\r
+               Window* getSelectingItem();\r
+               void setMenuAnimation(mof::AnimationResource& pMenuAnimation);\r
+       \r
+\r
+               \r
+       };\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/Sprite.cpp b/moftmp/Sprite.cpp
new file mode 100755 (executable)
index 0000000..1489475
--- /dev/null
@@ -0,0 +1,192 @@
+#include "mof/Sprite.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/stream/Constant.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/Font.hpp"\r
+\r
+namespace mof\r
+{\r
+    struct Sprite::Impl{\r
+           boost::shared_ptr<Texture> pTexture;\r
+\r
+           Impl()\r
+           {\r
+           }\r
+\r
+           ~Impl(){\r
+       }\r
+    };\r
+\r
+    Sprite::Sprite\r
+    (\r
+           const Rectangle<int>& rect ,\r
+           const boost::shared_ptr<Texture>& pTexture , \r
+           const Rectangle<float>& tRect \r
+       )\r
+    : \r
+        m_pImpl( new Impl( ) ) ,\r
+        Component2D( rect ) ,\r
+        TextureComponent( tRect ) \r
+    {\r
+           m_pImpl->pTexture = pTexture;\r
+    }\r
+\r
+\r
+    Sprite::Sprite\r
+    (\r
+           const boost::shared_ptr<Texture>& pTexture , \r
+           const Rectangle<float>& tRect \r
+       )\r
+    : \r
+        m_pImpl(new Impl()) ,\r
+        Component2D( Rectangle<int>( 0 , 0 , pTexture->getWidth() , pTexture->getHeight() ) ) ,\r
+        TextureComponent( tRect ) \r
+    {\r
+           m_pImpl->pTexture = pTexture;\r
+    }\r
+\r
+\r
+    Sprite::~Sprite()\r
+    {\r
+    }   \r
+\r
+    void Sprite::update()\r
+    {\r
+        m_textureStream.update();\r
+        m_colorStream.update();\r
+        m_sizeStream.update();\r
+        m_positionStream.update();\r
+    }\r
+\r
+    void Sprite::draw() const\r
+    {\r
+           static VertexXYZRHWCUV vertices[4];\r
+       \r
+           Rectangle<float> textureCoordinates = m_textureStream.value( );\r
+           Color color = m_colorStream.value( ).toColorCode( );\r
+        \r
+        //textureCoordinates = mof::Rectangle<float>( 0 , 0 , 0.625 , 0.546875 );\r
+        Vector2D position = m_positionStream.value( );\r
+        Vector2D size = m_sizeStream.value( );\r
+        Vector2D begin = Vector2D( position.x , position.y );\r
+           Vector2D end = begin + Vector2D( size.x , size.y );\r
+        \r
+        vertices[0].x = static_cast<float>(begin.x);\r
+           vertices[0].y = static_cast<float>(begin.y);\r
+           vertices[0].z = 0;\r
+           vertices[0].rhw = 1;\r
+           vertices[0].color = color;\r
+           vertices[0].tu = textureCoordinates.beginX;\r
+           vertices[0].tv = textureCoordinates.beginY;\r
+\r
+           vertices[1].x = static_cast<float>(end.x);\r
+           vertices[1].y = static_cast<float>(begin.y);\r
+           vertices[1].z = 0;\r
+           vertices[1].rhw = 1;\r
+           vertices[1].color = color;\r
+           vertices[1].tu = textureCoordinates.endX;\r
+           vertices[1].tv = textureCoordinates.beginY;\r
+\r
+           vertices[2].x = static_cast<float>(begin.x);\r
+       vertices[2].y = static_cast<float>(end.y);\r
+       vertices[2].z = 0;\r
+       vertices[2].rhw = 1;\r
+       vertices[2].color = color;\r
+       vertices[2].tu = textureCoordinates.beginX;\r
+       vertices[2].tv = textureCoordinates.endY;\r
+\r
+       vertices[3].x = static_cast<float>(end.x);\r
+       vertices[3].y = static_cast<float>(end.y);\r
+       vertices[3].z = 0;\r
+       vertices[3].rhw = 1;\r
+           vertices[3].color = color;\r
+           vertices[3].tu = textureCoordinates.endX;\r
+       vertices[3].tv = textureCoordinates.endY;\r
+\r
+       GraphicsDevice::setTexture(m_pImpl->pTexture.get());\r
+       GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , PRIMITIVE_TYPE_TRIANGLESTRIP);\r
+        \r
+    }\r
+\r
+    void Sprite::setPositionStream( const Vector2DStream& stream )\r
+    {\r
+        m_positionStream = stream;\r
+    }\r
+    \r
+    void Sprite::setSizeStream( const Vector2DStream& stream )\r
+    {\r
+        m_sizeStream = stream;\r
+    }\r
+\r
+\r
+    void Sprite::append\r
+    (\r
+           std::vector<VertexXYZRHWCUV>& list ,\r
+           const Rectangle<float>& region , \r
+       Color color , \r
+       const Rectangle<float>& textureCoordinates\r
+       )\r
+    {\r
+           list.push_back\r
+        (\r
+               VertexXYZRHWCUV(Vector2D(region.beginX , region.beginY) , \r
+               color , textureCoordinates.beginX , textureCoordinates.beginY)\r
+           );\r
+\r
+           list.push_back\r
+        (\r
+                   VertexXYZRHWCUV(Vector2D(region.endX , region.beginY) , \r
+                   color , textureCoordinates.endX , textureCoordinates.beginY)\r
+               );\r
+\r
+           list.push_back\r
+        (\r
+                   VertexXYZRHWCUV(Vector2D(region.beginX , region.endY) , \r
+                   color , textureCoordinates.beginX , textureCoordinates.endY)\r
+               );\r
+\r
+           list.push_back\r
+        (\r
+                   VertexXYZRHWCUV(Vector2D(region.beginX , region.endY) , \r
+               color , textureCoordinates.beginX , textureCoordinates.endY)\r
+               );\r
+\r
+           list.push_back\r
+        (\r
+                   VertexXYZRHWCUV(Vector2D(region.endX , region.beginY) , \r
+                   color , textureCoordinates.endX , textureCoordinates.beginY)\r
+               );\r
+\r
+\r
+           list.push_back\r
+        (\r
+                   VertexXYZRHWCUV(Vector2D(region.endX , region.endY) , \r
+                   color , textureCoordinates.endX , textureCoordinates.endY)\r
+               );\r
+\r
+    }\r
+\r
+    Sprite* Sprite::createTextSprite( const Font& font , const tstring& text)\r
+    {\r
+           boost::shared_ptr<PixelMap> pPixelMap( font.createText(text) );\r
+           boost::shared_ptr<Texture> pTexture(new Texture( pPixelMap));\r
+\r
+        return new Sprite\r
+        (\r
+                   Rectangle<int>( 0 , 0 , pPixelMap->shape()[0] ,  pPixelMap->shape()[1]) ,\r
+                   pTexture ,\r
+               Rectangle<real>\r
+            (\r
+                           0 , 0 , \r
+                static_cast<real>(pPixelMap->shape()[0]) / pTexture->getWidth() ,\r
+                           static_cast<real>(pPixelMap->shape()[1]) / pTexture->getHeight() \r
+            )\r
+               );\r
+\r
+    }\r
+\r
+\r
+} // namespace mof\r
+\r
+\r
+\r
diff --git a/moftmp/Sprite.hpp b/moftmp/Sprite.hpp
new file mode 100755 (executable)
index 0000000..46ec146
--- /dev/null
@@ -0,0 +1,69 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/Rectangle.hpp"\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/Texture.hpp"\r
+#include "mof/VertexTypes.hpp"\r
+#include "mof/stream/Manipulator.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+#include "mof/Component2D.hpp"\r
+#include "mof/ColorComponent.hpp"\r
+#include "mof/TextureComponent.hpp"\r
+#include "mof/Drawable.hpp"\r
+#include <vector>\r
+\r
+\r
+namespace mof{\r
+       \r
+       class Font;\r
+\r
+       class Sprite\r
+    : \r
+        public Component2D ,\r
+        public ColorComponent ,\r
+        public TextureComponent ,\r
+        public Drawable\r
+    {\r
+\r
+       public : \r
+               Sprite\r
+        (\r
+                       const Rectangle<int>& rect ,\r
+                       const boost::shared_ptr<Texture>& pTexture ,\r
+                       const Rectangle<real>& tRect\r
+               );\r
+\r
+               Sprite\r
+        (\r
+                       const boost::shared_ptr<Texture>& pTexture ,\r
+                       const Rectangle<real>& tRect\r
+       );\r
+\r
+               virtual ~Sprite();\r
+               virtual void update();\r
+               virtual void draw() const;\r
+        virtual void setPositionStream( const Vector2DStream& stream );\r
+        virtual void setSizeStream( const Vector2DStream& stream );\r
+\r
+\r
+\r
+               static void append\r
+        (\r
+                       std::vector<VertexXYZRHWCUV>& list ,\r
+                       const Rectangle<float>& region , \r
+                       Color color ,\r
+                       const Rectangle<real>& textureCoordinates\r
+               );\r
+\r
+               static Sprite* createTextSprite\r
+        (\r
+                       const Font& font , \r
+                       const tstring& text\r
+               );\r
+    private:\r
+        struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+\r
+} // namespace mof\r
diff --git a/moftmp/TextCompiler.cpp b/moftmp/TextCompiler.cpp
new file mode 100755 (executable)
index 0000000..afbcf6a
--- /dev/null
@@ -0,0 +1,42 @@
+#include "mof/TextCompiler.hpp"\r
+#include <boost/regex.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+namespace {\r
+       enum NodeType{\r
+               PLANE ,\r
+               NEWLINE\r
+       } ;\r
+\r
+       struct Node{\r
+               mof::tstring subtext;\r
+               NodeType type;\r
+       };\r
+\r
+}\r
+\r
+void recursive(const mof::tstring& text , std::vector<mof::Sprite*>& result, const mof::Font& font){\r
+       boost::basic_regex<TCHAR> regex("(.*)<\\s*nl\\s*/\\s*>(.*)");\r
+       boost::smatch results;\r
+       if(boost::regex_search(text , results , regex)){\r
+               if( results.str(1).length() != 0)recursive(results.str(1) , result , font);\r
+               if( results.str(2).length() != 0)recursive(results.str(2) , result , font);\r
+       }\r
+       else {\r
+               result.push_back(mof::Sprite::createTextSprite(font , text) );\r
+       }\r
+}\r
+       \r
+bool mof::compileText\r
+(\r
+       const mof::tstring       &text ,\r
+       const mof::Font          &font ,\r
+       std::vector<mof::Sprite*> &result \r
+){\r
+       \r
+       recursive(text , result , font);\r
+       \r
+\r
+\r
+       return true;\r
+}
\ No newline at end of file
diff --git a/moftmp/TextCompiler.hpp b/moftmp/TextCompiler.hpp
new file mode 100755 (executable)
index 0000000..d4493e9
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <vector>\r
+#include "mof/Sprite.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/Font.hpp"\r
+#include "mof/tstring.hpp"\r
+\r
+namespace mof{\r
+\r
+       \r
+       bool compileText(\r
+               const mof::tstring& text , \r
+               const mof::Font& font , \r
+               std::vector<mof::Sprite*>& result\r
+               );\r
+\r
+}\r
diff --git a/moftmp/TextView.cpp b/moftmp/TextView.cpp
new file mode 100755 (executable)
index 0000000..3da8e46
--- /dev/null
@@ -0,0 +1,184 @@
+#include "mof/TextView.hpp"\r
+#include "mof/MenuItemInfo.hpp"\r
+#include "mof/Sprite.hpp"\r
+#include "mof/Effect.hpp"\r
+#include "mof/Frame.hpp"\r
+#include "mof/mofAnimations.hpp"\r
+#include "mof/utilities.hpp"\r
+\r
+namespace mof\r
+{\r
+    struct TextView::Impl\r
+    {\r
+        mof::Font font;\r
+        mof::tstring caption;\r
+        mof::Effect* pEffect;\r
+        mof::Vector2D scaling;\r
+        mof::Frame* pFrame;\r
+\r
+        Impl(const mof::tstring& _caption , const mof::Font& _font)\r
+            :  font(_font) , caption(_caption) , pEffect(NULL) , pFrame( NULL )\r
+        {\r
+\r
+        }\r
+\r
+\r
+        ~Impl(){\r
+            delete pEffect;\r
+        }\r
+    };\r
+//{{{ TextView\r
+    TextView::TextView(const mof::tstring& caption  , const mof::Font& font)\r
+    : m_pImpl(new Impl(caption  , font))\r
+    {\r
+        m_pImpl->pEffect = new mof::Effect();\r
+    }\r
+//}}}\r
+//{{{ ~TextView \r
+    TextView::~TextView( )\r
+    {\r
+    }\r
+//}}}\r
+//{{{ initialize\r
+    mof::Rectangle<int> TextView::initialize( )\r
+    {\r
+\r
+            \r
+        mof::Sprite* pSprite = mof::Sprite::createTextSprite\r
+        (\r
+            m_pImpl->font , m_pImpl->caption\r
+        );\r
+\r
+        m_pImpl->pEffect->addSprite(_T("text") , pSprite);\r
+        m_pImpl->scaling = pSprite->getWorldTransform().mof::Matrix2D::getDiagonal();\r
+\r
+        {\r
+            //color\r
+            pSprite->setColor( mof::makeConstantHandler(mof::Color4f(0 , 1 , 1 , 1)) );\r
+        }\r
+        mof::Rectangle<int> bounds = pSprite->getWorldTransform().toBoundingBox();\r
+        \r
+        boost::shared_ptr<mof::Texture> pTexture(new mof::Texture( _T("image/frame3.png") ));\r
+        m_pImpl->pFrame = new mof::Frame( pTexture );\r
+        m_pImpl->pEffect->addDrawable( _T("bg") , m_pImpl->pFrame );\r
+        m_pImpl->pFrame->setRegion( mof::Rectangle<int>( 100 , 100 , 200 , 132 ) );\r
+        return bounds;\r
+    }\r
+//}}}\r
+//{{{ show\r
+    void TextView::show( )\r
+    {\r
+        mof::Sprite* pText = m_pImpl->pEffect->getSpriteByName(_T("text"));\r
+        {\r
+            //color\r
+            mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] =\r
+            {\r
+                mof::makeKeyFrame( 0 , mof::Color4f(0 , 1, 1 , 1) ),\r
+                mof::makeKeyFrame( 30 , mof::Color4f(1 , 1, 1 , 1) )\r
+            };\r
+            mof::Animation<mof::Color4f>::Handler handler\r
+            (\r
+                new mof::KeyFrameAnimation<mof::Color4f>\r
+                (\r
+                    keyFrames[0] , keyFrames[1] \r
+                )\r
+            );\r
+            pText->setColor( handler );\r
+            pText->setFrameNumber( 0 );\r
+        }\r
+\r
+    }\r
+//}}}\r
+//{{{ close\r
+    void mof::TextView::close(){\r
+        mof::Sprite* pText = m_pImpl->pEffect->getSpriteByName(_T("text"));\r
+        {\r
+            //color\r
+            mof::Sprite* pText = m_pImpl->pEffect->getSpriteByName(_T("text"));\r
+            mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] = {\r
+                mof::makeKeyFrame( 0 , mof::Color4f(1 , 1, 1 , 1) ),\r
+                mof::makeKeyFrame( 10 , mof::Color4f(0 , 1, 1 , 1) )\r
+            };\r
+            mof::Animation<mof::Color4f>::Handler handler(new mof::KeyFrameAnimation<mof::Color4f>(\r
+                keyFrames[0] , keyFrames[1] \r
+                ));\r
+            pText->setColor( handler );\r
+            pText->setFrameNumber(0);\r
+        }\r
+    }\r
+//}}}\r
+//{{{ focus\r
+    void mof::TextView::focus( ) \r
+    {\r
+    }\r
+//}}}\r
+//{{{ blur\r
+    void mof::TextView::blur()\r
+    {\r
+    }\r
+//}}}\r
+//{{{ setPosition\r
+    void mof::TextView::setPosition\r
+    (\r
+        const mof::Animation<mof::Matrix2D>::Handler& handler    \r
+    ) \r
+    {\r
+        mof::Sprite* pText = m_pImpl->pEffect->getSpriteByName(_T("text"));\r
+        mof::Animation<mof::Matrix2D>::Handler cascading[] = {\r
+            mof::makeConstantHandler<mof::Matrix2D>(mof::Matrix2D::createScaling(m_pImpl->scaling)) , \r
+            handler\r
+        };\r
+        mof::Animation<mof::Matrix2D>::Handler pAnimation(\r
+            new mof::CascadingAnimation<mof::Matrix2D>(cascading[0] , cascading[1])\r
+            );\r
+        pText->setWorldTransform(pAnimation);\r
+        /*pText->setWorldTransform(\r
+            mof::cascadingHandler2(\r
+                mof::Multiply<mof::Matrix2D> cascaor ,\r
+                mof::makeConstantHandler<mof::Matrix2D>(mof::Matrix2D::createScaling(m_pImpl->scaling)) , \r
+                handler\r
+            ));*/\r
+    }\r
+//}}}\r
+//{{{ setWorldTransform\r
+    void mof::TextView::setWorldTransform\r
+    (\r
+        const mof::Animation<mof::Matrix2D>::Handler& handler    \r
+    ) \r
+    {\r
+        mof::Sprite* pText = m_pImpl->pEffect->getSpriteByName(_T("text"));\r
+        pText->setWorldTransform( handler );\r
+        \r
+    }\r
+//}}}\r
+//{{{ setBounds\r
+    void mof::TextView::setBounds( const mof::Rectangle<int>& bounds )\r
+    {\r
+        mof::Sprite* pText = m_pImpl->pEffect->getSpriteByName(_T("text"));\r
+        //m_pImpl->scaling = mof::Vector2D( bounds.endX - bounds.beginX , bounds.endY - bounds.beginY );\r
+        mof::Vector2D translation( bounds.beginX , bounds.beginY );\r
+        mof::Animation<mof::Matrix2D>::Handler cascading[] = \r
+        {\r
+            mof::makeConstantHandler( mof::Matrix2D::createScaling( m_pImpl->scaling ) ) ,\r
+            mof::makeConstantHandler( mof::Matrix2D::createTranslation( translation ) ) ,\r
+        };\r
+        mof::Animation<mof::Matrix2D>::Handler pAnimation(\r
+            new mof::CascadingAnimation<mof::Matrix2D>(cascading[0] , mof::lastOf( cascading ) )\r
+            );\r
+        pText->setWorldTransform(pAnimation);\r
+    }\r
+//}}}\r
+//{{{ getEffect\r
+    const mof::Effect* TextView::getEffect() const\r
+    {\r
+        return m_pImpl->pEffect;\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void mof::TextView::update()\r
+    {\r
+        m_pImpl->pEffect->update();\r
+\r
+    }\r
+//}}}\r
+}\r
diff --git a/moftmp/TextView.hpp b/moftmp/TextView.hpp
new file mode 100755 (executable)
index 0000000..5917f11
--- /dev/null
@@ -0,0 +1,44 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/MenuView.hpp"\r
+#include "mof/tstring.hpp"\r
+#include "mof/Font.hpp"\r
+\r
+namespace mof\r
+{\r
+\r
+\r
+       class TextView : public MenuView \r
+    {\r
+       public:\r
+        TextView( const mof::tstring& caption , const mof::Font& font );\r
+               virtual ~TextView();\r
+               virtual mof::Rectangle<int> initialize();\r
+               virtual void show();\r
+               virtual void close();\r
+               virtual void focus();\r
+               virtual void blur();\r
+               /* diprecated */\r
+        virtual void setPosition\r
+        (\r
+                       const mof::Animation<mof::Matrix2D>::Handler& handler   \r
+        );\r
+        void setBounds( const mof::Rectangle<int>& bounds );\r
+\r
+        /* candidate */\r
+        virtual void setWorldTransform\r
+        (\r
+                       const mof::Animation<mof::Matrix2D>::Handler& handler   \r
+        );\r
+\r
+               virtual const mof::Effect* getEffect() const;\r
+               virtual void update();\r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+       \r
+       };\r
+\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/Texture.cpp b/moftmp/Texture.cpp
new file mode 100755 (executable)
index 0000000..1dda016
--- /dev/null
@@ -0,0 +1,53 @@
+#include "mof/private/TextureImpl.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/private/FileTextureBuilder.hpp"\r
+#include "mof/private/PixelMapTextureBuilder.hpp"\r
+\r
+mof::Texture::Texture( const tstring& filename)\r
+: m_pImpl(new Impl())\r
+{\r
+       m_pImpl->pTexture = mof::FileTextureBuilder( filename).create();\r
+       D3DSURFACE_DESC desc;\r
+       m_pImpl->pTexture->GetLevelDesc(0 , &desc);\r
+       m_pImpl->width = desc.Width;\r
+       m_pImpl->height = desc.Height;\r
+}\r
+\r
+mof::Texture::Texture( const boost::shared_ptr<mof::PixelMap>& pPixelMap)\r
+: m_pImpl(new Impl())\r
+{\r
+       m_pImpl->pTexture = mof::PixelMapTextureBuilder( pPixelMap).create();\r
+       D3DSURFACE_DESC desc;\r
+       m_pImpl->pTexture->GetLevelDesc(0 , &desc);\r
+       m_pImpl->width = desc.Width;\r
+       m_pImpl->height = desc.Height;\r
+}\r
+\r
+mof::Texture::~Texture(){}\r
+\r
+boost::shared_ptr<mof::PixelMap> mof::Texture::getPixelMap(){\r
+       typedef mof::PixelMap::size_type size_type;\r
+       boost::array<size_type , 2> sizes = {{getWidth() , getHeight()}};\r
+       \r
+       boost::shared_ptr<mof::PixelMap> pMap(new mof::PixelMap(sizes));\r
+       D3DLOCKED_RECT rect;\r
+       m_pImpl->pTexture->LockRect(0 , &rect , NULL , 0);\r
+       for(int y = 0 ; y < getHeight() ; y++){ \r
+               for(int x = 0 ; x < getWidth() ; x++){\r
+                       BYTE* pPixel = (BYTE*)rect.pBits + x * 4 + y * rect.Pitch;\r
+                       (*pMap)[x][y] = mof::createColor(*(pPixel + 3) , *(pPixel+2) , *(pPixel+1) , *(pPixel));\r
+               }\r
+       }\r
+       m_pImpl->pTexture->UnlockRect(0);\r
+       return pMap;\r
+}\r
+\r
+int mof::Texture::getWidth(){\r
+       return m_pImpl->width;\r
+}\r
+\r
+int mof::Texture::getHeight(){\r
+       return m_pImpl->height;\r
+}\r
+\r
+\r
diff --git a/moftmp/Texture.hpp b/moftmp/Texture.hpp
new file mode 100755 (executable)
index 0000000..b583910
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once\r
+\r
+#include "mof/PixelMap.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+#include <boost/noncopyable.hpp>\r
+#include "mof/GraphicsDevice.hpp"\r
+\r
+namespace mof{\r
+    \r
+       class Texture : boost::noncopyable\r
+       {\r
+           friend void GraphicsDevice::setTexture( const Texture* );\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+               \r
+       public:\r
+               Texture( const tstring& filename );\r
+               Texture( const boost::shared_ptr<mof::PixelMap>& pPixelMap);\r
+               ~Texture();\r
+               \r
+               boost::shared_ptr<mof::PixelMap> getPixelMap();\r
+\r
+               int getWidth();\r
+               int getHeight();\r
+       \r
+       };\r
+}\r
diff --git a/moftmp/TextureComponent.hpp b/moftmp/TextureComponent.hpp
new file mode 100755 (executable)
index 0000000..0923f10
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once\r
+#include "mof/stream/utilities.hpp"\r
+\r
+namespace mof\r
+{\r
+\r
+    class TextureComponent\r
+    {\r
+    public:\r
+        virtual ~TextureComponent( ){}\r
+\r
+        virtual void setRectangleCoordinatesStream( const RectangleStream& stream )\r
+        {\r
+            m_textureStream = stream;\r
+        }\r
+\r
+        virtual const RectangleStream& getRectangleCoordinatesStream( ) const\r
+        {\r
+            return m_textureStream;\r
+        }\r
+\r
+    protected:\r
+        RectangleStream m_textureStream;\r
+\r
+        TextureComponent( )\r
+        : \r
+            m_textureStream( makeConstantHandler( Rectangle< real >( 0 , 0 , 1 , 1 ) ) ) \r
+        {\r
+        }\r
+\r
+        TextureComponent( const Rectangle< real >& rect )\r
+        : \r
+            m_textureStream( makeConstantHandler( rect ) ) \r
+        {\r
+        }\r
+\r
+        TextureComponent( const RectangleStream& stream )\r
+        : \r
+            m_textureStream( stream ) \r
+        {\r
+        }\r
+\r
+    };\r
+\r
+} // namespace mof\r
diff --git a/moftmp/TextureResource.h b/moftmp/TextureResource.h
new file mode 100755 (executable)
index 0000000..8a6233f
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once\r
+\r
+#include "mof/ResourceManager.h"\r
+#include "mof/Texture.h"\r
+#include "mof/Animation.h"\r
+//#include "mof/MultipleAnimation.h"\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof{\r
+       typedef boost::shared_ptr<mof::Texture> TextureResource;\r
+       typedef mof::ResourceManager<mof::Texture> TextureManager;\r
+\r
+       \r
+       \r
+       //typedef boost::shared_ptr<mof::MultipleAnimation> MultipleAnimation;\r
+\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/Timer.cpp b/moftmp/Timer.cpp
new file mode 100755 (executable)
index 0000000..5c50444
--- /dev/null
@@ -0,0 +1,76 @@
+#include "mof/Timer.hpp"\r
+#include <windows.h>\r
+\r
+bool mof::Timer::initialized = false;\r
+\r
+\r
+\r
+mof::Timer::Timer() : m_startTime(timeGetTime()){\r
+       if(!initialized){\r
+               TIMECAPS caps;\r
+               timeGetDevCaps(&caps, sizeof(TIMECAPS)); \r
+               timeBeginPeriod(caps.wPeriodMin);//\8dÅ\8d\82\90«\94\\82Å\8cv\91ª\r
+               initialized = true;\r
+       }\r
+}\r
+\r
+void mof::Timer::reset(){\r
+       m_startTime = timeGetTime();\r
+}\r
+\r
+int mof::Timer::getTime() const{\r
+       return timeGetTime() - m_startTime;\r
+}\r
+\r
+/*\r
+//-----------------------------------------------\r
+// Clock::Clock\r
+// \r
+//-----------------------------------------------\r
+mof::Clock::Clock()\r
+\r
+{\r
+       \r
+       m_begintime = 0;\r
+       \r
+\r
+}\r
+\r
+//-----------------------------------------------\r
+// Clock::SetTimer\r
+// \r
+//-----------------------------------------------\r
+void mof::Clock::setTimer(){\r
+       \r
+       m_begintime =  timeGetTime();\r
+       \r
+\r
+}\r
+\r
+\r
+//-----------------------------------------------\r
+// Clock::GetBetweenTime\r
+// \r
+//-----------------------------------------------\r
+DWORD mof::Clock::getBetweenTime(){\r
+       DWORD temp_time = m_begintime;\r
+       m_begintime = timeGetTime();    \r
+       return m_begintime - temp_time;\r
+\r
+}\r
+\r
+\r
+\r
+//     void StopTimer();\r
+//     DWORD GetAvgTime();\r
+\r
+\r
+//-----------------------------------------------\r
+// Clock::GetFPS\r
+// \82 \82é\83t\83\8c\81[\83\80\90\94\82É\82©\82©\82Á\82½\8e\9e\8aÔ\82©\82ç\81AFPS\82ð\8eZ\8fo\82·\82é\r
+//-----------------------------------------------\r
+float mof::Clock::getFPS(DWORD in_time , UINT in_cnt_frame){\r
+       if(in_time == 0)return 0.0f;//\82O\82Å\8f\9c\8eZ\82ð\89ñ\94ð\r
+       return (float)in_cnt_frame / (float)in_time * 1000.0f;\r
+\r
+}*/\r
diff --git a/moftmp/Timer.hpp b/moftmp/Timer.hpp
new file mode 100755 (executable)
index 0000000..aa63bca
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef TIMER_HPP\r
+#define TIMER_HPP\r
+\r
+#pragma comment(lib , "winmm.lib")\r
+\r
+namespace mof{\r
+\r
+\r
+class Timer{\r
+       int m_startTime;\r
+       static bool initialized;\r
+public:\r
+       Timer();\r
+\r
+       void reset();\r
+       int getTime() const;\r
+\r
+};\r
+\r
+}\r
+\r
+#endif\r
diff --git a/moftmp/Vector2D.cpp b/moftmp/Vector2D.cpp
new file mode 100755 (executable)
index 0000000..0467c32
--- /dev/null
@@ -0,0 +1,75 @@
+\r
+#include "mof/Vector2D.hpp"\r
+\r
+mof::Vector2D::Vector2D(real x_ , real y_)\r
+: x(x_) , y(y_)\r
+{}\r
+\r
+mof::Vector2D::Vector2D(int x_ , int y_)\r
+: x(mof::int2real(x_)) , y(mof::int2real(y_))\r
+{}\r
+\r
+\r
+mof::Vector2D::Vector2D(){\r
+       x = y = 0;\r
+}\r
+\r
+mof::Vector2D::~Vector2D(void)\r
+{\r
+}\r
+\r
+\r
+bool mof::Vector2D::operator == (const mof::Vector2D& obj) const{\r
+       if(x == obj.x && y == obj.y)return true;\r
+       else return false;\r
+}\r
+\r
+bool mof::Vector2D::operator != (const mof::Vector2D& obj) const{\r
+       return !(*this == obj);\r
+}\r
+       \r
+mof::Vector2D mof::Vector2D::operator - () const{\r
+       return mof::Vector2D( -x , -y);\r
+}\r
+       \r
+\r
+\r
+mof::Vector2D mof::Vector2D::operator +( const mof::Vector2D& rhs) const{\r
+       return mof::Vector2D(this->x + rhs.x , this->y + rhs.y);\r
+}\r
+\r
+\r
+mof::Vector2D mof::Vector2D::operator -( const mof::Vector2D& rhs) const{\r
+       return mof::Vector2D(this->x - rhs.x , this->y - rhs.y);\r
+}\r
+               \r
+mof::Vector2D mof::Vector2D::operator *(float rhs) const{\r
+       return mof::Vector2D(this->x * rhs , this->y * rhs);\r
+}\r
+\r
+\r
+mof::Vector2D mof::Vector2D::operator /(float rhs) const{\r
+       return mof::Vector2D(this->x / rhs , this->y / rhs);\r
+}\r
+\r
+\r
+mof::Vector2D mof::operator *(const mof::Vector2D& vec , float f){\r
+       mof::Vector2D obj;\r
+       obj.x = vec.x * f;\r
+       obj.y = vec.y * f;\r
+       return obj;\r
+}\r
+       \r
+mof::Vector2D mof::operator *(float f , const mof::Vector2D& vec ){\r
+       mof::Vector2D obj;\r
+       obj.x = vec.x * f;\r
+       obj.y = vec.y * f;\r
+       return obj;\r
+}\r
+\r
+std::ostream& mof::operator <<(std::ostream& os , const mof::Vector2D& obj)\r
+{\r
+       os << '(' << obj.x << ',' << obj.y << ')';\r
+       return os;      \r
+}\r
+\r
diff --git a/moftmp/Vector2D.hpp b/moftmp/Vector2D.hpp
new file mode 100755 (executable)
index 0000000..f83dd8b
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef VECTOR2D_HPP\r
+#define VECTOR2D_HPP\r
+#include <mof/real.hpp>\r
+#include <iostream>\r
+\r
+namespace mof{\r
+\r
+       struct Vector2D\r
+       {\r
+               real x , y;\r
+       \r
+               Vector2D(real x_ , real y_);\r
+               Vector2D(int x_ , int y_);\r
+               Vector2D();\r
+               ~Vector2D(void);\r
+       \r
+               mof::Vector2D operator +(const mof::Vector2D& rhs) const;\r
+               mof::Vector2D operator -(const mof::Vector2D& rhs) const;\r
+               mof::Vector2D operator *(float rhs) const;\r
+               mof::Vector2D operator /(float rhs) const;\r
+\r
+               bool operator ==(const mof::Vector2D& obj) const;\r
+               bool operator !=(const mof::Vector2D& obj) const;\r
+        mof::Vector2D operator -( ) const;\r
+\r
+               friend mof::Vector2D operator *(const mof::Vector2D& vec , real f);\r
+               friend mof::Vector2D operator *(real f ,  const mof::Vector2D & vec);\r
+           friend std::ostream& operator <<(std::ostream& os , const Vector2D& obj );\r
+\r
+       };\r
+\r
+};\r
+\r
+#endif\r
diff --git a/moftmp/Vector3D.cpp b/moftmp/Vector3D.cpp
new file mode 100755 (executable)
index 0000000..9a9eaef
--- /dev/null
@@ -0,0 +1,72 @@
+  #include "mof/Vector3D.hpp"\r
+  #include <math.h>\r
+  \r
+  mof::Vector3D::Vector3D(real _x , float _y , float _z)\r
+  {\r
+       x = _x;\r
+       y = _y;\r
+       z = _z;\r
+  }\r
+  \r
+  mof::Vector3D::Vector3D(){\r
+       x = y = z = 0.0f;\r
+  }\r
+  \r
+  mof::Vector3D::~Vector3D(void)\r
+  {\r
+  }\r
+  \r
+  \r
+  void mof::Vector3D::normalize(){\r
+       real norm = sqrt(x*x + y*y + z*z);\r
+    if(norm < 1E-7 )return ;\r
+       x = x / norm;\r
+       y = y / norm;\r
+       z = z / norm;\r
+  }\r
+  \r
+  \r
+  bool mof::Vector3D::operator ==(const mof::Vector3D& rhs) const{\r
+       if(x == rhs.x && y == rhs.y && rhs.z == z)return true;\r
+       else return false;\r
+  }\r
+  \r
+  bool mof::Vector3D::operator != (const mof::Vector3D& obj) const{\r
+       return !(*this == obj);\r
+  }\r
+       \r
+  \r
+  mof::Vector3D mof::Vector3D::operator +(const mof::Vector3D& rhs) const{\r
+       return mof::Vector3D(this->x + rhs.x , this->y + rhs.y , this->z + rhs.z);\r
+  }\r
+  \r
+  \r
+  mof::Vector3D mof::Vector3D::operator -(const mof::Vector3D& rhs) const{\r
+       return mof::Vector3D(this->x - rhs.x , this->y - rhs.y , this->z - rhs.z);\r
+  }\r
+               \r
+  mof::Vector3D mof::Vector3D::operator *(real rhs) const{\r
+       return mof::Vector3D(this->x * rhs , this->y * rhs ,this->z * rhs);\r
+  }\r
+  \r
+  \r
+  mof::Vector3D mof::Vector3D::operator /(real rhs) const{\r
+       return mof::Vector3D(this->x / rhs , this->y / rhs , this->z / rhs);\r
+  }\r
\r
+ /*\r
+  mof::Vector3D mof::operator *(const mof::Vector3D& vec , real f){\r
+       mof::Vector3D obj;\r
+       obj.x = vec.x * f;\r
+       obj.y = vec.y * f;\r
+       obj.z = vec.z * f;\r
+       return obj;\r
+  }*/\r
+       \r
+  mof::Vector3D mof::operator *(real f , const mof::Vector3D& vec ){\r
+       mof::Vector3D obj;\r
+       obj.x = vec.x * f;\r
+       obj.y = vec.y * f;\r
+       obj.z = vec.z * f;\r
+       return obj;\r
+  }\r
diff --git a/moftmp/Vector3D.hpp b/moftmp/Vector3D.hpp
new file mode 100755 (executable)
index 0000000..1000bd5
--- /dev/null
@@ -0,0 +1,28 @@
+ #pragma once \r
+#include <mof/real.hpp>\r
+\r
+ namespace mof{\r
+       struct Vector3D\r
+       {\r
+               real x , y , z;\r
+               Vector3D(real _x , real _y , real _z);\r
+               Vector3D();\r
+               ~Vector3D(void);\r
+               void normalize();\r
\r
+               mof::Vector3D operator +(const mof::Vector3D& rhs) const ;\r
+               mof::Vector3D operator -(const mof::Vector3D& rhs) const ;\r
+               mof::Vector3D operator *(real rhs) const;\r
+               mof::Vector3D operator /(real rhs) const;\r
\r
+               //friend mof::Vector3D operator *(const mof::Vector3D& vec , real f);\r
+               friend mof::Vector3D operator *(real f ,  const mof::Vector3D & vec);\r
\r
\r
+               bool operator ==(const mof::Vector3D& rhs) const;\r
+               bool operator !=(const mof::Vector3D& rhs) const;\r
+       };\r
\r
+       Vector3D operator *(real f ,  const mof::Vector3D & vec);\r
+ } //namespace mof\r
\r
diff --git a/moftmp/VertexBuffer.cpp b/moftmp/VertexBuffer.cpp
new file mode 100755 (executable)
index 0000000..4ea6c26
--- /dev/null
@@ -0,0 +1,102 @@
+#pragma once\r
+#include "mof/VertexBuffer.hpp"\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include <d3dx9.h>\r
+#include "mof/VertexTypes.hpp"\r
+#include "mof/private/VertexFVF.hpp"\r
+#include <stdlib.h>\r
+\r
+template class mof::VertexBuffer<mof::VertexXYZRHWCUV>;\r
+template class mof::VertexBuffer<mof::VertexXYZRHWC>;\r
+template class mof::VertexBuffer<mof::VertexXYZCUV>;\r
+template class mof::VertexBuffer<mof::VertexXYZNUV>;\r
+template class mof::VertexBuffer<mof::VertexXYZC>;\r
+\r
+\r
+template <class T>\r
+struct mof::VertexBuffer<T>::Impl{\r
+       IDirect3DVertexBuffer9* pBuffer;\r
+       mof::PRIMITIVE_TYPE primitiveType;\r
+       \r
+       \r
+       Impl(mof::PRIMITIVE_TYPE primitiveType_);\r
+       ~Impl();\r
+};\r
+\r
+\r
+template <class T>\r
+mof::VertexBuffer<T>::Impl::Impl(mof::PRIMITIVE_TYPE primitiveType_ )\r
+: pBuffer(NULL) , primitiveType(primitiveType_) \r
+{      \r
+}\r
+\r
+template <class T>\r
+mof::VertexBuffer<T>::Impl::~Impl()\r
+{      \r
+       if(pBuffer != NULL)pBuffer->Release();\r
+}\r
+\r
+\r
+template <class T>\r
+mof::VertexBuffer<T>::VertexBuffer(const T& front , const T& back , mof::PRIMITIVE_TYPE primitiveType )\r
+: m_pImpl(new Impl( primitiveType ))\r
+{\r
+       int length = &back - &front + 1;\r
+       if(length <= 0)throw std::invalid_argument("\95s\90³\82È\92¸\93_\94z\97ñ\8ew\92è");\r
+       \r
+       const LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();\r
+       HRESULT hr = pDevice->CreateVertexBuffer( sizeof(T) * length , 0 , mof::getFVF<T>() , D3DPOOL_DEFAULT , &m_pImpl->pBuffer , NULL);\r
+       if(FAILED(hr))throw std::runtime_error("Failed -- CreateVertexBuffer");\r
+       \r
+       T* pBuffer;\r
+       hr = m_pImpl->pBuffer->Lock( 0, 0 ,(LPVOID*)&pBuffer , 0);\r
+       if(FAILED(hr))throw std::invalid_argument(std::string("\92¸\93_\83o\83b\83t\83@\82Ì\83\8d\83b\83N\82É\8e¸\94s\82µ\82Ü\82µ\82½"));\r
+       \r
+       memcpy( pBuffer , &front , sizeof(T) * length );\r
+       m_pImpl->pBuffer->Unlock();\r
+}\r
+\r
+\r
+\r
+template<class T>\r
+mof::VertexBuffer<T>::~VertexBuffer(){\r
+}\r
+\r
+\r
+template<class T>\r
+int mof::VertexBuffer<T>::getLength() const{\r
+       D3DVERTEXBUFFER_DESC desc;\r
+       m_pImpl->pBuffer->GetDesc(&desc);\r
+       return desc.Size / sizeof(T);\r
+}\r
+\r
+\r
+template<class T>\r
+mof::PRIMITIVE_TYPE mof::VertexBuffer<T>::getPrimitiveType() const{\r
+       return m_pImpl->primitiveType;\r
+}\r
+\r
+\r
+template<class T>\r
+void  mof::VertexBuffer<T>::draw() const{\r
+       HRESULT hr = E_FAIL;\r
+\r
+       const LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();\r
+\r
+       pDevice->SetFVF(mof::getFVF<T>());\r
+       pDevice->SetStreamSource(0 , m_pImpl->pBuffer , 0 , sizeof(T));\r
+\r
+       \r
+       int length = getLength();\r
+\r
+       if(m_pImpl->primitiveType == mof::PRIMITIVE_TYPE_TRIANGLESTRIP){\r
+               hr = pDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP , 0 , length -2 );\r
+       }\r
+       else if(m_pImpl->primitiveType == mof::PRIMITIVE_TYPE_TRIANGLELIST){\r
+               hr = pDevice->DrawPrimitive( D3DPT_TRIANGLELIST , 0 , length /3 );\r
+       }\r
+       \r
+       if(FAILED(hr))throw std::runtime_error("Failed -- DrawPrimitive");\r
+\r
+}\r
+\r
diff --git a/moftmp/VertexBuffer.hpp b/moftmp/VertexBuffer.hpp
new file mode 100755 (executable)
index 0000000..ab0a9dc
--- /dev/null
@@ -0,0 +1,30 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/VertexTypes.hpp"\r
+#include <boost/utility.hpp>\r
+\r
+namespace mof{\r
+\r
+\r
+\r
+template <class T>\r
+class VertexBuffer : boost::noncopyable{\r
+       \r
+       struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+public:\r
+       VertexBuffer\r
+       (\r
+               const T& front , const T& back , \r
+               mof::PRIMITIVE_TYPE primitiveType = PRIMITIVE_TYPE_TRIANGLELIST \r
+       );\r
+       ~VertexBuffer();\r
+\r
+       int getLength() const;\r
+       mof::PRIMITIVE_TYPE getPrimitiveType() const;\r
+       void draw() const;\r
+\r
+};\r
+\r
+       \r
+}\r
diff --git a/moftmp/VertexTypes.hpp b/moftmp/VertexTypes.hpp
new file mode 100755 (executable)
index 0000000..1cfd2d8
--- /dev/null
@@ -0,0 +1,104 @@
+#pragma once\r
+#include "mof/Color.hpp"\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Vector3D.hpp"\r
+namespace mof{\r
+\r
+\r
+struct VertexXYZRHWCUV{\r
+       float x , y , z , rhw;\r
+       mof::Color color;\r
+       float tu , tv;  \r
+\r
+       VertexXYZRHWCUV(){\r
+       }\r
+\r
+       VertexXYZRHWCUV(const mof::Vector2D& position , mof::Color color , float tu , float tv){\r
+               x = static_cast<float>(position.x);\r
+               y = static_cast<float>(position.y);\r
+               z = 0.0f;\r
+               rhw = 1.0f;\r
+               this->color = color;\r
+               this->tu = tu;\r
+               this->tv = tv;\r
+       }\r
+};\r
+\r
+struct VertexXYZRHWC{\r
+       float x , y , z , rhw;\r
+       mof::Color color;\r
+\r
+       VertexXYZRHWC(){\r
+       }\r
+\r
+       VertexXYZRHWC(const mof::Vector2D& position , mof::Color color){\r
+               x = static_cast<float>(position.x);\r
+               y = static_cast<float>(position.y);\r
+               z = 0.0f;\r
+               rhw = 1.0f;\r
+               this->color = color;\r
+       }\r
+};\r
+\r
+\r
+struct VertexXYZCUV{\r
+       float x , y , z;\r
+       mof::Color color;\r
+       float tu , tv;\r
+\r
+       VertexXYZCUV(){\r
+       }\r
+\r
+       VertexXYZCUV(const mof::Vector3D& position , mof::Color color ,float tu , float tv){\r
+               x = position.x;\r
+               y = position.y;\r
+               z = position.z;\r
+               this->color = color;\r
+               this->tu = tu;\r
+               this->tv = tv;\r
+       }\r
+};\r
+\r
+struct VertexXYZNUV{\r
+       float x , y , z;\r
+       float nx , ny , nz;\r
+       float tu , tv;\r
+\r
+       VertexXYZNUV(){\r
+       }\r
+\r
+       VertexXYZNUV(const mof::Vector3D& position , const mof::Vector3D& normal , float tu , float tv){\r
+               x = position.x;\r
+               y = position.y;\r
+               z = position.z;\r
+               nx = normal.x;  \r
+               ny = normal.y;\r
+               nz = normal.z;\r
+               this->tu = tu;\r
+               this->tv = tv;\r
+       }\r
+};\r
+\r
+struct VertexXYZC{\r
+       float x , y , z;\r
+       mof::Color color;\r
+\r
+       VertexXYZC(){\r
+       }\r
+\r
+       VertexXYZC(const mof::Vector3D& position , const mof::Color _color){\r
+               x = position.x;\r
+               y = position.y;\r
+               z = position.z;\r
+               color = _color;\r
+       }\r
+};\r
+\r
+enum PRIMITIVE_TYPE{\r
+       PRIMITIVE_TYPE_TRIANGLESTRIP,\r
+       PRIMITIVE_TYPE_TRIANGLELIST ,\r
+       PRIMITIVE_TYPE_LINELIST\r
+};\r
+\r
+\r
+}\r
diff --git a/moftmp/Window.cpp b/moftmp/Window.cpp
new file mode 100755 (executable)
index 0000000..f164673
--- /dev/null
@@ -0,0 +1,128 @@
+#include "mof/Window.hpp"\r
+#include "mof/InputDevice.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+#include <stdexcept>\r
+\r
+LRESULT WINAPI wndProc( HWND hWnd , UINT msg, WPARAM wParam, LPARAM lParam)\r
+{\r
+       switch(msg)\r
+       {\r
+               case WM_ACTIVATEAPP:\r
+                       if(LOWORD(wParam) == 0)\r
+                       {\r
+                       /*      *ConsoleOut::getInstance() << "Window\82ª\94ñ\83A\83N\83e\83B\83u\82É\82È\82è\82Ü\82µ\82½" << std::endl;\r
+                               mof::System::getInstance()->activate(false);\r
+                               mof::InputDevice::getInstance()->activate(false);*/\r
+                               mof::InputDevice::setActivation(false);\r
+                       }\r
+                       else \r
+                       {\r
+                       /*      *ConsoleOut::getInstance() << "Window\82ª\83A\83N\83e\83B\83u\82É\82È\82è\82Ü\82µ\82½" << std::endl;\r
+                               mof::System::getInstance()->activate(true);\r
+                               mof::InputDevice::getInstance()->activate(true);*/\r
+                               mof::InputDevice::setActivation(true);\r
+                       }\r
+                       break;\r
+               case WM_DESTROY:\r
+                       PostQuitMessage(0);\r
+                       break;\r
+               case WM_SETCURSOR:\r
+                       SetCursor(NULL);\r
+                       break;\r
+       }\r
+       \r
+       return DefWindowProc( hWnd, msg, wParam, lParam );\r
+}\r
+\r
+\r
+\r
+\r
+namespace mof\r
+{\r
+    \r
+    struct Window::Impl\r
+    {\r
+       mof::tstring appName;\r
+       HINSTANCE hInstance;\r
+       HWND hWindow;\r
+       \r
+       Impl(const mof::tstring& appname , HINSTANCE hInstance );\r
+    };\r
+\r
+    Window::Impl::Impl(const mof::tstring &appname, HINSTANCE hInstance )\r
+    : appName( appname ) , hInstance( hInstance ) , hWindow( NULL )\r
+    {\r
+           // do nothing\r
+    }   \r
+\r
+    Window::Window( const mof::tstring &appname , int width , int height , bool fullscreen )\r
+    : m_pImpl( new mof::Window::Impl( appname , GetModuleHandle(NULL) ) )\r
+    {\r
+\r
+           // \83E\83B\83\93\83h\83E\83N\83\89\83X\90Ý\92è\r
+        WNDCLASSEX wc = \r
+            { \r
+                sizeof(WNDCLASSEX), CS_CLASSDC, wndProc, 0L, 0L, \r
+                m_pImpl->hInstance , NULL, NULL, NULL, NULL,\r
+                m_pImpl->appName.c_str()  , NULL\r
+            };\r
+        RegisterClassEx( &wc );\r
+\r
+           // \83E\83B\83\93\83h\83E\90\90¬\r
+           if( !fullscreen )\r
+           {\r
+               // \8ew\92è\82³\82ê\82½\83N\83\89\83C\83A\83\93\83g\97Ì\88æ\82ð\8am\95Û\82·\82é\82½\82ß\82É\95K\97v\82È\83E\83B\83\93\83h\83E\83T\83C\83Y\82ð\93¾\82é\r
+               RECT rect_win;\r
+               SetRect( &rect_win , 0 , 0 , width , height );\r
+               AdjustWindowRect( &rect_win , WS_OVERLAPPEDWINDOW , false );\r
+            \r
+               //Window\83\82\81[\83h\r
+               m_pImpl->hWindow = \r
+                   CreateWindow\r
+                   ( \r
+                        m_pImpl->appName.c_str() , m_pImpl->appName.c_str() , \r
+                        WS_OVERLAPPEDWINDOW , CW_USEDEFAULT, CW_USEDEFAULT, (rect_win.right - rect_win.left) ,\r
+                        (rect_win.bottom - rect_win.top) , GetDesktopWindow() , NULL , wc.hInstance , NULL\r
+                   );\r
+           }\r
+       else\r
+       {\r
+                   //\83t\83\8b\83X\83N\83\8a\81[\83\93\r
+                   m_pImpl->hWindow = \r
+                       CreateWindow\r
+                       (\r
+                           m_pImpl->appName.c_str() , m_pImpl->appName.c_str() , \r
+                           WS_VISIBLE , CW_USEDEFAULT , CW_USEDEFAULT , width , height ,\r
+                               HWND_DESKTOP , NULL , wc.hInstance , NULL\r
+                       );\r
+           }\r
+       \r
+        \r
+           // \83E\83B\83\93\83h\83E\95`\89æ\r
+        ShowWindow( m_pImpl->hWindow , SW_SHOWDEFAULT );\r
+        UpdateWindow( m_pImpl->hWindow );\r
+\r
+\r
+    } // function constructor \r
+\r
+\r
+\r
+    Window::~Window( )\r
+    {\r
+           try\r
+           {\r
+               \r
+               //\97á\8aO\82È\82°\82é\81H\r
+               UnregisterClass(m_pImpl->appName.c_str() , m_pImpl->hInstance );\r
+           }\r
+           catch(...)\r
+           {\r
+           }\r
+       \r
+    }\r
+    \r
+    HWND Window::getHandler() const {\r
+        return m_pImpl->hWindow;\r
+    }\r
+\r
+} // namespace mof
\ No newline at end of file
diff --git a/moftmp/Window.hpp b/moftmp/Window.hpp
new file mode 100755 (executable)
index 0000000..b62b50a
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+\r
+#include "mof/tstring.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/utility.hpp>\r
+#include <windows.h>\r
+\r
+namespace mof\r
+{\r
+       \r
+    \r
+    class Window : boost::noncopyable\r
+    {\r
+           \r
+           struct Impl;\r
+           boost::scoped_ptr<Impl> m_pImpl;\r
+           \r
+        public:\r
+           Window( const mof::tstring& appname , int width , int height , bool fullscreen );\r
+           ~Window( );\r
+        HWND getHandler() const;\r
+  \r
+       \r
+    };\r
+\r
+\r
+}\r
diff --git a/moftmp/graphics/utilities.hpp b/moftmp/graphics/utilities.hpp
new file mode 100755 (executable)
index 0000000..cca335a
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+#include <mof/Texture.hpp>\r
+#include <mof/ResourceManager.hpp>\r
+\r
+namespace mof\r
+{\r
+    typedef boost::shared_ptr< Texture >        TextureHandler;\r
+    typedef ResourceManager< Texture >          TextureManager;\r
+    typedef boost::shared_ptr< TextureManager > TextureManagerHandler;\r
+}\r
diff --git a/moftmp/graphics/utilities.hpp~ b/moftmp/graphics/utilities.hpp~
new file mode 100755 (executable)
index 0000000..643e639
--- /dev/null
@@ -0,0 +1,11 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+#include <mof/Texture.hpp>\r
+#include <mof/ResourceManager.hpp>\r
+\r
+namespace mof\r
+{\r
+    typedef boost::shared_ptr< Texture > TextureHandler;\r
+    typedef ResourceManager< Texture > TextureManager;\r
+    typedef boost::shared_ptr< TextureManager > TextureManagerHandler;\r
+}\r
diff --git a/moftmp/mofGraphics.hpp b/moftmp/mofGraphics.hpp
new file mode 100755 (executable)
index 0000000..17e8141
--- /dev/null
@@ -0,0 +1,15 @@
+#pragma once\r
+//#include "mof/AmbientLight.hpp"\r
+#include "mof/GraphicsDevice.hpp"\r
+//#include "mof/Camera.hpp"\r
+#include "mof/Captor.hpp"\r
+#include "mof/Color.hpp"\r
+#include "mof/GraphicsUnit.hpp"\r
+//#include "mof/Light.hpp"\r
+//#include "mof/Material.hpp"\r
+//#include "mof/MaterialBuilder.hpp"\r
+#include "mof/PixelMap.hpp"\r
+#include "mof/Texture.hpp"\r
+#include "mof/VertexBuffer.hpp"\r
+#include "mof/VertexTypes.hpp"\r
+#include "mof/graphics/utilities.hpp"\r
diff --git a/moftmp/mofInput.hpp b/moftmp/mofInput.hpp
new file mode 100755 (executable)
index 0000000..3dfa25d
--- /dev/null
@@ -0,0 +1,7 @@
+#pragma\r
+#include "mof/InputDevice.hpp"\r
+#include "mof/InputEventCondition.hpp"\r
+#include "mof/KeyPressedEventCondition.hpp"\r
+#include "mof/private/DeviceInputReceiver.hpp"\r
+#include "mof/LoggedInputReceiver.hpp"\r
+#include "mof/LoggingInputReceiver.hpp"\r
diff --git a/moftmp/moflib.vcproj b/moftmp/moflib.vcproj
new file mode 100755 (executable)
index 0000000..4eb8426
--- /dev/null
@@ -0,0 +1,665 @@
+<?xml version="1.0" encoding="shift_jis"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="moflib"\r
+       ProjectGUID="{04CD4817-1559-4830-BCB0-C5AE997CD904}"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="4"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLibrarianTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="\83\\81[\83\83t\83@\83C\83\8b"\r
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\AbstractScene.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\AmbientLight.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Animation.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\AnimationScheduler.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\BackGroundModel.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Billboard.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Button.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Camera.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Capturer.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\CascadeAnimation.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Color.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Component2D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Component3D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ConsoleIO.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Container2D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Container3D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\CSVFile.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\DataTable.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\DeviceInputReceiver.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\DirectionalLight.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\FileMeshBuilder.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\FilePath.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\FileTextureBuilder.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Frame.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\GraphicsDevice.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\GraphicsObject.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\GraphicsSchedule.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\InputDevice.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\KeyFrameAnimation.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\LayoutManager.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Light.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Line2D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Line3D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\List.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\LoggedInputReceiver.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\LoggingInputReceiver.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Material.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Matrix3D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Mesh.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\PixelMap.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\PixelMapTextureBuilder.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\RectangleModel.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Resource.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\SelectionModel.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Sprite.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\System.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\TextTextureBuilder.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Texture.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Timer.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\VBMeshBuilder.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Vector2D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Vector3D.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Window.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\WindowSystem.cpp"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="\83w\83b\83_\81\83t\83@\83C\83\8b"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\AbstractScene.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\AmbientLight.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Animation.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\AnimationScheduler.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\BackGroundModel.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Billboard.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Button.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ButtonListener.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Camera.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Capturer.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\CascadeAnimation.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Color.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Component2D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Component3D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ConsoleIO.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Container2D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Container3D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\CSVFile.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\DataTable.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\DeviceInputReceiver.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\DirectionalLight.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\FileMeshBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\FilePath.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\FileTextureBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Frame.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\GeneralMap.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Graphics.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\GraphicsDevice.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\GraphicsObject.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\GraphicsSchedule.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\HardVertexBuffer.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\HardVertexBufferImpl.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\InputDevice.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\InputReceiver.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Interpolation.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\InterpolationImpl.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\KeyFrameAnimation.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\LayoutManager.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Light.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Line2D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Line3D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\List.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\LoggedInputReceiver.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\LoggingInputReceiver.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Material.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Matrix3D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Mesh.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\MeshBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\MeshResource.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\PixelMap.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\PixelMapTextureBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\RectangleModel.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Resource.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ResourceManager.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\SelectionModel.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\SoftVertexBuffer.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\SoftVertexBufferImpl.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Sprite.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\SquareMap.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\System.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\TextTextureBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Texture.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\TextureBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\TextureResource.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Timer.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tstring.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\VBMeshBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Vector2D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Vector3D.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\VertexBuffer.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\VertexFVF.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\VertexTypes.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\Window.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\WindowSystem.h"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="\83\8a\83\\81[\83\83t\83@\83C\83\8b"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/moftmp/moflib.vcproj.TOMOHIRO.TomohiroYasuda.user b/moftmp/moflib.vcproj.TOMOHIRO.TomohiroYasuda.user
new file mode 100755 (executable)
index 0000000..19f9a33
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="shift_jis"?>\r
+<VisualStudioUserFile\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       ShowAllFiles="false"\r
+       >\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       >\r
+                       <DebugSettings\r
+                               Command="$(TargetPath)"\r
+                               WorkingDirectory=""\r
+                               CommandArguments=""\r
+                               Attach="false"\r
+                               DebuggerType="3"\r
+                               Remote="1"\r
+                               RemoteMachine="TOMOHIRO"\r
+                               RemoteCommand=""\r
+                               HttpUrl=""\r
+                               PDBPath=""\r
+                               SQLDebugging=""\r
+                               Environment=""\r
+                               EnvironmentMerge="true"\r
+                               DebuggerFlavor=""\r
+                               MPIRunCommand=""\r
+                               MPIRunArguments=""\r
+                               MPIRunWorkingDirectory=""\r
+                               ApplicationCommand=""\r
+                               ApplicationArguments=""\r
+                               ShimCommand=""\r
+                               MPIAcceptMode=""\r
+                               MPIAcceptFilter=""\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       >\r
+                       <DebugSettings\r
+                               Command="$(TargetPath)"\r
+                               WorkingDirectory=""\r
+                               CommandArguments=""\r
+                               Attach="false"\r
+                               DebuggerType="3"\r
+                               Remote="1"\r
+                               RemoteMachine="TOMOHIRO"\r
+                               RemoteCommand=""\r
+                               HttpUrl=""\r
+                               PDBPath=""\r
+                               SQLDebugging=""\r
+                               Environment=""\r
+                               EnvironmentMerge="true"\r
+                               DebuggerFlavor=""\r
+                               MPIRunCommand=""\r
+                               MPIRunArguments=""\r
+                               MPIRunWorkingDirectory=""\r
+                               ApplicationCommand=""\r
+                               ApplicationArguments=""\r
+                               ShimCommand=""\r
+                               MPIAcceptMode=""\r
+                               MPIAcceptFilter=""\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+</VisualStudioUserFile>\r
diff --git a/moftmp/private/DeviceInputReceiver.hpp b/moftmp/private/DeviceInputReceiver.hpp
new file mode 100755 (executable)
index 0000000..d3fb6a5
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+#include "mof/InputReceiver.hpp"\r
+\r
+\r
+namespace mof{\r
+       struct InputEvent{\r
+               InputEvent(unsigned int _dwOfs , unsigned int _dwData){\r
+                       dwOfs = _dwOfs;\r
+                       dwData = _dwData;\r
+               }\r
+               unsigned int dwOfs;\r
+               unsigned int dwData;\r
+       };\r
+\r
+       class DeviceInputReceiver : public InputReceiver\r
+       {\r
+               bool* m_pKeyStates;\r
+       public:\r
+               \r
+               DeviceInputReceiver();\r
+               virtual ~DeviceInputReceiver();\r
+               virtual bool testKeyState(mof::InputReceiver::Key key);\r
+               virtual void update();\r
+               void notifyInputEvent(InputEvent& iEvent);\r
+       };\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/private/DirectInput.hpp b/moftmp/private/DirectInput.hpp
new file mode 100755 (executable)
index 0000000..c240ed2
--- /dev/null
@@ -0,0 +1,8 @@
+#pragma\r
+\r
+#pragma comment(lib , "dinput8.lib")\r
+#pragma comment(lib , "dxguid.lib")\r
+\r
+#define DIRECTINPUT_VERSION 0x0800\r
+#include <windows.h>\r
+#include <dinput.h>
\ No newline at end of file
diff --git a/moftmp/private/FileTextureBuilder.cpp b/moftmp/private/FileTextureBuilder.cpp
new file mode 100755 (executable)
index 0000000..db00c2d
--- /dev/null
@@ -0,0 +1,32 @@
+\r
+#include "mof/private/FileTextureBuilder.hpp"\r
+#include <d3dx9.h>\r
+#include <dxerr9.h>\r
+#include "mof/private/GraphicsDeviceImpl.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+mof::FileTextureBuilder::FileTextureBuilder( const mof::tstring& path)\r
+{\r
+       m_path = path;\r
+       \r
+}\r
+\r
+mof::FileTextureBuilder::~FileTextureBuilder(void)\r
+{\r
+}\r
+\r
+\r
+LPDIRECT3DTEXTURE9 mof::FileTextureBuilder::create(){\r
+       LPDIRECT3DTEXTURE9 texture;\r
+       LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();\r
+       HRESULT hr = D3DXCreateTextureFromFileEx(pDevice , m_path.c_str() , \r
+                       0 , 0 , 1 , 0/*RENDER*/ , D3DFMT_UNKNOWN , D3DPOOL_MANAGED ,\r
+                       D3DX_DEFAULT , D3DX_DEFAULT , mof::createColor(0 , 0 , 0) , NULL , NULL , &texture);\r
+\r
+       if(FAILED(hr))throw std::runtime_error("Failed --- CreateTextureFromFileEx");\r
+               \r
+       return texture; \r
+\r
+       \r
+\r
+}
\ No newline at end of file
diff --git a/moftmp/private/FileTextureBuilder.hpp b/moftmp/private/FileTextureBuilder.hpp
new file mode 100755 (executable)
index 0000000..0326415
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef MOF_FILE_TEXTURE_BUILDER_HPP\r
+#define MOF_FILE_TEXTURE_BUILDER_HPP\r
+\r
+#include "mof/private/TextureBuilder.hpp"\r
+#include "mof/tstring.hpp"\r
+\r
+namespace mof{\r
+       \r
+       class FileTextureBuilder : public TextureBuilder\r
+       {\r
+               mof::tstring m_path;\r
+       public:\r
+               FileTextureBuilder( const mof::tstring& path);\r
+               virtual ~FileTextureBuilder(void);\r
+               virtual LPDIRECT3DTEXTURE9 create();\r
+       };\r
+\r
+\r
+};\r
+\r
+#endif
\ No newline at end of file
diff --git a/moftmp/private/GraphicsDeviceImpl.hpp b/moftmp/private/GraphicsDeviceImpl.hpp
new file mode 100755 (executable)
index 0000000..a3d0e3c
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+\r
+#include <windows.h>\r
+#include "mof/GraphicsDevice.hpp"\r
+\r
+#include <d3dx9.h>\r
+#pragma comment(lib, "d3dxof.lib")\r
+#pragma comment(lib , "dxguid.lib")\r
+#pragma comment(lib , "d3dx9dt.lib")\r
+#pragma comment(lib , "d3d9.lib")\r
+#pragma comment(lib , "dxerr9.lib")\r
+\r
+namespace mof\r
+{\r
+    class Window;\r
+    \r
+    namespace GraphicsDevice\r
+    {\r
+        // private\r
+        void initialize(const Window& window ,  int width , int height , bool fullscreen);\r
+           void finalize();\r
+           void beginScene();\r
+           void endScene();\r
+           LPDIRECT3DDEVICE9 getRawDevice( );\r
+    }\r
+}\r
diff --git a/moftmp/private/Interpreter.hpp b/moftmp/private/Interpreter.hpp
new file mode 100755 (executable)
index 0000000..728a283
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+#include "../Interpreter.hpp"\r
+\r
+namespace mof\r
+{\r
+    namespace Interpreter\r
+    {\r
+    \r
+        int _createMessageWidget( );\r
+        \r
+        int _addMessageWidgetPage\r
+        ( \r
+            int id ,\r
+            const tstring& title ,\r
+            const tstring& text \r
+        );\r
+    \r
+        int _hideMessageWidget( int id );\r
+    \r
+        void _waitKey( const tstring& keystring );\r
+\r
+        void _waitFrame( int frame );\r
+    }\r
+}\r
+\r
+\r
diff --git a/moftmp/private/Interpreter.hpp~ b/moftmp/private/Interpreter.hpp~
new file mode 100755 (executable)
index 0000000..93943b7
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+#include "../Interpreter.hpp"\r
+\r
+namespace mof\r
+{\r
+    namespace Interpreter\r
+    {\r
+    \r
+        int _createMessageWidget();\r
+        \r
+        int _addMessageWidgetPage\r
+        ( \r
+            int id ,\r
+            const tstring& title ,\r
+            const tstring& text \r
+        );\r
+    \r
+        int _hideMessageWidget( int id );\r
+    \r
+        void _waitKey( const tstring& keystring );\r
+\r
+        void _waitFrame( int frame );\r
+    }\r
+}\r
+\r
+\r
diff --git a/moftmp/private/Mesh.hpp b/moftmp/private/Mesh.hpp
new file mode 100755 (executable)
index 0000000..edf30de
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef MOF_MESH_HPP\r
+#define MOF_MESH_HPP\r
+#include <d3d9.h>\r
+#include "mof/Graphics3D.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/Material.hpp"\r
+#include "mof/Texture.hpp"\r
+#include "mof/DefaultAnimationPlayer.hpp"\r
+\r
+namespace mof{\r
+\r
+struct MeshDisposer;\r
+\r
+class Mesh : public Graphics3D , public DefaultAnimationPlayer{\r
+       struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+public :\r
+       Mesh(\r
+               boost::shared_ptr<mof::MeshDisposer> pMeshDisposer ,\r
+               unsigned long nMaterials ,\r
+               const boost::shared_ptr<mof::Material>* pMaterials , \r
+               const boost::shared_ptr<mof::Texture>* pTextures );\r
+       virtual ~Mesh();\r
+\r
+       virtual void setWorldMatrix(const mof::Animation<mof::Matrix3D>::Handler& handler);\r
+       virtual void setTexture( \r
+               unsigned int num ,\r
+               const boost::shared_ptr<mof::Texture>& pTexture);\r
+\r
+       virtual bool isVisible() const;\r
+       virtual void update();\r
+       virtual void draw() const;\r
+       //virtual bool isDisposable() const;\r
+\r
+};\r
+\r
+}\r
+\r
+#endif
\ No newline at end of file
diff --git a/moftmp/private/MeshDisposer.hpp b/moftmp/private/MeshDisposer.hpp
new file mode 100755 (executable)
index 0000000..73f20df
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once\r
+#include <d3d9.h>\r
+#include <d3dx9.h>\r
+\r
+namespace mof{\r
+\r
+struct MeshDisposer{\r
+       \r
+       LPD3DXMESH      pMesh; //\83\81\83b\83V\83\85\r
+       LPD3DXBUFFER    pAdjacency;     //\83\81\83b\83V\83\85\82É\8aÜ\82Ü\82ê\82é\8ae\96Ê\82Ì\97×\90Ú\96Ê\82ð\8ai\94[\82·\82é\83|\83C\83\93\83^\r
+\r
+       ~MeshDisposer(){\r
+               if(pAdjacency != NULL)pAdjacency->Release();\r
+               if(pMesh != NULL)pMesh->Release();\r
+       }\r
+};\r
+\r
+}\r
diff --git a/moftmp/private/PixelMapTextureBuilder.hpp b/moftmp/private/PixelMapTextureBuilder.hpp
new file mode 100755 (executable)
index 0000000..89c2435
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef MOF_PIXEL_TEXTURE_BUILDER_HPP\r
+#define MOF_PIXEL_TEXTURE_BUILDER_HPP\r
+\r
+#include "mof/private/TextureBuilder.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/PixelMap.hpp"\r
+\r
+namespace mof{\r
+\r
+       class PixelMapTextureBuilder : public TextureBuilder\r
+       {\r
+               boost::shared_ptr<mof::PixelMap> m_pPixelMap;\r
+       public:\r
+               PixelMapTextureBuilder( const boost::shared_ptr<mof::PixelMap>& pPixelMap);\r
+               virtual ~PixelMapTextureBuilder();\r
+               virtual LPDIRECT3DTEXTURE9 create();\r
+       };\r
+\r
+\r
+};\r
+\r
+#endif
\ No newline at end of file
diff --git a/moftmp/private/TextureBuilder.hpp b/moftmp/private/TextureBuilder.hpp
new file mode 100755 (executable)
index 0000000..2c13437
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef MOF_TEXTURE_BUILDER_HPP\r
+#define MOF_TEXTURE_BUILDER_HPP\r
+#include <d3d9.h>\r
+\r
+namespace mof{\r
+       \r
+       class TextureBuilder\r
+       {\r
+       public:\r
+               virtual ~TextureBuilder(){}\r
+               virtual  LPDIRECT3DTEXTURE9 create() = 0;\r
+       };\r
+\r
+\r
+}\r
+\r
+#endif
\ No newline at end of file
diff --git a/moftmp/private/TextureImpl.hpp b/moftmp/private/TextureImpl.hpp
new file mode 100755 (executable)
index 0000000..9e3d41e
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef MOF_TEXTURE_IMPL_HPP\r
+#define MOF_TEXTURE_IMPL_HPP\r
+#include "Texture.hpp"\r
+\r
+\r
+#include "mof/GraphicsDevice.hpp"\r
+#include <d3dx9.h>\r
+\r
+\r
+struct mof::Texture::Impl{\r
+       LPDIRECT3DTEXTURE9 pTexture;\r
+       int width , height;\r
+\r
+       Impl() : pTexture(NULL) , width(0) , height(0){}\r
+       ~Impl(){\r
+               if(pTexture != NULL)pTexture->Release();\r
+       }\r
+};\r
+\r
+#endif
\ No newline at end of file
diff --git a/moftmp/private/VertexFVF.hpp b/moftmp/private/VertexFVF.hpp
new file mode 100755 (executable)
index 0000000..b33329c
--- /dev/null
@@ -0,0 +1,37 @@
+#pragma once\r
+#include "VertexTypes.hpp"\r
+#include <d3dx9.h>\r
+\r
+\r
+namespace mof{\r
+\r
+template<class T>\r
+DWORD getFVF();\r
+\r
+template<>\r
+inline DWORD getFVF<VertexXYZRHWCUV>(){\r
+       return  D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1;\r
+}\r
+\r
+template<>\r
+inline DWORD getFVF<VertexXYZRHWC>(){\r
+       return  D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX0;\r
+}\r
+\r
+template<>\r
+inline DWORD getFVF<VertexXYZCUV>(){\r
+       return  D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1;\r
+}\r
+\r
+template<>\r
+inline DWORD getFVF<VertexXYZNUV>(){\r
+       return  D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1;\r
+}\r
+\r
+template<>\r
+inline DWORD getFVF<VertexXYZC>(){\r
+       return  D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX0;\r
+}\r
+\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/private/commands.hpp~ b/moftmp/private/commands.hpp~
new file mode 100755 (executable)
index 0000000..01bad12
--- /dev/null
@@ -0,0 +1,14 @@
+#pragma once \r
+#include "mof/tstring.hpp"\r
+#include "luabind/luabind.hpp"\r
+#include <boost/bind.hpp>\r
+\r
+struct lua_State;\r
+\r
+namespace mof\r
+{\r
+    namespace command\r
+    {\r
+        void registMessage( lua_State* l );\r
+    }\r
+}\r
diff --git a/moftmp/private/message.cpp~ b/moftmp/private/message.cpp~
new file mode 100755 (executable)
index 0000000..b3dda90
--- /dev/null
@@ -0,0 +1,40 @@
+#include "mof/Interpreter.hpp"\r
+#include "mof/private/Interpreter.hpp"\r
+#include "mof/private/commands.hpp"\r
+#include "luabind/luabind.hpp"\r
+\r
+namespace mof\r
+{\r
+//{{{ _messageNewImplGlue old\r
+/*    int _messageNewImplGlue( lua_State* l ){\r
+        int n = lua_gettop(l);\r
+        if(!lua_isstring(l , 1))throw std::runtime_error("invalid call");\r
+        if(!lua_istable(l , 2))throw std::runtime_error("invalid call");\r
+        mof::tstring title = lua_tostring(l , 1);\r
+    \r
+        std::vector<mof::tstring> texts;\r
+        for(int i = 1 ; ; i++){\r
+            lua_pushnumber(l , i);\r
+            lua_gettable(l , -2);\r
+            if(lua_isnil(l , -1))break;\r
+            if(!lua_isstring(l , -1))throw std::runtime_error("invalid call");\r
+            texts.push_back(lua_tostring(l , -1));\r
+            lua_pop(l , 1);\r
+        }\r
+        lua_pop(l , n);\r
+\r
+        m_pMenu = m_pInstructionSet->createMessageWidget(title , texts.at(0)) ;\r
+        //m_pMenu.push_back( m_pInstructionSet->createMessageWidget(title , texts.at(0)) );\r
+        return 0;\r
+    } */\r
+//}}}\r
+//{{{ registMessage\r
+    void command::registMessage( lua_State* l )\r
+    {\r
+        luabind::module( l )[ luabind::def( "messageNewImpl" , mof::Interpreter::_createMessageWidget ) ];\r
+        luabind::module( l )[ luabind::def( "messagePageImpl" , mof::Inerpreter::_addMessageWidgetPage ) ];\r
+        luabind::module( l )[ luabind::def( "messageHideImpl" , mof::Interpreter::_hideMessageWidget ) ];\r
+\r
+    }\r
+//}}}\r
+}\r
diff --git a/moftmp/private/regist.cpp b/moftmp/private/regist.cpp
new file mode 100755 (executable)
index 0000000..a113f21
--- /dev/null
@@ -0,0 +1,48 @@
+#include "mof/Interpreter.hpp"\r
+#include "mof/private/Interpreter.hpp"\r
+#include "mof/private/regist.hpp"\r
+#include "luabind/luabind.hpp"\r
+\r
+namespace mof\r
+{\r
+//{{{ _messageNewImplGlue old\r
+/*    int _messageNewImplGlue( lua_State* l ){\r
+        int n = lua_gettop(l);\r
+        if(!lua_isstring(l , 1))throw std::runtime_error("invalid call");\r
+        if(!lua_istable(l , 2))throw std::runtime_error("invalid call");\r
+        mof::tstring title = lua_tostring(l , 1);\r
+    \r
+        std::vector<mof::tstring> texts;\r
+        for(int i = 1 ; ; i++){\r
+            lua_pushnumber(l , i);\r
+            lua_gettable(l , -2);\r
+            if(lua_isnil(l , -1))break;\r
+            if(!lua_isstring(l , -1))throw std::runtime_error("invalid call");\r
+            texts.push_back(lua_tostring(l , -1));\r
+            lua_pop(l , 1);\r
+        }\r
+        lua_pop(l , n);\r
+\r
+        m_pMenu = m_pInstructionSet->createMessageWidget(title , texts.at(0)) ;\r
+        //m_pMenu.push_back( m_pInstructionSet->createMessageWidget(title , texts.at(0)) );\r
+        return 0;\r
+    } */\r
+//}}}\r
+//{{{ registMessage\r
+    void regist::registMessage( lua_State* l )\r
+    {\r
+        luabind::module( l )[ luabind::def( "messageNewImpl" , mof::Interpreter::_createMessageWidget ) ];\r
+        luabind::module( l )[ luabind::def( "messagePageImpl" , mof::Interpreter::_addMessageWidgetPage ) ];\r
+        luabind::module( l )[ luabind::def( "messageHideImpl" , mof::Interpreter::_hideMessageWidget ) ];\r
+\r
+    }\r
+//}}}\r
+//{{{ registWait\r
+    void regist::registWait( lua_State* l )\r
+    {\r
+        luabind::module( l )[ luabind::def( "waitFrameImpl" , mof::Interpreter::_waitFrame ) ];\r
+        luabind::module( l )[ luabind::def( "waitKeyImpl" , mof::Interpreter::_waitKey ) ];\r
+\r
+    }\r
+//}}}\r
+}\r
diff --git a/moftmp/private/regist.cpp~ b/moftmp/private/regist.cpp~
new file mode 100755 (executable)
index 0000000..a113f21
--- /dev/null
@@ -0,0 +1,48 @@
+#include "mof/Interpreter.hpp"\r
+#include "mof/private/Interpreter.hpp"\r
+#include "mof/private/regist.hpp"\r
+#include "luabind/luabind.hpp"\r
+\r
+namespace mof\r
+{\r
+//{{{ _messageNewImplGlue old\r
+/*    int _messageNewImplGlue( lua_State* l ){\r
+        int n = lua_gettop(l);\r
+        if(!lua_isstring(l , 1))throw std::runtime_error("invalid call");\r
+        if(!lua_istable(l , 2))throw std::runtime_error("invalid call");\r
+        mof::tstring title = lua_tostring(l , 1);\r
+    \r
+        std::vector<mof::tstring> texts;\r
+        for(int i = 1 ; ; i++){\r
+            lua_pushnumber(l , i);\r
+            lua_gettable(l , -2);\r
+            if(lua_isnil(l , -1))break;\r
+            if(!lua_isstring(l , -1))throw std::runtime_error("invalid call");\r
+            texts.push_back(lua_tostring(l , -1));\r
+            lua_pop(l , 1);\r
+        }\r
+        lua_pop(l , n);\r
+\r
+        m_pMenu = m_pInstructionSet->createMessageWidget(title , texts.at(0)) ;\r
+        //m_pMenu.push_back( m_pInstructionSet->createMessageWidget(title , texts.at(0)) );\r
+        return 0;\r
+    } */\r
+//}}}\r
+//{{{ registMessage\r
+    void regist::registMessage( lua_State* l )\r
+    {\r
+        luabind::module( l )[ luabind::def( "messageNewImpl" , mof::Interpreter::_createMessageWidget ) ];\r
+        luabind::module( l )[ luabind::def( "messagePageImpl" , mof::Interpreter::_addMessageWidgetPage ) ];\r
+        luabind::module( l )[ luabind::def( "messageHideImpl" , mof::Interpreter::_hideMessageWidget ) ];\r
+\r
+    }\r
+//}}}\r
+//{{{ registWait\r
+    void regist::registWait( lua_State* l )\r
+    {\r
+        luabind::module( l )[ luabind::def( "waitFrameImpl" , mof::Interpreter::_waitFrame ) ];\r
+        luabind::module( l )[ luabind::def( "waitKeyImpl" , mof::Interpreter::_waitKey ) ];\r
+\r
+    }\r
+//}}}\r
+}\r
diff --git a/moftmp/private/regist.hpp b/moftmp/private/regist.hpp
new file mode 100755 (executable)
index 0000000..d1dfc9d
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once \r
+#include "mof/tstring.hpp"\r
+\r
+struct lua_State;\r
+\r
+namespace mof\r
+{\r
+    namespace regist\r
+    {\r
+        void registMessage( lua_State* l );\r
+        void registWait( lua_State* l );\r
+    }\r
+}\r
diff --git a/moftmp/private/regist.hpp~ b/moftmp/private/regist.hpp~
new file mode 100755 (executable)
index 0000000..115b285
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once \r
+#include "mof/tstring.hpp"\r
+\r
+struct lua_State;\r
+\r
+namespace mof\r
+{\r
+    namespace command\r
+    {\r
+        void registMessage( lua_State* l );\r
+    }\r
+}\r
diff --git a/moftmp/real.hpp b/moftmp/real.hpp
new file mode 100755 (executable)
index 0000000..d42256b
--- /dev/null
@@ -0,0 +1,16 @@
+#pragma once\r
+\r
+namespace mof\r
+{\r
+    typedef float real;\r
+\r
+    inline real int2real(int v)\r
+    {\r
+        return static_cast<real>(v);\r
+    }\r
+    \r
+    inline int real2int(real v)\r
+    {\r
+        return static_cast<int>(v);\r
+    }\r
+}\r
diff --git a/moftmp/stream/Animation.hpp~ b/moftmp/stream/Animation.hpp~
new file mode 100755 (executable)
index 0000000..2dc9666
--- /dev/null
@@ -0,0 +1,24 @@
+ #pragma once\r
+ #include <boost/shared_ptr.hpp>\r
+ #include <boost/utility.hpp>\r
\r
+ namespace mof{\r
\r
+       typedef unsigned int  FrameNumber;\r
\r
+       /**\r
+        * \83A\83j\83\81\81[\83V\83\87\83\93\83N\83\89\83X\82Í\95¡\90\94\83C\83\93\83X\83^\83\93\83X\8aÔ\82Å\8b¤\97L\82Å\82«\82é\82æ\82¤\82É\82·\82é\82½\82ß\82É\81A\r
+        * update()\82ð\8cÄ\82Ñ\8fo\82µ\82Ä\93à\97e\82ð\8f\91\82«\8a·\82¦\82é\8b@\8d\\82É\82Í\82·\82×\82«\82Å\82Í\82È\82¢\r
+        *\r
+       */\r
+       template<typename T>\r
+       class Animation : boost::noncopyable{\r
+       public:\r
+               typedef boost::shared_ptr<mof::Animation<T> > Handler;\r
+       \r
+               virtual T getValue(mof::FrameNumber) const = 0;\r
\r
+       };\r
\r
\r
+ } // namespace mof\r
diff --git a/moftmp/stream/AnimationPlayer.hpp b/moftmp/stream/AnimationPlayer.hpp
new file mode 100755 (executable)
index 0000000..6da6e9c
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef MOF_ANIMATION_PLAYER_HPP\r
+#define MOF_ANIMATION_PLAYER_HPP\r
+#include "mof/Animation.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+class AnimationPlayer{\r
+\r
+public:\r
+       virtual void setFrameNumber(mof::FrameNumber frame) = 0;\r
+       virtual void nextFrame() = 0;\r
+       virtual void prevFrame() = 0;\r
+       //virtual void reset(){setFrameNumber(0);}\r
+};\r
+\r
+}\r
+\r
+\r
+#endif\r
diff --git a/moftmp/stream/AnimationPlayer.hpp~ b/moftmp/stream/AnimationPlayer.hpp~
new file mode 100755 (executable)
index 0000000..6da6e9c
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef MOF_ANIMATION_PLAYER_HPP\r
+#define MOF_ANIMATION_PLAYER_HPP\r
+#include "mof/Animation.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+class AnimationPlayer{\r
+\r
+public:\r
+       virtual void setFrameNumber(mof::FrameNumber frame) = 0;\r
+       virtual void nextFrame() = 0;\r
+       virtual void prevFrame() = 0;\r
+       //virtual void reset(){setFrameNumber(0);}\r
+};\r
+\r
+}\r
+\r
+\r
+#endif\r
diff --git a/moftmp/stream/AnimationScheduler.cpp b/moftmp/stream/AnimationScheduler.cpp
new file mode 100755 (executable)
index 0000000..65e7787
--- /dev/null
@@ -0,0 +1,41 @@
+#include "mof/AnimationScheduler.h"\r
+#include "mof/ConsoleIO.h"\r
+\r
+typedef std::multimap<mof::AnimationKey , mof::AnimationResource>::iterator MapItr;\r
+\r
+mof::AnimationScheduler::AnimationScheduler(){\r
+       m_key = 0;\r
+\r
+}\r
+\r
+mof::AnimationScheduler::~AnimationScheduler(){\r
+\r
+}\r
+\r
+void mof::AnimationScheduler::update(){\r
+       \r
+       std::pair<MapItr , MapItr> range(m_map.begin() , m_map.upper_bound(m_key));\r
+       for(MapItr itr = range.first ; itr != range.second ; ++itr){\r
+               if(itr->second.get() != NULL && !itr->second->isPlaying())itr->second->start();\r
+       }\r
+       \r
+       m_key++;\r
+}\r
+\r
+void mof::AnimationScheduler::add(int index , mof::AnimationResource pAnimation){\r
+       if(pAnimation.get() != NULL)pAnimation->stop();\r
+       m_map.insert(std::multimap<mof::AnimationKey , mof::AnimationResource>::value_type(index , pAnimation));\r
+\r
+}\r
+               \r
+bool mof::AnimationScheduler::isFinalized(){\r
+       for(MapItr itr = m_map.begin() ; itr != m_map.end() ; ++itr){\r
+               if(!itr->second->isFinalized())return false;\r
+       }\r
+       return true;\r
+}\r
+\r
+void mof::AnimationScheduler::clear(){\r
+       m_key = 0;\r
+       m_map.clear();\r
+}
\ No newline at end of file
diff --git a/moftmp/stream/BoundsAnimation.hpp b/moftmp/stream/BoundsAnimation.hpp
new file mode 100755 (executable)
index 0000000..cdca1ea
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+#include "mof/KeyFrameAnimation.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include "mof/Vector2D.hpp"\r
+\r
+namespace mof\r
+{\r
+    class BoundsAnimation : public mof::Animation< mof::Rectangle<int> >\r
+    {\r
+    public:\r
+\r
+        BoundsAnimation\r
+        (\r
+            const mof::Animation<mof::Vector2D>::Handler& position ,\r
+            const mof::Animation<mof::Vector2D>::Handler& scale \r
+        )\r
+        : m_position( position) , m_scale( scale )\r
+        {\r
+        }\r
+\r
+        mof::Rectangle<int> getValue( mof::FrameNumber frame ) const\r
+        {\r
+            mof::Vector2D position = m_position->getValue( frame );\r
+            mof::Vector2D scale = m_scale->getValue( frame );\r
+            return mof::Rectangle<int>\r
+            (\r
+                position.x , position.y ,\r
+                position.x + scale.x ,\r
+                position.y + scale.y \r
+            );\r
+        }\r
+\r
+    private:\r
+\r
+        mof::Animation<mof::Vector2D>::Handler m_position;\r
+        mof::Animation<mof::Vector2D>::Handler m_scale;\r
+    };\r
+}\r
diff --git a/moftmp/stream/BoundsAnimation.hpp~ b/moftmp/stream/BoundsAnimation.hpp~
new file mode 100755 (executable)
index 0000000..cdca1ea
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+#include "mof/KeyFrameAnimation.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include "mof/Vector2D.hpp"\r
+\r
+namespace mof\r
+{\r
+    class BoundsAnimation : public mof::Animation< mof::Rectangle<int> >\r
+    {\r
+    public:\r
+\r
+        BoundsAnimation\r
+        (\r
+            const mof::Animation<mof::Vector2D>::Handler& position ,\r
+            const mof::Animation<mof::Vector2D>::Handler& scale \r
+        )\r
+        : m_position( position) , m_scale( scale )\r
+        {\r
+        }\r
+\r
+        mof::Rectangle<int> getValue( mof::FrameNumber frame ) const\r
+        {\r
+            mof::Vector2D position = m_position->getValue( frame );\r
+            mof::Vector2D scale = m_scale->getValue( frame );\r
+            return mof::Rectangle<int>\r
+            (\r
+                position.x , position.y ,\r
+                position.x + scale.x ,\r
+                position.y + scale.y \r
+            );\r
+        }\r
+\r
+    private:\r
+\r
+        mof::Animation<mof::Vector2D>::Handler m_position;\r
+        mof::Animation<mof::Vector2D>::Handler m_scale;\r
+    };\r
+}\r
diff --git a/moftmp/stream/Cache.cpp b/moftmp/stream/Cache.cpp
new file mode 100755 (executable)
index 0000000..764f1e1
--- /dev/null
@@ -0,0 +1,19 @@
+#include <mof/stream/Cache.hpp>\r
+\r
+namespace \r
+{\r
+    bool caching = true;\r
+}\r
+\r
+namespace mof\r
+{\r
+    void setCaching(bool b)\r
+    {\r
+        caching = b;\r
+    }\r
+\r
+    bool getCaching()\r
+    {\r
+        return caching;\r
+    }\r
+}\r
diff --git a/moftmp/stream/Cache.cpp~ b/moftmp/stream/Cache.cpp~
new file mode 100755 (executable)
index 0000000..5be4e3d
--- /dev/null
@@ -0,0 +1,14 @@
+#include <mof/stream/Cache.hpp>\r
+\r
+namespace \r
+{\r
+    bool g_caching = true;\r
+}\r
+\r
+namespace mof\r
+{\r
+    void setCaching(bool b)\r
+    {\r
+        g_caching = b;\r
+    }\r
+}\r
diff --git a/moftmp/stream/Cache.hpp b/moftmp/stream/Cache.hpp
new file mode 100755 (executable)
index 0000000..b848aa8
--- /dev/null
@@ -0,0 +1,69 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof{\r
+\r
+    void setCaching(bool b);\r
+    bool getCaching();\r
+       \r
+    \r
+    template< typename T >\r
+       class Cache : public Manipulator< T >\r
+    {\r
+                       \r
+       public:\r
+        typedef typename boost::shared_ptr<Cache> Handler;\r
+        \r
+        virtual ~Cache( ){}\r
+\r
+               virtual T value( FrameNumber frame ) const\r
+        {\r
+            if(getCaching())\r
+            {\r
+                if(m_lastFrame == (int)frame)return m_cached;\r
+                m_lastFrame = (int)frame;\r
+                m_cached = m_pBody->value(frame);\r
+                return m_cached;\r
+            }\r
+            else\r
+            {\r
+                return m_pBody->value(frame);\r
+            }\r
+               }\r
+\r
+\r
+    private:\r
+        typename Manipulator<T>::Handler m_pBody;\r
+        mutable int m_lastFrame;\r
+        mutable T m_cached;\r
+\r
+\r
+               Cache(const typename Manipulator<T>::Handler& pBody)\r
+               : m_pBody(pBody) , m_lastFrame(-1)\r
+               {\r
+               }\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Cache<T> > makeCacheHandler\r
+        (\r
+               const typename Manipulator<T>::Handler& pBody \r
+        );\r
+\r
+       };\r
+\r
+\r
+\r
+       template< typename T >\r
+       boost::shared_ptr< Cache< T > > makeCacheHandler\r
+    (\r
+               const typename Manipulator< T >::Handler& pBody \r
+    )\r
+    {\r
+               return typename Cache< T >::Handler(\r
+                       new Cache< T >( pBody )\r
+               );\r
+       }\r
+\r
+\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/Cache.hpp~ b/moftmp/stream/Cache.hpp~
new file mode 100755 (executable)
index 0000000..53ad444
--- /dev/null
@@ -0,0 +1,69 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof{\r
+\r
+    void setCaching(bool b);\r
+    bool getCaching();\r
+       \r
+    \r
+    template< typename T >\r
+       class Cache : public Manipulator< T >\r
+    {\r
+                       \r
+       public:\r
+        typedef typename boost::shared_ptr<Cache> Handler;\r
+        \r
+        virtual ~Cache( ){}\r
+\r
+               virtual T value( FrameNumber frame ) const\r
+        {\r
+            if(getCaching())\r
+            {\r
+                //if(m_lastFrame == (int)frame)return m_cached;\r
+                m_lastFrame = (int)frame;\r
+                m_cached = m_pBody->value(0);\r
+                return m_cached;\r
+            }\r
+            else\r
+            {\r
+                return m_pBody->value(0);\r
+            }\r
+               }\r
+\r
+\r
+    private:\r
+        typename Manipulator<T>::Handler m_pBody;\r
+        mutable int m_lastFrame;\r
+        mutable T m_cached;\r
+\r
+\r
+               Cache(const typename Manipulator<T>::Handler& pBody)\r
+               : m_pBody(pBody) , m_lastFrame(-1)\r
+               {\r
+               }\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Cache<T> > makeCacheHandler\r
+        (\r
+               const typename Manipulator<T>::Handler& pBody \r
+        );\r
+\r
+       };\r
+\r
+\r
+\r
+       template< typename T >\r
+       boost::shared_ptr< Cache< T > > makeCacheHandler\r
+    (\r
+               const typename Manipulator< T >::Handler& pBody \r
+    )\r
+    {\r
+               return typename Cache< T >::Handler(\r
+                       new Cache< T >( pBody )\r
+               );\r
+       }\r
+\r
+\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/Cascade.hpp b/moftmp/stream/Cascade.hpp
new file mode 100755 (executable)
index 0000000..300c723
--- /dev/null
@@ -0,0 +1,173 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+#include <vector> \r
+\r
+namespace mof\r
+{\r
+    #define DEFAULT_CASCADOR Multiply\r
+//{{{ struct Add\r
+    template<typename T>\r
+    struct Add\r
+    {\r
+           inline static T apply(const T& a , const T& b)\r
+        {\r
+               return a + b;\r
+           }\r
+    };\r
+//}}}\r
+//{{{ struct Multiply\r
+    template<typename T>\r
+    struct Multiply\r
+    {\r
+           inline static T apply(const T& a , const T& b)\r
+        {\r
+                   return a * b;\r
+           }\r
+    };\r
+//}}}\r
+//{{{ struct Overwrite\r
+    template<typename T>\r
+    struct Overwrite\r
+    {\r
+           inline static T apply(const T& , const T& b)\r
+        {\r
+                   return b;\r
+           }\r
+    };\r
+//}}}\r
+//{{{ class Cascade\r
+    template< typename T , class Cascador = DEFAULT_CASCADOR< T > >\r
+    class Cascade : public Manipulator< T >{\r
+    public:\r
+        typedef typename boost::shared_ptr< Cascade > Handler;\r
+\r
+           virtual ~Cascade()\r
+        {\r
+           }\r
+\r
+           virtual T value( FrameNumber frame) const\r
+        {\r
+                   T obj = m_list[0]->value(frame);\r
+                   for(unsigned int i = 1 ; i < m_list.size() ; i++)\r
+            {\r
+                           obj = Cascador::apply(obj , m_list[i]->value(frame));\r
+                   }\r
+                   return obj;\r
+           }\r
+\r
+           void clear()\r
+        {\r
+                   m_list.clear();\r
+           }\r
+\r
+           void add( const typename Manipulator<T>::Handler& handler )\r
+        {\r
+                   m_list.push_back( handler );\r
+       }\r
+\r
+    private:   \r
+           typedef std::vector< typename Manipulator< T >::Handler > List;\r
+           List m_list;\r
+        \r
+        Cascade\r
+        (\r
+                   const typename Manipulator< T >::Handler& front , \r
+                   const typename Manipulator< T >::Handler& back \r
+        )\r
+           {\r
+                   int length = &back - &front + 1;\r
+                   if(length <= 0)throw std::invalid_argument("list size is 0");\r
+\r
+                   for( int i = 0 ; i < length ; i++)\r
+            {\r
+                       m_list.push_back( (&front)[i] );\r
+               }\r
+           }\r
+    \r
+\r
+        Cascade(){}\r
+        \r
+        template< typename T , class Cascador >\r
+        friend typename boost::shared_ptr< Cascade< T , Cascador > >\r
+        makeCascadeHandler\r
+        (\r
+               const typename Manipulator< T >::Handler& front , \r
+               const typename Manipulator< T >::Handler& back \r
+        );\r
+\r
+        template< typename T , class Cascador >\r
+        friend typename boost::shared_ptr< Cascade< T , Cascador > > makeCascadeHandler();\r
+\r
+\r
+    };\r
+//}}}\r
+//{{{ ヘルパ関数 \r
+    template< typename T , class Cascador >\r
+    boost::shared_ptr< Cascade< T , Cascador > >\r
+    makeCascadeHandler\r
+    (\r
+           const typename Manipulator< T >::Handler& front , \r
+           const typename Manipulator< T >::Handler& back \r
+    )\r
+       {\r
+        return typename Cascade< T , Cascador >::Handler\r
+            (\r
+                new Cascade< T , Cascador >( front , back ) \r
+            );\r
+       }\r
+    \r
+    template< typename T , class Cascador >\r
+    typename boost::shared_ptr< Cascade< T , Cascador > >\r
+    makeCascadeHandler( )\r
+       {\r
+        return typename Cascade< T , Cascador >::Handler\r
+            (\r
+                new Cascade< T , Cascador >\r
+            );\r
+       }\r
+\r
+    template<typename T >\r
+    typename boost::shared_ptr< Cascade< T , DEFAULT_CASCADOR< T > > >\r
+    makeCascadeHandler\r
+    (\r
+           const typename Manipulator< T >::Handler& front , \r
+           const typename Manipulator< T >::Handler& back \r
+    )\r
+       {\r
+        return makeCascadeHandler< T , DEFAULT_CASCADOR< T > >( front , back );\r
+       }\r
+    \r
+    template<typename T >\r
+    typename boost::shared_ptr< Cascade< T , DEFAULT_CASCADOR< T > > >\r
+    makeCascadeHandler( )\r
+       {\r
+        return makeCascadeHandler< T , DEFAULT_CASCADOR< T > >();\r
+       }\r
+//}}}\r
+//{{{ ストリーム演算子\r
+    template< typename T , class Cascador >\r
+    boost::shared_ptr< Cascade< T , Cascador > >& \r
+    operator << \r
+    (\r
+        boost::shared_ptr< Cascade< T , Cascador > >& a ,\r
+        const typename Manipulator< T >::Handler& b \r
+    )\r
+    {\r
+        a->add( b );\r
+        return a;\r
+    }\r
+\r
+    template< typename T , class Cascador >\r
+    typename boost::shared_ptr< Cascade< T , Cascador > >& \r
+    operator << \r
+    (\r
+        boost::shared_ptr< Cascade< T , Cascador > >& a ,\r
+        const T& b \r
+    )\r
+    {\r
+        a->add( mof::makeConstantHandler( b ) );\r
+        return a;\r
+    }\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/Cascade.hpp~ b/moftmp/stream/Cascade.hpp~
new file mode 100755 (executable)
index 0000000..f7cfaf3
--- /dev/null
@@ -0,0 +1,179 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+#include <vector> \r
+\r
+namespace mof\r
+{\r
+    #define DEFAULT_CASCADOR Multiply\r
+//{{{ struct Add\r
+    template<typename T>\r
+    struct Add\r
+    {\r
+           inline static T apply(const T& a , const T& b)\r
+        {\r
+               return a + b;\r
+           }\r
+    };\r
+//}}}\r
+//{{{ struct Multiply\r
+    template<typename T>\r
+    struct Multiply\r
+    {\r
+           inline static T apply(const T& a , const T& b)\r
+        {\r
+                   return a * b;\r
+           }\r
+    };\r
+//}}}\r
+//{{{ struct Overwrite\r
+    template<typename T>\r
+    struct Overwrite\r
+    {\r
+           inline static T apply(const T& , const T& b)\r
+        {\r
+                   return b;\r
+           }\r
+    };\r
+//}}}\r
+//{{{ class Cascade\r
+    template< typename T , class Cascador = DEFAULT_CASCADOR< T > >\r
+    class Cascade : public Manipulator< T >{\r
+    public:\r
+        typedef typename boost::shared_ptr< Cascade > Handler;\r
+\r
+           virtual ~Cascade()\r
+        {\r
+           }\r
+\r
+           virtual T value( FrameNumber frame) const\r
+        {\r
+                   T obj = m_list[0]->value(frame);\r
+                   for(unsigned int i = 1 ; i < m_list.size() ; i++)\r
+            {\r
+                           obj = Cascador::apply(obj , m_list[i]->value(frame));\r
+                   }\r
+                   return obj;\r
+           }\r
+\r
+           void clear()\r
+        {\r
+                   m_list.clear();\r
+           }\r
+\r
+           void add( const typename Manipulator<T>::Handler& handler )\r
+        {\r
+                   m_list.push_back( handler );\r
+       }\r
+\r
+        const typename Manipulator<T>::Handler get( int i )\r
+        {\r
+                   return m_cascadeList.at(i);\r
+           }\r
+\r
+        \r
+    private:   \r
+           typedef std::vector< typename Manipulator< T >::Handler > List;\r
+           List m_list;\r
+        \r
+        Cascade\r
+        (\r
+                   const typename Manipulator< T >::Handler& front , \r
+                   const typename Manipulator< T >::Handler& back \r
+        )\r
+           {\r
+                   int length = &back - &front + 1;\r
+                   if(length <= 0)throw std::invalid_argument("list size is 0");\r
+\r
+                   for( int i = 0 ; i < length ; i++)\r
+            {\r
+                       m_list.push_back( (&front)[i] );\r
+               }\r
+           }\r
+    \r
+\r
+        Cascade(){}\r
+        \r
+        template< typename T , class Cascador >\r
+        friend typename boost::shared_ptr< Cascade< T , Cascador > >\r
+        makeCascadeHandler\r
+        (\r
+               const typename Manipulator< T >::Handler& front , \r
+               const typename Manipulator< T >::Handler& back \r
+        );\r
+\r
+        template< typename T , class Cascador >\r
+        friend typename boost::shared_ptr< Cascade< T , Cascador > > makeCascadeHandler();\r
+\r
+\r
+    };\r
+//}}}\r
+//{{{ ヘルパ関数 \r
+    template< typename T , class Cascador >\r
+    boost::shared_ptr< Cascade< T , Cascador > >\r
+    makeCascadeHandler\r
+    (\r
+           const typename Manipulator< T >::Handler& front , \r
+           const typename Manipulator< T >::Handler& back \r
+    )\r
+       {\r
+        return typename Cascade< T , Cascador >::Handler\r
+            (\r
+                new Cascade< T , Cascador >( front , back ) \r
+            );\r
+       }\r
+    \r
+    template< typename T , class Cascador >\r
+    typename boost::shared_ptr< Cascade< T , Cascador > >\r
+    makeCascadeHandler( )\r
+       {\r
+        return typename Cascade< T , Cascador >::Handler\r
+            (\r
+                new Cascade< T , Cascador >\r
+            );\r
+       }\r
+\r
+    template<typename T >\r
+    typename boost::shared_ptr< Cascade< T , DEFAULT_CASCADOR< T > > >\r
+    makeCascadeHandler\r
+    (\r
+           const typename Manipulator< T >::Handler& front , \r
+           const typename Manipulator< T >::Handler& back \r
+    )\r
+       {\r
+        return makeCascadeHandler< T , DEFAULT_CASCADOR< T > >( front , back );\r
+       }\r
+    \r
+    template<typename T >\r
+    typename boost::shared_ptr< Cascade< T , DEFAULT_CASCADOR< T > > >\r
+    makeCascadeHandler( )\r
+       {\r
+        return makeCascadeHandler< T , DEFAULT_CASCADOR< T > >();\r
+       }\r
+//}}}\r
+//{{{ ストリーム演算子\r
+    template< typename T , class Cascador >\r
+    boost::shared_ptr< Cascade< T , Cascador > >& \r
+    operator << \r
+    (\r
+        boost::shared_ptr< Cascade< T , Cascador > >& a ,\r
+        const typename Manipulator< T >::Handler& b \r
+    )\r
+    {\r
+        a->add( b );\r
+        return a;\r
+    }\r
+\r
+    template< typename T , class Cascador >\r
+    typename boost::shared_ptr< Cascade< T , Cascador > >& \r
+    operator << \r
+    (\r
+        boost::shared_ptr< Cascade< T , Cascador > >& a ,\r
+        const T& b \r
+    )\r
+    {\r
+        a->add( mof::makeConstantHandler( b ) );\r
+        return a;\r
+    }\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/CascadeAnimation.cpp b/moftmp/stream/CascadeAnimation.cpp
new file mode 100755 (executable)
index 0000000..b2ab0a4
--- /dev/null
@@ -0,0 +1,161 @@
+\r
+#include "mof/CascadeAnimation.h"\r
+\r
+\r
+\r
+mof::CascadeAnimation::CascadeAnimation()\r
+: mof::Animation(false)\r
+{\r
+       m_key = 0;\r
+       m_maxKey = m_finalKey = 0;\r
+}\r
+\r
+mof::CascadeAnimation::~CascadeAnimation(){\r
+\r
+}\r
+\r
+void mof::CascadeAnimation::setElement(int index , mof::AnimationResource& pAnimation){\r
+       if(m_pAnimations.size() <= index)m_pAnimations.resize(index+1);\r
+       m_pAnimations.at(index) = pAnimation;\r
+       \r
+}\r
+\r
+mof::AnimationResource mof::CascadeAnimation::getElement(int index){\r
+       if(m_pAnimations.size() <= index)return mof::AnimationResource();\r
+       else return m_pAnimations.at(index);\r
+}\r
+\r
+\r
+\r
+bool mof::CascadeAnimation::update(){\r
+       if(!isPlaying())return false;\r
+       m_key++;\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() != NULL)m_pAnimations.at(i)->update();\r
+       }\r
+       return true;\r
+}\r
+\r
+bool mof::CascadeAnimation::isFinalized(){\r
+\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               if(!m_pAnimations.at(i)->isFinalized())return false;\r
+       }\r
+       return true;\r
+}\r
+\r
+void mof::CascadeAnimation::setFinalKey(mof::AnimationKey key){\r
+       if(key > m_maxKey)m_finalKey = m_maxKey;\r
+       else m_finalKey = key;\r
+}\r
+\r
+/*\r
+mof::Vector2D mof::CascadeAnimation::getPosition(mof::Vector2D& position){\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               position = m_pAnimations.at(i)->getPosition(position);\r
+       }\r
+       return position;\r
+\r
+}*/\r
+\r
+mof::Vector2D mof::CascadeAnimation::getPosition(){\r
+       mof::Vector2D position;\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               position = position + m_pAnimations.at(i)->getPosition();\r
+       }\r
+       return position;\r
+\r
+}\r
+       \r
+float mof::CascadeAnimation::getWidth(){\r
+       float result = 1.0f;\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               result *= m_pAnimations.at(i)->getWidth();\r
+       }\r
+       return result;\r
+}\r
+\r
+float mof::CascadeAnimation::getHeight(){\r
+       float result = 1.0f;\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               result *= m_pAnimations.at(i)->getHeight();\r
+       }\r
+       return result;\r
+}\r
+\r
+\r
+float mof::CascadeAnimation::getDepth(){\r
+       float result = 1.0f;\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               result *= m_pAnimations.at(i)->getDepth();\r
+       }\r
+       return result;\r
+}\r
+\r
+\r
+               \r
+mof::Color mof::CascadeAnimation::getColor(){\r
+       float a = 1.0f , r = 1.0f, g = 1.0f, b = 1.0f;\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               mof::Color tmp =  m_pAnimations.at(i)->getColor();\r
+               a = a * ((float)mof::getAlpha(tmp) / 255);\r
+               r = r * ((float)mof::getRed(tmp) / 255);\r
+               g = g * ((float)mof::getGreen(tmp) / 255);\r
+               b = b * ((float)mof::getBlue(tmp) / 255);\r
+       }\r
+       return mof::createColor(a * 255 , r * 255 , g * 255 , b * 255);\r
+}\r
+\r
+\r
+mof::Matrix3D mof::CascadeAnimation::getWorldTransform(mof::Matrix3D& matrix){\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               matrix = m_pAnimations.at(i)->getWorldTransform(matrix);\r
+       }\r
+       return matrix;\r
+}\r
+\r
+\r
+mof::Line2D mof::CascadeAnimation::getTextureRectangle(){\r
+       mof::Line2D result;\r
+       for(int i = 0 ; i < m_pAnimations.size() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               mof::Line2D tmp = m_pAnimations.at(i)->getTextureRectangle();\r
+               if(tmp != mof::Line2D())result = tmp;\r
+       }\r
+       return result;\r
+}\r
+\r
+\r
+void mof::CascadeAnimation::start(){\r
+       for(int i = 0 ; i < getLength() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               if(!m_pAnimations.at(i)->isPlaying())m_pAnimations.at(i)->start();\r
+       }\r
+}\r
+       \r
+void mof::CascadeAnimation::stop(){\r
+       for(int i = 0 ; i < getLength() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               if(m_pAnimations.at(i)->isPlaying())m_pAnimations.at(i)->stop();\r
+       }\r
+}\r
+\r
+bool mof::CascadeAnimation::isPlaying(){\r
+       if(getLength() == 0)return true;\r
+       bool hasAnimation = false;\r
+\r
+       for(int i = 0 ; i < getLength() ; i++){\r
+               if(m_pAnimations.at(i).get() == NULL)continue;\r
+               if(m_pAnimations.at(i)->isPlaying())return true;\r
+               else hasAnimation = true;\r
+       }\r
+       return !hasAnimation;//\91S\97v\91f\82ªNULL\82È\82çtrue\r
+}
\ No newline at end of file
diff --git a/moftmp/stream/CascadingAnimation.hpp~ b/moftmp/stream/CascadingAnimation.hpp~
new file mode 100755 (executable)
index 0000000..013d6db
--- /dev/null
@@ -0,0 +1,143 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+#include <boost/function/function2.hpp>\r
+#include <vector> \r
+\r
+namespace mof\r
+{\r
+namespace stream\r
+{\r
+\r
+    template<typename T>\r
+    struct Add\r
+    {\r
+           inline static T apply(const T& a , const T& b){\r
+               return a + b;\r
+           }\r
+    };\r
+\r
+    template<typename T>\r
+    struct Multiply\r
+    {\r
+           inline static T apply(const T& a , const T& b){\r
+                   return a * b;\r
+           }\r
+    };\r
+\r
+    template<typename T , class Cascador = mof::Multiply<T> >\r
+    class Cascade : public Manipulator<T>{\r
+           typedef std::vector< typename Manipulator< T >::Handler > List;\r
+           List m_list;\r
+    public:\r
+\r
+                   virtual ~Cascade()\r
+        {\r
+           }\r
+\r
+           virtual T value( mof::FrameNumber frame) const\r
+        {\r
+                   T obj = m_list[0]->getValue(frame);\r
+                   for(unsigned int i = 1 ; i < m_cascadeList.size() ; i++){\r
+                           obj = Cascador::apply(obj , m_list[i]->value(frame));\r
+                   }\r
+                   return obj;\r
+           }\r
+\r
+           void clear()\r
+        {\r
+                   m_list.clear();\r
+           }\r
+\r
+           void add( const typename Manipulator<T>::Handler& handler )\r
+        {\r
+\r
+                   m_list.push_back( handler );\r
+       }\r
+\r
+        \r
+        \r
+        void set(int i , const typename Manipulator<T>::Handler& handler )\r
+        {\r
+\r
+                   m_list.at(i) = handler;\r
+       }\r
+\r
+\r
+        const typename Manipulator<T>::Handler get(int i ){\r
+                   return m_cascadeList.at(i);\r
+           }\r
+\r
+    private:   \r
+        Cascade\r
+        (\r
+                   const typename Manipulator< T >::Handler& front , \r
+                   const typename Manipulator< T >::Handler& back \r
+        )\r
+           {\r
+                   int length = &back - &front + 1;\r
+                   if(length <= 0)throw std::invalid_argument("list size is 0");\r
+\r
+                   for( int i = 0 ; i < length ; i++){\r
+                       m_list.push_back( (&front)[i] );\r
+               }\r
+           }\r
+\r
+        Cascade( ){}\r
+\r
+        friend template< class T , class Cascador >\r
+        mof::stream::Cascade< T , Cascador >::Handler \r
+        operator << \r
+        (\r
+            mof::stream::Cascade< T , Cascador >::Handler a ,\r
+            const mof::stream::Manipulator< T >::Handler& b \r
+        );\r
+\r
+    };\r
+\r
+    template<typename T , class Cascador = mof::Multiply<T> >\r
+    Cascade< T , Cascador > makeCascadeHandler\r
+    (\r
+           const typename Manipulator< T >::Handler& front , \r
+           const typename Manipulator< T >::Handler& back \r
+    )\r
+       {\r
+        return typename Cascade< T , Cascador >::Handler\r
+            (\r
+                new Cascade< T , Cascador >( front , back ); \r
+            );\r
+       }\r
+    \r
+    template<typename T , class Cascador = mof::Multiply<T> >\r
+    Cascade< T , Cascador > makeCascadeHandler( )\r
+       {\r
+        return typename Cascade< T , Cascador >::Handler\r
+            (\r
+                new Cascade< T , Cascador >( ); \r
+            );\r
+       }\r
+\r
+\r
+} //namespace stream\r
+} //namespace mof\r
+\r
+template< class T , class Cascador >\r
+mof::stream::Cascade< T , Cascador >::Handler \r
+operator << \r
+(\r
+    mof::stream::Cascade< T , Cascador >::Handler a ,\r
+    const mof::stream::Manipulator< T >::Handler& b \r
+)\r
+{\r
+    return a->add( b );\r
+}\r
+\r
+template< class T , class Cascador >\r
+mof::stream::Cascade< T , Cascador >::Handler \r
+operator << \r
+(\r
+    mof::stream::Cascade< T , Cascador >::Handler a ,\r
+    const T& b \r
+)\r
+{\r
+    return a->add( mof::stream::makeConstantHandler( b ) );\r
+}\r
diff --git a/moftmp/stream/Constant.hpp b/moftmp/stream/Constant.hpp
new file mode 100755 (executable)
index 0000000..e390b5f
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once\r
+#include <mof/stream/Manipulator.hpp>\r
+\r
+namespace mof\r
+{\r
+    template< typename T > class Constant;\r
+\r
+    template< typename T >\r
+    boost::shared_ptr< Constant<T> > makeConstantHandler(const T&);\r
+\r
+\r
+    template< typename T >\r
+    class Constant : public Manipulator< T >{\r
+    public:\r
+           typedef typename boost::shared_ptr< Constant< T > > Handler;\r
+\r
+        virtual ~Constant( ){}\r
+           \r
+           virtual T value( FrameNumber ) const\r
+        {\r
+                   return m_value;\r
+           }\r
+\r
+    private:\r
+           T m_value;\r
+        \r
+        Constant(const T& value) : m_value(value)\r
+        {\r
+           }\r
+\r
+        template< typename T >\r
+        friend boost::shared_ptr< Constant<T> > makeConstantHandler(const T&);\r
+    };\r
+\r
+//{{{ ヘルパ関数\r
+    template<typename T>\r
+    boost::shared_ptr< Constant<T> > makeConstantHandler( const T& value)\r
+    {\r
+           return typename Constant<T>::Handler(new Constant<T>(value));\r
+    }\r
+//}}}\r
+\r
+} // namespace mof\r
+\r
+\r
diff --git a/moftmp/stream/Constant.hpp~ b/moftmp/stream/Constant.hpp~
new file mode 100755 (executable)
index 0000000..ceda069
--- /dev/null
@@ -0,0 +1,45 @@
+#pragma once\r
+#include <mof/stream/Manipulator.hpp>\r
+\r
+namespace mof\r
+{\r
+    template< typename T > class Constant;\r
+\r
+    template< typename T >\r
+    boost::shared_ptr< Constant<T> > makeConstantHandler(const T&);\r
+\r
+\r
+    template< typename T >\r
+    class Constant : public Manipulator< T >{\r
+    public:\r
+           typedef typename boost::shared_ptr< Constant< T > > Handler;\r
+\r
+        virtual ~Constant( ){}\r
+           \r
+           virtual T value( FrameNumber ) const\r
+        {\r
+                   return m_value;\r
+           }\r
+\r
+    private:\r
+           T m_value;\r
+        \r
+        Constant(const T& value) : m_value(value)\r
+        {\r
+           }\r
+\r
+        template< typename T >\r
+        friend boost::shared_ptr< Constant<T> > makeConstantHandler(const T&);\r
+    };\r
+\r
+//{{{ ヘルパ関数\r
+    template<typename T>\r
+    boost::shared_ptr< Constant<T> > makeConstantHandler( const T& value)\r
+    {\r
+           return typename Constant<T>::Handler( new Constant<T>( value ) );\r
+    }\r
+//}}}\r
+\r
+} // namespace mof\r
+\r
+\r
diff --git a/moftmp/stream/DataBasedAnimation.cpp b/moftmp/stream/DataBasedAnimation.cpp
new file mode 100755 (executable)
index 0000000..caed86b
--- /dev/null
@@ -0,0 +1,193 @@
+#include "mof/DataBasedAnimation.h"\r
+#include "mof/KeyFrameAnimation.h"\r
+#include "mof/CSVFile.h"\r
+#include <boost/lexical_cast.hpp>\r
+\r
+\r
+mof::DataBasedAnimation::DataBasedAnimation(const TCHAR * const pPath , mof::Vector3D& denormalizeScale , bool isLooping  )\r
+: mof::Animation(isLooping)  , m_denormalizeScale(denormalizeScale){\r
+       m_pBody = new KeyFrameAnimation(isLooping);\r
+       m_pFile = new CSVFile(pPath);\r
+       m_pFile->setIgnoreNL(false);\r
+       m_pFile->nextLine();//1\8ds\96Ú\82Í\97ñ\92è\8b`\82È\82Ì\82Å\8eÌ\82Ä\82é\r
+       loadNextKeyFrame();\r
+       \r
+}\r
+\r
+mof::DataBasedAnimation::DataBasedAnimation(const TCHAR * const pPath , bool isLooping  )\r
+: mof::Animation(isLooping)  , m_denormalizeScale(1 , 1 , 1){\r
+       m_pBody = new KeyFrameAnimation(isLooping);\r
+       m_pFile = new CSVFile(pPath);\r
+       m_pFile->setIgnoreNL(false);\r
+       m_pFile->nextLine();//1\8ds\96Ú\82Í\97ñ\92è\8b`\82È\82Ì\82Å\8eÌ\82Ä\82é\r
+       loadNextKeyFrame();\r
+       \r
+}\r
+\r
+void mof::DataBasedAnimation::loadNextKeyFrame(){\r
+       if(!m_pFile->hasNextValue())return;\r
+       \r
+       //KeyFrame\r
+       int keyFrame = boost::lexical_cast<int>(m_pFile->getNextValue());\r
+\r
+       //Position\r
+       {\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf1 = m_pFile->getNextValue();\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf2 = m_pFile->getNextValue();\r
+               if(buf1 != _T("") && buf2 != _T("")){\r
+                       mof::tstring buf3;\r
+                       if(m_pFile->hasNextValue())buf3 = m_pFile->getNextValue();\r
+                       if(buf3 != _T("")){\r
+                               //z\8dÀ\95W\82à\97L\8cø\82È\8fê\8d\87\82Í\82R\8e\9f\8c³\8dÀ\95W\82Æ\82µ\82Ä\88µ\82¤\r
+                               mof::Vector3D pos(\r
+                                       boost::lexical_cast<float>(buf1) , boost::lexical_cast<float>(buf2) , boost::lexical_cast<float>(buf3));\r
+                               pos.x = pos.x * m_denormalizeScale.x;\r
+                               pos.y = pos.y * m_denormalizeScale.y;\r
+                               pos.z = pos.z * m_denormalizeScale.z;\r
+                               m_pBody->setPosition(keyFrame , pos);\r
+                       }\r
+                       else m_pBody->setPosition(keyFrame , mof::Vector2D(boost::lexical_cast<int>(buf1) , boost::lexical_cast<int>(buf2)));\r
+               }\r
+               else if(m_pFile->hasNextValue())m_pFile->getNextValue();//PositionZ\82ð\8eÌ\82Ä\82é\r
+       }\r
+\r
+       //Color\r
+       {\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf1 = m_pFile->getNextValue();\r
+               if(buf1 != _T("")){\r
+                       m_pBody->setColor(keyFrame , mof::createColor(buf1));\r
+               }\r
+       }\r
+\r
+       //Texture\r
+       {\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring tux = m_pFile->getNextValue();\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring tuy = m_pFile->getNextValue();\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring tvx = m_pFile->getNextValue();\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring tvy = m_pFile->getNextValue();\r
+               if(tux != _T("") && tuy != _T("") && tvx != _T("") && tvy != _T("")){\r
+                       m_pBody->setTextureRectangle(keyFrame , mof::Line2D(\r
+                               boost::lexical_cast<int>(tux) , boost::lexical_cast<int>(tuy) ,\r
+                               boost::lexical_cast<int>(tvx) , boost::lexical_cast<int>(tvy)));\r
+               }\r
+       }\r
+\r
+       //Scale\r
+       {\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf1 = m_pFile->getNextValue();\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf2 = m_pFile->getNextValue();\r
+               if(buf1 != _T("") && buf2 != _T("")){\r
+                       mof::tstring buf3;\r
+                       if(m_pFile->hasNextValue())buf3 = m_pFile->getNextValue();\r
+                       if(buf3 != _T("")){\r
+                               //\89\9c\8ds\82«\82à\97L\8cø\82È\8fê\8d\87\82Í\82R\8e\9f\8c³\8dÀ\95W\82Æ\82µ\82Ä\88µ\82¤\r
+                               m_pBody->setScale(keyFrame , mof::Vector3D(\r
+                                       boost::lexical_cast<float>(buf1) , boost::lexical_cast<float>(buf2) , boost::lexical_cast<float>(buf3)));\r
+                       }\r
+                       else {\r
+                               //ToDo \82Q\8e\9f\8c³\82Ì\83X\83P\81[\83\8b\r
+                               //m_pBody->set(keyFrame , mof::Vector2D(boost::lexical_cast<int>(buf1) , boost::lexical_cast<int>(buf2)));\r
+                       }\r
+               }\r
+               else if(m_pFile->hasNextValue())m_pFile->getNextValue();//Depth\82ð\8eÌ\82Ä\82é\r
+       }\r
+\r
+       //Rotate\r
+       {\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf1 = m_pFile->getNextValue();\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf2 = m_pFile->getNextValue();\r
+               if(buf1 != _T("") && buf2 != _T("")){\r
+                       mof::tstring buf3;\r
+                       if(m_pFile->hasNextValue())buf3 = m_pFile->getNextValue();\r
+                       if(buf3 != _T("")){\r
+                               //Z\8e²\92\86\90S\82à\97L\8cø\82È\8fê\8d\87\82Í\82R\8e\9f\8c³\8dÀ\95W\82Æ\82µ\82Ä\88µ\82¤\r
+                               m_pBody->setRotation(keyFrame , mof::Vector3D(\r
+                                       boost::lexical_cast<float>(buf1) , boost::lexical_cast<float>(buf2) , boost::lexical_cast<float>(buf3)));\r
+                       }\r
+                       else {\r
+                               //ToDo \82Q\8e\9f\8c³\82Ì\89ñ\93]\r
+                               //m_pBody->set(keyFrame , mof::Vector2D(boost::lexical_cast<int>(buf1) , boost::lexical_cast<int>(buf2)));\r
+                       }\r
+               }\r
+               else if(m_pFile->hasNextValue())m_pFile->getNextValue();//RotZ\82ð\8eÌ\82Ä\82é\r
+       }\r
+\r
+\r
+       //finalize\83V\83O\83i\83\8b\r
+       {\r
+               if(!m_pFile->hasNextValue())goto END;\r
+               mof::tstring buf1 = m_pFile->getNextValue();\r
+               if(buf1 != _T("")){\r
+                       m_pBody->setFinalKey(boost::lexical_cast<int>(buf1));\r
+               }\r
+       }\r
+\r
+\r
+END:\r
+       m_pFile->nextLine();\r
+}\r
+\r
+\r
+mof::DataBasedAnimation::~DataBasedAnimation(void){\r
+       delete m_pBody;\r
+       delete m_pFile;\r
+}\r
+\r
+\r
+bool mof::DataBasedAnimation::update(){\r
+       if(!isPlaying())return false;\r
+       m_pBody->update();\r
+\r
+       loadNextKeyFrame();\r
+       return false;\r
+}\r
+\r
+\r
+bool mof::DataBasedAnimation::isFinalized(){\r
+       return m_pBody->isFinalized();\r
+}\r
+\r
+\r
+mof::Vector2D mof::DataBasedAnimation::getPosition(){\r
+       return m_pBody->getPosition();\r
+}\r
+\r
+       \r
+float mof::DataBasedAnimation::getWidth(){\r
+       return m_pBody->getWidth();\r
+}\r
+\r
+\r
+float mof::DataBasedAnimation::getHeight(){\r
+       return m_pBody->getHeight();\r
+}\r
+\r
+\r
+float mof::DataBasedAnimation::getDepth(){\r
+       return m_pBody->getDepth();\r
+}\r
+\r
+mof::Color mof::DataBasedAnimation::getColor(){\r
+       return m_pBody->getColor();\r
+}\r
+\r
+               \r
+mof::Matrix3D mof::DataBasedAnimation::getWorldTransform(mof::Matrix3D& matrix){\r
+       return m_pBody->getWorldTransform(matrix);\r
+}\r
+\r
+               \r
+mof::Line2D mof::DataBasedAnimation::getTextureRectangle(){\r
+       return m_pBody->getTextureRectangle();\r
+}\r
diff --git a/moftmp/stream/DataBasedAnimation.h b/moftmp/stream/DataBasedAnimation.h
new file mode 100755 (executable)
index 0000000..271bff5
--- /dev/null
@@ -0,0 +1,37 @@
+\r
+#pragma once\r
+#include "mof/Animation.h"\r
+#include "mof/tstring.h"\r
+\r
+namespace mof{\r
+       \r
+       class KeyFrameAnimation;\r
+       class CSVFile;\r
+\r
+       class DataBasedAnimation : public Animation\r
+       {\r
+               KeyFrameAnimation* m_pBody;\r
+               CSVFile* m_pFile;\r
+               mof::Vector3D m_denormalizeScale;\r
+               \r
+               void loadNextKeyFrame();\r
+       public:\r
+               DataBasedAnimation(const TCHAR * const pPath , bool isLooping = false);\r
+               DataBasedAnimation(const TCHAR * const pPath , mof::Vector3D& denormalizePositionScale , bool isLooping = false);\r
+               virtual ~DataBasedAnimation(void);\r
+\r
+               virtual bool update();\r
+               virtual bool isFinalized();\r
+\r
+               virtual mof::Vector2D getPosition();\r
+               virtual float getWidth();\r
+               virtual float getHeight();\r
+               virtual float getDepth();\r
+               virtual mof::Color getColor();\r
+               virtual mof::Matrix3D getWorldTransform(mof::Matrix3D& matrix);\r
+               virtual mof::Line2D getTextureRectangle();\r
+       \r
+               \r
+       };\r
+\r
+};
\ No newline at end of file
diff --git a/moftmp/stream/DefaultAnimationPlayer.cpp b/moftmp/stream/DefaultAnimationPlayer.cpp
new file mode 100755 (executable)
index 0000000..e5ce380
--- /dev/null
@@ -0,0 +1,21 @@
+#include "DefaultAnimationPlayer.hpp"\r
+\r
+\r
+\r
+\r
+mof::DefaultAnimationPlayer::DefaultAnimationPlayer()\r
+: m_frame(0)\r
+{\r
+}\r
+\r
+void mof::DefaultAnimationPlayer::setFrameNumber(mof::FrameNumber frame){\r
+       m_frame = frame;\r
+}\r
+\r
+void mof::DefaultAnimationPlayer::nextFrame(){\r
+       m_frame++;\r
+}\r
+\r
+void mof::DefaultAnimationPlayer::prevFrame(){\r
+       if(m_frame > 0)m_frame--;\r
+}
\ No newline at end of file
diff --git a/moftmp/stream/DefaultAnimationPlayer.hpp b/moftmp/stream/DefaultAnimationPlayer.hpp
new file mode 100755 (executable)
index 0000000..92e9026
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef MOF_DEFAULT_ANIMATION_PLAYER_HPP\r
+#define MOF_DEFAULT_ANIMATION_PLAYER_HPP\r
+#include "mof/AnimationPlayer.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+class DefaultAnimationPlayer : AnimationPlayer{\r
+protected:\r
+       mof::FrameNumber m_frame;\r
+public:\r
+       DefaultAnimationPlayer();\r
+       virtual void setFrameNumber(mof::FrameNumber frame);\r
+       virtual void nextFrame();\r
+       virtual void prevFrame();\r
+       \r
+};\r
+\r
+}\r
+\r
+\r
+#endif\r
diff --git a/moftmp/stream/DefaultAnimationPlayer.hpp~ b/moftmp/stream/DefaultAnimationPlayer.hpp~
new file mode 100755 (executable)
index 0000000..e1101da
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef MOF_DEFAULT_ANIMATION_PLAYER_HPP\r
+#define MOF_DEFAULT_ANIMATION_PLAYER_HPP\r
+#include "mof/AnimationPlayer.hpp"\r
+\r
+namespace mof{\r
+\r
+\r
+class DefaultAnimationPlayer : AnimationPlayer{\r
+protected:\r
+       mof::FrameNumber m_frame;\r
+public:\r
+       DefaultAnimationPlayer();\r
+       virtual void setFrameNumber(mof::FrameNumber frame);\r
+       virtual void nextFrame();\r
+       virtual void prevFrame();\r
+       \r
+};\r
+\r
+}\r
+\r
+\r
+#endif
\ No newline at end of file
diff --git a/moftmp/stream/Filter.hpp b/moftmp/stream/Filter.hpp
new file mode 100755 (executable)
index 0000000..6c9afac
--- /dev/null
@@ -0,0 +1,51 @@
+#pragma once\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Filter : public Manipulator< Vector2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr<Filter> Handler;\r
+       \r
+        Filter\r
+        (\r
+                   const Manipulator<Vector2D>::Handler& body ,\r
+            const mof::Vector2D& filter\r
+               )\r
+        : m_body( body ) , m_filter( filter)\r
+           {\r
+           }\r
+\r
+           virtual Vector2D value( FrameNumber frame ) const\r
+        {\r
+            mof::Vector2D value = m_body->value(frame);\r
+                   return mof::Vector2D( value.x * m_filter.x , value.y * m_filter.y);\r
+           }\r
+\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+           Vector2D m_filter;\r
+\r
+\r
+    };\r
+\r
+//{{{ ヘルパ関数\r
+    inline Filter::Handler makeFilterHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body ,\r
+        const Vector2D& filter\r
+    )\r
+       {\r
+        return Filter::Handler\r
+            (\r
+                new Filter( body , filter  )\r
+            );\r
+       }\r
+//}}}\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/Filter.hpp~ b/moftmp/stream/Filter.hpp~
new file mode 100755 (executable)
index 0000000..e442d31
--- /dev/null
@@ -0,0 +1,51 @@
+#pragma once\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Filter : public Manipulator< Vector2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Translation2D > Handler;\r
+       \r
+        Filter\r
+        (\r
+                   const Manipulator<Vector2D>::Handler& body ,\r
+            const mof::Vector2D& filter\r
+               )\r
+        : m_body( body ) , m_filter( filter)\r
+           {\r
+           }\r
+\r
+           virtual Vector2D value( FrameNumber frame ) const\r
+        {\r
+            mof::Vector2D value = m_body->value(frame);\r
+                   return mof::Vector2D( value.x * m_filter.x , value.y * m_filter.y);\r
+           }\r
+\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+           Vector2D m_filter;\r
+\r
+\r
+    };\r
+\r
+//{{{ ヘルパ関数\r
+    inline Filter::Handler makeFilterHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body ,\r
+        const Vector2D& filter\r
+    )\r
+       {\r
+        return Filter::Handler\r
+            (\r
+                new Filter( body , filter  )\r
+            );\r
+       }\r
+//}}}\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/Joint.hpp b/moftmp/stream/Joint.hpp
new file mode 100755 (executable)
index 0000000..b343cd2
--- /dev/null
@@ -0,0 +1,99 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof\r
+{\r
+       template< typename T , typename K >\r
+       class Joint : public Manipulator< T >\r
+    {\r
+       public:\r
+               typedef typename boost::shared_ptr< mof::Joint< T , K > > Handler;\r
+\r
+        \r
+        virtual ~Joint( )\r
+        {\r
+        }\r
+\r
+               virtual T value( FrameNumber frame ) const\r
+        {\r
+            return m_converter( m_body->value( frame ) );\r
+        }\r
+        \r
+        typename Manipulator< K >::Handler get( ) const { return m_body; }\r
+\r
+        void set( const typename Manipulator< K >::Handler& handler ){ m_body = handler; }\r
+\r
+    private:\r
+        typename Manipulator<K>::Handler m_body;\r
+        T (*m_converter)( const K& );\r
+\r
+        Joint( const typename Manipulator< K >::Handler& handler , T (*converter)( const K& ) )\r
+        : m_body( handler) , m_converter( converter )\r
+        {\r
+        }\r
+\r
+        template< typename T , typename K > friend\r
+        typename Joint< T , K >::Handler makeJointHandler\r
+        ( \r
+            const typename Manipulator< K >::Handler& handler ,\r
+            T (*converter)( const K& )\r
+        );\r
+\r
+       }; // class Joint\r
+\r
+    /** \8c^\95Ï\8a·\82ð\8ds\82í\82È\82¢Joint */\r
+    template< typename T >\r
+       class Joint< T , T > : public Manipulator< T >\r
+    {\r
+       public:\r
+               typedef typename boost::shared_ptr< mof::Joint< T , T > > Handler;\r
+\r
+               \r
+               virtual T getValue( mof::FrameNumber frame ) const\r
+        {\r
+            return m_body->getValue( frame );\r
+        }\r
+\r
+        typename mof::Manipulator< T >::Handler get( ) const { return m_body; }\r
+        void set( const typename mof::Manipulator< T >::Handler& handler ){ m_body = handler; }\r
+    \r
+    private:\r
+        typename mof::Manipulator< T >::Handler m_body;\r
+\r
+        Joint( const typename Manipulator< T >::Handler& handler )\r
+        : m_body( handler)\r
+        {\r
+        }\r
+\r
+        template< typename T > friend\r
+        typename Joint< T , T >::Handler makeJointHandler\r
+        ( \r
+            const typename Manipulator< T >::Handler& handler \r
+        );\r
+\r
+       }; // class Joint \r
+\r
+    \r
+    template< typename T , typename K >\r
+    typename Joint< T , K >::Handler makeJointHandler\r
+    ( \r
+        const typename Manipulator< K >::Handler& handler  ,\r
+        T (*converter)( const K& )\r
+    )\r
+    {\r
+        return typename Joint< T , K >::Handler( new Joint< T , K >( handler , converter ) );\r
+    }\r
+\r
+    /** \8c^\95Ï\8a·\82ð\8ds\82í\82È\82¢Joint\82Ì\90\90¬ */\r
+    // TODO \8c^\90\84\98_\82ª\8cø\82©\82È\82¢\r
+    template< typename T >\r
+    typename Joint< T , T >::Handler makeJointHandler\r
+    ( \r
+        const typename Manipulator< T >::Handler& handler \r
+    )\r
+    {\r
+        return typename Joint< T , T >::Handler( new Joint< T , T >( handler ) );\r
+    }\r
+\r
+    \r
+} // namespace mof\r
diff --git a/moftmp/stream/Joint.hpp~ b/moftmp/stream/Joint.hpp~
new file mode 100755 (executable)
index 0000000..f1e28cb
--- /dev/null
@@ -0,0 +1,99 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof\r
+{\r
+       template< typename T , typename K >\r
+       class Joint : public Manipulator< T >\r
+    {\r
+       public:\r
+               typedef typename boost::shared_ptr< mof::Joint< T , K > > Handler;\r
+\r
+        \r
+        virtual ~Joint( )\r
+        {\r
+        }\r
+\r
+               virtual T value( FrameNumber frame ) const\r
+        {\r
+            return m_converter( m_body->value( frame ) );\r
+        }\r
+        \r
+        typename Manipulator< K >::Handler get( ) const { return m_body; }\r
+\r
+        void set( const typename Manipulator< K >::Handler& handler ){ m_body = handler; }\r
+\r
+    private:\r
+        typename Manipulator<K>::Handler m_body;\r
+        T (*m_converter)( const K& );\r
+\r
+        Joint( const typename Manipulator< K >::Handler& handler , T (*converter)( const K& ) )\r
+        : m_body( handler) , m_converter( converter )\r
+        {\r
+        }\r
+\r
+        template< typename T , typename K > friend\r
+        typename Joint< T , K >::Handler makeJointHandler\r
+        ( \r
+            const typename Manipulator< K >::Handler& handler ,\r
+            T (*converter)( const K& )\r
+        );\r
+\r
+       }; // class Joint\r
+\r
+    /** \8c^\95Ï\8a·\82ð\8ds\82í\82È\82¢Joint */\r
+    template< typename T >\r
+       class Joint< T , T > : public Manipulator< T >\r
+    {\r
+       public:\r
+               typedef typename boost::shared_ptr< mof::Joint< T , T > > Handler;\r
+\r
+               \r
+               virtual T getValue( mof::FrameNumber frame ) const\r
+        {\r
+            return m_body->getValue( frame );\r
+        }\r
+\r
+        typename mof::Manipulator< T >::Handler get( ) const { return m_body; }\r
+        void set( const typename mof::Manipulator< T >::Handler& handler ){ m_body = handler; }\r
+    \r
+    private:\r
+        typename mof::Manipulator< T >::Handler m_body;\r
+\r
+        Joint( const typename Manipulator< T >::Handler& handler )\r
+        : m_body( handler)\r
+        {\r
+        }\r
+\r
+        template< typename T > friend\r
+        typename Joint< T , T >::Handler makeJointHandler\r
+        ( \r
+            const Manipulator< T >::Handler& handler \r
+        );\r
+\r
+       }; // class Joint \r
+\r
+    \r
+    template< typename T , typename K >\r
+    typename Joint< T , K >::Handler makeJointHandler\r
+    ( \r
+        const typename Manipulator< K >::Handler& handler  ,\r
+        T (*converter)( const K& )\r
+    )\r
+    {\r
+        return typename Joint< T , K >::Handler( new Joint< T , K >( handler , converter ) );\r
+    }\r
+\r
+    /** \8c^\95Ï\8a·\82ð\8ds\82í\82È\82¢Joint\82Ì\90\90¬ */\r
+    // TODO \8c^\90\84\98_\82ª\8cø\82©\82È\82¢\r
+    template< typename T >\r
+    typename Joint< T , T >::Handler makeJointHandler\r
+    ( \r
+        const typename Manipulator< T >::Handler& handler \r
+    )\r
+    {\r
+        return typename Joint< T , T >::Handler( new Joint< T , T >( handler ) );\r
+    }\r
+\r
+    \r
+} // namespace mof\r
diff --git a/moftmp/stream/JointAnimation.hpp~ b/moftmp/stream/JointAnimation.hpp~
new file mode 100755 (executable)
index 0000000..f22ff2a
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once\r
+#include "mof/Animation.hpp"\r
+#include <boost/function/function1.hpp>\r
+\r
+namespace mof{\r
+\r
+\r
+       template< typename T , typename K >\r
+       class Joint : boost::noncopyable{\r
+       public:\r
+               typedef boost::shared_ptr< mof::Joint<T> > Handler;\r
+        typedef boost::function1< const T& , const K& > Converter;\r
+\r
+        Joint( const mof::Animation<K>::Handler& handler , const Converter& converter )\r
+        : m_body( handler) , m_converter( converter )\r
+        {\r
+        }\r
+       \r
+               virtual T getValue( mof::FrameNumber frame ) const\r
+        {\r
+            return m_converter( m_body->getValue( frame ) );\r
+        }\r
+\r
+    private:\r
+        mof::Animation<K>::Handler m_body;\r
+        Converter m_converter;\r
+       };\r
+\r
+    template< typename T , typename K >\r
+    Joint< T , K >::Handler makeJointHandler\r
+    ( \r
+        const Animation<K>::Handler& handler ,\r
+        const Joint< T , K >::Converter& converter\r
+    )\r
+    {\r
+        return Joint::Handler( new Joint<T , K>( handler , converter) );\r
+    }\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/KeyFrameAnimation.hpp b/moftmp/stream/KeyFrameAnimation.hpp
new file mode 100755 (executable)
index 0000000..839c50c
--- /dev/null
@@ -0,0 +1,164 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+#include <map>\r
+#include <stdexcept>\r
+#include <boost/function/function2.hpp>\r
+#include "mof/Interpolation.hpp"\r
+\r
+namespace mof{\r
+\r
+    template<typename T >\r
+    class KeyFrameAnimation : public Manipulator< T >\r
+    {\r
+       public:\r
+           typedef std::pair< FrameNumber , T > KeyFrame;\r
+           typedef typename std::map< FrameNumber , T> KeyMap;\r
+\r
+        virtual ~KeyFrameAnimation(){}\r
+\r
+           virtual T value( mof::FrameNumber frame) const\r
+        {\r
+                   return m_interpolator(m_map , frame);\r
+       }\r
+\r
+           mof::FrameNumber getFinalKeyFrameNumber()\r
+        {\r
+                   return m_maxKeyFrameNumber;\r
+           }\r
+\r
+    private:\r
+           KeyMap m_map;\r
+           FrameNumber m_maxKeyFrameNumber;\r
+           boost::function2<T , const KeyMap& , mof::FrameNumber> m_interpolator;\r
+\r
+        KeyFrameAnimation\r
+        (\r
+                   const KeyFrame& front ,\r
+            const KeyFrame& back , \r
+                   const boost::function2< T , const KeyMap& , FrameNumber > & interpolator\r
+               )\r
+        : m_interpolator(interpolator)\r
+           {\r
+                   int length = &back - &front + 1;\r
+                   if(length < 1)throw std::invalid_argument("length < 1");\r
+                   m_maxKeyFrameNumber = 0;\r
+                   for(int i = 0 ; i < length ; i++)\r
+            {\r
+                           if((&front)[i].first > m_maxKeyFrameNumber)m_maxKeyFrameNumber = (&front)[i].first;\r
+                           m_map.insert( std::make_pair((&front)[i].first , (&front)[i].second ) );\r
+               }\r
+       }\r
+\r
+           KeyFrameAnimation\r
+        (\r
+                   const KeyFrame& front , const KeyFrame& back \r
+               )\r
+        : m_interpolator(&mof::linerInterpolate<T>)\r
+           {\r
+                   int length = &back - &front + 1;\r
+                   if(length < 1)throw std::invalid_argument("length < 1");\r
+                   m_maxKeyFrameNumber = 0;\r
+                   for(int i = 0 ; i < length ; i++)\r
+            {\r
+                           if((&front)[i].first > m_maxKeyFrameNumber)m_maxKeyFrameNumber = (&front)[i].first;\r
+                           m_map.insert( std::make_pair((&front)[i].first , (&front)[i].second ) );\r
+                   }\r
+           }\r
+\r
+        template< typename T > friend\r
+           typename KeyFrameAnimation< T >::KeyFrame \r
+           makeKeyFrame( mof::FrameNumber frame , const T & obj );\r
+\r
+        template< typename T > friend\r
+        typename KeyFrameAnimation< T >::Handler \r
+        makeKeyFrameAnimationHandler\r
+        (\r
+               const std::pair< FrameNumber , T >& front ,\r
+            const std::pair< FrameNumber , T >& back  ,\r
+                   const boost::function2< T , const std::map< FrameNumber , T >& , FrameNumber> & interpolator\r
+        );\r
+\r
+        template< typename T > friend\r
+        typename KeyFrameAnimation< T >::Handler \r
+        makeKeyFrameAnimationHandler\r
+        (\r
+               const std::pair< FrameNumber , T >& front ,\r
+            const std::pair< FrameNumber , T >& back  \r
+        );\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+       template< typename T >\r
+       typename KeyFrameAnimation< T >::KeyFrame \r
+       makeKeyFrame( mof::FrameNumber frame , const T & obj )\r
+    {\r
+               return std::make_pair< FrameNumber , T>(frame , obj);\r
+       }\r
+\r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+           const std::pair< FrameNumber , T >& front ,\r
+        const std::pair< FrameNumber , T >& back  ,\r
+               const boost::function2< T , const std::map< FrameNumber , T >& , FrameNumber> & interpolator\r
+    )\r
+       {\r
+        return KeyFrameAnimation< T >::Handler\r
+            (\r
+                new KeyFrameAnimation< T >( front , back , interpolator )\r
+            );\r
+       }\r
+\r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+           const std::pair< FrameNumber , T >& front ,\r
+        const std::pair< FrameNumber , T >& back  \r
+    )\r
+    {\r
+        return KeyFrameAnimation< T >::Handler\r
+            (\r
+                new KeyFrameAnimation< T >( front , back ) \r
+            );\r
+       }\r
+\r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+           FrameNumber fn1 , const T& v1 ,\r
+           FrameNumber fn2 , const T& v2 \r
+    )\r
+    {\r
+        KeyFrameAnimation<T>::KeyFrame keyFrames[] =\r
+        {\r
+            makeKeyFrame(fn1 , v1) ,\r
+            makeKeyFrame(fn2 , v2) \r
+        };\r
+        return makeKeyFrameAnimationHandler(keyFrames[0] , lastOf(keyFrames));\r
+       }\r
+    \r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+           FrameNumber fn1 , const T& v1 ,\r
+           FrameNumber fn2 , const T& v2 ,\r
+               const boost::function2< T , const std::map< FrameNumber , T >& , FrameNumber> & interpolator\r
+    )\r
+    {\r
+        KeyFrameAnimation<T>::KeyFrame keyFrames[] =\r
+        {\r
+            makeKeyFrame(fn1 , v1) ,\r
+            makeKeyFrame(fn2 , v2) \r
+        };\r
+        return makeKeyFrameAnimationHandler(keyFrames[0] , lastOf(keyFrames) , interpolator);\r
+       }\r
+\r
+\r
+\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/KeyFrameAnimation.hpp~ b/moftmp/stream/KeyFrameAnimation.hpp~
new file mode 100755 (executable)
index 0000000..9bc6ee1
--- /dev/null
@@ -0,0 +1,146 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+#include <map>\r
+#include <stdexcept>\r
+#include <boost/function/function2.hpp>\r
+#include "mof/Interpolation.hpp"\r
+\r
+namespace mof{\r
+\r
+    template<typename T >\r
+    class KeyFrameAnimation : public Manipulator< T >\r
+    {\r
+       public:\r
+           typedef std::pair< FrameNumber , T > KeyFrame;\r
+           typedef typename std::map< FrameNumber , T> KeyMap;\r
+\r
+        virtual ~KeyFrameAnimation(){}\r
+\r
+           virtual T value( mof::FrameNumber frame) const\r
+        {\r
+                   return m_interpolator(m_map , frame);\r
+       }\r
+\r
+           mof::FrameNumber getFinalKeyFrameNumber()\r
+        {\r
+                   return m_maxKeyFrameNumber;\r
+           }\r
+\r
+    private:\r
+           KeyMap m_map;\r
+           FrameNumber m_maxKeyFrameNumber;\r
+           boost::function2<T , const KeyMap& , mof::FrameNumber> m_interpolator;\r
+\r
+        KeyFrameAnimation\r
+        (\r
+                   const KeyFrame& front ,\r
+            const KeyFrame& back , \r
+                   const boost::function2< T , const KeyMap& , FrameNumber > & interpolator\r
+               )\r
+        : m_interpolator(interpolator)\r
+           {\r
+                   int length = &back - &front + 1;\r
+                   if(length < 1)throw std::invalid_argument("length < 1");\r
+                   m_maxKeyFrameNumber = 0;\r
+                   for(int i = 0 ; i < length ; i++)\r
+            {\r
+                           if((&front)[i].first > m_maxKeyFrameNumber)m_maxKeyFrameNumber = (&front)[i].first;\r
+                           m_map.insert( std::make_pair((&front)[i].first , (&front)[i].second ) );\r
+               }\r
+       }\r
+\r
+           KeyFrameAnimation\r
+        (\r
+                   const KeyFrame& front , const KeyFrame& back \r
+               )\r
+        : m_interpolator(&mof::linerInterpolate<T>)\r
+           {\r
+                   int length = &back - &front + 1;\r
+                   if(length < 1)throw std::invalid_argument("length < 1");\r
+                   m_maxKeyFrameNumber = 0;\r
+                   for(int i = 0 ; i < length ; i++)\r
+            {\r
+                           if((&front)[i].first > m_maxKeyFrameNumber)m_maxKeyFrameNumber = (&front)[i].first;\r
+                           m_map.insert( std::make_pair((&front)[i].first , (&front)[i].second ) );\r
+                   }\r
+           }\r
+\r
+        template< typename T > friend\r
+           typename KeyFrameAnimation< T >::KeyFrame \r
+           makeKeyFrame( mof::FrameNumber frame , const T & obj );\r
+\r
+        template< typename T > friend\r
+        typename KeyFrameAnimation< T >::Handler \r
+        makeKeyFrameAnimationHandler\r
+        (\r
+               const std::pair< FrameNumber , T >& front ,\r
+            const std::pair< FrameNumber , T >& back  ,\r
+                   const boost::function2< T , const std::map< FrameNumber , T >& , FrameNumber> & interpolator\r
+        );\r
+\r
+        template< typename T > friend\r
+        typename KeyFrameAnimation< T >::Handler \r
+        makeKeyFrameAnimationHandler\r
+        (\r
+               const std::pair< FrameNumber , T >& front ,\r
+            const std::pair< FrameNumber , T >& back  \r
+        );\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+       template< typename T >\r
+       typename KeyFrameAnimation< T >::KeyFrame \r
+       makeKeyFrame( mof::FrameNumber frame , const T & obj )\r
+    {\r
+               return std::make_pair< FrameNumber , T>(frame , obj);\r
+       }\r
+\r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+           const std::pair< FrameNumber , T >& front ,\r
+        const std::pair< FrameNumber , T >& back  ,\r
+               const boost::function2< T , const std::map< FrameNumber , T >& , FrameNumber> & interpolator\r
+    )\r
+       {\r
+        return KeyFrameAnimation< T >::Handler\r
+            (\r
+                new KeyFrameAnimation< T >( front , back , interpolator )\r
+            );\r
+       }\r
+\r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+           const std::pair< FrameNumber , T >& front ,\r
+        const std::pair< FrameNumber , T >& back  \r
+    )\r
+    {\r
+        return KeyFrameAnimation< T >::Handler\r
+            (\r
+                new KeyFrameAnimation< T >( front , back ) \r
+            );\r
+       }\r
+\r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+           FrameNumber fn1 , const T& v1 ,\r
+           FrameNumber fn2 , const T& v2 \r
+    )\r
+    {\r
+        KeyFrameAnimation<T>::KeyFrame keyFrames[] =\r
+        {\r
+            makeKeyFrame(fn1 , v1) ,\r
+            makeKeyFrame(fn2 , v2) \r
+        };\r
+        return makeKeyFrameAnimationHandler(keyFrames[0] , lastOf(keyFrames));\r
+       }\r
+\r
+\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/Loop.hpp b/moftmp/stream/Loop.hpp
new file mode 100755 (executable)
index 0000000..0d13f58
--- /dev/null
@@ -0,0 +1,98 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    template< typename T >\r
+    class Loop : public Manipulator< T >\r
+    {\r
+           \r
+    public:\r
+\r
+        virtual ~Loop( ){}     \r
+\r
+       virtual T value( FrameNumber frame) const\r
+        {\r
+               return m_pBody->value( getInnerFrameNumber( frame ) );\r
+           }\r
+\r
+    private:\r
+\r
+        typename Manipulator<T>::Handler m_pBody;\r
+           FrameNumber m_beginLoopFrameNumber;\r
+           FrameNumber m_endLoopFrameNumber;\r
+\r
+           FrameNumber getInnerFrameNumber(FrameNumber frame) const\r
+        {\r
+                   if(frame < m_beginLoopFrameNumber)return frame;\r
+                   FrameNumber d = m_endLoopFrameNumber - m_beginLoopFrameNumber;\r
+                   return (frame - m_beginLoopFrameNumber) % d + m_beginLoopFrameNumber;\r
+           }\r
+\r
+        Loop(const typename Manipulator<T>::Handler& pBody , FrameNumber endLoopFrameNumber)\r
+           : m_pBody(pBody) , m_beginLoopFrameNumber(0) , m_endLoopFrameNumber(endLoopFrameNumber)\r
+           {\r
+           }\r
+\r
+           Loop\r
+        (\r
+                   const typename Manipulator<T>::Handler& pBody ,\r
+                   FrameNumber beginLoopFrameNumber ,\r
+                   FrameNumber endLoopFrameNumber\r
+           ) \r
+        : m_pBody(pBody) ,  m_beginLoopFrameNumber(beginLoopFrameNumber) , m_endLoopFrameNumber(endLoopFrameNumber)\r
+           {\r
+                   if(m_endLoopFrameNumber < m_beginLoopFrameNumber)throw std::invalid_argument("endLoop < beginLoop");\r
+           }\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Loop< T> >\r
+           makeLoopHandler\r
+        (\r
+                   const typename Manipulator<T>::Handler& pBody ,\r
+                   FrameNumber beginLoopFrameNumber ,\r
+                   FrameNumber endLoopFrameNumber\r
+        );\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Loop< T> >\r
+           makeLoopHandler\r
+        (\r
+                   const typename Manipulator<T>::Handler& pBody ,\r
+                   FrameNumber endLoopFrameNumber\r
+        );\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+       template<typename T >\r
+       typename boost::shared_ptr< Loop< T> >\r
+       makeLoopHandler\r
+    (\r
+               const typename Manipulator<T>::Handler& pBody ,\r
+               FrameNumber beginLoopFrameNumber ,\r
+               FrameNumber endLoopFrameNumber\r
+    )\r
+    {\r
+               return typename Manipulator< T >::Handler\r
+            (\r
+                           new Loop< T >(pBody , beginLoopFrameNumber , endLoopFrameNumber)\r
+                       );\r
+       }\r
+\r
+    template<typename T >\r
+       typename boost::shared_ptr< Loop< T> >\r
+       makeLoopHandler\r
+    (\r
+               const typename Manipulator<T>::Handler& pBody ,\r
+               FrameNumber endLoopFrameNumber\r
+    )\r
+    {\r
+               return typename Manipulator< T >::Handler\r
+            (\r
+                           new Loop< T >(pBody , endLoopFrameNumber)\r
+                       );\r
+       }\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/Loop.hpp~ b/moftmp/stream/Loop.hpp~
new file mode 100755 (executable)
index 0000000..bb233a6
--- /dev/null
@@ -0,0 +1,98 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    template< typename T >\r
+    class Loop : public Manipulator< T >\r
+    {\r
+           \r
+    public:\r
+\r
+        virtual ~Loop( ){}     \r
+\r
+       virtual T value( FrameNumber frame) const\r
+        {\r
+               return m_pBody->value( getInnerFrameNumber( frame ) );\r
+           }\r
+\r
+    private:\r
+\r
+        typename Manipulator<T>::Handler m_pBody;\r
+           FrameNumber m_beginLoopFrameNumber;\r
+           FrameNumber m_endLoopFrameNumber;\r
+\r
+           FrameNumber getInnerFrameNumber(FrameNumber frame) const\r
+        {\r
+                   if(frame < m_beginLoopFrameNumber)return frame;\r
+                   FrameNumber d = m_endLoopFrameNumber - m_beginLoopFrameNumber;\r
+                   return (frame - m_beginLoopFrameNumber) % d + m_beginLoopFrameNumber;\r
+           }\r
+\r
+        Loop(const typename Manipulator<T>::Handler& pBody , FrameNumber endLoopFrameNumber)\r
+           : m_pBody(pBody) , m_beginLoopFrameNumber(0) , m_endLoopFrameNumber(endLoopFrameNumber)\r
+           {\r
+           }\r
+\r
+           LoopManipulator\r
+        (\r
+                   const typename Manipulator<T>::Handler& pBody ,\r
+                   FrameNumber beginLoopFrameNumber ,\r
+                   FrameNumber endLoopFrameNumber\r
+           ) \r
+        : m_pBody(pBody) ,  m_beginLoopFrameNumber(beginLoopFrameNumber) , m_endLoopFrameNumber(endLoopFrameNumber)\r
+           {\r
+                   if(m_endLoopFrameNumber < m_beginLoopFrameNumber)throw std::invalid_argument("endLoop < beginLoop");\r
+           }\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Loop< T> >\r
+           makeLoopHandler\r
+        (\r
+                   const typename Manipulator<T>::Handler& pBody ,\r
+                   FrameNumber beginLoopFrameNumber ,\r
+                   FrameNumber endLoopFrameNumber\r
+        );\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Loop< T> >\r
+           makeLoopHandler\r
+        (\r
+                   const typename Manipulator<T>::Handler& pBody ,\r
+                   FrameNumber endLoopFrameNumber\r
+        );\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+       template<typename T >\r
+       typename boost::shared_ptr< Loop< T> >\r
+       makeLoopHandler\r
+    (\r
+               const typename Manipulator<T>::Handler& pBody ,\r
+               FrameNumber beginLoopFrameNumber ,\r
+               FrameNumber endLoopFrameNumber\r
+    )\r
+    {\r
+               return typename Manipulator< T >::Handler\r
+            (\r
+                           new Loop< T >(pBody , beginLoopFrameNumber , endLoopFrameNumber)\r
+                       );\r
+       }\r
+\r
+    template<typename T >\r
+       typename boost::shared_ptr< Loop< T> >\r
+       makeLoopHandler\r
+    (\r
+               const typename Manipulator<T>::Handler& pBody ,\r
+               FrameNumber endLoopFrameNumber\r
+    )\r
+    {\r
+               return typename Manipulator< T >::Handler\r
+            (\r
+                           new Loop< T >(pBody , endLoopFrameNumber)\r
+                       );\r
+       }\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/LoopAnimation.hpp~ b/moftmp/stream/LoopAnimation.hpp~
new file mode 100755 (executable)
index 0000000..1a07990
--- /dev/null
@@ -0,0 +1,60 @@
+ #pragma once\r
+ #include "mof/Animation.hpp"\r
\r
\r
+ namespace mof{\r
\r
+ template<typename T >\r
+ class LoopAnimation : public Animation<T>{\r
+       typename Animation<T>::Handler m_pBody;\r
+       FrameNumber m_beginLoopFrameNumber;\r
+       FrameNumber m_endLoopFrameNumber;\r
\r
+       FrameNumber getInnerFrameNumber(FrameNumber frame) const{\r
+               if(frame < m_beginLoopFrameNumber)return frame;\r
+               mof::FrameNumber d = m_endLoopFrameNumber - m_beginLoopFrameNumber;\r
+               return (frame - m_beginLoopFrameNumber) % d + m_beginLoopFrameNumber;\r
+       }\r
\r
+ public:\r
\r
+       LoopAnimation(const typename Animation<T>::Handler& pBody , FrameNumber endLoopFrameNumber)\r
+               : m_pBody(pBody) , m_beginLoopFrameNumber(0) , m_endLoopFrameNumber(endLoopFrameNumber)\r
+       {\r
+       }\r
\r
+       LoopAnimation(\r
+               const typename mof::Animation<T>::Handler& pBody ,\r
+               mof::FrameNumber beginLoopFrameNumber ,\r
+               mof::FrameNumber endLoopFrameNumber\r
+       ) : m_pBody(pBody) ,  m_beginLoopFrameNumber(beginLoopFrameNumber) , m_endLoopFrameNumber(endLoopFrameNumber)\r
+       {\r
+               if(m_endLoopFrameNumber < m_beginLoopFrameNumber)throw std::invalid_argument("endLoop < beginLoop");\r
+       }\r
\r
+       \r
\r
+       virtual T getValue( mof::FrameNumber frame) const{\r
+               return m_pBody->getValue(getInnerFrameNumber(frame));\r
+       }\r
\r
\r
\r
+ };\r
\r
+\r
+       template<typename T >\r
+       typename mof::Animation<T>::Handler \r
+       makeLoopHandler(\r
+               const typename mof::Animation<T>::Handler& pBody ,\r
+               mof::FrameNumber beginLoopFrameNumber ,\r
+               mof::FrameNumber endLoopFrameNumber){\r
+\r
+               return typename mof::Animation<T>::Handler(\r
+                       new mof::LoopAnimation<T>(pBody , beginLoopFrameNumber , endLoopFrameNumber)\r
+                       );\r
+       }\r
\r
+\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/Manipulator.hpp b/moftmp/stream/Manipulator.hpp
new file mode 100755 (executable)
index 0000000..71c39ba
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+    typedef unsigned int FrameNumber;\r
+\r
+       template<typename T>\r
+       class Manipulator \r
+    {\r
+       public:\r
+        typedef typename boost::shared_ptr< Manipulator > Handler;\r
+        virtual ~Manipulator(){}       \r
+               virtual T value( FrameNumber fn ) const = 0;\r
+\r
+       };\r
+\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/Manipulator.hpp~ b/moftmp/stream/Manipulator.hpp~
new file mode 100755 (executable)
index 0000000..10fcd4f
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+\r
+       template<typename T>\r
+       class Manipulator \r
+    {\r
+       public:\r
+        typedef typename boost::shared_ptr< Manipulator > Handler;\r
+        virtual ~Manipulator(){}       \r
+               virtual T value( FrameNumber fn ) const = 0;\r
+\r
+       };\r
+\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/Offset.hpp b/moftmp/stream/Offset.hpp
new file mode 100755 (executable)
index 0000000..dd4e716
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof{\r
+\r
+       template< typename T >\r
+       class Offset : public Manipulator< T >\r
+    {\r
+                       \r
+       public:\r
+        typedef typename boost::shared_ptr< Offset > Handler;\r
+        \r
+        virtual ~Offset( ){}\r
+\r
+               virtual T value( FrameNumber frame ) const\r
+        {\r
+            if( m_offset + frame < 0)return m_pBody->value( 0 );\r
+            else return m_pBody->value( frame + m_offset );\r
+               }\r
+\r
+    private:\r
+        typename Manipulator<T>::Handler m_pBody;\r
+               int m_offset;\r
+\r
+\r
+               Offset( const typename Manipulator<T>::Handler& pBody , int offset )\r
+               : m_pBody(pBody) , m_offset(offset) \r
+               {\r
+               }\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Offset< T > > makeOffsetHandler\r
+        (\r
+               const typename Manipulator<T>::Handler& pBody ,\r
+               int offset\r
+        );\r
+\r
+       };\r
+\r
+\r
+       template< typename T >\r
+       boost::shared_ptr< Offset< T > > makeOffsetHandler\r
+    (\r
+               const typename Manipulator< T >::Handler& pBody ,\r
+               int offset\r
+    )\r
+    {\r
+               return typename Offset< T >::Handler(\r
+                       new Offset< T >( pBody , offset )\r
+               );\r
+       }\r
+\r
+\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/Offset.hpp~ b/moftmp/stream/Offset.hpp~
new file mode 100755 (executable)
index 0000000..ca92b9a
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+\r
+namespace mof{\r
+\r
+       template< typename T >\r
+       class Offset : public Manipulator< T >\r
+    {\r
+                       \r
+       public:\r
+        typedef typename boost::shared_ptr< Cascade > Handler;\r
+        \r
+        virtual ~Offset( ){}\r
+\r
+               virtual T value( FrameNumber frame ) const\r
+        {\r
+            if( m_offset + frame < 0)return m_pBody->value( 0 );\r
+            else return m_pBody->value( frame + m_offset );\r
+               }\r
+\r
+    private:\r
+        typename Manipulator<T>::Handler m_pBody;\r
+               int m_offset;\r
+\r
+\r
+               Offset( const typename Manipulator<T>::Handler& pBody , int offset )\r
+               : m_pBody(pBody) , m_offset(offset) \r
+               {\r
+               }\r
+\r
+        template<typename T > friend\r
+           typename boost::shared_ptr< Offset< T > > makeOffsetHandler\r
+        (\r
+               const typename Manipulator<T>::Handler& pBody ,\r
+               int offset\r
+        );\r
+\r
+       };\r
+\r
+\r
+       template< typename T >\r
+       boost::shared_ptr< Offset< T > > makeOffsetHandler\r
+    (\r
+               const typename Manipulator< T >::Handler& pBody ,\r
+               int offset\r
+    )\r
+    {\r
+               return typename Offset< T >::Handler(\r
+                       new Offset< T >( pBody , offset )\r
+               );\r
+       }\r
+\r
+\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/OffsetAnimation.hpp~ b/moftmp/stream/OffsetAnimation.hpp~
new file mode 100755 (executable)
index 0000000..b3bb2a8
--- /dev/null
@@ -0,0 +1,48 @@
+#pragma once\r
+#include "mof/Animation.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+       template<typename T >\r
+       class OffsetAnimation : public Animation<T>{\r
+               typename Animation<T>::Handler m_pBody;\r
+               int m_offset;\r
+\r
+\r
+       public:\r
+\r
+               OffsetAnimation(const typename Animation<T>::Handler& pBody , int offset)\r
+               : m_pBody(pBody) , m_offset(offset) \r
+               {\r
+               }\r
+\r
+       \r
+\r
+               virtual T getValue( mof::FrameNumber frame) const{\r
+            if( m_offset + frame < 0)return m_pBody->getValue( 0 );\r
+            else return m_pBody->getValue(frame + m_offset );\r
+               }\r
+\r
+\r
+\r
+       };\r
+\r
+\r
+       template<typename T >\r
+       typename mof::Animation<T>::Handler \r
+       makeOffsetHandler\r
+    (\r
+               const typename mof::Animation<T>::Handler& pBody ,\r
+               int offset\r
+    )\r
+    {\r
+               return typename mof::Animation<T>::Handler\r
+        (\r
+                       new mof::OffsetAnimation<T>(pBody , offset)\r
+           );\r
+       }\r
+\r
+\r
+} //namespace mof\r
+\r
diff --git a/moftmp/stream/ParametricAnimation.hpp b/moftmp/stream/ParametricAnimation.hpp
new file mode 100755 (executable)
index 0000000..ea7d17d
--- /dev/null
@@ -0,0 +1,30 @@
+ #pragma once\r
\r
+ #include <mof/Animation.hpp>\r
\r
+ namespace mof{\r
\r
\r
\r
+ template<typename T>\r
+ class ParametricAnimation : public mof::Animation<T>{\r
+       const boost::shared_ptr<T>& m_parameter;\r
+ public:\r
\r
+       ParametricAnimation(const boost::shared_ptr<T>& parameter) \r
+               : m_parameter(parameter){\r
+       }\r
\r
+       virtual T getValue(mof::FrameNumber ) const{\r
+               return *m_parameter;\r
+       }\r
\r
+ };\r
\r
+ template<class T>\r
+ typename mof::Animation<T>::Handler makeParametricHandler(const boost::shared_ptr<T>& parameter){\r
+       return mof::Animation<T>::Handler(new mof::ParametricAnimation<T>(parameter));\r
+ }\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/ParametricAnimation.hpp~ b/moftmp/stream/ParametricAnimation.hpp~
new file mode 100755 (executable)
index 0000000..ea7d17d
--- /dev/null
@@ -0,0 +1,30 @@
+ #pragma once\r
\r
+ #include <mof/Animation.hpp>\r
\r
+ namespace mof{\r
\r
\r
\r
+ template<typename T>\r
+ class ParametricAnimation : public mof::Animation<T>{\r
+       const boost::shared_ptr<T>& m_parameter;\r
+ public:\r
\r
+       ParametricAnimation(const boost::shared_ptr<T>& parameter) \r
+               : m_parameter(parameter){\r
+       }\r
\r
+       virtual T getValue(mof::FrameNumber ) const{\r
+               return *m_parameter;\r
+       }\r
\r
+ };\r
\r
+ template<class T>\r
+ typename mof::Animation<T>::Handler makeParametricHandler(const boost::shared_ptr<T>& parameter){\r
+       return mof::Animation<T>::Handler(new mof::ParametricAnimation<T>(parameter));\r
+ }\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/Reference.hpp b/moftmp/stream/Reference.hpp
new file mode 100755 (executable)
index 0000000..a83de0f
--- /dev/null
@@ -0,0 +1,52 @@
+#pragma once\r
+#include <mof/stream/Manipulator.hpp>\r
+\r
+namespace mof\r
+{\r
+    template< typename T > class Reference;\r
+\r
+    template< typename T > \r
+    boost::shared_ptr< Reference<T> >\r
+    makeReferenceHandler(const typename Manipulator<T>::Handler&);\r
+\r
+//{{{ Reference\r
+       template<typename T>\r
+       class Reference : public Manipulator<T>\r
+    {\r
+       public:\r
+        typedef typename boost::shared_ptr<Reference> Handler;\r
+        \r
+        virtual ~Reference(){} \r
+               \r
+        virtual T value(FrameNumber fn) const\r
+        {\r
+            return m_body->value(fn);\r
+        }\r
+\r
+        void replace(const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_body = body;\r
+        }\r
+\r
+    private:\r
+        Manipulator<T>::Handler m_body;\r
+\r
+        Reference(const Manipulator<T>::Handler& body) : m_body(body)\r
+        {}\r
+        \r
+        template< typename T >\r
+        friend typename boost::shared_ptr< Reference<T> > \r
+        makeReferenceHandler(const typename Manipulator<T>::Handler&);\r
+\r
+       };\r
+//}}}\r
+//{{{ ヘルパ関数\r
+    template<typename T>\r
+    boost::shared_ptr< Reference<T> >\r
+    makeReferenceHandler(const typename Manipulator<T>::Handler& body)\r
+    {\r
+           return typename Reference<T>::Handler(new Reference<T>(body));\r
+    }\r
+//}}}\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/Reference.hpp~ b/moftmp/stream/Reference.hpp~
new file mode 100755 (executable)
index 0000000..9dd462c
--- /dev/null
@@ -0,0 +1,52 @@
+#pragma once\r
+#include <mof/stream/Manipulator.hpp>\r
+\r
+namespace mof\r
+{\r
+    template< typename T > class Reference;\r
+\r
+    template< typename T > \r
+    boost::shared_ptr< Reference<T> >\r
+    makeReferenceHandler(const typename Manipulator<T>::Handler&);\r
+\r
+//{{{ Reference\r
+       template<typename T>\r
+       class Reference : public Manipulator<T>\r
+    {\r
+       public:\r
+        typedef typename boost::shared_ptr<Reference> Handler;\r
+        \r
+        virtual ~Reference(){} \r
+               \r
+        virtual T value(FrameNumber fn) const\r
+        {\r
+            return m_body.value(fn);\r
+        }\r
+\r
+        void replace(const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_body = body;\r
+        }\r
+\r
+    private:\r
+        Manipulator<T>::Handler m_body;\r
+\r
+        Reference(const Manipulator<T>::Handler& body) : m_body(body)\r
+        {}\r
+        \r
+        template< typename T >\r
+        friend typename boost::shared_ptr< Reference<T> > \r
+        makeReferenceHandler(const typename Manipulator<T>::Handler&);\r
+\r
+       };\r
+//}}}\r
+//{{{ ヘルパ関数\r
+    template<typename T>\r
+    boost::shared_ptr< Reference<T> >\r
+    makeReferenceHandler(const typename Manipulator<T>::Handler& body)\r
+    {\r
+           return typename Reference<T>::Handler(new Reference<T>(body));\r
+    }\r
+//}}}\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/ReferenceWrapper.hpp b/moftmp/stream/ReferenceWrapper.hpp
new file mode 100755 (executable)
index 0000000..d97efe9
--- /dev/null
@@ -0,0 +1,56 @@
+#pragma once\r
+#include <mof/stream/Reference.hpp>\r
+#include <mof/stream/Offset.hpp>\r
+#include <mof/stream/TypeStream.hpp>\r
+#include <vector>\r
+\r
+namespace mof\r
+{\r
+//{{{ ReferenceWrapper\r
+    template<typename T>\r
+    class ReferenceWrapper\r
+    {\r
+    public:\r
+    \r
+        typename Reference<T>::Handler makeRef(const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_list.push_back(makeReferenceHandler(body));\r
+            return m_list.back();\r
+        }\r
+        \r
+        typename Reference<T>::Handler makeRef(const T& body)\r
+        {\r
+            m_list.push_back(makeReferenceHandler<T>(makeConstantHandler(body)));\r
+            return m_list.back();\r
+        }\r
+\r
+\r
+        void replace(int index , const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_list[index]->replace(body);\r
+            //m_list[index]->replace(makeOffsetHandler(body , -1 * (int)m_stream.getCurrentFrameNumber()));\r
+        }\r
+        \r
+        void replace(int index , const T& body)\r
+        {\r
+            m_list[index]->replace(makeConstantHandler(body));\r
+            //m_list[index]->replace(makeOffsetHandler(makeConstantHandler(body) , -1 * (int)m_stream.getCurrentFrameNumber()));\r
+        }\r
+\r
+        void replace(int index , const TypeStream<T>& stream , const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_list[index]->replace(makeOffsetHandler<T>(body , -1 * stream.getCurrentFrameNumber()));\r
+        }\r
+        \r
+\r
+        typename Reference<T>::Handler getRef(int index) const\r
+        {\r
+            return m_list[index];\r
+        }\r
+\r
+    private:\r
+        std::vector<typename Reference<T>::Handler> m_list;\r
+    };\r
+//}}}\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/ReferenceWrapper.hpp~ b/moftmp/stream/ReferenceWrapper.hpp~
new file mode 100755 (executable)
index 0000000..a1fdd64
--- /dev/null
@@ -0,0 +1,56 @@
+#pragma once\r
+#include <mof/stream/Reference.hpp>\r
+#include <mof/stream/Offset.hpp>\r
+#include <mof/stream/TypeStream.hpp>\r
+#include <vector>\r
+\r
+namespace mof\r
+{\r
+//{{{ ReferenceWrapper\r
+    template<typename T>\r
+    class ReferenceWrapper\r
+    {\r
+    public:\r
+    \r
+        typename Reference<T>::Handler makeRef(const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_list.push_back(makeReferenceHandler(body));\r
+            return m_list.back();\r
+        }\r
+        \r
+        typename Reference<T>::Handler makeRef(const T& body)\r
+        {\r
+            m_list.push_back(makeReferenceHandler<T>(makeConstantHandler(body)));\r
+            return m_list.back();\r
+        }\r
+\r
+\r
+        void replace(int index , const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_list[index]->replace(body);\r
+            //m_list[index]->replace(makeOffsetHandler(body , -1 * (int)m_stream.getCurrentFrameNumber()));\r
+        }\r
+        \r
+        void replace(int index , const T& body)\r
+        {\r
+            m_list[index]->replace(makeConstantHandler(body));\r
+            //m_list[index]->replace(makeOffsetHandler(makeConstantHandler(body) , -1 * (int)m_stream.getCurrentFrameNumber()));\r
+        }\r
+\r
+        void replace(int index , const TypeStream<T>& stream , const typename Manipulator<T>::Handler& body)\r
+        {\r
+            m_list[index]->replace(makeOffsetHandler(body , -1 * stream.getCurrentFrameNumber()));\r
+        }\r
+        \r
+\r
+        typename Reference<T>::Handler getRef(int index) const\r
+        {\r
+            return m_list[index];\r
+        }\r
+\r
+    private:\r
+        std::vector<typename Reference<T>::Handler> m_list;\r
+    };\r
+//}}}\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/Rotation2D.hpp b/moftmp/stream/Rotation2D.hpp
new file mode 100755 (executable)
index 0000000..5a8dec9
--- /dev/null
@@ -0,0 +1,76 @@
+#pragma once\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Rotation2D : public Manipulator< Matrix2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Rotation2D > Handler;\r
+       \r
+        Rotation2D\r
+        (\r
+                   const std::pair< FrameNumber , mof::Vector2D >& front , \r
+                   const std::pair< FrameNumber , mof::Vector2D >& back  \r
+               )\r
+           {\r
+            m_body = makeKeyFrameAnimationHandler< Vector2D >\r
+                (\r
+                    front , back , &linerInterpolate< Vector2D >\r
+                );\r
+           }\r
+    \r
+        Rotation2D\r
+        (\r
+               const Manipulator< Vector2D >::Handler&  body\r
+           )\r
+        : m_body( body )\r
+           {\r
+           }\r
+\r
+           virtual Matrix2D value( FrameNumber frame ) const\r
+        {\r
+                   return Matrix2D::createRotation( m_body->value(frame) );\r
+           }\r
+\r
+        Manipulator<mof::Vector2D>::Handler get( ) const\r
+        {\r
+            return m_body;\r
+        }\r
+    \r
+        void set( const Manipulator< Vector2D >::Handler& handler ) \r
+        {\r
+            m_body = handler;\r
+        }\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+    inline Rotation2D::Handler makeRotation2DHandler\r
+    (\r
+           const std::pair< FrameNumber , Vector2D >& front ,\r
+        const std::pair< FrameNumber , Vector2D >& back  \r
+    )\r
+       {\r
+        return Rotation2D::Handler\r
+            (\r
+                new Rotation2D( front , back  )\r
+            );\r
+       }\r
+\r
+    inline Rotation2D::Handler makeRotation2DHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body\r
+    )\r
+       {\r
+        return Rotation2D::Handler\r
+            (\r
+                new Rotation2D( body  )\r
+            );\r
+       }\r
+//}}}\r
+} // namespace mof\r
diff --git a/moftmp/stream/Rotation2D.hpp~ b/moftmp/stream/Rotation2D.hpp~
new file mode 100755 (executable)
index 0000000..4cc6c62
--- /dev/null
@@ -0,0 +1,76 @@
+#pragma once\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Rotation2D : public Manipulator< Matrix2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Rotation2D > Handler;\r
+       \r
+        Rotation2D\r
+        (\r
+                   const std::pair< FrameNumber , mof::Vector2D >& front , \r
+                   const std::pair< FrameNumber , mof::Vector2D >& back  \r
+               )\r
+           {\r
+            m_body = makeKeyFrameAnimationHandler< Vector2D >\r
+                (\r
+                    front , back , &linerInterpolate< Vector2D >\r
+                );\r
+           }\r
+    \r
+        Rotation2D\r
+        (\r
+               const Manipulator< Vector2D >::Handler&  body\r
+           )\r
+        : m_body( body )\r
+           {\r
+           }\r
+\r
+           virtual Matrix2D value( FrameNumber frame ) const\r
+        {\r
+                   return Matrix2D::createRotation( m_body->value(frame) );\r
+           }\r
+\r
+        Manipulator<mof::Vector2D>::Handler get( ) const\r
+        {\r
+            return m_body;\r
+        }\r
+    \r
+        void set( const Manipulator< Vector2D >::Handler& handler ) \r
+        {\r
+            m_body = handler;\r
+        }\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+    Rotation2D::Handler makeRotation2DHandler\r
+    (\r
+           const std::pair< FrameNumber , Vector2D >& front ,\r
+        const std::pair< FrameNumber , Vector2D >& back  \r
+    )\r
+       {\r
+        return Rotation2D::Handler\r
+            (\r
+                new Rotation2D( front , back  )\r
+            );\r
+       }\r
+\r
+    Rotation2D::Handler makeRotation2DHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body\r
+    )\r
+       {\r
+        return Rotation2D::Handler\r
+            (\r
+                new Rotation2D( body  )\r
+            );\r
+       }\r
+//}}}\r
+} // namespace mof\r
diff --git a/moftmp/stream/RotationAnimation2D.hpp~ b/moftmp/stream/RotationAnimation2D.hpp~
new file mode 100755 (executable)
index 0000000..da8fe55
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef MOF_ROTATION_ANIMATION_2D_HPP\r
+#define MOF_ROTATION_ANIMATION_2D_HPP\r
+#include "mof/KeyFrameAnimation.hpp"\r
+#include <map>\r
+#include <stdexcept>\r
+#include <boost/function/function2.hpp>\r
+#include "mof/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+#include "mof/utilities.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+\r
+class RotationAnimation2D : public mof::Animation<mof::Matrix2D>{\r
+       boost::shared_ptr<mof::KeyFrameAnimation<mof::Vector2D>> m_pBody;\r
+public:\r
+\r
+       RotationAnimation2D(\r
+               const std::pair<mof::FrameNumber , mof::Vector2D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector2D>& back  \r
+               )\r
+       {\r
+               m_pBody = boost::shared_ptr<mof::KeyFrameAnimation<mof::Vector2D>>(\r
+                       new mof::KeyFrameAnimation<mof::Vector2D>(front , back , &mof::linerInterpolate<mof::Vector2D>)\r
+                       );\r
+       }\r
+\r
+       virtual mof::Matrix2D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix2D::createRotation(m_pBody->getValue(frame));\r
+       }\r
+\r
+       mof::FrameNumber getFinalKeyFrameNumber(){\r
+               return m_pBody->getFinalKeyFrameNumber();\r
+       }\r
+\r
+\r
+};\r
+\r
+\r
+\r
+\r
+}\r
+\r
+#endif
\ No newline at end of file
diff --git a/moftmp/stream/RotationAnimation3D.hpp b/moftmp/stream/RotationAnimation3D.hpp
new file mode 100755 (executable)
index 0000000..27dcc12
--- /dev/null
@@ -0,0 +1,53 @@
+ #pragma once\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include <map>\r
+ #include <stdexcept>\r
+ #include <boost/function/function2.hpp>\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include "mof/Matrix3D.hpp"\r
\r
\r
\r
+ namespace mof{\r
\r
\r
+ class RotationAnimation3D : public mof::Animation<mof::Matrix3D>{\r
+       mof::Animation<mof::Vector3D>::Handler  m_body;\r
+ public:\r
\r
+       RotationAnimation3D(\r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& back  \r
+               )\r
+       {\r
+               m_body = mof::Animation<mof::Vector3D>::Handler\r
+        (\r
+                       new mof::KeyFrameAnimation<mof::Vector3D>(front , back , &mof::linerInterpolate<mof::Vector3D> )\r
+               );\r
+       }\r
+    \r
+    RotationAnimation3D\r
+    (\r
+           const mof::Animation<mof::Vector3D>::Handler&  body\r
+       )\r
+    : m_body( body )\r
+       {\r
+       }\r
\r
+       virtual mof::Matrix3D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix3D::createRotation(m_body->getValue(frame));\r
+       }\r
\r
\r
+       /*mof::FrameNumber getFinalKeyFrameNumber(){\r
+               return m_pBody->getFinalKeyFrameNumber();\r
+       }*/\r
\r
\r
+ };\r
\r
\r
\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/RotationAnimation3D.hpp~ b/moftmp/stream/RotationAnimation3D.hpp~
new file mode 100755 (executable)
index 0000000..27dcc12
--- /dev/null
@@ -0,0 +1,53 @@
+ #pragma once\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include <map>\r
+ #include <stdexcept>\r
+ #include <boost/function/function2.hpp>\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include "mof/Matrix3D.hpp"\r
\r
\r
\r
+ namespace mof{\r
\r
\r
+ class RotationAnimation3D : public mof::Animation<mof::Matrix3D>{\r
+       mof::Animation<mof::Vector3D>::Handler  m_body;\r
+ public:\r
\r
+       RotationAnimation3D(\r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& back  \r
+               )\r
+       {\r
+               m_body = mof::Animation<mof::Vector3D>::Handler\r
+        (\r
+                       new mof::KeyFrameAnimation<mof::Vector3D>(front , back , &mof::linerInterpolate<mof::Vector3D> )\r
+               );\r
+       }\r
+    \r
+    RotationAnimation3D\r
+    (\r
+           const mof::Animation<mof::Vector3D>::Handler&  body\r
+       )\r
+    : m_body( body )\r
+       {\r
+       }\r
\r
+       virtual mof::Matrix3D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix3D::createRotation(m_body->getValue(frame));\r
+       }\r
\r
\r
+       /*mof::FrameNumber getFinalKeyFrameNumber(){\r
+               return m_pBody->getFinalKeyFrameNumber();\r
+       }*/\r
\r
\r
+ };\r
\r
\r
\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/Scaling2D.hpp b/moftmp/stream/Scaling2D.hpp
new file mode 100755 (executable)
index 0000000..a21ab0a
--- /dev/null
@@ -0,0 +1,78 @@
+#pragma once\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Scaling2D : public Manipulator< Matrix2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Scaling2D > Handler;\r
+       \r
+        Scaling2D\r
+        (\r
+                   const std::pair< FrameNumber , mof::Vector2D >& front , \r
+                   const std::pair< FrameNumber , mof::Vector2D >& back  \r
+               )\r
+           {\r
+            m_body = makeKeyFrameAnimationHandler< Vector2D >\r
+                (\r
+                    front , back , &linerInterpolate< Vector2D >\r
+                );\r
+           }\r
+    \r
+        Scaling2D\r
+        (\r
+               const Manipulator< Vector2D >::Handler&  body\r
+           )\r
+        : m_body( body )\r
+           {\r
+           }\r
+\r
+           virtual Matrix2D value( FrameNumber frame ) const\r
+        {\r
+                   return Matrix2D::createScaling( m_body->value(frame) );\r
+           }\r
+\r
+        Manipulator<mof::Vector2D>::Handler get( ) const\r
+        {\r
+            return m_body;\r
+        }\r
+    \r
+        void set( const Manipulator< Vector2D >::Handler& handler ) \r
+        {\r
+            m_body = handler;\r
+        }\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+    inline Scaling2D::Handler makeScaling2DHandler\r
+    (\r
+           const std::pair< FrameNumber , Vector2D >& front ,\r
+        const std::pair< FrameNumber , Vector2D >& back  \r
+    )\r
+       {\r
+        return Scaling2D::Handler\r
+            (\r
+                new Scaling2D( front , back  )\r
+            );\r
+       }\r
+\r
+    inline Scaling2D::Handler makeScaling2DHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body\r
+    )\r
+       {\r
+        return Scaling2D::Handler\r
+            (\r
+                new Scaling2D( body  )\r
+            );\r
+       }\r
+//}}}\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/Scaling2D.hpp~ b/moftmp/stream/Scaling2D.hpp~
new file mode 100755 (executable)
index 0000000..e7480ce
--- /dev/null
@@ -0,0 +1,78 @@
+#pragma once\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Scaling2D : public Manipulator< Matrix2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Scaling2D > Handler;\r
+       \r
+        Scaling2D\r
+        (\r
+                   const std::pair< FrameNumber , mof::Vector2D >& front , \r
+                   const std::pair< FrameNumber , mof::Vector2D >& back  \r
+               )\r
+           {\r
+            m_body = makeKeyFrameAnimationHandler< Vector2D >\r
+                (\r
+                    front , back , &linerInterpolate< Vector2D >\r
+                );\r
+           }\r
+    \r
+        Scaling2D\r
+        (\r
+               const Manipulator< Vector2D >::Handler&  body\r
+           )\r
+        : m_body( body )\r
+           {\r
+           }\r
+\r
+           virtual Matrix2D value( FrameNumber frame ) const\r
+        {\r
+                   return Matrix2D::createScaling( m_body->value(frame) );\r
+           }\r
+\r
+        Manipulator<mof::Vector2D>::Handler get( ) const\r
+        {\r
+            return m_body;\r
+        }\r
+    \r
+        void set( const Manipulator< Vector2D >::Handler& handler ) \r
+        {\r
+            m_body = handler;\r
+        }\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+\r
+\r
+    };\r
+//{{{ ヘルパ関数\r
+    Scaling2D::Handler makeScaling2DHandler\r
+    (\r
+           const std::pair< FrameNumber , Vector2D >& front ,\r
+        const std::pair< FrameNumber , Vector2D >& back  \r
+    )\r
+       {\r
+        return Scaling2D::Handler\r
+            (\r
+                new Scaling2D( front , back  )\r
+            );\r
+       }\r
+\r
+    Scaling2D::Handler makeScaling2DHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body\r
+    )\r
+       {\r
+        return Scaling2D::Handler\r
+            (\r
+                new Scaling2D( body  )\r
+            );\r
+       }\r
+//}}}\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/ScalingAnimation2D.hpp~ b/moftmp/stream/ScalingAnimation2D.hpp~
new file mode 100755 (executable)
index 0000000..130829f
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once\r
+#include <boost/function/function2.hpp>\r
+#include "mof/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+\r
+class ScalingAnimation2D : public mof::Animation<mof::Matrix2D>{\r
+       mof::Animation<mof::Vector2D>::Handler  m_body;\r
+public:\r
+    typedef boost::shared_ptr< mof::ScalingAnimation2D > Handler;\r
+\r
+       ScalingAnimation2D(\r
+               const std::pair<mof::FrameNumber , mof::Vector2D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector2D>& back  \r
+               )\r
+       {\r
+        m_body = mof::Animation<mof::Vector2D>::Handler\r
+        (\r
+                       new mof::KeyFrameAnimation<mof::Vector2D>(front , back , &mof::linerInterpolate<mof::Vector2D> )\r
+               );\r
+\r
+       }\r
+    \r
+    ScalingAnimation2D\r
+    (\r
+           const mof::Animation<mof::Vector2D>::Handler&  body\r
+       )\r
+    : m_body( body )\r
+       {\r
+       }\r
+\r
+\r
+    virtual mof::Matrix2D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix2D::createScaling(m_body->getValue(frame));\r
+       }\r
+\r
+    mof::Animation<mof::Vector2D>::Handler get( ) const\r
+    {\r
+        return m_body;\r
+    }\r
+    \r
+    void set( const mof::Animation<mof::Vector2D>::Handler& handler ) \r
+    {\r
+        m_body = handler;\r
+    }\r
+\r
+\r
+};\r
+\r
+\r
+}\r
+\r
diff --git a/moftmp/stream/ScalingAnimation3D.hpp b/moftmp/stream/ScalingAnimation3D.hpp
new file mode 100755 (executable)
index 0000000..90891aa
--- /dev/null
@@ -0,0 +1,39 @@
+ #pragma once\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include <map>\r
+ #include <stdexcept>\r
+ #include <boost/function/function2.hpp>\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include "mof/Matrix3D.hpp"\r
\r
\r
+ namespace mof{\r
\r
\r
+ class ScalingAnimation3D : public mof::Animation<mof::Matrix3D>{\r
+       boost::shared_ptr<mof::KeyFrameAnimation<mof::Vector3D> > m_pBody;\r
+ public:\r
\r
+       ScalingAnimation3D(\r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& back  \r
+               )\r
+       {\r
+               m_pBody = boost::shared_ptr<mof::KeyFrameAnimation<mof::Vector3D> >(\r
+                       new mof::KeyFrameAnimation<mof::Vector3D>(front , back , &mof::linerInterpolate<mof::Vector3D>)\r
+                       );\r
+       }\r
\r
+       virtual mof::Matrix3D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix3D::createScaling(m_pBody->getValue(frame));\r
+       }\r
\r
+       mof::FrameNumber getFinalKeyFrameNumber(){\r
+               return m_pBody->getFinalKeyFrameNumber();\r
+       }\r
\r
\r
+ };\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/ScalingAnimation3D.hpp~ b/moftmp/stream/ScalingAnimation3D.hpp~
new file mode 100755 (executable)
index 0000000..90891aa
--- /dev/null
@@ -0,0 +1,39 @@
+ #pragma once\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include <map>\r
+ #include <stdexcept>\r
+ #include <boost/function/function2.hpp>\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include "mof/Matrix3D.hpp"\r
\r
\r
+ namespace mof{\r
\r
\r
+ class ScalingAnimation3D : public mof::Animation<mof::Matrix3D>{\r
+       boost::shared_ptr<mof::KeyFrameAnimation<mof::Vector3D> > m_pBody;\r
+ public:\r
\r
+       ScalingAnimation3D(\r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& back  \r
+               )\r
+       {\r
+               m_pBody = boost::shared_ptr<mof::KeyFrameAnimation<mof::Vector3D> >(\r
+                       new mof::KeyFrameAnimation<mof::Vector3D>(front , back , &mof::linerInterpolate<mof::Vector3D>)\r
+                       );\r
+       }\r
\r
+       virtual mof::Matrix3D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix3D::createScaling(m_pBody->getValue(frame));\r
+       }\r
\r
+       mof::FrameNumber getFinalKeyFrameNumber(){\r
+               return m_pBody->getFinalKeyFrameNumber();\r
+       }\r
\r
\r
+ };\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/Stream.hpp~ b/moftmp/stream/Stream.hpp~
new file mode 100755 (executable)
index 0000000..764c35a
--- /dev/null
@@ -0,0 +1,76 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/stream/Cascade.hpp"\r
+#include "mof/stream/Constant.hpp"\r
+\r
+namespace mof\r
+{\r
+    \r
+    template< typename T , class Cascador = DEFAULT_CASCADOR< T > >\r
+       struct TypeStream\r
+    {\r
+       public:\r
+        TypeStream( )\r
+        : m_frameNumber( 0 ) , m_cascade( mof::makeCascadeHandler< T >() )\r
+        {\r
+        }\r
+        \r
+        TypeStream( const typename Cascade< T , Cascador >::Handler& handler )\r
+        : m_frameNumber( 0 ) , m_cascade( handler )\r
+        {\r
+        }\r
+\r
+\r
+        ~TypeStream( )\r
+        {\r
+        }\r
+\r
+        typename Cascade< T , Cascador >::Handler& \r
+        get()\r
+        {\r
+            return m_cascador;\r
+        }\r
+        \r
+        typename const Cascade< T , Cascador >::Handler& \r
+        get() const\r
+        {\r
+            return m_cascador;\r
+        }\r
+\r
+\r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const typename Manipulator< T >::Handler& b \r
+        )\r
+        {\r
+            m_cascade->add( b );\r
+            return *this;\r
+        }\r
+\r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const T& b \r
+        )\r
+        {\r
+            m_cascade->add( mof::makeConstantHandler( b ) );\r
+            return *this;\r
+        }\r
+\r
+               T value( ) const\r
+        {\r
+            return m_cascade->value( m_frameNumber );\r
+        }\r
+    \r
+        void update( )\r
+        {\r
+            m_frameNumber++;\r
+        }\r
+\r
+    private:\r
+        FrameNumber m_frameNumber;\r
+        typename Cascade< T , Cascador >::Handler m_cascade;\r
+       };\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/Translation2D.hpp b/moftmp/stream/Translation2D.hpp
new file mode 100755 (executable)
index 0000000..78a80f9
--- /dev/null
@@ -0,0 +1,80 @@
+#pragma once\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Translation2D : public Manipulator< Matrix2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Translation2D > Handler;\r
+       \r
+        Translation2D\r
+        (\r
+                   const std::pair< FrameNumber , mof::Vector2D >& front , \r
+                   const std::pair< FrameNumber , mof::Vector2D >& back  \r
+               )\r
+           {\r
+            m_body = makeKeyFrameAnimationHandler< Vector2D >\r
+                (\r
+                    front , back , &linerInterpolate< Vector2D >\r
+                );\r
+           }\r
+    \r
+        Translation2D\r
+        (\r
+               const Manipulator< Vector2D >::Handler&  body\r
+           )\r
+        : m_body( body )\r
+           {\r
+           }\r
+\r
+           virtual Matrix2D value( FrameNumber frame ) const\r
+        {\r
+                   return Matrix2D::createTranslation( m_body->value(frame) );\r
+           }\r
+\r
+        Manipulator<mof::Vector2D>::Handler get( ) const\r
+        {\r
+            return m_body;\r
+        }\r
+    \r
+        void set( const Manipulator< Vector2D >::Handler& handler ) \r
+        {\r
+            m_body = handler;\r
+        }\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+\r
+\r
+    };\r
+\r
+//{{{ ヘルパ関数\r
+    inline Translation2D::Handler makeTranslation2DHandler\r
+    (\r
+           const std::pair< FrameNumber , Vector2D >& front ,\r
+        const std::pair< FrameNumber , Vector2D >& back  \r
+    )\r
+       {\r
+        return Translation2D::Handler\r
+            (\r
+                new Translation2D( front , back  )\r
+            );\r
+       }\r
+\r
+    inline Translation2D::Handler makeTranslation2DHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body\r
+    )\r
+       {\r
+        return Translation2D::Handler\r
+            (\r
+                new Translation2D( body  )\r
+            );\r
+       }\r
+//}}}\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/Translation2D.hpp~ b/moftmp/stream/Translation2D.hpp~
new file mode 100755 (executable)
index 0000000..32574e1
--- /dev/null
@@ -0,0 +1,80 @@
+#pragma once\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Translation2D : public Manipulator< Matrix2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Translation2D > Handler;\r
+       \r
+        Translation2D\r
+        (\r
+                   const std::pair< FrameNumber , mof::Vector2D >& front , \r
+                   const std::pair< FrameNumber , mof::Vector2D >& back  \r
+               )\r
+           {\r
+            m_body = makeKeyFrameAnimationHandler< Vector2D >\r
+                (\r
+                    front , back , &linerInterpolate< Vector2D >\r
+                );\r
+           }\r
+    \r
+        Translation2D\r
+        (\r
+               const Manipulator< Vector2D >::Handler&  body\r
+           )\r
+        : m_body( body )\r
+           {\r
+           }\r
+\r
+           virtual Matrix2D value( FrameNumber frame ) const\r
+        {\r
+                   return Matrix2D::createTranslation( m_body->value(frame) );\r
+           }\r
+\r
+        Manipulator<mof::Vector2D>::Handler get( ) const\r
+        {\r
+            return m_body;\r
+        }\r
+    \r
+        void set( const Manipulator< Vector2D >::Handler& handler ) \r
+        {\r
+            m_body = handler;\r
+        }\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+\r
+\r
+    };\r
+\r
+//{{{ ヘルパ関数\r
+    Translation2D::Handler makeTranslation2DHandler\r
+    (\r
+           const std::pair< FrameNumber , Vector2D >& front ,\r
+        const std::pair< FrameNumber , Vector2D >& back  \r
+    )\r
+       {\r
+        return Translation2D::Handler\r
+            (\r
+                new Translation2D( front , back  )\r
+            );\r
+       }\r
+\r
+    Translation2D::Handler makeTranslation2DHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body\r
+    )\r
+       {\r
+        return Translation2D::Handler\r
+            (\r
+                new Translation2D( body  )\r
+            );\r
+       }\r
+//}}}\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/TranslationAnimation2D.hpp~ b/moftmp/stream/TranslationAnimation2D.hpp~
new file mode 100755 (executable)
index 0000000..91e6bf9
--- /dev/null
@@ -0,0 +1,96 @@
+#pragma once\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+\r
+\r
+namespace mof{\r
+\r
+    class Translation2D : public Manipulator< Matrix2D >\r
+    {\r
+    public:\r
+        typedef boost::shared_ptr< Translation2D > Handler;\r
+       \r
+        Translation2D\r
+        (\r
+                   const std::pair< FrameNumber , mof::Vector2D >& front , \r
+                   const std::pair< FrameNumber , mof::Vector2D >& back  \r
+               )\r
+           {\r
+            m_body = makeKeyFrameAnimationHandler\r
+                (\r
+                    front , back , &linerInterpolate< Vector2D >\r
+                );\r
+           }\r
+    \r
+        Translation2D\r
+        (\r
+               const Manipulator< Vector2D >::Handler&  body\r
+           )\r
+        : m_body( body )\r
+           {\r
+           }\r
+\r
+           virtual Matrix2D value( FrameNumber frame ) const\r
+        {\r
+                   return Matrix2D::createTranslation( m_body->value(frame) );\r
+           }\r
+\r
+        Manipulator<mof::Vector2D>::Handler get( ) const\r
+        {\r
+            return m_body;\r
+        }\r
+    \r
+        void set( const Manipulator< Vector2D >::Handler& handler ) \r
+        {\r
+            m_body = handler;\r
+        }\r
+\r
+    private:\r
+           Manipulator< Vector2D >::Handler  m_body;\r
+\r
+\r
+    };\r
+\r
+//{{{ ヘルパ関数\r
+    template< typename T >\r
+    typename Translation2D< T >::Handler \r
+    makeTranslation2DHandler\r
+    (\r
+           const std::pair< FrameNumber , T >& front ,\r
+        const std::pair< FrameNumber , T >& back  ,\r
+    )\r
+       {\r
+        return Translation2D< T >::Handler\r
+            (\r
+                new Translation2D< T >( front , back  )\r
+            );\r
+       }\r
+\r
+    template< typename T >\r
+    typename Translation2D< T >::Handler \r
+    makeTranslation2DHandler\r
+    (\r
+           const Manipulator< Vector2D >::Handler&  body\r
+    )\r
+       {\r
+        return Translation2D< T >::Handler\r
+            (\r
+                new Translation2D< T >( body  )\r
+            );\r
+       }\r
+\r
+    template< typename T >\r
+    typename KeyFrameAnimation< T >::Handler \r
+    makeKeyFrameAnimationHandler\r
+    (\r
+    )\r
+    {\r
+        return KeyFrameAnimation< T >::Handler\r
+            (\r
+                new KeyFrameAnimation< T >( front , back ) \r
+            );\r
+       }\r
+//}}}\r
+\r
+}\r
+\r
diff --git a/moftmp/stream/TranslationAnimation3D.hpp b/moftmp/stream/TranslationAnimation3D.hpp
new file mode 100755 (executable)
index 0000000..3761713
--- /dev/null
@@ -0,0 +1,53 @@
+ #pragma once\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include <map>\r
+ #include <stdexcept>\r
+ #include <boost/function/function2.hpp>\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include "mof/Matrix3D.hpp"\r
\r
\r
\r
+ namespace mof{\r
\r
\r
+ class TranslationAnimation3D : public mof::Animation<mof::Matrix3D>{\r
+       mof::Animation<mof::Vector3D>::Handler  m_body;\r
+ public:\r
\r
+       TranslationAnimation3D\r
+    (\r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& back  \r
+       )\r
+       {\r
+               m_body = mof::Animation<mof::Vector3D>::Handler\r
+        (\r
+                   new mof::KeyFrameAnimation<mof::Vector3D>(front , back , &mof::linerInterpolate<mof::Vector3D>)\r
+               );\r
+       }\r
\r
+    TranslationAnimation3D\r
+    (\r
+           const mof::Animation<mof::Vector3D>::Handler&  body\r
+       )\r
+    : m_body( body )\r
+       {\r
+       }\r
+\r
+       virtual mof::Matrix3D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix3D::createTranslation(m_body->getValue(frame));\r
+       }\r
\r
+       /*mof::FrameNumber getFinalKeyFrameNumber(){\r
+               return m_pBody->getFinalKeyFrameNumber();\r
+       }*/\r
\r
\r
+ };\r
\r
\r
\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/TranslationAnimation3D.hpp~ b/moftmp/stream/TranslationAnimation3D.hpp~
new file mode 100755 (executable)
index 0000000..3761713
--- /dev/null
@@ -0,0 +1,53 @@
+ #pragma once\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include <map>\r
+ #include <stdexcept>\r
+ #include <boost/function/function2.hpp>\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include "mof/Matrix3D.hpp"\r
\r
\r
\r
+ namespace mof{\r
\r
\r
+ class TranslationAnimation3D : public mof::Animation<mof::Matrix3D>{\r
+       mof::Animation<mof::Vector3D>::Handler  m_body;\r
+ public:\r
\r
+       TranslationAnimation3D\r
+    (\r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& front , \r
+               const std::pair<mof::FrameNumber , mof::Vector3D>& back  \r
+       )\r
+       {\r
+               m_body = mof::Animation<mof::Vector3D>::Handler\r
+        (\r
+                   new mof::KeyFrameAnimation<mof::Vector3D>(front , back , &mof::linerInterpolate<mof::Vector3D>)\r
+               );\r
+       }\r
\r
+    TranslationAnimation3D\r
+    (\r
+           const mof::Animation<mof::Vector3D>::Handler&  body\r
+       )\r
+    : m_body( body )\r
+       {\r
+       }\r
+\r
+       virtual mof::Matrix3D getValue( mof::FrameNumber frame) const{\r
+               return mof::Matrix3D::createTranslation(m_body->getValue(frame));\r
+       }\r
\r
+       /*mof::FrameNumber getFinalKeyFrameNumber(){\r
+               return m_pBody->getFinalKeyFrameNumber();\r
+       }*/\r
\r
\r
+ };\r
\r
\r
\r
\r
+ } //namespace mof\r
\r
diff --git a/moftmp/stream/TypeStream.hpp b/moftmp/stream/TypeStream.hpp
new file mode 100755 (executable)
index 0000000..ea2b497
--- /dev/null
@@ -0,0 +1,94 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/stream/Cascade.hpp"\r
+#include "mof/stream/Constant.hpp"\r
+#include "mof/stream/Offset.hpp"\r
+\r
+namespace mof\r
+{\r
+    \r
+    template< typename T , class Cascador = DEFAULT_CASCADOR< T > >\r
+       class TypeStream\r
+    {\r
+       public:\r
+        TypeStream( )\r
+        : m_frameNumber( 0 ) , m_cascade( mof::makeCascadeHandler< T , Cascador >() )\r
+        {}\r
+        \r
+\r
+        TypeStream( const typename Manipulator< T >::Handler& handler )\r
+        : m_frameNumber( 0 )  , m_cascade( mof::makeCascadeHandler< T , Cascador >() )\r
+        {\r
+            m_cascade << handler;\r
+        }\r
+        \r
+        TypeStream( const T& value )\r
+        : m_frameNumber( 0 )  , m_cascade( mof::makeCascadeHandler< T , Cascador >() )\r
+        {\r
+            m_cascade << value;\r
+        }\r
+\r
+        ~TypeStream( )\r
+        {}\r
+        \r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const typename Manipulator< T >::Handler& b \r
+        )\r
+        {\r
+            m_cascade->add\r
+            (\r
+                makeOffsetHandler< T >( b , -1 * (int)m_frameNumber)\r
+            );\r
+            return *this;\r
+        }\r
+        \r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const TypeStream< T , Cascador >& obj \r
+        )\r
+        {\r
+            //m_cascade->add( obj.m_cascade  );\r
+            m_cascade->add( makeCacheHandler<T>(makeOffsetHandler< T >( obj.m_cascade , obj.m_frameNumber - m_frameNumber) ) );\r
+            return *this;\r
+        }\r
+\r
+\r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const T& b \r
+        )\r
+        {\r
+            m_cascade->add( mof::makeConstantHandler( b ) );\r
+            return *this;\r
+        }\r
+\r
+               T value( ) const\r
+        {\r
+            return m_cascade->value( m_frameNumber );\r
+        }\r
+\r
+        typename Manipulator<T>::Handler toManipulator()\r
+        {\r
+            return m_cascade;\r
+        }\r
+    \r
+        void update( )\r
+        {\r
+            m_frameNumber++;\r
+        }\r
+\r
+        FrameNumber getCurrentFrameNumber() const\r
+        {\r
+            return m_frameNumber;\r
+        }\r
+\r
+    private:\r
+        FrameNumber m_frameNumber;\r
+        typename Cascade< T , Cascador >::Handler m_cascade;\r
+       };\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/TypeStream.hpp~ b/moftmp/stream/TypeStream.hpp~
new file mode 100755 (executable)
index 0000000..291bbf5
--- /dev/null
@@ -0,0 +1,94 @@
+#pragma once\r
+#include <boost/shared_ptr.hpp>\r
+#include "mof/stream/Cascade.hpp"\r
+#include "mof/stream/Constant.hpp"\r
+#include "mof/stream/Offset.hpp"\r
+\r
+namespace mof\r
+{\r
+    \r
+    template< typename T , class Cascador = DEFAULT_CASCADOR< T > >\r
+       class TypeStream\r
+    {\r
+       public:\r
+        TypeStream( )\r
+        : m_frameNumber( 0 ) , m_cascade( mof::makeCascadeHandler< T , Cascador >() )\r
+        {}\r
+        \r
+\r
+        TypeStream( const typename Manipulator< T >::Handler& handler )\r
+        : m_frameNumber( 0 )  , m_cascade( mof::makeCascadeHandler< T , Cascador >() )\r
+        {\r
+            m_cascade << handler;\r
+        }\r
+        \r
+        TypeStream( const T& value )\r
+        : m_frameNumber( 0 )  , m_cascade( mof::makeCascadeHandler< T , Cascador >() )\r
+        {\r
+            m_cascade << value;\r
+        }\r
+\r
+        ~TypeStream( )\r
+        {}\r
+        \r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const typename Manipulator< T >::Handler& b \r
+        )\r
+        {\r
+            m_cascade->add\r
+            (\r
+                makeOffsetHandler< T >( b , -1 * (int)m_frameNumber)\r
+            );\r
+            return *this;\r
+        }\r
+        \r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const TypeStream< T , Cascador >& obj \r
+        )\r
+        {\r
+            //m_cascade->add( obj.m_cascade  );\r
+            m_cascade->add( makeCacheHandler<T>(makeOffsetHandler< T >( obj.m_cascade , obj.m_frameNumber - m_frameNumber) ) );\r
+            return *this;\r
+        }\r
+\r
+\r
+        TypeStream< T , Cascador >&\r
+        operator << \r
+        (\r
+            const T& b \r
+        )\r
+        {\r
+            m_cascade->add( mof::makeConstantHandler( b ) );\r
+            return *this;\r
+        }\r
+\r
+               T value( ) const\r
+        {\r
+            return m_cascade->value( m_frameNumber );\r
+        }\r
+\r
+        Manipulator<T>::Handler toManipulator()\r
+        {\r
+            return m_cascade;\r
+        }\r
+    \r
+        void update( )\r
+        {\r
+            m_frameNumber++;\r
+        }\r
+\r
+        FrameNumber getCurrentFrameNumber() const\r
+        {\r
+            return m_frameNumber;\r
+        }\r
+\r
+    private:\r
+        FrameNumber m_frameNumber;\r
+        typename Cascade< T , Cascador >::Handler m_cascade;\r
+       };\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/UniformAnimation.hpp b/moftmp/stream/UniformAnimation.hpp
new file mode 100755 (executable)
index 0000000..4c5b246
--- /dev/null
@@ -0,0 +1,48 @@
+#pragma once\r
+#include "mof/Animation.hpp"\r
+#include "mof/Vector3D.hpp"\r
+       \r
+namespace mof{\r
+\r
+       class UniformAnimation : public mof::Animation<mof::Vector3D>\r
+    {\r
+       \r
+           mof::Vector3D m_initialValue;\r
+           mof::Vector3D m_targetValue;        \r
+               double m_speed; \r
+           public:\r
+       \r
+               UniformAnimation\r
+        (\r
+                   const mof::Vector3D& initialValue   ,\r
+                   const mof::Vector3D& targetValue    ,\r
+            double speed \r
+           ) \r
+        : m_initialValue(initialValue) , m_targetValue(targetValue) , m_speed(speed)\r
+               {\r
+               }\r
+       \r
+       \r
+               virtual mof::Vector3D getValue( mof::FrameNumber frame) const\r
+        {\r
+            \r
+                       mof::Vector3D direction = ( m_targetValue - m_initialValue );\r
+            direction.normalize();\r
+            mof::Vector3D result = m_initialValue + direction * m_speed * frame;//\91\9d\95ª \r
+            if( direction.x > 0 && result.x > m_targetValue.x )result.x = m_targetValue.x; \r
+            else if( direction.x < 0 && result.x < m_targetValue.x )result.x = m_targetValue.x; \r
+            if( direction.y > 0 && result.y > m_targetValue.y )result.y = m_targetValue.y; \r
+            else if( direction.y < 0 && result.y < m_targetValue.y )result.y = m_targetValue.y; \r
+            if( direction.z > 0 && result.z > m_targetValue.z )result.z = m_targetValue.z; \r
+            else if( direction.z < 0 && result.z < m_targetValue.z )result.z = m_targetValue.z; \r
+            \r
+            return result;\r
+        }\r
+\r
+                        \r
+       };\r
+       \r
+       \r
+       \r
+} //namespace mof\r
+       \r
diff --git a/moftmp/stream/UniformAnimation.hpp~ b/moftmp/stream/UniformAnimation.hpp~
new file mode 100755 (executable)
index 0000000..091c550
--- /dev/null
@@ -0,0 +1,48 @@
+#pragma once\r
+#include "mof/Animation.hpp"\r
+#include "mof/Vector3D.hpp"\r
+       \r
+namespace mof{\r
+\r
+       class UniformAnimation : public mof::Animation<mof::Vector3D>\r
+    {\r
+       \r
+           mof::Vector3D m_initialValue;\r
+           mof::Vector3D m_targetValue;        \r
+               double m_speed; \r
+           public:\r
+       \r
+               UniformAnimation\r
+        (\r
+                   const mof::Vector3D& initialValue   ,\r
+                   const mof::Vector3D& targetValue    ,\r
+            double speed \r
+           ) \r
+        : m_initialValue(initialValue) , m_targetValue(targetValue) , m_speed(speed)\r
+               {\r
+               }\r
+       \r
+       \r
+               virtual mof::Vector3D getValue( mof::FrameNumber frame) const\r
+        {\r
+            \r
+                       mof::Vector3D direction = ( m_targetValue - m_initialValue );\r
+            direction.normalize();\r
+            mof::Vector3D result = m_initialValue + direction * m_speed * frame;//増分 \r
+            if( direction.x > 0 && result.x > m_targetValue.x )result.x = m_targetValue.x; \r
+            else if( direction.x < 0 && result.x < m_targetValue.x )result.x = m_targetValue.x; \r
+            if( direction.y > 0 && result.y > m_targetValue.y )result.y = m_targetValue.y; \r
+            else if( direction.y < 0 && result.y < m_targetValue.y )result.y = m_targetValue.y; \r
+            if( direction.z > 0 && result.z > m_targetValue.z )result.z = m_targetValue.z; \r
+            else if( direction.z < 0 && result.z < m_targetValue.z )result.z = m_targetValue.z; \r
+            \r
+            return result;\r
+        }\r
+\r
+                        \r
+       };\r
+       \r
+       \r
+       \r
+} //namespace mof\r
+       \r
diff --git a/moftmp/stream/mofAnimations.hpp~ b/moftmp/stream/mofAnimations.hpp~
new file mode 100755 (executable)
index 0000000..6b89a3b
--- /dev/null
@@ -0,0 +1,18 @@
+ #pragma once\r
\r
+ #include "mof/ParametricAnimation.hpp"\r
+ #include "mof/KeyFrameAnimation.hpp"\r
+ #include "mof/RotationAnimation3D.hpp"\r
+ #include "mof/TranslationAnimation3D.hpp"\r
+ #include "mof/ScalingAnimation3D.hpp"\r
+ #include "mof/RotationAnimation2D.hpp"\r
+ #include "mof/TranslationAnimation2D.hpp"\r
+ #include "mof/ScalingAnimation2D.hpp"\r
+ #include "mof/Constant.hpp"\r
+ #include "mof/CascadingAnimation.hpp"\r
+ #include "mof/LoopAnimation.hpp"\r
+ #include "mof/Joint.hpp"\r
+ #include "mof/dynamic/utilities.hpp"\r
+ #include "mof/BoundsAnimation.hpp"\r
+ #include "mof/OffsetAnimation.hpp"\r
+ #include "mof/Interpolation.hpp"\r
diff --git a/moftmp/stream/utilities.cpp b/moftmp/stream/utilities.cpp
new file mode 100755 (executable)
index 0000000..3cb5465
--- /dev/null
@@ -0,0 +1,54 @@
+#include "mof/stream/utilities.hpp"\r
+#include "mof/stream/Joint.hpp"\r
+#include <boost/bind.hpp>\r
+\r
+namespace\r
+{\r
+    mof::Vector2D matrix2translation( const mof::Matrix2D& matrix )\r
+    {\r
+        return mof::Matrix2D::getTranslation( matrix );\r
+    }\r
+    \r
+    mof::Vector2D matrix2scaling( const mof::Matrix2D& matrix )\r
+    {\r
+        return matrix.getDiagonal( );\r
+    }\r
+\r
+    mof::Vector2D matrix2rotation( const mof::Matrix2D& matrix )\r
+    {\r
+        //TODO implementation\r
+        return matrix.getDiagonal( );\r
+    }\r
+\r
+}\r
+\r
+\r
+namespace mof\r
+{\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeTranslation2DHandler( const Manipulator< Matrix2D >::Handler& handler )\r
+    {\r
+        return makeJointHandler( handler , &matrix2translation );\r
+        //return makeJointHandler( handler , boost::bind( &matrix2translation ) );\r
+    }\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeScaling2DHandler( const Manipulator< Matrix2D >::Handler& handler )\r
+    {\r
+        return makeJointHandler( handler , &matrix2scaling );\r
+        //return makeJointHandler( handler , boost::bind( &matrix2scaling ) );\r
+    }\r
+\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeRotation2DHandler( const Manipulator< Matrix2D >::Handler& handler )\r
+    {\r
+        return makeJointHandler( handler , &matrix2rotation  );\r
+        //return makeJointHandler( handler , boost::bind( &matrix2rotation )  );\r
+    }\r
+\r
+\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/utilities.cpp~ b/moftmp/stream/utilities.cpp~
new file mode 100755 (executable)
index 0000000..0a51d5f
--- /dev/null
@@ -0,0 +1,54 @@
+#include "mof/stream/utilities.hpp"\r
+#include "mof/stream/Joint.hpp"\r
+#include <boost/bind.hpp>\r
+\r
+namespace\r
+{\r
+    mof::Vector2D matrix2translation( const mof::Matrix2D& matrix )\r
+    {\r
+        return mof::Matrix2D::getTranslation( matrix );\r
+    }\r
+    \r
+    mof::Vector2D matrix2scaling( const mof::Matrix2D& matrix )\r
+    {\r
+        return matrix.getDiagonal( );\r
+    }\r
+\r
+    mof::Vector2D matrix2rotation( const mof::Matrix2D& matrix )\r
+    {\r
+        //TODO implementation\r
+        return matrix.getDiagonal( );\r
+    }\r
+\r
+}\r
+\r
+\r
+namespace mof\r
+{\r
+\r
+    Animation< Vector2D >::Handler \r
+    makeTranslation2DHandler( const Animation< Matrix2D >::Handler& handler )\r
+    {\r
+        return makeJointHandler( handler , &matrix2translation );\r
+        //return makeJointHandler( handler , boost::bind( &matrix2translation ) );\r
+    }\r
+\r
+    Animation< Vector2D >::Handler \r
+    makeScaling2DHandler( const Animation< Matrix2D >::Handler& handler )\r
+    {\r
+        return makeJointHandler( handler , &matrix2scaling );\r
+        //return makeJointHandler( handler , boost::bind( &matrix2scaling ) );\r
+    }\r
+\r
+\r
+    Animation< Vector2D >::Handler \r
+    makeRotation2DHandler( const Animation< Matrix2D >::Handler& handler )\r
+    {\r
+        return makeJointHandler( handler , &matrix2rotation  );\r
+        //return makeJointHandler( handler , boost::bind( &matrix2rotation )  );\r
+    }\r
+\r
+\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/stream/utilities.hpp b/moftmp/stream/utilities.hpp
new file mode 100755 (executable)
index 0000000..64b2900
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+#include "mof/stream/TypeStream.hpp"\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+#include "mof/Color.hpp"\r
+#include "mof/Rectangle.hpp"\r
+\r
+namespace mof\r
+{\r
+    typedef TypeStream< Vector2D , Add< Vector2D > > Vector2DStream;\r
+    typedef TypeStream< Color4f , Multiply< Color4f > > ColorStream;\r
+    typedef TypeStream< Rectangle< float > , Overwrite< Rectangle< float > > > RectangleStream;\r
+\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeTranslation2DHandler( const Manipulator< Matrix2D >::Handler& handler );\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeScaling2DHandler( const Manipulator< Matrix2D >::Handler& handler );\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeRotation2DHandler( const Manipulator< Matrix2D >::Handler& handler );\r
+\r
+\r
+} // namespace mof\r
diff --git a/moftmp/stream/utilities.hpp~ b/moftmp/stream/utilities.hpp~
new file mode 100755 (executable)
index 0000000..29116cf
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once\r
+#include "mof/stream/Manipulator.hpp"\r
+#include "mof/stream/TypeStream.hpp"\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Matrix2D.hpp"\r
+#include "mof/Color.hpp"\r
+#include "mof/Rectangle.hpp"\r
+\r
+namespace mof\r
+{\r
+    typedef TypeStream< Vector2D , Add< Vector2D > > Vector2DStream;\r
+    typedef TypeStream< Color4f , Multiply< Color4f > > ColorStream;\r
+    typedef TypeStream< Rectangle< float > , Add< Rectangle< float > > > RectangleStream;\r
+\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeTranslation2DHandler( const Manipulator< Matrix2D >::Handler& handler );\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeScaling2DHandler( const Manipulator< Matrix2D >::Handler& handler );\r
+\r
+    Manipulator< Vector2D >::Handler \r
+    makeRotation2DHandler( const Manipulator< Matrix2D >::Handler& handler );\r
+\r
+\r
+} // namespace mof\r
diff --git a/moftmp/streams.hpp b/moftmp/streams.hpp
new file mode 100755 (executable)
index 0000000..21f08a7
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+\r
+\r
+#include "mof/stream/TypeStream.hpp"\r
+#include "mof/stream/Manipulator.hpp"\r
+#include "mof/stream/Cascade.hpp"\r
+#include "mof/stream/Constant.hpp"\r
+#include "mof/stream/KeyFrameAnimation.hpp"\r
+#include "mof/stream/Translation2D.hpp"\r
+#include "mof/stream/Rotation2D.hpp"\r
+#include "mof/stream/Scaling2D.hpp"\r
+#include "mof/stream/Loop.hpp"\r
+#include "mof/stream/Joint.hpp"\r
+#include "mof/stream/Offset.hpp"\r
+#include "mof/stream/Reference.hpp"\r
+#include "mof/stream/Filter.hpp"\r
+#include "mof/stream/ReferenceWrapper.hpp"\r
+#include "mof/stream/Cache.hpp"\r
+#include "mof/stream/utilities.hpp"\r
+\r
+/*\r
+#include "mof/ParametricAnimation.hpp"\r
+#include "mof/RotationAnimation3D.hpp"\r
+#include "mof/TranslationAnimation3D.hpp"\r
+#include "mof/ScalingAnimation3D.hpp"\r
+#include "mof/BoundsAnimation.hpp"\r
+*/\r
diff --git a/moftmp/tests/Alltests.cpp b/moftmp/tests/Alltests.cpp
new file mode 100755 (executable)
index 0000000..3085e77
--- /dev/null
@@ -0,0 +1,32 @@
+#include <cppunit/BriefTestProgressListener.h>\r
+#include <cppunit/CompilerOutputter.h>\r
+#include <cppunit/extensions/TestFactoryRegistry.h>\r
+#include <cppunit/TestResult.h>\r
+#include <cppunit/TestResultCollector.h>\r
+#include <cppunit/TestRunner.h>\r
+#include <conio.h>\r
+\r
+int main( int argc, char* argv[] ) {\r
+  // \83C\83x\83\93\83g\81E\83}\83l\81[\83W\83\83\82Æ\83e\83X\83g\81E\83R\83\93\83g\83\8d\81[\83\89\82ð\90\90¬\82·\82é\r
+  CPPUNIT_NS::TestResult controller;\r
+\r
+  // \83e\83X\83g\8c\8b\89Ê\8eû\8fW\83\8a\83X\83i\82ð\83R\83\93\83g\83\8d\81[\83\89\82É\83A\83^\83b\83`\82·\82é\r
+  CPPUNIT_NS::TestResultCollector result;\r
+  controller.addListener( &result );\r
+\r
+  // \81u.\81v\82Å\90i\8ds\8fó\8bµ\82ð\8fo\97Í\82·\82é\83\8a\83X\83i\82ð\83A\83^\83b\83`\82·\82é\r
+  CPPUNIT_NS::BriefTestProgressListener progress;\r
+  controller.addListener( &progress );\r
+\r
+  // \83e\83X\83g\81E\83\89\83\93\83i\81[\82É\83e\83X\83g\8cQ\82ð\97^\82¦\81A\83e\83X\83g\82·\82é\r
+  CPPUNIT_NS::TestRunner runner;\r
+  runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );\r
+  runner.run( controller );\r
+\r
+  // \83e\83X\83g\8c\8b\89Ê\82ð\95W\8f\80\8fo\97Í\82É\93f\82«\8fo\82·\r
+  CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );\r
+  outputter.write();\r
+\r
+  \r
+  return result.wasSuccessful() ? 0 : 1;\r
+} 
\ No newline at end of file
diff --git a/moftmp/tests/SceneGraphTest.cpp b/moftmp/tests/SceneGraphTest.cpp
new file mode 100755 (executable)
index 0000000..bf52ac7
--- /dev/null
@@ -0,0 +1,39 @@
+#include <cppunit/extensions/HelperMacros.h> \r
+#include "mof/SceneGraph.hpp"\r
+#include "mof/tstring.hpp"\r
+\r
+class SceneGraphTest : public CPPUNIT_NS::TestFixture { \r
+  CPPUNIT_TEST_SUITE( SceneGraphTest );\r
+  CPPUNIT_TEST( test_run );          \r
+  CPPUNIT_TEST_SUITE_END();          \r
+\r
+protected:\r
+       mof::SceneGraph* c_;\r
+\r
+public:\r
+  void setUp();      //\r
+  void tearDown();   //\r
+\r
+protected:\r
+  void test_run();  //\r
\r
+};\r
+\r
+\r
+CPPUNIT_TEST_SUITE_REGISTRATION( SceneGraphTest ); //\r
+\r
+// \8ae\83e\83X\83g\81E\83P\81[\83X\82Ì\8eÀ\8ds\92¼\91O\82É\8cÄ\82Î\82ê\82é\r
+void SceneGraphTest::setUp() {\r
+       c_ = new mof::SceneGraph();\r
+}\r
+\r
+// \8ae\83e\83X\83g\81E\83P\81[\83X\82Ì\8eÀ\8ds\92¼\8cã\82É\8cÄ\82Î\82ê\82é\r
+void SceneGraphTest::tearDown() {\r
+  delete c_;\r
+}\r
+\r
+// \82±\82ê\88È\8d~\82Í\83e\83X\83g\81E\83P\81[\83X\82Ì\8eÀ\91\95\93à\97e\r
+\r
+void SceneGraphTest::test_run() {\r
+  //CPPUNIT_ASSERT_EQUAL(0, c_->run(NULL)); //\r
+}\r
diff --git a/moftmp/tests/TimerTest.cpp b/moftmp/tests/TimerTest.cpp
new file mode 100755 (executable)
index 0000000..2f686f6
--- /dev/null
@@ -0,0 +1,32 @@
+#include <cppunit/extensions/HelperMacros.h> \r
+#include "mof/Timer.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <memory>\r
+\r
+class TimerTest : public CPPUNIT_NS::TestFixture { \r
+  CPPUNIT_TEST_SUITE( TimerTest );   \r
+  CPPUNIT_TEST( test_run );    \r
+  CPPUNIT_TEST_SUITE_END();          \r
+\r
+protected:\r
+       std::auto_ptr<mof::Timer> m_pTarget;\r
+\r
+public:\r
+  void setUp();         \r
+\r
+protected:\r
+       void test_run();\r
\r
+};\r
+\r
+\r
+CPPUNIT_TEST_SUITE_REGISTRATION( TimerTest ); \r
+\r
+void TimerTest::setUp() {\r
+       m_pTarget = std::auto_ptr<mof::Timer>(new mof::Timer());\r
+}\r
+\r
+\r
+void TimerTest::test_run(){\r
+\r
+}
\ No newline at end of file
diff --git a/moftmp/tstring.hpp b/moftmp/tstring.hpp
new file mode 100755 (executable)
index 0000000..89c095e
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef TSTRING_HPP\r
+#define TSTRING_HPP\r
+\r
+#include <string>\r
+#include <tchar.h>\r
+#include <sstream>\r
+\r
+namespace mof {\r
+       typedef std::basic_string<TCHAR> tstring;\r
+       typedef std::basic_ostringstream<TCHAR> otstringstream;\r
+};\r
+\r
+#endif\r
diff --git a/moftmp/utilities.hpp b/moftmp/utilities.hpp
new file mode 100755 (executable)
index 0000000..17ac91f
--- /dev/null
@@ -0,0 +1,53 @@
+#pragma once\r
+#define _USE_MATH_DEFINES\r
+#include <math.h>\r
+#include <boost/foreach.hpp>\r
+#define foreach BOOST_FOREACH \r
+\r
+namespace mof{\r
+    \r
+    inline float deg2rad( float deg )\r
+    {\r
+        return deg / 180.0f * static_cast<float>(M_PI);\r
+    }\r
+\r
+    inline float rad2deg( float rad )\r
+    {\r
+        return rad / static_cast<float>(M_PI) * 180.0f;\r
+    }\r
+\r
+    template< typename T , int N >\r
+    int lengthOf( T (&)[N] )\r
+    {\r
+        return N;\r
+    }\r
+    \r
+    template< typename T , int N >\r
+    T& lastOf( T(&arr)[N] )\r
+    {\r
+        return arr[N-1];\r
+    }\r
+\r
+    template< typename T >\r
+    void safe_delete( T* (&p) )\r
+    {\r
+        delete p;\r
+        p = NULL;\r
+    }\r
+\r
+    template< typename T >\r
+    void safe_delete_array( T* (&p) )\r
+    {\r
+        delete[] p;\r
+        p = NULL;\r
+    }\r
+\r
+    inline int rotation_mod(int a , unsigned int b)\r
+    {\r
+        return a >= 0 ? a % b : b - (-a % b);\r
+    }\r
+\r
+\r
+\r
+} // namespace mof\r
+\r
diff --git a/moftmp/widget/ButtonWidgetView.hpp~ b/moftmp/widget/ButtonWidgetView.hpp~
new file mode 100755 (executable)
index 0000000..7199387
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once\r
+#include "mof/widget/WdigetView.hpp"\r
+\r
+namespace mof\r
+{\r
+       \r
+\r
+       class ButtonWidgetView  \r
+    :\r
+        public WidgetView ,\r
+    {\r
+       public:\r
+\r
+        virtual FrameNumber blur( bool imidiately = false ) = 0;\r
+\r
+       };\r
+\r
+}\r
diff --git a/moftmp/widget/Container.cpp b/moftmp/widget/Container.cpp
new file mode 100755 (executable)
index 0000000..8ec0825
--- /dev/null
@@ -0,0 +1,174 @@
+#include <mof/widget/Container.hpp>\r
+#include "mof/mofGraphics.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/widgets.hpp"\r
+#include "mof/streams.hpp"\r
+#include <vector>\r
+#include <algorithm>\r
+#include <memory>\r
+#include <boost/shared_ptr.hpp>\r
+   \r
+using std::auto_ptr;\r
+using boost::shared_ptr;\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ struct Impl\r
+    struct Container::Impl\r
+    {\r
+        std::vector< shared_ptr<WidgetView> > children;\r
+        auto_ptr<Layout> pLayout;\r
+        \r
+    \r
+        Impl() : pLayout(NULL){}\r
+        ~Impl(){}\r
+    \r
+    };\r
+//}}}\r
+//{{{ constructor\r
+    Container::Container\r
+    (\r
+        const shared_ptr<WidgetView>& front ,\r
+        const shared_ptr<WidgetView>& back ,\r
+        const FactoryMethod<Layout>& layout\r
+    )\r
+    : \r
+        m_pImpl( new Impl( ) ) \r
+    {\r
+        \r
+        int length = (&back - &front) +1;\r
+        for(int i = 0 ; i < length ; i++)\r
+        {\r
+            m_pImpl->children.push_back( (&front)[i] );\r
+        }\r
+\r
+        m_pImpl->pLayout = auto_ptr<Layout>( layout() );\r
+        foreach(shared_ptr<WidgetView> pView , m_pImpl->children)\r
+        {\r
+            m_pImpl->pLayout->add(pView);\r
+        }\r
+        m_sizeStream << m_pImpl->pLayout->getPreferredSize();\r
+        m_pImpl->pLayout->connect(this);\r
+\r
+        for(int i = 0 ; i < length ; i++)\r
+        {\r
+            m_pImpl->children[i]->getColorStream() << getColorStream(); \r
+        }\r
+    }\r
+//}}}\r
+//{{{ destructor\r
+    Container::~Container()\r
+    {\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void Container::update( )\r
+    {\r
+        m_positionStream.update( );\r
+        m_sizeStream.update( );\r
+        m_colorStream.update( );\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            value->update();\r
+        }\r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void Container::draw( ) const\r
+    {\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            value->draw();\r
+        }\r
+\r
+    }\r
+//}}}\r
+//{{{ show\r
+    FrameNumber Container::show(bool imidiately) \r
+    {\r
+        unsigned int maxFrame = 0;\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            maxFrame = max(value->show(imidiately) , maxFrame);\r
+        }\r
+        return maxFrame;\r
+    }\r
+//}}}\r
+//{{{ hide\r
+    FrameNumber Container::hide(bool imidiately)\r
+    {\r
+        unsigned int maxFrame = 0;\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            maxFrame = max(value->hide(imidiately) , maxFrame);\r
+        }\r
+        return maxFrame;\r
+\r
+    }\r
+//}}}\r
+//{{{ focus\r
+    FrameNumber Container::focus(bool) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ blur\r
+    FrameNumber Container::blur(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ click\r
+    FrameNumber Container::click(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ getAt\r
+    shared_ptr<WidgetView> Container::getAt(int index) const\r
+    {\r
+        return m_pImpl->children[index];\r
+    }\r
+//}}}\r
+//{{{ getLength\r
+    int Container::getLength() const\r
+    {\r
+        return m_pImpl->children.size();\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsUp\r
+    int Container::getAdjacencyAsUp(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsUp(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsDown\r
+    int Container::getAdjacencyAsDown(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsDown(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsLeft\r
+    int Container::getAdjacencyAsLeft(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsLeft(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsRight\r
+    int Container::getAdjacencyAsRight(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsRight(index);\r
+    }\r
+//}}}\r
+//{{{ add\r
+    void Container::add(shared_ptr<WidgetView> pView)\r
+    {\r
+        //children.push_back( pView ); \r
+        //m_pImpl->pLayout = adaptWidgetViewAndLayout( m_pImpl->children.begin( ) , m_pImpl->children.end( ) , layout);\r
+    }\r
+//}}}\r
+\r
+}\r
+} // namespace mof\r
diff --git a/moftmp/widget/Container.cpp~ b/moftmp/widget/Container.cpp~
new file mode 100755 (executable)
index 0000000..6e1f7e6
--- /dev/null
@@ -0,0 +1,175 @@
+#include <mof/widget/Container.hpp>\r
+#include "mof/mofGraphics.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/widgets.hpp"\r
+#include "mof/streams.hpp"\r
+#include <vector>\r
+#include <algorithm>\r
+#include <memory>\r
+#include <boost/shared_ptr.hpp>\r
+   \r
+using std::auto_ptr;\r
+using boost::shared_ptr;\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ struct Impl\r
+    struct Container::Impl\r
+    {\r
+        std::vector< shared_ptr<WidgetView> > children;\r
+        auto_ptr<Layout> pLayout;\r
+        \r
+    \r
+        Impl() : pLayout(NULL){}\r
+        ~Impl(){}\r
+    \r
+    };\r
+//}}}\r
+//{{{ constructor\r
+    Container::Container\r
+    (\r
+        const shared_ptr<WidgetView>& front ,\r
+        const shared_ptr<WidgetView>& back ,\r
+        const FactoryMethod<Layout>& layout\r
+    )\r
+    : \r
+        m_pImpl( new Impl( ) ) \r
+    {\r
+        \r
+        int length = (&back - &front) +1;\r
+        for(int i = 0 ; i < length ; i++)\r
+        {\r
+            m_pImpl->children.push_back( (&front)[i] );\r
+        }\r
+\r
+        m_pImpl->pLayout = auto_ptr<Layout>( layout() );\r
+        foreach(shared_ptr<WidgetView> pView , m_pImpl->children)\r
+        {\r
+            m_pImpl->pLayout->add(pView);\r
+        }\r
+        DEBUG_PRINT( m_pImpl->pLayout->getPreferredSize());\r
+        m_sizeStream << m_pImpl->pLayout->getPreferredSize();\r
+        m_pImpl->pLayout->connect(this);\r
+\r
+        for(int i = 0 ; i < length ; i++)\r
+        {\r
+            m_pImpl->children[i]->getColorStream() << getColorStream(); \r
+        }\r
+    }\r
+//}}}\r
+//{{{ destructor\r
+    Container::~Container()\r
+    {\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void Container::update( )\r
+    {\r
+        m_positionStream.update( );\r
+        m_sizeStream.update( );\r
+        m_colorStream.update( );\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            value->update();\r
+        }\r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void Container::draw( ) const\r
+    {\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            value->draw();\r
+        }\r
+\r
+    }\r
+//}}}\r
+//{{{ show\r
+    FrameNumber Container::show(bool imidiately) \r
+    {\r
+        unsigned int maxFrame = 0;\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            maxFrame = max(value->show(imidiately) , maxFrame);\r
+        }\r
+        return maxFrame;\r
+    }\r
+//}}}\r
+//{{{ hide\r
+    FrameNumber Container::hide(bool imidiately)\r
+    {\r
+        unsigned int maxFrame = 0;\r
+        foreach(shared_ptr<WidgetView> value , m_pImpl->children)\r
+        {\r
+            maxFrame = max(value->hide(imidiately) , maxFrame);\r
+        }\r
+        return maxFrame;\r
+\r
+    }\r
+//}}}\r
+//{{{ focus\r
+    FrameNumber Container::focus(bool) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ blur\r
+    FrameNumber Container::blur(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ click\r
+    FrameNumber Container::click(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ getAt\r
+    shared_ptr<WidgetView> Container::getAt(int index) const\r
+    {\r
+        return m_pImpl->children[index];\r
+    }\r
+//}}}\r
+//{{{ getLength\r
+    int Container::getLength() const\r
+    {\r
+        return m_pImpl->children.size();\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsUp\r
+    int Container::getAdjacencyAsUp(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsUp(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsDown\r
+    int Container::getAdjacencyAsDown(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsDown(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsLeft\r
+    int Container::getAdjacencyAsLeft(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsLeft(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsRight\r
+    int Container::getAdjacencyAsRight(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsRight(index);\r
+    }\r
+//}}}\r
+//{{{ add\r
+    void Container::add(shared_ptr<WidgetView> pView)\r
+    {\r
+        //children.push_back( pView ); \r
+        //m_pImpl->pLayout = adaptWidgetViewAndLayout( m_pImpl->children.begin( ) , m_pImpl->children.end( ) , layout);\r
+    }\r
+//}}}\r
+\r
+}\r
+} // namespace mof\r
diff --git a/moftmp/widget/Container.hpp b/moftmp/widget/Container.hpp
new file mode 100755 (executable)
index 0000000..f4b2c31
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once\r
+#include "mof/widget/WidgetView.hpp"\r
+#include <mof/widget/Layout.hpp>\r
+#include "mof/FactoryMethod.hpp"\r
+#include "mof/graphics/utilities.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+\r
+namespace widget\r
+{\r
+\r
+    class Container\r
+    : \r
+        public WidgetView\r
+    {\r
+    public:\r
+        \r
+        Container\r
+        (\r
+            const boost::shared_ptr<WidgetView>& front ,\r
+            const boost::shared_ptr<WidgetView>& back ,\r
+            const FactoryMethod<Layout>& layout\r
+        );\r
+       virtual ~Container( );\r
+\r
+        virtual FrameNumber show( bool imidiately = false );\r
+        virtual FrameNumber hide( bool imidiately = false );\r
+        virtual FrameNumber focus( bool imidiately = false );\r
+        virtual FrameNumber blur( bool imidiately = false );\r
+        virtual FrameNumber click( bool imidiately = false );\r
+        virtual void update( );\r
+        virtual void draw( ) const;\r
+        boost::shared_ptr<WidgetView> getAt(int index) const;\r
+        int getLength() const;\r
+        int getAdjacencyAsUp(int index) const;\r
+        int getAdjacencyAsDown(int index) const;\r
+        int getAdjacencyAsLeft(int index) const;\r
+        int getAdjacencyAsRight(int index) const;\r
+        void add(boost::shared_ptr<WidgetView> pView);\r
+\r
+    private:\r
+        struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+       \r
+    };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/Container.hpp~ b/moftmp/widget/Container.hpp~
new file mode 100755 (executable)
index 0000000..30c74bf
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once\r
+#include "mof/widget/WidgetView.hpp"\r
+#include <mof/widget/Layout.hpp>\r
+#include "mof/FactoryMethod.hpp"\r
+#include "mof/graphics/utilities.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+\r
+namespace widget\r
+{\r
+\r
+    class Container\r
+    : \r
+        public WidgetView\r
+    {\r
+    public:\r
+        \r
+        Container\r
+        (\r
+            boost::shared_ptr<WidgetView> pTop ,\r
+            const FactoryMethod<WidgetView>& last ,\r
+            const FactoryMethod<Layout>& layout\r
+        );\r
+       virtual ~Container( );\r
+\r
+        virtual FrameNumber show( bool imidiately = false );\r
+        virtual FrameNumber hide( bool imidiately = false );\r
+        virtual FrameNumber focus( bool imidiately = false );\r
+        virtual FrameNumber blur( bool imidiately = false );\r
+        virtual FrameNumber click( bool imidiately = false );\r
+        virtual void update( );\r
+        virtual void draw( ) const;\r
+        boost::shared_ptr<WidgetView> getAt(int index) const;\r
+        int getLength() const;\r
+        int getAdjacencyAsUp(int index) const;\r
+        int getAdjacencyAsDown(int index) const;\r
+        int getAdjacencyAsLeft(int index) const;\r
+        int getAdjacencyAsRight(int index) const;\r
+        void add(boost::shared_ptr<WidgetView> pView);\r
+\r
+    private:\r
+        struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+       \r
+    };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/ContainerWidgetView.cpp~ b/moftmp/widget/ContainerWidgetView.cpp~
new file mode 100755 (executable)
index 0000000..47b924a
--- /dev/null
@@ -0,0 +1,160 @@
+#include <mof/widget/ContainerWidgetView.hpp>\r
+#include "mof/mofGraphics.hpp"\r
+#include <mof/adaptWidgetViewAndLayout.hpp>\r
+#include "mof/utilities.hpp"\r
+#include "mof/widgets.hpp"\r
+#include "mof/streams.hpp"\r
+#include <vector>\r
+#include <algorithm>\r
+    \r
+namespace mof\r
+{\r
+//{{{ struct Impl\r
+    struct ContainerWidgetView::Impl\r
+    {\r
+        std::vector<WidgetView*> children;\r
+        mof::Layout* pLayout;\r
+    \r
+        Impl() : pLayout(NULL){}\r
+        ~Impl(){}\r
+    \r
+    };\r
+//}}}\r
+//{{{ constructor\r
+    ContainerWidgetView::ContainerWidgetView\r
+    (\r
+        const FactoryMethod<WidgetView>& front ,\r
+        const FactoryMethod<WidgetView>& last ,\r
+        const FactoryMethod<Layout>& layout\r
+    )\r
+    : \r
+        m_pImpl( new Impl( ) ) \r
+    {\r
+        \r
+        int length = (&last - &front) +1;\r
+        for(int i = 0 ; i < length ; i++)\r
+        {\r
+            m_pImpl->children.push_back((&front)[i]());\r
+        }\r
+\r
+        m_pImpl->pLayout = adaptWidgetViewAndLayout(m_pImpl->children , layout);\r
+        m_sizeStream << m_pImpl->pLayout->getBounds();\r
+\r
+        for(int i = 0 ; i < length ; i++)\r
+        {\r
+            m_pImpl->children[i]->getPositionStream() << getPositionStream(); \r
+            m_pImpl->children[i]->getColorStream() << getColorStream(); \r
+        }\r
+    }\r
+//}}}\r
+//{{{ destructor\r
+    ContainerWidgetView::~ContainerWidgetView()\r
+    {\r
+        foreach(WidgetView* value , m_pImpl->children)\r
+        {\r
+            delete value;\r
+        }\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void ContainerWidgetView::update( )\r
+    {\r
+        m_positionStream.update( );\r
+        m_sizeStream.update( );\r
+        m_colorStream.update( );\r
+        foreach(WidgetView* value , m_pImpl->children)\r
+        {\r
+            value->update();\r
+        }\r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void ContainerWidgetView::draw( ) const\r
+    {\r
+        foreach(WidgetView* value , m_pImpl->children)\r
+        {\r
+            value->draw();\r
+        }\r
+\r
+    }\r
+//}}}\r
+//{{{ show\r
+    FrameNumber ContainerWidgetView::show(bool imidiately) \r
+    {\r
+        unsigned int maxFrame = 0;\r
+        foreach(WidgetView* value , m_pImpl->children)\r
+        {\r
+            maxFrame = max(value->show(imidiately) , maxFrame);\r
+        }\r
+        return maxFrame;\r
+    }\r
+//}}}\r
+//{{{ hide\r
+    FrameNumber ContainerWidgetView::hide(bool imidiately)\r
+    {\r
+        int maxFrame = 0;\r
+        foreach(WidgetView* value , m_pImpl->children)\r
+        {\r
+            maxFrame = max(value->hide(imidiately) , maxFrame);\r
+        }\r
+        return maxFrame;\r
+\r
+    }\r
+//}}}\r
+//{{{ focus\r
+    FrameNumber ContainerWidgetView::focus(bool) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ blur\r
+    FrameNumber ContainerWidgetView::blur(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ click\r
+    FrameNumber ContainerWidgetView::click(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ getAt\r
+    WidgetView* ContainerWidgetView::getAt(int index) const\r
+    {\r
+        return m_pImpl->children[index];\r
+    }\r
+//}}}\r
+//{{{ getLength\r
+    int ContainerWidgetView::getLength() const\r
+    {\r
+        return m_pImpl->children.size();\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsUp\r
+    int ContainerWidgetView::getAdjacencyAsUp(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsUp(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsDown\r
+    int ContainerWidgetView::getAdjacencyAsDown(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsDown(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsLeft\r
+    int ContainerWidgetView::getAdjacencyAsLeft(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsLeft(index);\r
+    }\r
+//}}}\r
+//{{{ getAdjacentAsRight\r
+    int ContainerWidgetView::getAdjacencyAsRight(int index) const\r
+    {\r
+        return m_pImpl->pLayout->getAdjacencyAsRight(index);\r
+    }\r
+//}}}\r
+\r
+\r
+} // namespace mof\r
diff --git a/moftmp/widget/ContainerWidgetView.hpp~ b/moftmp/widget/ContainerWidgetView.hpp~
new file mode 100755 (executable)
index 0000000..3b39334
--- /dev/null
@@ -0,0 +1,46 @@
+#pragma once\r
+#include "mof/widget/WidgetView.hpp"\r
+#include <mof/widget/Layout.hpp>\r
+#include "mof/FactoryMethod.hpp"\r
+#include "mof/graphics/utilities.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+\r
+    class ContainerWidgetView \r
+    : \r
+        public WidgetView\r
+    {\r
+    public:\r
+       ContainerWidgetView\r
+        (\r
+            const FactoryMethod<WidgetView>& front ,\r
+            const FactoryMethod<WidgetView>& last ,\r
+            const FactoryMethod<Layout>& layout\r
+        );\r
+       virtual ~ContainerWidgetView( );\r
+\r
+        virtual FrameNumber show( bool imidiately = false );\r
+        virtual FrameNumber hide( bool imidiately = false );\r
+        virtual FrameNumber focus( bool imidiately = false );\r
+        virtual FrameNumber blur( bool imidiately = false );\r
+        virtual void update( );\r
+        virtual void draw( ) const;\r
+        WidgetView* getAt(int index) const;\r
+        int getLength() const;\r
+        int getAdjacencyAsUp(int index) const;\r
+        int getAdjacencyAsDown(int index) const;\r
+        int getAdjacencyAsLeft(int index) const;\r
+        int getAdjacencyAsRight(int index) const;\r
+\r
+\r
+    private:\r
+        struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+       \r
+    };\r
+\r
+}\r
diff --git a/moftmp/widget/Effect.cpp b/moftmp/widget/Effect.cpp
new file mode 100755 (executable)
index 0000000..10db4f3
--- /dev/null
@@ -0,0 +1,109 @@
+#include "mof/widget/Effect.hpp"\r
+#include <map>\r
+#include "mof/Sprite.hpp"\r
+#include "mof/Drawable.hpp"\r
+#include "mof/utilities.hpp"\r
+#include <stdexcept>\r
+\r
+typedef std::map<mof::tstring , mof::Sprite*> SpriteMap;\r
+typedef std::pair<mof::tstring , mof::Sprite*> SpriteMapPair;\r
+typedef std::map<mof::tstring , mof::Drawable*> DrawableMap;\r
+typedef std::pair<mof::tstring , mof::Drawable*> DrawableMapPair;\r
+\r
+\r
+struct mof::Effect::Impl\r
+{\r
+       SpriteMap spriteMap;\r
+       DrawableMap drawableMap;\r
+\r
+       Impl(){\r
+\r
+       }\r
+\r
+       ~Impl(){\r
+               deleteAll();\r
+       }\r
+\r
+       void deleteAll(){\r
+        foreach(DrawableMapPair pair , drawableMap){\r
+                       delete pair.second;\r
+               }\r
+               drawableMap.clear();\r
+\r
+               foreach(SpriteMapPair pair , spriteMap){\r
+                       delete pair.second;\r
+               }\r
+               spriteMap.clear();\r
+       }\r
+};\r
+\r
+\r
+mof::Effect::Effect()\r
+: m_pImpl(new Impl())\r
+{\r
+}\r
+\r
+mof::Effect::~Effect(){\r
+}\r
+\r
+mof::Sprite* mof::Effect::getSpriteByName(const mof::tstring &name) {\r
+       SpriteMap::iterator result = m_pImpl->spriteMap.find(name);\r
+       if(result == m_pImpl->spriteMap.end())throw std::invalid_argument(name + "is not exists");\r
+       return result->second;\r
+}\r
+\r
+void mof::Effect::addSprite(const mof::tstring& name , mof::Sprite* pSprite){\r
+       SpriteMap::iterator result = m_pImpl->spriteMap.find(name);\r
+       if(result != m_pImpl->spriteMap.end())throw std::invalid_argument(name + "is already exists");\r
+       m_pImpl->spriteMap.insert(SpriteMapPair(name , pSprite));\r
+}\r
+               \r
+void mof::Effect::addDrawable( const mof::tstring& name , mof::Drawable* pDrawable )\r
+{\r
+       DrawableMap::iterator result = m_pImpl->drawableMap.find(name);\r
+       if(result != m_pImpl->drawableMap.end())throw std::invalid_argument(name + "is already exists");\r
+       m_pImpl->drawableMap.insert(DrawableMapPair(name , pDrawable));\r
+}\r
+\r
+void mof::Effect::remove(const mof::tstring& name ){\r
+    {\r
+        SpriteMap::iterator result = m_pImpl->spriteMap.find(name);\r
+           if(result != m_pImpl->spriteMap.end())\r
+        {\r
+            m_pImpl->spriteMap.erase(name);\r
+            return;\r
+        }\r
+    }\r
+    {\r
+        DrawableMap::iterator result = m_pImpl->drawableMap.find(name);\r
+        if(result != m_pImpl->drawableMap.end())\r
+        {\r
+            m_pImpl->drawableMap.erase(name);\r
+            return;\r
+        }\r
+    }\r
+       throw std::invalid_argument(name + "is not exists");\r
+}\r
+\r
+void mof::Effect::deleteAll(){\r
+       m_pImpl->deleteAll();\r
+}\r
+\r
+void mof::Effect::draw() const\r
+{\r
+    foreach(DrawableMapPair pair , m_pImpl->drawableMap){\r
+               pair.second->draw();\r
+       }\r
+       foreach(SpriteMapPair pair , m_pImpl->spriteMap){\r
+               pair.second->draw();\r
+       }\r
+}\r
+\r
+\r
+void mof::Effect::update(){\r
+       foreach(SpriteMapPair pair , m_pImpl->spriteMap){\r
+               pair.second->update();\r
+       }\r
+}\r
+\r
+\r
diff --git a/moftmp/widget/Effect.cpp~ b/moftmp/widget/Effect.cpp~
new file mode 100755 (executable)
index 0000000..f8bd495
--- /dev/null
@@ -0,0 +1,108 @@
+#include "mof/widget/Effect.hpp"\r
+#include <map>\r
+#include "mof/Sprite.hpp"\r
+#include "mof/Drawable.hpp"\r
+#include "mof/utilities.hpp"\r
+#include <stdexcept>\r
+\r
+typedef std::map<mof::tstring , mof::Sprite*> SpriteMap;\r
+typedef std::pair<mof::tstring , mof::Sprite*> SpriteMapPair;\r
+typedef std::map<mof::tstring , mof::Drawable*> DrawableMap;\r
+typedef std::pair<mof::tstring , mof::Drawable*> DrawableMapPair;\r
+\r
+\r
+struct mof::Effect::Impl\r
+{\r
+       SpriteMap spriteMap;\r
+       DrawableMap drawableMap;\r
+\r
+       Impl(){\r
+\r
+       }\r
+\r
+       ~Impl(){\r
+               deleteAll();\r
+       }\r
+\r
+       void deleteAll(){\r
+        foreach(DrawableMapPair pair , drawableMap){\r
+                       delete pair.second;\r
+               }\r
+               drawableMap.clear();\r
+\r
+               foreach(SpriteMapPair pair , spriteMap){\r
+                       delete pair.second;\r
+               }\r
+               spriteMap.clear();\r
+       }\r
+};\r
+\r
+\r
+mof::Effect::Effect()\r
+: m_pImpl(new Impl())\r
+{\r
+}\r
+\r
+mof::Effect::~Effect(){\r
+}\r
+\r
+mof::Sprite* mof::Effect::getSpriteByName(const mof::tstring &name) {\r
+       SpriteMap::iterator result = m_pImpl->spriteMap.find(name);\r
+       if(result == m_pImpl->spriteMap.end())throw std::invalid_argument(name + "is not exists");\r
+       return result->second;\r
+}\r
+\r
+void mof::Effect::addSprite(const mof::tstring& name , mof::Sprite* pSprite){\r
+       SpriteMap::iterator result = m_pImpl->spriteMap.find(name);\r
+       if(result != m_pImpl->spriteMap.end())throw std::invalid_argument(name + "is already exists");\r
+       m_pImpl->spriteMap.insert(SpriteMapPair(name , pSprite));\r
+}\r
+               \r
+void mof::Effect::addDrawable( const mof::tstring& name , mof::Drawable* pDrawable )\r
+{\r
+       DrawableMap::iterator result = m_pImpl->drawableMap.find(name);\r
+       if(result != m_pImpl->drawableMap.end())throw std::invalid_argument(name + "is already exists");\r
+       m_pImpl->drawableMap.insert(DrawableMapPair(name , pDrawable));\r
+}\r
+\r
+void mof::Effect::remove(const mof::tstring& name ){\r
+    {\r
+        SpriteMap::iterator result = m_pImpl->spriteMap.find(name);\r
+           if(result != m_pImpl->spriteMap.end())\r
+        {\r
+            m_pImpl->spriteMap.erase(name);\r
+            return;\r
+        }\r
+    }\r
+    {\r
+        DrawableMap::iterator result = m_pImpl->drawableMap.find(name);\r
+        if(result != m_pImpl->drawableMap.end())\r
+        {\r
+            m_pImpl->drawableMap.erase(name);\r
+            return;\r
+        }\r
+    }\r
+       throw std::invalid_argument(name + "is not exists");\r
+}\r
+\r
+void mof::Effect::deleteAll(){\r
+       m_pImpl->deleteAll();\r
+}\r
+\r
+void mof::Effect::draw() const{\r
+    foreach(DrawableMapPair pair , m_pImpl->drawableMap){\r
+               pair.second->draw();\r
+       }\r
+       foreach(SpriteMapPair pair , m_pImpl->spriteMap){\r
+               pair.second->draw();\r
+       }\r
+}\r
+\r
+\r
+void mof::Effect::update(){\r
+       foreach(SpriteMapPair pair , m_pImpl->spriteMap){\r
+               pair.second->update();\r
+       }\r
+}\r
+\r
+\r
diff --git a/moftmp/widget/Effect.hpp b/moftmp/widget/Effect.hpp
new file mode 100755 (executable)
index 0000000..4f59aad
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/utility.hpp>\r
+#include "mof/tstring.hpp"\r
+\r
+namespace mof{\r
+       class Sprite;\r
+       class Drawable;\r
+\r
+       class Effect : boost::noncopyable{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       public:\r
+               Effect();\r
+               ~Effect();\r
+               mof::Sprite* getSpriteByName(const mof::tstring& name);\r
+               void addSprite(const mof::tstring& name , mof::Sprite* pSprite);\r
+               void addDrawable( const mof::tstring& name , mof::Drawable* pDrawable );\r
+               void remove(const mof::tstring& name);\r
+               void deleteAll();\r
+\r
+               void draw() const;\r
+               void update();\r
+       };\r
+\r
+       \r
+}\r
diff --git a/moftmp/widget/Effect.hpp~ b/moftmp/widget/Effect.hpp~
new file mode 100755 (executable)
index 0000000..4f59aad
--- /dev/null
@@ -0,0 +1,27 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/utility.hpp>\r
+#include "mof/tstring.hpp"\r
+\r
+namespace mof{\r
+       class Sprite;\r
+       class Drawable;\r
+\r
+       class Effect : boost::noncopyable{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       public:\r
+               Effect();\r
+               ~Effect();\r
+               mof::Sprite* getSpriteByName(const mof::tstring& name);\r
+               void addSprite(const mof::tstring& name , mof::Sprite* pSprite);\r
+               void addDrawable( const mof::tstring& name , mof::Drawable* pDrawable );\r
+               void remove(const mof::tstring& name);\r
+               void deleteAll();\r
+\r
+               void draw() const;\r
+               void update();\r
+       };\r
+\r
+       \r
+}\r
diff --git a/moftmp/widget/Frame.cpp b/moftmp/widget/Frame.cpp
new file mode 100755 (executable)
index 0000000..d7ade2e
--- /dev/null
@@ -0,0 +1,126 @@
+#pragma once\r
+#include <mof/widget/Frame.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+#include <mof/widget/Container.hpp>\r
+#include <mof/widget/ImageView.hpp>\r
+#include <mof/widget/GridLayout.hpp>\r
+#include <mof/widget/OverlapLayout.hpp>\r
+#include <mof/utilities.hpp>\r
+#include <boost/make_shared.hpp>\r
+\r
+using namespace mof::widget;\r
+using boost::shared_ptr;\r
+using boost::make_shared;\r
+using mof::lastOf;\r
+using std::vector;\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ Impl\r
+       struct Frame::Impl\r
+       {\r
+        shared_ptr<WidgetView> pCaptionView; \r
+        shared_ptr<WidgetView> pContentBackgroundView; \r
+        shared_ptr<WidgetView> pTitleBackgroundView; \r
+        shared_ptr<Container> pContainer; \r
+\r
+           Impl()\r
+           : \r
+            pCaptionView( ) ,\r
+            pContentBackgroundView( ) ,\r
+            pContainer( )\r
+           {}\r
+       };\r
+//}}}\r
+//{{{ constructor\r
+       Frame::Frame\r
+       (\r
+        const mof::tstring& caption , const mof::Font& font ,\r
+        shared_ptr<WidgetView> pContentView ,\r
+        const FactoryMethod<WidgetView>& contentBackground , \r
+        const FactoryMethod<WidgetView>& titleBackground \r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+        m_pImpl->pCaptionView = make_shared<ImageView>( caption , font );\r
+        m_pImpl->pContentBackgroundView = shared_ptr<WidgetView>( contentBackground( ) );\r
+        m_pImpl->pTitleBackgroundView = shared_ptr<WidgetView>( titleBackground( ) );\r
+     \r
+        {\r
+            shared_ptr<WidgetView> children[] = {\r
+                m_pImpl->pTitleBackgroundView ,\r
+                m_pImpl->pCaptionView ,\r
+            };\r
+            m_pImpl->pContainer = make_shared<Container>( \r
+                children[0] ,\r
+                lastOf( children ) ,\r
+                makeFactoryMethod<OverlapLayout>( m_pImpl->pCaptionView->getSizeStream().value() )\r
+            );\r
+        }\r
+\r
+        {\r
+            shared_ptr<WidgetView> children[] = {\r
+                m_pImpl->pContainer ,\r
+                pContentView ,\r
+            };\r
+            m_pImpl->pContainer = make_shared<Container>( \r
+                children[0] ,\r
+                lastOf( children ) ,\r
+                makeFactoryMethod<GridLayout>( GridLayout::VERTICAL , 0 , 10)\r
+            );\r
+        }\r
+        \r
+        {\r
+            shared_ptr<WidgetView> children[] = {\r
+                m_pImpl->pContentBackgroundView ,\r
+                m_pImpl->pContainer ,\r
+            };\r
+            m_pImpl->pContainer = make_shared<Container>( \r
+                children[0] ,\r
+                lastOf( children ) ,\r
+                makeFactoryMethod<OverlapLayout>( m_pImpl->pContainer->getSizeStream().value() )\r
+            );\r
+        }\r
+\r
+       }\r
+//}}}\r
+//{{{ destructor\r
+       Frame::~Frame()\r
+       {\r
+       }\r
+//}}}\r
+//{{{ show\r
+       mof::FrameNumber Frame::show(bool imidiately)\r
+       {\r
+           return m_pImpl->pContainer->show(imidiately);\r
+       }\r
+//}}}\r
+//{{{ hide\r
+       mof::FrameNumber Frame::hide(bool imidiately)\r
+       {\r
+           return m_pImpl->pContainer->hide(imidiately);\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       const boost::shared_ptr<WidgetView> Frame::getView( ) const\r
+       {\r
+        return m_pImpl->pContainer;\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       boost::shared_ptr<WidgetView> Frame::getView( ) \r
+       {\r
+        return m_pImpl->pContainer;\r
+       }\r
+//}}}\r
+//{{{ update\r
+       void Frame::update()\r
+       {\r
+           m_pImpl->pContainer->update();\r
+       }\r
+//}}}\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/Frame.cpp~ b/moftmp/widget/Frame.cpp~
new file mode 100755 (executable)
index 0000000..0bc2f23
--- /dev/null
@@ -0,0 +1,126 @@
+#pragma once\r
+#include <mof/widget/Frame.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+#include <mof/widget/Container.hpp>\r
+#include <mof/widget/ImageView.hpp>\r
+#include <mof/widget/GridLayout.hpp>\r
+#include <mof/widget/OverlapLayout.hpp>\r
+#include <mof/utilities.hpp>\r
+#include <boost/make_shared.hpp>\r
+\r
+using namespace mof::widget;\r
+using boost::shared_ptr;\r
+using boost::make_shared;\r
+using mof::lastOf;\r
+using std::vector;\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ Impl\r
+       struct Frame::Impl\r
+       {\r
+        shared_ptr<WidgetView> pCaptionView; \r
+        shared_ptr<WidgetView> pContentBackgroundView; \r
+        shared_ptr<WidgetView> pTitleBackgroundView; \r
+        shared_ptr<Container> pContainer; \r
+\r
+           Impl()\r
+           : \r
+            pCaptionView( ) ,\r
+            pContentBackgroundView( ) ,\r
+            pContainer( )\r
+           {}\r
+       };\r
+//}}}\r
+//{{{ constructor\r
+       Frame::Frame\r
+       (\r
+        const mof::tstring& caption , const mof::Font& font ,\r
+        shared_ptr<WidgetView> pContentView ,\r
+        const FactoryMethod<WidgetView>& contentBackground , \r
+        const FactoryMethod<WidgetView>& titleBackground \r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+        m_pImpl->pCaptionView = make_shared<ImageView>( caption , font );\r
+        m_pImpl->pContentBackgroundView = shared_ptr<WidgetView>( contentBackground( ) );\r
+        m_pImpl->pTitleBackgroundView = shared_ptr<WidgetView>( titleBackground( ) );\r
+     \r
+        {\r
+            shared_ptr<WidgetView> children[] = {\r
+                m_pImpl->pTitleBackgroundView ,\r
+                m_pImpl->pCaptionView ,\r
+            };\r
+            m_pImpl->pContainer = make_shared<Container>( \r
+                children[0] ,\r
+                lastOf( children ) ,\r
+                makeFactoryMethod<OverlapLayout>( m_pImpl->pCaptionView->getSizeStream().value() )\r
+            );\r
+        }\r
+\r
+        {\r
+            shared_ptr<WidgetView> children[] = {\r
+                m_pImpl->pContainer ,\r
+                pContentView ,\r
+            };\r
+            m_pImpl->pContainer = make_shared<Container>( \r
+                children[0] ,\r
+                lastOf( children ) ,\r
+                makeFactoryMethod<GridLayout>( GridLayout::VERTICAL , 0 , 20)\r
+            );\r
+        }\r
+        \r
+        {\r
+            shared_ptr<WidgetView> children[] = {\r
+                m_pImpl->pContentBackgroundView ,\r
+                m_pImpl->pContainer ,\r
+            };\r
+            m_pImpl->pContainer = make_shared<Container>( \r
+                children[0] ,\r
+                lastOf( children ) ,\r
+                makeFactoryMethod<OverlapLayout>( m_pImpl->pContainer->getSizeStream().value() )\r
+            );\r
+        }\r
+\r
+       }\r
+//}}}\r
+//{{{ destructor\r
+       Frame::~Frame()\r
+       {\r
+       }\r
+//}}}\r
+//{{{ show\r
+       mof::FrameNumber Frame::show(bool imidiately)\r
+       {\r
+           return m_pImpl->pContainer->show(imidiately);\r
+       }\r
+//}}}\r
+//{{{ hide\r
+       mof::FrameNumber Frame::hide(bool imidiately)\r
+       {\r
+           return m_pImpl->pContainer->hide(imidiately);\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       const boost::shared_ptr<WidgetView> Frame::getView( ) const\r
+       {\r
+        return m_pImpl->pContainer;\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       boost::shared_ptr<WidgetView> Frame::getView( ) \r
+       {\r
+        return m_pImpl->pContainer;\r
+       }\r
+//}}}\r
+//{{{ update\r
+       void Frame::update()\r
+       {\r
+           m_pImpl->pContainer->update();\r
+       }\r
+//}}}\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/Frame.hpp b/moftmp/widget/Frame.hpp
new file mode 100755 (executable)
index 0000000..656ecb9
--- /dev/null
@@ -0,0 +1,43 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+#include <mof/widget/Widget.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+\r
+namespace widget\r
+{\r
+\r
+    class Frame : public Widget\r
+    {\r
+    public:\r
+        Frame\r
+        (\r
+            const tstring& title ,\r
+            const Font& font ,\r
+            boost::shared_ptr<WidgetView> content ,\r
+            const FactoryMethod<WidgetView>& contentBackground ,\r
+            const FactoryMethod<WidgetView>& titleBackground \r
+        );\r
+\r
+        virtual ~Frame();\r
+               virtual FrameNumber show(bool imidiately = false);\r
+               virtual FrameNumber hide(bool imidiately = false);\r
+        virtual const boost::shared_ptr<WidgetView> getView( ) const;\r
+        virtual boost::shared_ptr<WidgetView> getView( );\r
+               virtual void update();\r
+\r
+\r
+        \r
+    protected:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+    };\r
+\r
+\r
+} // namespace widget\r
+} // namespace mof\r
diff --git a/moftmp/widget/Frame.hpp~ b/moftmp/widget/Frame.hpp~
new file mode 100755 (executable)
index 0000000..2f478bd
--- /dev/null
@@ -0,0 +1,43 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+#include <mof/widget/Widget.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+\r
+namespace widget\r
+{\r
+\r
+    class Frame : public Widget\r
+    {\r
+    public:\r
+        Frame\r
+        (\r
+            const tstring& title ,\r
+            const Font& font ,\r
+            boost::shared_ptr<Widget> content ,\r
+            const FactoryMethod<WidgetView>& contentBackground ,\r
+            const FactoryMethod<WidgetView>& titleBackground \r
+        );\r
+\r
+        virtual ~Frame();\r
+               virtual FrameNumber show(bool imidiately = false);\r
+               virtual FrameNumber hide(bool imidiately = false);\r
+        virtual const boost::shared_ptr<WidgetView> getView( ) const;\r
+        virtual boost::shared_ptr<WidgetView> getView( );\r
+               virtual void update();\r
+\r
+\r
+        \r
+    protected:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+    };\r
+\r
+\r
+} // namespace widget\r
+} // namespace mof\r
diff --git a/moftmp/widget/FrameBuilder.hpp b/moftmp/widget/FrameBuilder.hpp
new file mode 100755 (executable)
index 0000000..d6226c0
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once\r
+#include <boost/utility.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+#include <mof/tstring.hpp>\r
+#include <memory>\r
+#include <mof/widget/Frame.hpp>\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+namespace widget\r
+{\r
+\r
+    class FrameBuilder : boost::noncopyable\r
+    {\r
+    public:\r
+        FrameBuilder();\r
+        ~FrameBuilder();\r
+\r
+        void setTitle( const mof::tstring& title , const mof::Font& font );\r
+        void setContentBackgroundView( const mof::FactoryMethod<WidgetView>& contentBackground );\r
+        void setTitleBackgroundView( const mof::FactoryMethod<WidgetView>& titleBackground );\r
+        std::auto_ptr<Frame> create( );\r
+\r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+    }; // class FrameBuilder\r
+} // namespace widget\r
+} // namespace mof\r
diff --git a/moftmp/widget/FrameBuilder.hpp~ b/moftmp/widget/FrameBuilder.hpp~
new file mode 100755 (executable)
index 0000000..0a9359a
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once\r
+#include <boost/utility.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+#include <mof/tstring.hpp>\r
+#include <memory>\r
+#include <mof/widget/Frame.hpp>\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+namespace widget\r
+{\r
+\r
+    class FrameBuilder : boost::noncopyable\r
+    {\r
+    public:\r
+        FrameBuilder();\r
+        ~FrameBuilder();\r
+\r
+        void setTitle( const mof::tstring& title , const mof::Font& font );\r
+        void setContentBackgroundView( const FactoryMethod<WidgetView>& contentBackground );\r
+        void setTitleBackgroundView( const FactoryMethod<WidgetView>& titleBackground );\r
+        std::auto_ptr<Frame> create( );\r
+\r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+    }; // class FrameBuilder\r
+} // namespace widget\r
+} // namespace mof\r
diff --git a/moftmp/widget/GridLayout.cpp b/moftmp/widget/GridLayout.cpp
new file mode 100755 (executable)
index 0000000..d50e35e
--- /dev/null
@@ -0,0 +1,144 @@
+#include <mof/widget/GridLayout.hpp>\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/streams.hpp>\r
+#include <mof/utilities.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+#include <algorithm>\r
+#include <vector>\r
+\r
+using boost::shared_ptr;\r
+\r
+//{{{ Impl\r
+struct mof::widget::GridLayout::Impl\r
+{\r
+       \r
+       mof::widget::GridLayout::Direction direction;\r
+       int span , margin;\r
+    int width , height;// preferredSize\r
+    std::vector< shared_ptr<WidgetView> > views;\r
+    std::vector<Vector2D> positions;\r
+\r
+       Impl(Direction _direction , int span_ , int margin_ )\r
+       : \r
+        direction(_direction) , span(span_) , margin(margin_) ,\r
+               width(0) , height(0)\r
+       {}\r
+       \r
+\r
+       ~Impl()\r
+    {\r
+       }\r
+};\r
+//}}}\r
+//{{{ GridLayout\r
+mof::widget::GridLayout::GridLayout\r
+(\r
+       Direction direction , int span , int margin\r
+)\r
+: m_pImpl( new Impl( direction , span , margin ) )\r
+{\r
+}\r
+//}}}\r
+//{{{ ~GridLayout\r
+mof::widget::GridLayout::~GridLayout( )\r
+{\r
+}\r
+//}}}\r
+//{{{ add\r
+void mof::widget::GridLayout::add(shared_ptr<WidgetView> pView)\r
+{\r
+    mof::Vector2D size = pView->getSizeStream().value();\r
+    m_pImpl->views.push_back(pView);\r
+    \r
+    if(m_pImpl->direction == VERTICAL)\r
+    {\r
+        m_pImpl->positions.push_back( mof::Vector2D(0 , m_pImpl->height));\r
+        if( !m_pImpl->views.empty( ) )m_pImpl->height += m_pImpl->margin;\r
+        m_pImpl->width = m_pImpl->width < size.x \r
+            ? mof::real2int(size.x) \r
+            : m_pImpl->width;\r
+           m_pImpl->height += mof::real2int(size.y);\r
+    }\r
+    else if(m_pImpl->direction == HORIZONTAL)\r
+    {\r
+        m_pImpl->positions.push_back( mof::Vector2D(m_pImpl->width , 0));\r
+        if( !m_pImpl->views.empty( ) )m_pImpl->width += m_pImpl->margin;\r
+           m_pImpl->width += mof::real2int(size.x);\r
+        m_pImpl->height = m_pImpl->height < size.y \r
+            ? mof::real2int(size.y) \r
+            : m_pImpl->height;\r
+    }\r
+}\r
+//}}}\r
+//{{{ getLength\r
+size_t mof::widget::GridLayout::getLength() const\r
+{\r
+    return m_pImpl->positions.size();\r
+}\r
+//}}}\r
+//{{{ getPreferredSize\r
+mof::Vector2D mof::widget::GridLayout::getPreferredSize() const\r
+{\r
+    return mof::Vector2D(m_pImpl->width , m_pImpl->height);\r
+}\r
+//}}}\r
+//{{{ getSizeDependencyType\r
+mof::widget::Layout::DependencyType mof::widget::GridLayout::getSizeDependencyType() const\r
+{\r
+    return mof::widget::Layout::PARENT_LEADING;\r
+}\r
+//}}}\r
+//{{{ connect\r
+void mof::widget::GridLayout::connect(WidgetView* pParentView) \r
+{\r
+    size_t i = 0;\r
+    if(m_pImpl->direction == VERTICAL)\r
+    {\r
+        foreach(shared_ptr<WidgetView> pView , m_pImpl->views) \r
+        {\r
+            pView->getPositionStream() << m_pImpl->positions[i++] << pParentView->getPositionStream();\r
+            mof::Vector2D filter(1 , 0);\r
+            mof::Vector2D offset(-1.0f * pView->getSizeStream().value().x , 0.0f);\r
+            pView->getSizeStream() \r
+                << offset\r
+                << mof::makeFilterHandler(pParentView->getSizeStream().toManipulator() , filter);\r
+        }\r
+    }\r
+    else\r
+    {\r
+        foreach(shared_ptr<WidgetView> pView , m_pImpl->views) \r
+        {\r
+            pView->getPositionStream() << m_pImpl->positions[i++] << pParentView->getPositionStream();\r
+            pView->getSizeStream() << -pView->getSizeStream().value() << pParentView->getSizeStream();\r
+        }\r
+    }\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsUp\r
+int mof::widget::GridLayout::getAdjacencyAsUp(int index) const\r
+{\r
+    if(m_pImpl->direction == VERTICAL)return mof::rotation_mod(index-1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsDown\r
+int mof::widget::GridLayout::getAdjacencyAsDown(int index) const\r
+{\r
+    if(m_pImpl->direction == VERTICAL)return mof::rotation_mod(index+1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsLeft\r
+int mof::widget::GridLayout::getAdjacencyAsLeft(int index) const\r
+{\r
+    if(m_pImpl->direction == HORIZONTAL)return mof::rotation_mod(index-1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsRight\r
+int mof::widget::GridLayout::getAdjacencyAsRight(int index) const\r
+{\r
+    if(m_pImpl->direction == HORIZONTAL)return mof::rotation_mod(index+1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
diff --git a/moftmp/widget/GridLayout.cpp~ b/moftmp/widget/GridLayout.cpp~
new file mode 100755 (executable)
index 0000000..cf524cd
--- /dev/null
@@ -0,0 +1,144 @@
+#include <mof/widget/GridLayout.hpp>\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/streams.hpp>\r
+#include <mof/utilities.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+#include <algorithm>\r
+#include <vector>\r
+\r
+using boost::shared_ptr;\r
+\r
+//{{{ Impl\r
+struct mof::widget::GridLayout::Impl\r
+{\r
+       \r
+       mof::widget::GridLayout::Direction direction;\r
+       int span , margin;\r
+    int width , height;// preferredSize\r
+    std::vector< shared_ptr<WidgetView> > views;\r
+    std::vector<Vector2D> positions;\r
+\r
+       Impl(Direction _direction , int span_ , int margin_ )\r
+       : \r
+        direction(_direction) , span(span_) , margin(margin_) ,\r
+               width(0) , height(0)\r
+       {}\r
+       \r
+\r
+       ~Impl()\r
+    {\r
+       }\r
+};\r
+//}}}\r
+//{{{ GridLayout\r
+mof::widget::GridLayout::GridLayout\r
+(\r
+       Direction direction , int span , int margin\r
+)\r
+: m_pImpl( new Impl( direction , span , margin ) )\r
+{\r
+}\r
+//}}}\r
+//{{{ ~GridLayout\r
+mof::widget::GridLayout::~GridLayout( )\r
+{\r
+}\r
+//}}}\r
+//{{{ add\r
+void mof::widget::GridLayout::add(shared_ptr<WidgetView> pView)\r
+{\r
+    mof::Vector2D size = pView->getSizeStream().value();\r
+    m_pImpl->views.push_back(pView);\r
+    \r
+    if(m_pImpl->direction == VERTICAL)\r
+    {\r
+        //if( !m_pImpl->views.empty( ) )m_pImpl->height += m_pImpl->margin;\r
+        m_pImpl->positions.push_back( mof::Vector2D(0 , m_pImpl->height));\r
+        m_pImpl->width = m_pImpl->width < size.x \r
+            ? mof::real2int(size.x) \r
+            : m_pImpl->width;\r
+           m_pImpl->height += mof::real2int(size.y);\r
+    }\r
+    else if(m_pImpl->direction == HORIZONTAL)\r
+    {\r
+        if( !m_pImpl->views.empty( ) )m_pImpl->width += m_pImpl->margin;\r
+        m_pImpl->positions.push_back( mof::Vector2D(m_pImpl->width , 0));\r
+           m_pImpl->width += mof::real2int(size.x);\r
+        m_pImpl->height = m_pImpl->height < size.y \r
+            ? mof::real2int(size.y) \r
+            : m_pImpl->height;\r
+    }\r
+}\r
+//}}}\r
+//{{{ getLength\r
+size_t mof::widget::GridLayout::getLength() const\r
+{\r
+    return m_pImpl->positions.size();\r
+}\r
+//}}}\r
+//{{{ getPreferredSize\r
+mof::Vector2D mof::widget::GridLayout::getPreferredSize() const\r
+{\r
+    return mof::Vector2D(m_pImpl->width , m_pImpl->height);\r
+}\r
+//}}}\r
+//{{{ getSizeDependencyType\r
+mof::widget::Layout::DependencyType mof::widget::GridLayout::getSizeDependencyType() const\r
+{\r
+    return mof::widget::Layout::PARENT_LEADING;\r
+}\r
+//}}}\r
+//{{{ connect\r
+void mof::widget::GridLayout::connect(WidgetView* pParentView) \r
+{\r
+    size_t i = 0;\r
+    if(m_pImpl->direction == VERTICAL)\r
+    {\r
+        foreach(shared_ptr<WidgetView> pView , m_pImpl->views) \r
+        {\r
+            pView->getPositionStream() << m_pImpl->positions[i++] << pParentView->getPositionStream();\r
+            mof::Vector2D filter(1 , 0);\r
+            mof::Vector2D offset(-1.0f * pView->getSizeStream().value().x , 0.0f);\r
+            pView->getSizeStream() \r
+                << offset\r
+                << mof::makeFilterHandler(pParentView->getSizeStream().toManipulator() , filter);\r
+        }\r
+    }\r
+    else\r
+    {\r
+        foreach(shared_ptr<WidgetView> pView , m_pImpl->views) \r
+        {\r
+            pView->getPositionStream() << m_pImpl->positions[i++] << pParentView->getPositionStream();\r
+            pView->getSizeStream() << -pView->getSizeStream().value() << pParentView->getSizeStream();\r
+        }\r
+    }\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsUp\r
+int mof::widget::GridLayout::getAdjacencyAsUp(int index) const\r
+{\r
+    if(m_pImpl->direction == VERTICAL)return mof::rotation_mod(index-1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsDown\r
+int mof::widget::GridLayout::getAdjacencyAsDown(int index) const\r
+{\r
+    if(m_pImpl->direction == VERTICAL)return mof::rotation_mod(index+1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsLeft\r
+int mof::widget::GridLayout::getAdjacencyAsLeft(int index) const\r
+{\r
+    if(m_pImpl->direction == HORIZONTAL)return mof::rotation_mod(index-1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsRight\r
+int mof::widget::GridLayout::getAdjacencyAsRight(int index) const\r
+{\r
+    if(m_pImpl->direction == HORIZONTAL)return mof::rotation_mod(index+1 , m_pImpl->positions.size());\r
+    else return index;\r
+}\r
+//}}}\r
diff --git a/moftmp/widget/GridLayout.hpp b/moftmp/widget/GridLayout.hpp
new file mode 100755 (executable)
index 0000000..0557194
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class GridLayout : public Layout\r
+    {\r
+\r
+       public:\r
+               enum Direction\r
+        {\r
+                       HORIZONTAL , VERTICAL\r
+               };\r
+\r
+               GridLayout(Direction direction , int span , int margin = 0 );\r
+               virtual ~GridLayout();\r
+               virtual void add(boost::shared_ptr<WidgetView> pView);\r
+        virtual Vector2D getPreferredSize() const;\r
+        virtual DependencyType getSizeDependencyType() const;\r
+        virtual void connect(WidgetView* pParentView);\r
+        virtual size_t getLength( ) const;\r
+        virtual int getAdjacencyAsUp(int index) const;\r
+        virtual int getAdjacencyAsDown(int index) const;\r
+        virtual int getAdjacencyAsLeft(int index) const;\r
+        virtual int getAdjacencyAsRight(int index) const;\r
+\r
+    private:\r
+        struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+}\r
+} // namepsace mof\r
+\r
diff --git a/moftmp/widget/GridLayout.hpp~ b/moftmp/widget/GridLayout.hpp~
new file mode 100755 (executable)
index 0000000..011b511
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class GridLayout : public Layout\r
+    {\r
+\r
+       public:\r
+               enum Direction\r
+        {\r
+                       HORIZONTAL , VERTICAL\r
+               };\r
+\r
+               GridLayout(Direction direction , int span , int margin = 0 );\r
+               virtual ~GridLayout();\r
+               virtual void add(boost::shared_ptr<WidgetView> pView);\r
+        virtual Vector2D getPreferredSize() const;\r
+        virtual DependencyType getSizeDependencyType() const;\r
+        virtual void connect( boost::shared_ptr<WidgetView> pParentView);\r
+        virtual size_t getLength( ) const;\r
+        virtual int getAdjacencyAsUp(int index) const;\r
+        virtual int getAdjacencyAsDown(int index) const;\r
+        virtual int getAdjacencyAsLeft(int index) const;\r
+        virtual int getAdjacencyAsRight(int index) const;\r
+\r
+    private:\r
+        struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+}\r
+} // namepsace mof\r
+\r
diff --git a/moftmp/widget/ImageView.cpp b/moftmp/widget/ImageView.cpp
new file mode 100755 (executable)
index 0000000..ef1c434
--- /dev/null
@@ -0,0 +1,117 @@
+#include <mof/widget/ImageView.hpp>\r
+#include "mof/mofGraphics.hpp"\r
+#include "mof/Font.hpp"\r
+#include "mof/Sprite.hpp"\r
+#include "mof/widget/Effect.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/widgets.hpp"\r
+#include "mof/streams.hpp"\r
+    \r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ struct Impl\r
+    struct ImageView::Impl\r
+    {\r
+        Sprite* pSprite;\r
+    \r
+        Impl( )\r
+        : pSprite( NULL )\r
+        {\r
+        }\r
+    \r
+        ~Impl()\r
+        {\r
+            delete pSprite;\r
+        }\r
+    \r
+    };\r
+//}}}\r
+//{{{ constructor\r
+    ImageView::ImageView\r
+    (\r
+        const tstring& caption ,\r
+        const Font& font\r
+    )\r
+    : \r
+        m_pImpl( new Impl ) \r
+    {\r
+        { // 画像の生成\r
+            m_pImpl->pSprite = Sprite::createTextSprite( font , caption );\r
+            m_pImpl->pSprite->getPositionStream( ) << getPositionStream( ); \r
+            m_pImpl->pSprite->getColorStream( ) << getColorStream( ); \r
+            m_sizeStream << m_pImpl->pSprite->getSizeStream( ); //ビューのサイズを設定\r
+        }\r
+    }\r
+//}}}\r
+//{{{ constructor\r
+    ImageView::ImageView\r
+    (\r
+        const TextureHandler& texture ,\r
+        const Rectangle<float>& tRect\r
+    )\r
+    : \r
+        m_pImpl( new Impl( ) ) \r
+    {\r
+        { // 画像の生成\r
+            m_pImpl->pSprite = new Sprite( texture , tRect );\r
+            m_pImpl->pSprite->getPositionStream( ) << getPositionStream( ); \r
+            m_pImpl->pSprite->getColorStream( ) << getColorStream( ); \r
+            m_sizeStream << m_pImpl->pSprite->getSizeStream( ); //ビューのサイズを設定\r
+        }\r
+        \r
+    }\r
+//}}}\r
+//{{{ destructor\r
+    ImageView::~ImageView()\r
+    {\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void ImageView::update( )\r
+    {\r
+        m_positionStream.update( );\r
+        m_sizeStream.update( );\r
+        m_colorStream.update( );\r
+        m_pImpl->pSprite->update();\r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void ImageView::draw( ) const\r
+    {\r
+        m_pImpl->pSprite->draw( );\r
+    }\r
+//}}}\r
+//{{{ show\r
+    FrameNumber ImageView::show(bool) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ hide\r
+    FrameNumber ImageView::hide(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ focus\r
+    FrameNumber ImageView::focus(bool) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ blur\r
+    FrameNumber ImageView::blur(bool imidiately)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ click\r
+    FrameNumber ImageView::click(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+}\r
+} // namespace mof\r
diff --git a/moftmp/widget/ImageView.cpp~ b/moftmp/widget/ImageView.cpp~
new file mode 100755 (executable)
index 0000000..cb35bc5
--- /dev/null
@@ -0,0 +1,118 @@
+#include <mof/widget/ImageView.hpp>\r
+#include "mof/mofGraphics.hpp"\r
+#include "mof/Font.hpp"\r
+#include "mof/Sprite.hpp"\r
+#include "mof/widget/Effect.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/widgets.hpp"\r
+#include "mof/streams.hpp"\r
+    \r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ struct Impl\r
+    struct ImageView::Impl\r
+    {\r
+        Sprite* pSprite;\r
+    \r
+        Impl( )\r
+        : pSprite( NULL )\r
+        {\r
+        }\r
+    \r
+        ~Impl()\r
+        {\r
+            delete pSprite;\r
+        }\r
+    \r
+    };\r
+//}}}\r
+//{{{ constructor\r
+    ImageView::ImageView\r
+    (\r
+        const tstring& caption ,\r
+        const Font& font\r
+    )\r
+    : \r
+        m_pImpl( new Impl ) \r
+    {\r
+        { // 画像の生成\r
+            m_pImpl->pSprite = Sprite::createTextSprite( font , caption );\r
+            m_pImpl->pSprite->getPositionStream( ) << getPositionStream( ); \r
+            m_pImpl->pSprite->getColorStream( ) << getColorStream( ); \r
+            m_sizeStream << m_pImpl->pSprite->getSizeStream( ); //ビューのサイズを設定\r
+        }\r
+    }\r
+//}}}\r
+//{{{ constructor\r
+    ImageView::ImageView\r
+    (\r
+        const TextureHandler& texture ,\r
+        const Rectangle<float>& tRect\r
+    )\r
+    : \r
+        m_pImpl( new Impl( ) ) \r
+    {\r
+        { // 画像の生成\r
+            m_pImpl->pSprite = new Sprite( texture , tRect );\r
+            m_pImpl->pSprite->getPositionStream( ) << getPositionStream( ); \r
+            m_pImpl->pSprite->getColorStream( ) << getColorStream( ); \r
+            m_sizeStream << m_pImpl->pSprite->getSizeStream( ); //ビューのサイズを設定\r
+        }\r
+        \r
+    }\r
+//}}}\r
+//{{{ destructor\r
+    ImageView::~ImageView()\r
+    {\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void ImageView::update( )\r
+    {\r
+        m_positionStream.update( );\r
+        m_sizeStream.update( );\r
+        m_colorStream.update( );\r
+        m_pImpl->pSprite->update();\r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void ImageView::draw( ) const\r
+    {\r
+        m_pImpl->pSprite->draw( );\r
+    }\r
+//}}}\r
+//{{{ show\r
+    FrameNumber ImageView::show(bool) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ hide\r
+    FrameNumber ImageView::hide(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ focus\r
+    FrameNumber ImageView::focus(bool) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ blur\r
+    FrameNumber ImageView::blur(bool imidiately)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ click\r
+    FrameNumber ImageView::click(bool)\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+\r
+}\r
+} // namespace mof\r
diff --git a/moftmp/widget/ImageView.hpp b/moftmp/widget/ImageView.hpp
new file mode 100755 (executable)
index 0000000..337aca3
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+#include "mof/widget/WidgetView.hpp"\r
+#include "mof/graphics/utilities.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+\r
+namespace widget\r
+{\r
+\r
+    class ImageView \r
+    : \r
+        public WidgetView\r
+    {\r
+    public:\r
+       ImageView( const tstring& caption , const Font& font );\r
+       ImageView( const TextureHandler& texture , const Rectangle<float>& tRect );\r
+       virtual ~ImageView( );\r
+\r
+        virtual FrameNumber show( bool imidiately = false );\r
+        virtual FrameNumber hide( bool imidiately = false );\r
+        virtual FrameNumber focus( bool imidiately = false );\r
+        virtual FrameNumber blur( bool imidiately = false );\r
+        virtual FrameNumber click( bool imidiately = false );\r
+        virtual void update( );\r
+        virtual void draw( ) const;\r
+\r
+    private:\r
+        struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+       \r
+    };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/ImageView.hpp~ b/moftmp/widget/ImageView.hpp~
new file mode 100755 (executable)
index 0000000..f69f2dd
--- /dev/null
@@ -0,0 +1,38 @@
+#pragma once\r
+#include "mof/widget/WidgetView.hpp"\r
+#include "mof/graphics/utilities.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+    class Font;\r
+\r
+    class ImageView \r
+    : \r
+        public WidgetView\r
+    {\r
+    public:\r
+       ImageView( const tstring& caption , const Font& font );\r
+       ImageView( const TextureHandler& texture , const Rectangle<float>& tRect );\r
+       virtual ~ImageView( );\r
+\r
+        virtual FrameNumber show( bool imidiately = false );\r
+        virtual FrameNumber hide( bool imidiately = false );\r
+        virtual FrameNumber focus( bool imidiately = false );\r
+        virtual FrameNumber blur( bool imidiately = false );\r
+        virtual FrameNumber click( bool imidiately = false );\r
+        virtual void update( );\r
+        virtual void draw( ) const;\r
+\r
+    private:\r
+        struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+       \r
+    };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/ImageWidgetView.cpp~ b/moftmp/widget/ImageWidgetView.cpp~
new file mode 100755 (executable)
index 0000000..86999b7
--- /dev/null
@@ -0,0 +1,115 @@
+#include <mof/widget/ImageWidgetView.hpp>\r
+#include "mof/mofGraphics.hpp"\r
+#include "mof/Font.hpp"\r
+#include "mof/Sprite.hpp"\r
+#include "mof/widget/Effect.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/widgets.hpp"\r
+#include "mof/streams.hpp"\r
+    \r
+namespace mof\r
+{\r
+//{{{ struct Impl\r
+    struct ImageWidgetView::Impl\r
+    {\r
+        Sprite* pSprite;\r
+    \r
+        Impl( )\r
+        : pSprite( NULL )\r
+        {\r
+        }\r
+    \r
+        ~Impl()\r
+        {\r
+            delete pSprite;\r
+        }\r
+    \r
+    };\r
+//}}}\r
+//{{{ constructor\r
+    ImageWidgetView::ImageWidgetView\r
+    (\r
+        const tstring& caption ,\r
+        const Font& font\r
+    )\r
+    : \r
+        m_pImpl( new Impl( ) ) \r
+    {\r
+        { // 画像の生成\r
+            m_pImpl->pSprite = Sprite::createTextSprite( font , caption );\r
+            m_pImpl->pSprite->getPositionStream( ) << getPositionStream( ); \r
+            m_pImpl->pSprite->getColorStream( ) << getColorStream( ); \r
+            m_sizeStream << m_pImpl->pSprite->getSizeStream( ); //ビューのサイズを設定\r
+        }\r
+    }\r
+//}}}\r
+//{{{ constructor\r
+    ImageWidgetView::ImageWidgetView\r
+    (\r
+        const TextureHandler& texture ,\r
+        const Rectangle<float>& tRect\r
+    )\r
+    : \r
+        m_pImpl( new Impl( ) ) \r
+    {\r
+        { // 画像の生成\r
+            m_pImpl->pSprite = new Sprite( texture , tRect );\r
+            m_pImpl->pSprite->getPositionStream( ) << getPositionStream( ); \r
+            m_pImpl->pSprite->getColorStream( ) << getColorStream( ); \r
+            m_sizeStream << m_pImpl->pSprite->getSizeStream( ); //ビューのサイズを設定\r
+        }\r
+        \r
+    }\r
+//}}}\r
+//{{{ destructor\r
+    ImageWidgetView::~ImageWidgetView()\r
+    {\r
+    }\r
+//}}}\r
+//{{{ update\r
+    void ImageWidgetView::update( )\r
+    {\r
+        m_positionStream.update( );\r
+        m_sizeStream.update( );\r
+        m_colorStream.update( );\r
+        m_pImpl->pSprite->update();\r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void ImageWidgetView::draw( ) const\r
+    {\r
+        m_pImpl->pSprite->draw( );\r
+    }\r
+//}}}\r
+//{{{ show\r
+    FrameNumber ImageWidgetView::show( bool imidiately ) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ hide\r
+    FrameNumber ImageWidgetView::hide( bool imidiately )\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ focus\r
+    FrameNumber ImageWidgetView::focus( bool imidiately ) \r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ blur\r
+    FrameNumber ImageWidgetView::blur( bool imidiately )\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+//{{{ click\r
+    FrameNumber ImageWidgetView::click( bool imidiately )\r
+    {\r
+        return 0;\r
+    }\r
+//}}}\r
+\r
+} // namespace mof\r
diff --git a/moftmp/widget/ImageWidgetView.hpp~ b/moftmp/widget/ImageWidgetView.hpp~
new file mode 100755 (executable)
index 0000000..e6f7d69
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once\r
+#include "mof/widget/WidgetView.hpp"\r
+#include "mof/graphics/utilities.hpp"\r
+#include "mof/tstring.hpp"\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+    class Font;\r
+\r
+    class ImageWidgetView \r
+    : \r
+        public WidgetView\r
+    {\r
+    public:\r
+       ImageWidgetView( const tstring& caption , const Font& font );\r
+       ImageWidgetView( const TextureHandler& texture , const Rectangle<float>& tRect );\r
+       virtual ~ImageWidgetView( );\r
+\r
+        virtual FrameNumber show( bool imidiately = false );\r
+        virtual FrameNumber hide( bool imidiately = false );\r
+        virtual FrameNumber focus( bool imidiately = false );\r
+        virtual FrameNumber blur( bool imidiately = false );\r
+        virtual void update( );\r
+        virtual void draw( ) const;\r
+\r
+    private:\r
+        struct Impl;\r
+       boost::scoped_ptr<Impl> m_pImpl;\r
+       \r
+    };\r
+\r
+}\r
diff --git a/moftmp/widget/Layout.hpp b/moftmp/widget/Layout.hpp
new file mode 100755 (executable)
index 0000000..3abfb3b
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once\r
+\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+    class WidgetView;\r
+\r
+    class Layout\r
+    {\r
+\r
+       public:\r
+        enum DependencyType\r
+        {\r
+            PARENT_LEADING ,\r
+            CHILD_LEADING\r
+        };\r
+\r
+               virtual ~Layout(){}\r
+               virtual void add(boost::shared_ptr<WidgetView> pView) = 0;\r
+        virtual Vector2D getPreferredSize() const = 0;\r
+        virtual DependencyType getSizeDependencyType() const = 0;\r
+        virtual void connect( WidgetView* pParentView) = 0;\r
+               virtual size_t getLength() const = 0;\r
+        virtual int getAdjacencyAsUp(int index) const = 0;\r
+        virtual int getAdjacencyAsDown(int index) const = 0;\r
+        virtual int getAdjacencyAsLeft(int index) const = 0;\r
+        virtual int getAdjacencyAsRight(int index) const = 0;\r
+       };\r
+}\r
+}\r
diff --git a/moftmp/widget/Layout.hpp~ b/moftmp/widget/Layout.hpp~
new file mode 100755 (executable)
index 0000000..3abfb3b
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once\r
+\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+    class WidgetView;\r
+\r
+    class Layout\r
+    {\r
+\r
+       public:\r
+        enum DependencyType\r
+        {\r
+            PARENT_LEADING ,\r
+            CHILD_LEADING\r
+        };\r
+\r
+               virtual ~Layout(){}\r
+               virtual void add(boost::shared_ptr<WidgetView> pView) = 0;\r
+        virtual Vector2D getPreferredSize() const = 0;\r
+        virtual DependencyType getSizeDependencyType() const = 0;\r
+        virtual void connect( WidgetView* pParentView) = 0;\r
+               virtual size_t getLength() const = 0;\r
+        virtual int getAdjacencyAsUp(int index) const = 0;\r
+        virtual int getAdjacencyAsDown(int index) const = 0;\r
+        virtual int getAdjacencyAsLeft(int index) const = 0;\r
+        virtual int getAdjacencyAsRight(int index) const = 0;\r
+       };\r
+}\r
+}\r
diff --git a/moftmp/widget/LayoutManager.cpp~ b/moftmp/widget/LayoutManager.cpp~
new file mode 100755 (executable)
index 0000000..55ab9d0
--- /dev/null
@@ -0,0 +1,73 @@
+#include "mof/LayoutManager.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+\r
+\r
+\r
+struct mof::LayoutManager::Impl{\r
+       \r
+       mof::LayoutManager::Direction direction;\r
+       int span;\r
+       int length;\r
+       unsigned int width;\r
+       unsigned int height;\r
+       mof::Vector2D* positions;\r
+\r
+\r
+       Impl( Direction _direction , int _n )\r
+               : direction(_direction) , span(_n) , \r
+               width(0) , height(0) , length(0) , positions(NULL)\r
+       {\r
+       }\r
+\r
+       ~Impl(){\r
+               delete[] positions;\r
+       }\r
+};\r
+\r
+\r
+mof::LayoutManager::LayoutManager\r
+(\r
+       Direction direction , int n\r
+)\r
+: m_pImpl( new Impl( direction , n ) )\r
+{\r
+}\r
+\r
+\r
+mof::LayoutManager::~LayoutManager( )\r
+{\r
+}\r
+\r
+void mof::LayoutManager::replace\r
+(\r
+       unsigned int width , \r
+    unsigned int height, \r
+       const mof::Rectangle<int> &front ,\r
+    const mof::Rectangle<int> &back\r
+)\r
+{\r
+       m_pImpl->width = width;\r
+       m_pImpl->height = height;\r
+       m_pImpl->length = &back - &front + 1;\r
+       if(m_pImpl->length <= 0)throw std::invalid_argument("the length of front-back is less than zero");\r
+\r
+       delete[] m_pImpl->positions;\r
+       m_pImpl->positions = new mof::Vector2D[m_pImpl->length];\r
+\r
+       //TODO X Layout\r
+       int sumOfY = 0;\r
+       for(int i = 0 ; i < m_pImpl->length ; ++i){\r
+               m_pImpl->positions[i] = mof::Vector2D( 0 , sumOfY );\r
+               sumOfY += (&front)[i].endY - (&front)[i].beginY;\r
+       }\r
+       \r
+}\r
+\r
+mof::Vector2D mof::LayoutManager::getPosition(int index) const{\r
+       if(m_pImpl->positions == NULL)throw std::runtime_error("layout has not initialized yet");\r
+       return m_pImpl->positions[index];\r
+}\r
+\r
+               \r
+       \r
diff --git a/moftmp/widget/LayoutManager.hpp~ b/moftmp/widget/LayoutManager.hpp~
new file mode 100755 (executable)
index 0000000..b028855
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Rectangle.hpp"\r
+\r
+namespace mof{\r
+\r
+       class LayoutManager{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+\r
+       public:\r
+               enum Direction{\r
+                       HORIZONTAL , VERTICAL\r
+               };\r
+               LayoutManager( Direction direction , int n);\r
+               virtual ~LayoutManager();\r
+               void replace(unsigned int width , unsigned int height , const mof::Rectangle<int>& front , const mof::Rectangle<int>& back);\r
+               \r
+               mof::Vector2D getPosition(int index) const ;\r
+               int getLength( ) const ;\r
+       };\r
+}\r
diff --git a/moftmp/widget/Menu.cpp b/moftmp/widget/Menu.cpp
new file mode 100755 (executable)
index 0000000..9df1de2
--- /dev/null
@@ -0,0 +1,158 @@
+#pragma once\r
+#include <mof/widget/Menu.hpp>\r
+#include <mof/widget/GridLayout.hpp>\r
+#include <mof/widget/Container.hpp>\r
+#include <boost/make_shared.hpp>\r
+\r
+using mof::widget::Container;\r
+using mof::widget::WidgetView;\r
+using mof::widget::GridLayout;\r
+using mof::widget::MenuItem;\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ Impl\r
+       struct Menu::Impl\r
+       {\r
+           std::vector< boost::function0<void> > actions;\r
+        boost::shared_ptr<Container> pView; \r
+           int currentIndex;\r
+       \r
+           Impl()\r
+           : pView() , currentIndex(0)\r
+           {}\r
+       };\r
+//}}}\r
+//{{{ constructor\r
+       Menu::Menu\r
+       (\r
+           const MenuItem& front ,\r
+           const MenuItem& back\r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+           int length = &back - &front + 1;\r
+           std::vector< boost::shared_ptr<mof::widget::WidgetView> > views;\r
+           for(int i = 0 ; i < length ; i++)\r
+           {\r
+               views.push_back( boost::shared_ptr<WidgetView>( (&front + i)->view( ) ) );\r
+           }\r
+       \r
+           m_pImpl->pView = boost::make_shared<Container>\r
+           (\r
+               views.front() , views.back() , \r
+            makeFactoryMethod<GridLayout>(GridLayout::VERTICAL , 0)\r
+        );\r
+       \r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ constructor\r
+       Menu::Menu\r
+       (\r
+           const MenuItem& front ,\r
+           const MenuItem& back ,\r
+        const FactoryMethod<Layout>& layout\r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+           int length = &back - &front + 1;\r
+           std::vector< boost::shared_ptr<mof::widget::WidgetView> > views;\r
+           for(int i = 0 ; i < length ; i++)\r
+           {\r
+               views.push_back( boost::shared_ptr<WidgetView>( (&front + i)->view( ) ) );\r
+           }\r
+       \r
+           m_pImpl->pView = boost::make_shared<Container>\r
+           (\r
+               views.front() , views.back() , layout\r
+        );\r
+       \r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ destructor\r
+       Menu::~Menu()\r
+       {\r
+       }\r
+//}}}\r
+//{{{ show\r
+       mof::FrameNumber Menu::show(bool imidiately)\r
+       {\r
+           return m_pImpl->pView->show(imidiately);\r
+       }\r
+//}}}\r
+//{{{ hide\r
+       mof::FrameNumber Menu::hide(bool imidiately)\r
+       {\r
+           return m_pImpl->pView->hide(imidiately);\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       const boost::shared_ptr<WidgetView> Menu::getView( ) const\r
+       {\r
+           return m_pImpl->pView;\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       boost::shared_ptr<WidgetView> Menu::getView( ) \r
+       {\r
+           return m_pImpl->pView;\r
+       }\r
+//}}}\r
+//{{{ update\r
+       void Menu::update()\r
+       {\r
+           m_pImpl->pView->update();\r
+       }\r
+//}}}\r
+//{{{ up\r
+       void Menu::up()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsUp(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ down\r
+       void Menu::down()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsDown(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ left \r
+       void Menu::left()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsLeft(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ right \r
+       void Menu::right()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsRight(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ performAction\r
+       void Menu::performAction() const\r
+       {\r
+           m_pImpl->actions[m_pImpl->currentIndex]();\r
+       }\r
+//}}}\r
+}\r
+}\r
diff --git a/moftmp/widget/Menu.cpp~ b/moftmp/widget/Menu.cpp~
new file mode 100755 (executable)
index 0000000..12e8c31
--- /dev/null
@@ -0,0 +1,157 @@
+#pragma once\r
+#include <mof/widget/Menu.hpp>\r
+#include <mof/widget/GridLayout.hpp>\r
+#include <mof/widget/Container.hpp>\r
+\r
+using mof::widget::Container;\r
+using mof::widget::WidgetView;\r
+using mof::widget::GridLayout;\r
+using mof::widget::MenuItem;\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+//{{{ Impl\r
+       struct Menu::Impl\r
+       {\r
+           std::vector< boost::function0<void> > actions;\r
+        boost::shared_ptr<Container> pView; \r
+           int currentIndex;\r
+       \r
+           Impl()\r
+           : pView() , currentIndex(0)\r
+           {}\r
+       };\r
+//}}}\r
+//{{{ constructor\r
+       Menu::Menu\r
+       (\r
+           const MenuItem& front ,\r
+           const MenuItem& back\r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+           int length = &back - &front + 1;\r
+           std::vector< boost::shared_ptr<mof::widget::WidgetView> > views;\r
+           for(int i = 0 ; i < length ; i++)\r
+           {\r
+               views.push_back( boost::shared_ptr<WidgetView>( (&front + i)->view( ) ) );\r
+           }\r
+       \r
+           m_pImpl->pView = boost::make_shared<Container>\r
+           (\r
+               views.front() , views.back() , \r
+            makeFactoryMethod<GridLayout>(GridLayout::VERTICAL , 0)\r
+        );\r
+       \r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ constructor\r
+       Menu::Menu\r
+       (\r
+           const MenuItem& front ,\r
+           const MenuItem& back ,\r
+        const FactoryMethod<Layout>& layout\r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+           int length = &back - &front + 1;\r
+           std::vector< boost::shared_ptr<mof::widget::WidgetView> > views;\r
+           for(int i = 0 ; i < length ; i++)\r
+           {\r
+               views.push_back( boost::shared_ptr<WidgetView>( (&front + i)->view( ) ) );\r
+           }\r
+       \r
+           m_pImpl->pView = boost::make_shared<Container>\r
+           (\r
+               views.front() , views.back() , layout\r
+        );\r
+       \r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ destructor\r
+       Menu::~Menu()\r
+       {\r
+       }\r
+//}}}\r
+//{{{ show\r
+       mof::FrameNumber Menu::show(bool imidiately)\r
+       {\r
+           return m_pImpl->pView->show(imidiately);\r
+       }\r
+//}}}\r
+//{{{ hide\r
+       mof::FrameNumber Menu::hide(bool imidiately)\r
+       {\r
+           return m_pImpl->pView->hide(imidiately);\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       const boost::shared_ptr<WidgetView> Menu::getView( ) const\r
+       {\r
+           return m_pImpl->pView;\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       boost::shared_ptr<WidgetView> Menu::getView( ) \r
+       {\r
+           return m_pImpl->pView;\r
+       }\r
+//}}}\r
+//{{{ update\r
+       void Menu::update()\r
+       {\r
+           m_pImpl->pView->update();\r
+       }\r
+//}}}\r
+//{{{ up\r
+       void Menu::up()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsUp(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ down\r
+       void Menu::down()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsDown(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ left \r
+       void Menu::left()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsLeft(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ right \r
+       void Menu::right()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsRight(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ performAction\r
+       void Menu::performAction() const\r
+       {\r
+           m_pImpl->actions[m_pImpl->currentIndex]();\r
+       }\r
+//}}}\r
+}\r
+}\r
diff --git a/moftmp/widget/Menu.hpp b/moftmp/widget/Menu.hpp
new file mode 100755 (executable)
index 0000000..4afeb3f
--- /dev/null
@@ -0,0 +1,68 @@
+#pragma once\r
+#include <mof/widget/Widget.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+#include <boost/function/function0.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+    inline void emptyFunc(){}\r
+\r
+    struct MenuItem\r
+    {\r
+        mof::FactoryMethod<WidgetView> view;\r
+        boost::function0<void> action;\r
+        \r
+        MenuItem\r
+        (\r
+            const mof::FactoryMethod<WidgetView>& view_ ,\r
+            const boost::function0<void>& action_\r
+        )\r
+        : view(view_) , action(action_)\r
+        {\r
+        }\r
+        \r
+        MenuItem\r
+        (\r
+            const mof::FactoryMethod<WidgetView>& view_ \r
+        )\r
+        : view(view_) , action(emptyFunc)\r
+        {\r
+        }\r
+\r
+    };\r
+\r
+       class Menu  : public Widget\r
+    {\r
+       public:\r
+               Menu(const MenuItem& front , const MenuItem& back );\r
+               Menu\r
+        (\r
+            const MenuItem& front ,\r
+            const MenuItem& back ,\r
+            const FactoryMethod<Layout>& layout\r
+        );\r
+\r
+               virtual ~Menu();\r
+               virtual FrameNumber show(bool imidiately = false);\r
+               virtual FrameNumber hide(bool imidiately = false);\r
+        virtual const boost::shared_ptr<WidgetView> getView( ) const;\r
+        virtual boost::shared_ptr<WidgetView> getView( );\r
+               virtual void update();\r
+        \r
+        virtual void up();\r
+               virtual void down();\r
+               virtual void left();\r
+               virtual void right();\r
+               virtual void performAction() const;\r
+    protected:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+}\r
+} // namespace mof\r
diff --git a/moftmp/widget/Menu.hpp~ b/moftmp/widget/Menu.hpp~
new file mode 100755 (executable)
index 0000000..11f697d
--- /dev/null
@@ -0,0 +1,68 @@
+#pragma once\r
+#include <mof/widget/Widget.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+#include <boost/function/function0.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+    inline void emptyFunc(){}\r
+\r
+    struct MenuItem\r
+    {\r
+        mof::FactoryMethod<WidgetView> view;\r
+        boost::function0<void> action;\r
+        \r
+        MenuItem\r
+        (\r
+            const mof::FactoryMethod<WidgetView>& view_ ,\r
+            const boost::function0<void>& action_\r
+        )\r
+        : view(view_) , action(action_)\r
+        {\r
+        }\r
+        \r
+        MenuItem\r
+        (\r
+            const mof::FactoryMethod<WidgetView>& view_ \r
+        )\r
+        : view(view_) , action(emptyFunc)\r
+        {\r
+        }\r
+\r
+    };\r
+\r
+       class Menu  : public Widget\r
+    {\r
+       public:\r
+               Menu(const MenuItem& front , const MenuItem& back );\r
+               Menu\r
+        (\r
+            const MenuItem& front ,\r
+            const MenuItem& back ,\r
+            const FactoryMethod<Layout>& layout\r
+        );\r
+\r
+               virtual ~Menu();\r
+               virtual FrameNumber show(bool imidiately = false);\r
+               virtual FrameNumber hide(bool imidiately = false);\r
+        virtual const boost::shared_ptr<WidgetView> getView() const = 0;\r
+        virtual boost::shared_ptr<WidgetView> getView() = 0;\r
+               virtual void update();\r
+        \r
+        virtual void up();\r
+               virtual void down();\r
+               virtual void left();\r
+               virtual void right();\r
+               virtual void performAction() const;\r
+    protected:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+}\r
+} // namespace mof\r
diff --git a/moftmp/widget/MenuWidget.cpp~ b/moftmp/widget/MenuWidget.cpp~
new file mode 100755 (executable)
index 0000000..37dc288
--- /dev/null
@@ -0,0 +1,150 @@
+#pragma once\r
+#include "widget/MenuWidget.hpp"\r
+#include <mof/widget/GridLayout.hpp>\r
+#include <mof/widget/ContainerWidgetView.hpp>\r
+\r
+namespace mof\r
+{\r
+//{{{ Impl\r
+       struct MenuWidget::Impl\r
+       {\r
+           std::vector< boost::function0<void> > actions;\r
+           mof::ContainerWidgetView* pView; \r
+           int currentIndex;\r
+       \r
+           Impl()\r
+           : pView(NULL) , currentIndex(0)\r
+           {}\r
+       };\r
+//}}}\r
+//{{{ constructor\r
+       MenuWidget::MenuWidget\r
+       (\r
+           const mof::MenuItem& front ,\r
+           const mof::MenuItem& back\r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+           int length = &back - &front + 1;\r
+           std::vector< mof::FactoryMethod<mof::WidgetView> > views;\r
+           for(int i = 0 ; i < length ; i++)\r
+           {\r
+               views.push_back((&front + i)->view);\r
+           }\r
+       \r
+           m_pImpl->pView = new mof::ContainerWidgetView\r
+           (\r
+               views.front() , views.back() , \r
+            makeFactoryMethod<GridLayout>(mof::GridLayout::VERTICAL , 0)\r
+        );\r
+       \r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ constructor\r
+       MenuWidget::MenuWidget\r
+       (\r
+           const mof::MenuItem& front ,\r
+           const mof::MenuItem& back ,\r
+        const FactoryMethod<Layout>& layout\r
+       )\r
+       : m_pImpl(new Impl)\r
+       {\r
+           int length = &back - &front + 1;\r
+           std::vector< mof::FactoryMethod<mof::WidgetView> > views;\r
+           for(int i = 0 ; i < length ; i++)\r
+           {\r
+               views.push_back((&front + i)->view);\r
+           }\r
+       \r
+           m_pImpl->pView = new mof::ContainerWidgetView\r
+           (\r
+               views.front() , views.back() , layout\r
+        );\r
+       \r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ destructor\r
+       MenuWidget::~MenuWidget()\r
+       {\r
+           delete m_pImpl->pView;\r
+       }\r
+//}}}\r
+//{{{ show\r
+       mof::FrameNumber MenuWidget::show(bool imidiately)\r
+       {\r
+           return m_pImpl->pView->show(imidiately);\r
+       }\r
+//}}}\r
+//{{{ hide\r
+       mof::FrameNumber MenuWidget::hide(bool imidiately)\r
+       {\r
+           return m_pImpl->pView->hide(imidiately);\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       const mof::WidgetView& MenuWidget::getView() const\r
+       {\r
+           return *m_pImpl->pView;\r
+       }\r
+//}}}\r
+//{{{ getView\r
+       mof::WidgetView& MenuWidget::getView()\r
+       {\r
+           return *m_pImpl->pView;\r
+       }\r
+//}}}\r
+//{{{ update\r
+       void MenuWidget::update()\r
+       {\r
+           m_pImpl->pView->update();\r
+       }\r
+//}}}\r
+//{{{ up\r
+       void MenuWidget::up()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsUp(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ down\r
+       void MenuWidget::down()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsDown(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ left \r
+       void MenuWidget::left()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsLeft(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ right \r
+       void MenuWidget::right()\r
+       {\r
+           int index = m_pImpl->pView->getAdjacencyAsRight(m_pImpl->currentIndex);\r
+           if(index == m_pImpl->currentIndex)return;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur();\r
+           m_pImpl->currentIndex = index;\r
+           m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus();\r
+       }\r
+//}}}\r
+//{{{ performAction\r
+       void MenuWidget::performAction() const\r
+       {\r
+           m_pImpl->actions[m_pImpl->currentIndex]();\r
+       }\r
+//}}}\r
+}      \r
diff --git a/moftmp/widget/MenuWidget.hpp~ b/moftmp/widget/MenuWidget.hpp~
new file mode 100755 (executable)
index 0000000..43131d5
--- /dev/null
@@ -0,0 +1,64 @@
+#pragma once\r
+#include <mof/widget/Widget.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+#include <boost/function/function0.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+\r
+namespace mof{\r
+\r
+    inline void emptyFunc(){}\r
+\r
+    struct MenuItem\r
+    {\r
+        mof::FactoryMethod<WidgetView> view;\r
+        boost::function0<void> action;\r
+        \r
+        MenuItem\r
+        (\r
+            const mof::FactoryMethod<WidgetView>& view_ ,\r
+            const boost::function0<void>& action_\r
+        )\r
+        : view(view_) , action(action_)\r
+        {\r
+        }\r
+        \r
+        MenuItem\r
+        (\r
+            const mof::FactoryMethod<WidgetView>& view_ \r
+        )\r
+        : view(view_) , action(emptyFunc)\r
+        {\r
+        }\r
+\r
+    };\r
+\r
+       class MenuWidget  \r
+    {\r
+       public:\r
+               MenuWidget(const MenuItem& front , const MenuItem& back );\r
+               MenuWidget\r
+        (\r
+            const MenuItem& front ,\r
+            const MenuItem& back ,\r
+            const FactoryMethod<Layout>& layout\r
+        );\r
+\r
+               virtual ~MenuWidget();\r
+               virtual FrameNumber show(bool imidiately = false);\r
+               virtual FrameNumber hide(bool imidiately = false);\r
+        virtual const WidgetView& getView() const;\r
+        virtual WidgetView& getView();\r
+               virtual void update();\r
+        \r
+        virtual void up();\r
+               virtual void down();\r
+               virtual void left();\r
+               virtual void right();\r
+               virtual void performAction() const;\r
+    protected:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+} // namespace mof\r
diff --git a/moftmp/widget/Message.hpp b/moftmp/widget/Message.hpp
new file mode 100755 (executable)
index 0000000..98a5c48
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/widget/Widget.hpp>\r
+#include <mof/stream/Manipulator.hpp>\r
+#include <boost/utility.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class Message : public Widget\r
+    {\r
+       public:\r
+        Message(mof::tstring& message);\r
+               virtual ~Message();\r
+               virtual FrameNumber show(bool imidiately = false);\r
+               virtual FrameNumber hide(bool imidiately = false);\r
+        virtual const boost::shared_ptr<WidgetView> getView() const;\r
+        virtual boost::shared_ptr<WidgetView> getView();\r
+               virtual void update();\r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+       }; \r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/Message.hpp~ b/moftmp/widget/Message.hpp~
new file mode 100755 (executable)
index 0000000..732a846
--- /dev/null
@@ -0,0 +1,29 @@
+#pragma once\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/widget/Widget.hpp>\r
+#include <mof/stream/Manipulator.hpp>\r
+#include <boost/utility.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class Message : public Widget\r
+    {\r
+       public:\r
+        Message();\r
+               virtual ~Message();\r
+               virtual FrameNumber show(bool imidiately = false);\r
+               virtual FrameNumber hide(bool imidiately = false);\r
+        virtual const boost::shared_ptr<WidgetView> getView() const;\r
+        virtual boost::shared_ptr<WidgetView> getView();\r
+               virtual void update();\r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+       }; \r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/MessageWidget.cpp b/moftmp/widget/MessageWidget.cpp
new file mode 100755 (executable)
index 0000000..0edce2b
--- /dev/null
@@ -0,0 +1,238 @@
+#include "mof/MessageWidget.hpp"\r
+#include "mof/Effect.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/LayoutManager.hpp"\r
+#include <boost/scoped_array.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/WidgetView.hpp"\r
+#include "mof/TextView.hpp"\r
+#include "mof/GraphicsDevice.hpp"\r
+#include "mof/mofAnimations.hpp"\r
+#include "mof/TextCompiler.hpp"\r
+#include "mof/widgets.hpp"\r
+    \r
+namespace mof\r
+{\r
+    \r
+    struct MessageWidget::Impl\r
+    {\r
+       mof::WidgetView* pBackgroundView;\r
+       mof::TextView* pTitleView;\r
+       mof::LayoutManager* pLayout;\r
+       //boost::shared_ptr<mof::Matrix2D> pTranslation;\r
+        mof::TranslationAnimation2D::Handler translation;\r
+        mof::ScalingAnimation2D::Handler scaling;\r
+        mof::Pager* pPager;\r
+        mof::FrameNumber frame;\r
+       //int width;\r
+       //int height;\r
+       \r
+//{{{ Impl    \r
+       Impl()\r
+        : \r
+            pBackgroundView(NULL) , \r
+            pTitleView(NULL) , \r
+            pLayout(NULL) ,\r
+            pPager( NULL ) ,\r
+            frame( 0 )\r
+        {\r
+            translation = mof::TranslationAnimation2D::Handler\r
+            (\r
+                new mof::TranslationAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D( 0 , 0 )\r
+                               )\r
+                )\r
+            );\r
+\r
+            scaling = mof::ScalingAnimation2D::Handler\r
+            (\r
+                new mof::ScalingAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D( 0 , 0 )\r
+                               )\r
+                )\r
+            );\r
+\r
+       }\r
+//}}}\r
+//{{{ ~Impl\r
+       ~Impl()\r
+        {\r
+               delete pLayout;\r
+               delete pBackgroundView;\r
+               delete pTitleView;\r
+               delete pPager;\r
+       }\r
+    \r
+//}}}    \r
+    };\r
+//{{{ MessageWidget\r
+    MessageWidget::MessageWidget\r
+    (\r
+       mof::WidgetView* pBackgroundView ,\r
+        const mof::Rectangle<int>& bounds ,\r
+       mof::LayoutManager* pLayout\r
+    )\r
+    : m_pImpl( new Impl( ) )\r
+    {\r
+       m_pImpl->pLayout = pLayout;\r
+       m_pImpl->pBackgroundView = pBackgroundView;\r
+        m_pImpl->pBackgroundView->setBounds( bounds );\r
+        m_pImpl->translation->set( m_pImpl->pBackgroundView->getPosition( ) );\r
+        m_pImpl->scaling->set( m_pImpl->pBackgroundView->getSize( ) );\r
+    \r
+        { // \83^\83C\83g\83\8b\82Ì\8f\89\8aú\89»\r
+            if( true )\r
+            {\r
+                m_pImpl->pTitleView = new mof::TextView\r
+                (\r
+                    _T("Title") , mof::Font( mof::Font::MS_P_GOTHIC , 25 )\r
+                );\r
+                m_pImpl->pTitleView->initialize();\r
+                mof::Rectangle<int> tmp( bounds.beginX , bounds.beginY , bounds.endX , bounds.beginY + 32 );\r
+                       m_pImpl->pTitleView->setBounds( tmp );\r
+    \r
+            }\r
+        }\r
+        { // \83y\81[\83W\83\83\82Ì\90\90¬\r
+            mof::LayoutManager* pLayout = new mof::LayoutManager( mof::LayoutManager::HORIZONTAL , 1);\r
+            m_pImpl->pPager = new mof::Pager( bounds , pLayout );\r
+        }\r
+    }\r
+//}}}\r
+//{{{ ~MessageWidget\r
+    MessageWidget::~MessageWidget(){\r
+    \r
+    }\r
+//}}}\r
+//{{{ show\r
+    void MessageWidget::show(){\r
+       m_pImpl->pPager->show();\r
+        m_pImpl->pBackgroundView->show();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->show();\r
+    }\r
+//}}}\r
+//{{{ close\r
+    void MessageWidget::close()\r
+    {\r
+       m_pImpl->pPager->close();\r
+       m_pImpl->pBackgroundView->close();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->close();\r
+    }\r
+//}}}\r
+//{{{ nextPage\r
+    void MessageWidget::nextPage(){\r
+       if( !m_pImpl->pPager->hasNextPage( ) )close();\r
+        else if( !m_pImpl->pPager->hasPreviousPage() )show();\r
+        else m_pImpl->pPager->nextPage();\r
+    }\r
+//}}}\r
+//{{{ addPage\r
+    void MessageWidget::addPage( const PageRequest& page ){\r
+        \r
+        m_pImpl->pPager->addPage( page );\r
+               \r
+       std::vector<mof::Rectangle<int> > boundList;\r
+        if( m_pImpl->pTitleView )boundList.push_back( mof::Rectangle<int>( 0 , 0 , 1 , 32) );\r
+        boundList.push_back( m_pImpl->pPager->getBounds( ) );\r
+       \r
+        mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+           m_pImpl->pLayout->replace\r
+        (\r
+            scaling.x , scaling.y ,\r
+            boundList.front() , boundList.back()\r
+        );\r
+\r
+        int i = 0;\r
+       if( m_pImpl->pTitleView )\r
+        {\r
+               mof::Animation<mof::Matrix2D>::Handler children[] =\r
+            {\r
+                       mof::makeConstantHandler\r
+                ( \r
+                    mof::Matrix2D::createScaling\r
+                    (\r
+                                   mof::Vector2D(boundList.at(i).getWidth( ) , boundList.at(i).getHeight( ) )\r
+                    )\r
+                   ) ,\r
+                       m_pImpl->translation ,\r
+                       mof::makeConstantHandler\r
+                (\r
+                           mof::Matrix2D::createTranslation( m_pImpl->pLayout->getPosition(i) )\r
+                       )\r
+           }; // array children\r
+    \r
+               mof::Animation<mof::Matrix2D>::Handler handler\r
+            (\r
+                   new mof::CascadingAnimation<mof::Matrix2D>( children[0] , mof::lastOf( children ) )\r
+               );\r
+            i++;\r
+            //m_pImpl->pTitleView->setWorldTransform( handler );\r
+            //m_pImpl->pTitleView->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+    \r
+        } // if\r
+        {\r
+               const mof::Animation<mof::Vector2D>::Handler children[] =\r
+            {\r
+                       //mof::makeConstantHandler( mof::Vector2D( 300 , 300) ) ,\r
+                       m_pImpl->translation->get( ) ,\r
+                       mof::makeConstantHandler\r
+                (\r
+                           m_pImpl->pLayout->getPosition(i) \r
+                       )\r
+           }; // array children\r
+    \r
+               mof::Animation<mof::Vector2D>::Handler handler\r
+            (\r
+                   new mof::CascadingAnimation<mof::Vector2D , mof::Add<mof::Vector2D> >( children[0] , mof::lastOf( children ) )\r
+               );\r
+            m_pImpl->pPager->setPosition( handler );\r
+            //m_pImpl->pTitleView->setWorldTransform( handler );\r
+            //m_pImpl->pTitleView->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+    \r
+        } // for       \r
+    \r
+    \r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void MessageWidget::draw() const{\r
+       m_pImpl->pBackgroundView->draw();\r
+        \r
+        { // \95`\89æ\97Ì\88æ\82ð\90§\8cÀ\r
+            mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+            mof::Vector2D translation = m_pImpl->translation->get( )->getValue( m_pImpl->frame );\r
+            mof::GraphicsDevice::setViewport \r
+            ( \r
+                    mof::Rectangle<int>( translation.x , translation.y , translation.x + scaling.x , translation.y + scaling.y )\r
+            );\r
+        }\r
+\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->getEffect()->draw();\r
+        m_pImpl->pPager->draw();       \r
+        mof::GraphicsDevice::setViewport(mof::Rectangle<int>(0 , 0 , 640 , 480));//TODO\r
+       \r
+    }\r
+//}}}\r
+//{{{ update\r
+    void MessageWidget::update() {\r
+    \r
+       m_pImpl->pBackgroundView->update();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->update();\r
+        m_pImpl->pPager->update();     \r
+        m_pImpl->frame++;\r
+    }\r
+//}}}\r
+//{{{ hasNextPage\r
+    bool MessageWidget::hasNextPage( ){\r
+       return m_pImpl->pPager->hasNextPage( );\r
+    \r
+    }\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/widget/MessageWidget.cpp20090811 b/moftmp/widget/MessageWidget.cpp20090811
new file mode 100755 (executable)
index 0000000..2c09778
--- /dev/null
@@ -0,0 +1,250 @@
+#include "mof/MessageWidget.hpp"\r
+#include "mof/Effect.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/LayoutManager.hpp"\r
+#include <boost/scoped_array.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/WidgetView.hpp"\r
+#include "mof/TextView.hpp"\r
+#include "mof/GraphicsDevice.hpp"\r
+#include "mof/mofAnimations.hpp"\r
+#include "mof/TextCompiler.hpp"\r
+#include "mof/widgets.hpp"\r
+\r
+struct mof::MessageWidget::Impl{\r
+       mof::WidgetView* pBackgroundView;\r
+       mof::TextView* pTitleView;\r
+       mof::LayoutManager* pLayout;\r
+       boost::shared_ptr<mof::Matrix2D> pTranslation;\r
+       int width;\r
+       int height;\r
+       \r
+       std::vector<std::vector<mof::Sprite*> > pages;\r
+       int currentPage;\r
+\r
+       Impl(const mof::Rectangle<int>& _bounds)\r
+    : \r
+        pBackgroundView(NULL) , \r
+        pTitleView(NULL) , \r
+               width(_bounds.endX - _bounds.beginX) ,\r
+        height(_bounds.endY - _bounds.beginY) ,\r
+               currentPage(-1) ,\r
+        pLayout(NULL) \r
+    {\r
+               pTranslation = boost::shared_ptr<mof::Matrix2D>\r
+        (\r
+                       new mof::Matrix2D\r
+            (\r
+                               mof::Matrix2D::createTranslation\r
+                (\r
+                                       mof::Vector2D(_bounds.beginX , _bounds.beginY )\r
+                               )\r
+                       )\r
+               );\r
+       }\r
+\r
+       ~Impl(){\r
+               delete pLayout;\r
+               delete pBackgroundView;\r
+               delete pTitleView;\r
+               foreach(std::vector<mof::Sprite*>& page , pages ){\r
+                       foreach(mof::Sprite*& pSprite , page ){\r
+                               delete pSprite;\r
+                       }\r
+               }\r
+       }\r
+\r
+       void showPage(bool first){\r
+               mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] = {\r
+                       mof::makeKeyFrame(first ? 0 : 10*2 , mof::Color4f(0 , 1 , 1 , 1) ) ,\r
+                       mof::makeKeyFrame(first ? 30*2 : 90 , mof::Color4f(1 , 1 , 1 , 1) ) \r
+               };\r
+               mof::Animation<mof::Color4f>::Handler handler(new mof::KeyFrameAnimation<mof::Color4f>(keyFrames[0] , keyFrames[1]));\r
+               foreach(mof::Sprite*& pSprite , pages.at(currentPage) ){\r
+                       pSprite->setColor(handler);\r
+                       pSprite->setFrameNumber(0);\r
+               }\r
+       }\r
+\r
+       void closePage(bool last){\r
+               mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] = {\r
+                       mof::makeKeyFrame(0 , mof::Color4f(1 , 1 , 1 , 1) ) ,\r
+                       mof::makeKeyFrame(last ? 10*2 : 10*2 , mof::Color4f(0 , 1 , 1 , 1) ) \r
+               };\r
+               mof::Animation<mof::Color4f>::Handler handler(new mof::KeyFrameAnimation<mof::Color4f>(keyFrames[0] , keyFrames[1]));\r
+               foreach(mof::Sprite*& pSprite , pages.at(currentPage) ){\r
+                       pSprite->setColor(handler);\r
+                       pSprite->setFrameNumber(0);\r
+               }\r
+       }\r
+\r
+\r
+       \r
+};\r
+\r
+//{{{ MessageWidget\r
+mof::MessageWidget::MessageWidget\r
+(\r
+       mof::WidgetView* pBackgroundView ,\r
+       const mof::Rectangle<int>& bounds ,\r
+       mof::LayoutManager* pLayout\r
+)\r
+: m_pImpl( new Impl( bounds) )\r
+{\r
+       m_pImpl->pLayout = pLayout;\r
+       m_pImpl->pBackgroundView = pBackgroundView;\r
+\r
+    { // \83^\83C\83g\83\8b\82Ì\8f\89\8aú\89»\r
+        if( true )\r
+        {\r
+            m_pImpl->pTitleView = new mof::TextView\r
+            (\r
+                _T("Title") , mof::Font( mof::Font::MS_P_GOTHIC , 25 )\r
+            );\r
+            m_pImpl->pTitleView->initialize();\r
+            mof::Rectangle<int> tmp( bounds.beginX , bounds.beginY , bounds.endX , bounds.beginY + 32 );\r
+                       m_pImpl->pTitleView->setBounds( tmp );\r
+\r
+        }\r
+    }\r
+\r
+       m_pImpl->pBackgroundView->setBounds(bounds);\r
+}\r
+//}}}\r
+//{{{ ~MessageWidget\r
+mof::MessageWidget::~MessageWidget(){\r
+\r
+}\r
+//}}}\r
+//{{{ show\r
+void mof::MessageWidget::show(){\r
+       m_pImpl->currentPage = -1;\r
+       m_pImpl->pBackgroundView->show();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->show();\r
+       m_pImpl->currentPage++;\r
+       m_pImpl->showPage(true);\r
+}\r
+//}}}\r
+//{{{ close\r
+void mof::MessageWidget::close(){\r
+\r
+       m_pImpl->pBackgroundView->close();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->close();\r
+       if(m_pImpl->currentPage < 0)return;\r
+       m_pImpl->closePage(true);\r
+}\r
+//}}}\r
+//{{{ nextPage\r
+void mof::MessageWidget::nextPage(){\r
+       if(m_pImpl->currentPage < 0){\r
+               show();\r
+               return;\r
+       }\r
+       m_pImpl->closePage(false);\r
+       if(m_pImpl->currentPage >= static_cast<signed int>(m_pImpl->pages.size()) -1 ){\r
+               close();\r
+               return;\r
+       }\r
+       m_pImpl->currentPage++;\r
+       m_pImpl->showPage(false);\r
+}\r
+//}}}\r
+//{{{ addPage\r
+void mof::MessageWidget::addPage( const Page& page ){\r
+\r
+       m_pImpl->pages.push_back(std::vector<mof::Sprite*>());\r
+       mof::compileText( page.message , page.font , m_pImpl->pages.back() );\r
+               \r
+       std::vector<mof::Rectangle<int> > boundList;\r
+    if( m_pImpl->pTitleView )boundList.push_back( mof::Rectangle<int>( 0 , 0 , 1 , 32) );\r
+    //if( m_pImpl->pTitleView )boundList.push_back( m_pImpl->pTitle->getBounds() );\r
+       \r
+    foreach(mof::Sprite*& pSprite , m_pImpl->pages.back() ){\r
+               mof::Rectangle<int> bounds = pSprite->getWorldTransform().toBoundingBox();                      \r
+               boundList.push_back(bounds);\r
+       }\r
+       m_pImpl->pLayout->replace(m_pImpl->width , m_pImpl->height , boundList.front() , boundList.back() );\r
+    \r
+    //TODO: LayoutAnimation\82ð\82Â\82­\82é\r
+       for(unsigned int j = 0 ; j < m_pImpl->pLayout->getLength( ) ; ++j)\r
+    {\r
+               const mof::Animation<mof::Matrix2D>::Handler children[] =\r
+        {\r
+                       mof::makeConstantHandler\r
+            ( \r
+                mof::Matrix2D::createScaling\r
+                (\r
+                                   mof::Vector2D(boundList.at(j).endX - boundList.at(j).beginX , boundList.at(j).endY - boundList.at(j).beginY)\r
+                )\r
+                   ) ,\r
+                       mof::makeParametricHandler(m_pImpl->pTranslation) ,\r
+                       mof::makeConstantHandler\r
+            (\r
+                           mof::Matrix2D::createTranslation( m_pImpl->pLayout->getPosition(j) )\r
+                       )\r
+           }; // array children\r
+\r
+               mof::Animation<mof::Matrix2D>::Handler handler\r
+        (\r
+                   new mof::CascadingAnimation<mof::Matrix2D>( children[0] , mof::lastOf( children ) )\r
+               );\r
+\r
+        //if( m_pImpl->pTitleView && j == 0 )m_pImpl->pTitleView->setPosition( handler );\r
+        if( m_pImpl->pTitleView && j !=  0 )\r
+        {\r
+            m_pImpl->pages.back().at(j-1)->setWorldTransform( handler );\r
+               m_pImpl->pages.back().at(j-1)->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+        }\r
+        else if( NULL != m_pImpl->pTitleView )\r
+        {\r
+            m_pImpl->pages.back().at(j)->setWorldTransform( handler );\r
+               m_pImpl->pages.back().at(j)->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+        }\r
+\r
+    } // for   \r
+\r
+\r
+}\r
+//}}}\r
+//{{{ draw\r
+void mof::MessageWidget::draw() const{\r
+       m_pImpl->pBackgroundView->draw();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->getEffect()->draw();\r
+       if(m_pImpl->currentPage < 0)return;\r
+       \r
+       if(m_pImpl->currentPage > 0){\r
+               foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage-1) ){\r
+                       pSprite->draw();\r
+               }\r
+       }\r
+       mof::GraphicsDevice::setViewport(m_pImpl->pBackgroundView->getBounds());\r
+       foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage) ){\r
+               pSprite->draw();\r
+       }\r
+       mof::GraphicsDevice::setViewport(mof::Rectangle<int>(0 , 0 , 640 , 480));//TODO\r
+       \r
+}\r
+//}}}\r
+//{{{ update\r
+void mof::MessageWidget::update() {\r
+\r
+       m_pImpl->pBackgroundView->update();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->update();\r
+       if(m_pImpl->currentPage < 0)return;\r
+       if(m_pImpl->currentPage > 0){\r
+               foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage-1) ){\r
+                       pSprite->update();\r
+               }\r
+       }\r
+       foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage) ){\r
+               pSprite->update();\r
+       }\r
+}\r
+//}}}\r
+//{{{ hasNextPage\r
+bool mof::MessageWidget::hasNextPage(){\r
+       return m_pImpl->currentPage < static_cast<signed int>(m_pImpl->pages.size()) -1;\r
+\r
+}\r
+//}}}\r
+\r
diff --git a/moftmp/widget/MessageWidget.cpp~ b/moftmp/widget/MessageWidget.cpp~
new file mode 100755 (executable)
index 0000000..0edce2b
--- /dev/null
@@ -0,0 +1,238 @@
+#include "mof/MessageWidget.hpp"\r
+#include "mof/Effect.hpp"\r
+#include "mof/utilities.hpp"\r
+#include "mof/LayoutManager.hpp"\r
+#include <boost/scoped_array.hpp>\r
+#include "mof/ConsoleIO.hpp"\r
+#include "mof/WidgetView.hpp"\r
+#include "mof/TextView.hpp"\r
+#include "mof/GraphicsDevice.hpp"\r
+#include "mof/mofAnimations.hpp"\r
+#include "mof/TextCompiler.hpp"\r
+#include "mof/widgets.hpp"\r
+    \r
+namespace mof\r
+{\r
+    \r
+    struct MessageWidget::Impl\r
+    {\r
+       mof::WidgetView* pBackgroundView;\r
+       mof::TextView* pTitleView;\r
+       mof::LayoutManager* pLayout;\r
+       //boost::shared_ptr<mof::Matrix2D> pTranslation;\r
+        mof::TranslationAnimation2D::Handler translation;\r
+        mof::ScalingAnimation2D::Handler scaling;\r
+        mof::Pager* pPager;\r
+        mof::FrameNumber frame;\r
+       //int width;\r
+       //int height;\r
+       \r
+//{{{ Impl    \r
+       Impl()\r
+        : \r
+            pBackgroundView(NULL) , \r
+            pTitleView(NULL) , \r
+            pLayout(NULL) ,\r
+            pPager( NULL ) ,\r
+            frame( 0 )\r
+        {\r
+            translation = mof::TranslationAnimation2D::Handler\r
+            (\r
+                new mof::TranslationAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D( 0 , 0 )\r
+                               )\r
+                )\r
+            );\r
+\r
+            scaling = mof::ScalingAnimation2D::Handler\r
+            (\r
+                new mof::ScalingAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D( 0 , 0 )\r
+                               )\r
+                )\r
+            );\r
+\r
+       }\r
+//}}}\r
+//{{{ ~Impl\r
+       ~Impl()\r
+        {\r
+               delete pLayout;\r
+               delete pBackgroundView;\r
+               delete pTitleView;\r
+               delete pPager;\r
+       }\r
+    \r
+//}}}    \r
+    };\r
+//{{{ MessageWidget\r
+    MessageWidget::MessageWidget\r
+    (\r
+       mof::WidgetView* pBackgroundView ,\r
+        const mof::Rectangle<int>& bounds ,\r
+       mof::LayoutManager* pLayout\r
+    )\r
+    : m_pImpl( new Impl( ) )\r
+    {\r
+       m_pImpl->pLayout = pLayout;\r
+       m_pImpl->pBackgroundView = pBackgroundView;\r
+        m_pImpl->pBackgroundView->setBounds( bounds );\r
+        m_pImpl->translation->set( m_pImpl->pBackgroundView->getPosition( ) );\r
+        m_pImpl->scaling->set( m_pImpl->pBackgroundView->getSize( ) );\r
+    \r
+        { // \83^\83C\83g\83\8b\82Ì\8f\89\8aú\89»\r
+            if( true )\r
+            {\r
+                m_pImpl->pTitleView = new mof::TextView\r
+                (\r
+                    _T("Title") , mof::Font( mof::Font::MS_P_GOTHIC , 25 )\r
+                );\r
+                m_pImpl->pTitleView->initialize();\r
+                mof::Rectangle<int> tmp( bounds.beginX , bounds.beginY , bounds.endX , bounds.beginY + 32 );\r
+                       m_pImpl->pTitleView->setBounds( tmp );\r
+    \r
+            }\r
+        }\r
+        { // \83y\81[\83W\83\83\82Ì\90\90¬\r
+            mof::LayoutManager* pLayout = new mof::LayoutManager( mof::LayoutManager::HORIZONTAL , 1);\r
+            m_pImpl->pPager = new mof::Pager( bounds , pLayout );\r
+        }\r
+    }\r
+//}}}\r
+//{{{ ~MessageWidget\r
+    MessageWidget::~MessageWidget(){\r
+    \r
+    }\r
+//}}}\r
+//{{{ show\r
+    void MessageWidget::show(){\r
+       m_pImpl->pPager->show();\r
+        m_pImpl->pBackgroundView->show();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->show();\r
+    }\r
+//}}}\r
+//{{{ close\r
+    void MessageWidget::close()\r
+    {\r
+       m_pImpl->pPager->close();\r
+       m_pImpl->pBackgroundView->close();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->close();\r
+    }\r
+//}}}\r
+//{{{ nextPage\r
+    void MessageWidget::nextPage(){\r
+       if( !m_pImpl->pPager->hasNextPage( ) )close();\r
+        else if( !m_pImpl->pPager->hasPreviousPage() )show();\r
+        else m_pImpl->pPager->nextPage();\r
+    }\r
+//}}}\r
+//{{{ addPage\r
+    void MessageWidget::addPage( const PageRequest& page ){\r
+        \r
+        m_pImpl->pPager->addPage( page );\r
+               \r
+       std::vector<mof::Rectangle<int> > boundList;\r
+        if( m_pImpl->pTitleView )boundList.push_back( mof::Rectangle<int>( 0 , 0 , 1 , 32) );\r
+        boundList.push_back( m_pImpl->pPager->getBounds( ) );\r
+       \r
+        mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+           m_pImpl->pLayout->replace\r
+        (\r
+            scaling.x , scaling.y ,\r
+            boundList.front() , boundList.back()\r
+        );\r
+\r
+        int i = 0;\r
+       if( m_pImpl->pTitleView )\r
+        {\r
+               mof::Animation<mof::Matrix2D>::Handler children[] =\r
+            {\r
+                       mof::makeConstantHandler\r
+                ( \r
+                    mof::Matrix2D::createScaling\r
+                    (\r
+                                   mof::Vector2D(boundList.at(i).getWidth( ) , boundList.at(i).getHeight( ) )\r
+                    )\r
+                   ) ,\r
+                       m_pImpl->translation ,\r
+                       mof::makeConstantHandler\r
+                (\r
+                           mof::Matrix2D::createTranslation( m_pImpl->pLayout->getPosition(i) )\r
+                       )\r
+           }; // array children\r
+    \r
+               mof::Animation<mof::Matrix2D>::Handler handler\r
+            (\r
+                   new mof::CascadingAnimation<mof::Matrix2D>( children[0] , mof::lastOf( children ) )\r
+               );\r
+            i++;\r
+            //m_pImpl->pTitleView->setWorldTransform( handler );\r
+            //m_pImpl->pTitleView->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+    \r
+        } // if\r
+        {\r
+               const mof::Animation<mof::Vector2D>::Handler children[] =\r
+            {\r
+                       //mof::makeConstantHandler( mof::Vector2D( 300 , 300) ) ,\r
+                       m_pImpl->translation->get( ) ,\r
+                       mof::makeConstantHandler\r
+                (\r
+                           m_pImpl->pLayout->getPosition(i) \r
+                       )\r
+           }; // array children\r
+    \r
+               mof::Animation<mof::Vector2D>::Handler handler\r
+            (\r
+                   new mof::CascadingAnimation<mof::Vector2D , mof::Add<mof::Vector2D> >( children[0] , mof::lastOf( children ) )\r
+               );\r
+            m_pImpl->pPager->setPosition( handler );\r
+            //m_pImpl->pTitleView->setWorldTransform( handler );\r
+            //m_pImpl->pTitleView->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+    \r
+        } // for       \r
+    \r
+    \r
+    }\r
+//}}}\r
+//{{{ draw\r
+    void MessageWidget::draw() const{\r
+       m_pImpl->pBackgroundView->draw();\r
+        \r
+        { // \95`\89æ\97Ì\88æ\82ð\90§\8cÀ\r
+            mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+            mof::Vector2D translation = m_pImpl->translation->get( )->getValue( m_pImpl->frame );\r
+            mof::GraphicsDevice::setViewport \r
+            ( \r
+                    mof::Rectangle<int>( translation.x , translation.y , translation.x + scaling.x , translation.y + scaling.y )\r
+            );\r
+        }\r
+\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->getEffect()->draw();\r
+        m_pImpl->pPager->draw();       \r
+        mof::GraphicsDevice::setViewport(mof::Rectangle<int>(0 , 0 , 640 , 480));//TODO\r
+       \r
+    }\r
+//}}}\r
+//{{{ update\r
+    void MessageWidget::update() {\r
+    \r
+       m_pImpl->pBackgroundView->update();\r
+       if( m_pImpl->pTitleView )m_pImpl->pTitleView->update();\r
+        m_pImpl->pPager->update();     \r
+        m_pImpl->frame++;\r
+    }\r
+//}}}\r
+//{{{ hasNextPage\r
+    bool MessageWidget::hasNextPage( ){\r
+       return m_pImpl->pPager->hasNextPage( );\r
+    \r
+    }\r
+//}}}\r
+} //namespace mof\r
+\r
diff --git a/moftmp/widget/MessageWidget.hpp b/moftmp/widget/MessageWidget.hpp
new file mode 100755 (executable)
index 0000000..d7f099c
--- /dev/null
@@ -0,0 +1,48 @@
+#pragma once\r
+#include <boost/function/function0.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+//#include "mof/MenuView.hpp"\r
+#include "mof/widget/WidgetView.hpp"\r
+#include "mof/Font.hpp"\r
+\r
+namespace mof\r
+{\r
+    struct PageRequest\r
+    {\r
+               tstring message;\r
+               Font font;\r
+                       \r
+               PageRequest(const tstring& message_ , const Font& font_ )\r
+               : message(message_) , font(font_)\r
+               {\r
+               }\r
+       };\r
+\r
+       class LayoutManager;\r
+       class WidgetView;\r
+    class Pager;\r
+    struct Page;\r
+\r
+       class MessageWidget : boost::noncopyable{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       public:\r
+               \r
+        MessageWidget\r
+        ( \r
+                       WidgetView* pBackgroundView , \r
+                       const Rectangle< int >& bounds , LayoutManager* pLayout\r
+               );\r
+\r
+               ~MessageWidget();\r
+               void show();\r
+               void close();\r
+               void nextPage();\r
+               void addPage( const PageRequest& page );\r
+               void draw() const;\r
+               void update();\r
+               bool hasNextPage();\r
+\r
+       };\r
+}\r
diff --git a/moftmp/widget/MessageWidget.hpp~ b/moftmp/widget/MessageWidget.hpp~
new file mode 100755 (executable)
index 0000000..21b6f59
--- /dev/null
@@ -0,0 +1,48 @@
+#pragma once\r
+#include <boost/function/function0.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+#include <boost/scoped_ptr.hpp>\r
+//#include "mof/MenuView.hpp"\r
+#include "mof/WidgetView.hpp"\r
+#include "mof/Font.hpp"\r
+\r
+namespace mof\r
+{\r
+    struct PageRequest\r
+    {\r
+               tstring message;\r
+               Font font;\r
+                       \r
+               PageRequest(const tstring& message_ , const Font& font_ )\r
+               : message(message_) , font(font_)\r
+               {\r
+               }\r
+       };\r
+\r
+       class LayoutManager;\r
+       class WidgetView;\r
+    class Pager;\r
+    struct Page;\r
+\r
+       class MessageWidget : boost::noncopyable{\r
+               struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       public:\r
+               \r
+        MessageWidget\r
+        ( \r
+                       WidgetView* pBackgroundView , \r
+                       const Rectangle< int >& bounds , LayoutManager* pLayout\r
+               );\r
+\r
+               ~MessageWidget();\r
+               void show();\r
+               void close();\r
+               void nextPage();\r
+               void addPage( const PageRequest& page );\r
+               void draw() const;\r
+               void update();\r
+               bool hasNextPage();\r
+\r
+       };\r
+}\r
diff --git a/moftmp/widget/OverlapLayout.cpp b/moftmp/widget/OverlapLayout.cpp
new file mode 100755 (executable)
index 0000000..e0a7864
--- /dev/null
@@ -0,0 +1,103 @@
+#include <mof/widget/OverlapLayout.hpp>\r
+#include <mof/utilities.hpp>\r
+#include <mof/widgets.hpp>\r
+#include <mof/streams.hpp>\r
+#include <algorithm>\r
+#include <vector>\r
+\r
+using boost::shared_ptr;\r
+using mof::widget::WidgetView;\r
+//{{{ Impl\r
+struct mof::widget::OverlapLayout::Impl\r
+{\r
+       \r
+    int width , height;\r
+    size_t length;\r
+    std::vector< shared_ptr<WidgetView> > views;\r
+\r
+       Impl( const mof::Vector2D& size )\r
+       : \r
+               width(size.x) , height(size.y) , length(0)\r
+       {}\r
+       \r
+\r
+       ~Impl()\r
+    {\r
+       }\r
+};\r
+//}}}\r
+//{{{ OverlapLayout\r
+mof::widget::OverlapLayout::OverlapLayout( const mof::Vector2D& size )\r
+: m_pImpl( new Impl( size ) )\r
+{\r
+}\r
+//}}}\r
+//{{{ ~OverlapLayout\r
+mof::widget::OverlapLayout::~OverlapLayout( )\r
+{\r
+}\r
+//}}}\r
+//{{{ add\r
+void mof::widget::OverlapLayout::add(shared_ptr<WidgetView> pView)\r
+{\r
+    /*if(m_pImpl->length == 0 ){\r
+           m_pImpl->width = mof::real2int(size.x);\r
+           m_pImpl->width = mof::real2int(size.y);\r
+    }*/\r
+    m_pImpl->length++;\r
+    m_pImpl->views.push_back(pView);\r
+}\r
+//}}}\r
+//{{{ getLength\r
+size_t mof::widget::OverlapLayout::getLength() const\r
+{\r
+    return m_pImpl->length;\r
+}\r
+//}}}\r
+//{{{ getPreferredSize\r
+mof::Vector2D mof::widget::OverlapLayout::getPreferredSize() const\r
+{\r
+    return mof::Vector2D(m_pImpl->width , m_pImpl->height);\r
+}\r
+//}}}\r
+//{{{ getSizeDependencyType\r
+mof::widget::Layout::DependencyType mof::widget::OverlapLayout::getSizeDependencyType() const\r
+{\r
+    return mof::widget::Layout::PARENT_LEADING;\r
+}\r
+//}}}\r
+//{{{ connect\r
+void mof::widget::OverlapLayout::connect(WidgetView* pParentView) \r
+{\r
+    size_t i = 0;\r
+    foreach(shared_ptr<WidgetView> pView , m_pImpl->views) \r
+    {\r
+        pView->getPositionStream() << pParentView->getPositionStream();\r
+        pView->getSizeStream() << pParentView->getSizeStream() << - pView->getSizeStream().value();\r
+    }\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsUp\r
+int mof::widget::OverlapLayout::getAdjacencyAsUp(int index) const\r
+{\r
+    return mof::rotation_mod(index-1 , m_pImpl->length);\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsDown\r
+int mof::widget::OverlapLayout::getAdjacencyAsDown(int index) const\r
+{\r
+    return mof::rotation_mod(index+1 , m_pImpl->length );\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsLeft\r
+int mof::widget::OverlapLayout::getAdjacencyAsLeft(int index) const\r
+{\r
+    return mof::rotation_mod(index-1 , m_pImpl->length );\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsRight\r
+int mof::widget::OverlapLayout::getAdjacencyAsRight(int index) const\r
+{\r
+    return mof::rotation_mod(index+1 , m_pImpl->length );\r
+}\r
+//}}}\r
diff --git a/moftmp/widget/OverlapLayout.cpp~ b/moftmp/widget/OverlapLayout.cpp~
new file mode 100755 (executable)
index 0000000..3936671
--- /dev/null
@@ -0,0 +1,103 @@
+#include <mof/widget/OverlapLayout.hpp>\r
+#include <mof/utilities.hpp>\r
+#include <mof/widgets.hpp>\r
+#include <mof/streams.hpp>\r
+#include <algorithm>\r
+#include <vector>\r
+\r
+using boost::shared_ptr;\r
+using mof::widget::WidgetView;\r
+//{{{ Impl\r
+struct mof::widget::OverlapLayout::Impl\r
+{\r
+       \r
+    int width , height;\r
+    size_t length;\r
+    std::vector< shared_ptr<WidgetView> > views;\r
+\r
+       Impl( const mof::Vector2D& size )\r
+       : \r
+               width(size.x) , height(size.y) , length(0)\r
+       {}\r
+       \r
+\r
+       ~Impl()\r
+    {\r
+       }\r
+};\r
+//}}}\r
+//{{{ OverlapLayout\r
+mof::widget::OverlapLayout::OverlapLayout( const mof::Vector2D& size )\r
+: m_pImpl( new Impl( size ) )\r
+{\r
+}\r
+//}}}\r
+//{{{ ~OverlapLayout\r
+mof::widget::OverlapLayout::~OverlapLayout( )\r
+{\r
+}\r
+//}}}\r
+//{{{ add\r
+void mof::widget::OverlapLayout::add(shared_ptr<WidgetView> pView)\r
+{\r
+    /*if(m_pImpl->length == 0 ){\r
+           m_pImpl->width = mof::real2int(size.x);\r
+           m_pImpl->width = mof::real2int(size.y);\r
+    }*/\r
+    m_pImpl->length++;\r
+    m_pImpl->views.push_back(pView);\r
+}\r
+//}}}\r
+//{{{ getLength\r
+size_t mof::widget::OverlapLayout::getLength() const\r
+{\r
+    return m_pImpl->length;\r
+}\r
+//}}}\r
+//{{{ getPreferredSize\r
+mof::Vector2D mof::widget::OverlapLayout::getPreferredSize() const\r
+{\r
+    return mof::Vector2D(m_pImpl->width , m_pImpl->height);\r
+}\r
+//}}}\r
+//{{{ getSizeDependencyType\r
+mof::widget::Layout::DependencyType mof::widget::OverlapLayout::getSizeDependencyType() const\r
+{\r
+    return mof::widget::Layout::PARENT_LEADING;\r
+}\r
+//}}}\r
+//{{{ connect\r
+void mof::widget::OverlapLayout::connect(WidgetView* pParentView) \r
+{\r
+    size_t i = 0;\r
+    foreach(shared_ptr<WidgetView> pView , m_pImpl->views) \r
+    {\r
+        pView->getPositionStream() << pParentView;\r
+        pView->getSizeStream() << pParentView->getSizeStream() << - pView->getSizeStream().value();\r
+    }\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsUp\r
+int mof::widget::OverlapLayout::getAdjacencyAsUp(int index) const\r
+{\r
+    return mof::rotation_mod(index-1 , m_pImpl->length);\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsDown\r
+int mof::widget::OverlapLayout::getAdjacencyAsDown(int index) const\r
+{\r
+    return mof::rotation_mod(index+1 , m_pImpl->length );\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsLeft\r
+int mof::widget::OverlapLayout::getAdjacencyAsLeft(int index) const\r
+{\r
+    return mof::rotation_mod(index-1 , m_pImpl->length );\r
+}\r
+//}}}\r
+//{{{ getAdjacencyAsRight\r
+int mof::widget::OverlapLayout::getAdjacencyAsRight(int index) const\r
+{\r
+    return mof::rotation_mod(index+1 , m_pImpl->length );\r
+}\r
+//}}}\r
diff --git a/moftmp/widget/OverlapLayout.hpp b/moftmp/widget/OverlapLayout.hpp
new file mode 100755 (executable)
index 0000000..294a596
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class OverlapLayout : public Layout\r
+    {\r
+       public:\r
+\r
+               OverlapLayout( const mof::Vector2D& size );\r
+               virtual ~OverlapLayout();\r
+               virtual void add(boost::shared_ptr<WidgetView> pView);\r
+        virtual Vector2D getPreferredSize() const;\r
+        virtual DependencyType getSizeDependencyType() const;\r
+        virtual void connect(WidgetView* pParentView);\r
+        virtual size_t getLength( ) const;\r
+        virtual int getAdjacencyAsUp(int index) const;\r
+        virtual int getAdjacencyAsDown(int index) const;\r
+        virtual int getAdjacencyAsLeft(int index) const;\r
+        virtual int getAdjacencyAsRight(int index) const;\r
+\r
+    private:\r
+        struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+}\r
+} // namepsace mof\r
+\r
diff --git a/moftmp/widget/OverlapLayout.hpp~ b/moftmp/widget/OverlapLayout.hpp~
new file mode 100755 (executable)
index 0000000..98f6189
--- /dev/null
@@ -0,0 +1,33 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include <mof/widget/Layout.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class OverlapLayout : public Layout\r
+    {\r
+       public:\r
+\r
+               OverlapLayout( const mof::Vector2D& size );\r
+               virtual ~OverlapLayout();\r
+               virtual void add(boost::shared_ptr<WidgetView> pView);\r
+        virtual Vector2D getPreferredSize() const;\r
+        virtual DependencyType getSizeDependencyType() const;\r
+        virtual void connect(boost::shared_ptr<WidgetView> pParentView);\r
+        virtual size_t getLength( ) const;\r
+        virtual int getAdjacencyAsUp(int index) const;\r
+        virtual int getAdjacencyAsDown(int index) const;\r
+        virtual int getAdjacencyAsLeft(int index) const;\r
+        virtual int getAdjacencyAsRight(int index) const;\r
+\r
+    private:\r
+        struct Impl;\r
+               boost::scoped_ptr<Impl> m_pImpl;\r
+       };\r
+\r
+}\r
+} // namepsace mof\r
+\r
diff --git a/moftmp/widget/Page.hpp~ b/moftmp/widget/Page.hpp~
new file mode 100755 (executable)
index 0000000..a7a7c9d
--- /dev/null
@@ -0,0 +1,86 @@
+#pragma once\r
+\r
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/tstring.hpp"\r
+#include "mof/Font.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include "mof/Animation.hpp"\r
+#include "mof/Vector2D.hpp"\r
+\r
+\r
+namespace mof\r
+{\r
+    struct PageRequest;        \r
+    class LayoutManager;\r
+\r
+    /** ページから\r
+     */\r
+    class Page\r
+    {\r
+    public:\r
+        Page\r
+        ( \r
+            mof::LayoutManager* pLayout\r
+               );\r
+\r
+        ~Page( );\r
+\r
+        /** このウィジェットを表示にする\r
+         * @note 即座に処理されることは保障されない\r
+         */\r
+        void show( );\r
+\r
+        /** このウィジェットを非表示にする\r
+         * @note 即座に処理されることは保障されない\r
+         */\r
+               void hide( );\r
+\r
+        /** このウィジェットの内容を描画する\r
+         *  @note setPosition()やsetSize()で指定した領域外にも描画が行われることもある\r
+         */\r
+               void draw( ) const;\r
+               \r
+        /** ウィジェット内のフレームを進める\r
+         */\r
+        void update( );\r
+\r
+        /** このウィジェットがとれる最小の大きさに\r
+         */\r
+        void pack( );\r
+      \r
+        /** ウィジェットの左上の位置を得る\r
+         *  @note   このメソッドで得られるハンドラとsetPosition()で\r
+         *          指定したハンドラは同一であると扱える\r
+         *  @retval このウィジェットの左上の位置を得るためのハンドラ \r
+         */\r
+        mof::Animation< mof::Vector2D>::Handler getPosition( ) const;\r
+\r
+        /** ウィジェットの大きさを得る\r
+         *  @note   このメソッドで得られるハンドラとsetSize()で\r
+         *          指定したハンドラは同一であると扱える\r
+         *  @retval このウィジェットの大きさを得るためのハンドラ \r
+         */\r
+        mof::Animation< mof::Vector2D>::Handler getSize( ) const;\r
+\r
+        /** ウィジェットの左上の位置を指定する\r
+         *  @note   このメソッドで指定するハンドラとgetPosition()で\r
+         *          得られるハンドラは同一であると扱える\r
+         *  @retval このウィジェットの左上の位置を得るためのハンドラ \r
+         */\r
+        void setPosition( const mof::Animation<mof::Vector2D>::Handler& handler ); \r
+        \r
+        /** ウィジェットの左上の位置を指定する\r
+         *  @note   このメソッドで指定するハンドラとgetPosition()で\r
+         *          得られるハンドラは同一であると扱える\r
+         *  @retval このウィジェットの左上の位置を得るためのハンドラ \r
+         */\r
+        void setSize( const mof::Animation<mof::Vector2D>::Handler& handler ); \r
+        \r
+        mof::Rectangle<int> getBounds( ); \r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+    };\r
+\r
+}\r
diff --git a/moftmp/widget/Pager.cpp b/moftmp/widget/Pager.cpp
new file mode 100755 (executable)
index 0000000..32ede49
--- /dev/null
@@ -0,0 +1,254 @@
+#include "mof/Pager.hpp"\r
+#include "mof/Sprite.hpp"\r
+#include "mof/utilities.hpp"\r
+#include <vector>\r
+#include "mof/widgets.hpp"\r
+#include "mof/mofAnimations.hpp"\r
+#include "mof/mofGraphics.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+namespace mof\r
+{\r
+    struct Pager::Impl\r
+    {\r
+           std::vector< std::vector<mof::Sprite*> > pages;\r
+        mof::FrameNumber frame;\r
+        int currentPage;\r
+           mof::LayoutManager* pLayout;\r
+        mof::TranslationAnimation2D::Handler translation;\r
+        mof::ScalingAnimation2D::Handler scaling;\r
+\r
+//{{{ Impl\r
+        Impl( const mof::Rectangle<int>& _bounds )\r
+        : \r
+                   currentPage(-1) ,\r
+            pLayout(NULL) ,\r
+            frame( 0 )\r
+        {\r
+               translation = mof::TranslationAnimation2D::Handler\r
+            (\r
+                new mof::TranslationAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D(_bounds.beginX , _bounds.beginY )\r
+                               )\r
+                )\r
+            );\r
+\r
+            scaling = mof::ScalingAnimation2D::Handler\r
+            (\r
+                new mof::ScalingAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D(_bounds.getWidth( ) , _bounds.getHeight( ) )\r
+                               )\r
+                )\r
+            );\r
+\r
+           }\r
+//}}}\r
+//{{{ ~Impl\r
+        ~Impl(){\r
+                   delete pLayout;\r
+                   foreach(std::vector<mof::Sprite*>& page , pages ){\r
+                           foreach(mof::Sprite*& pSprite , page ){\r
+                                   delete pSprite;\r
+                           }\r
+                   }\r
+           }\r
+//}}}\r
+//{{{ showPage\r
+    void showPage(bool first)\r
+    {\r
+               mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] = {\r
+                       mof::makeKeyFrame(first ? 0 : 10*2 , mof::Color4f(0 , 1 , 1 , 1) ) ,\r
+                       mof::makeKeyFrame(first ? 30*2 : 90 , mof::Color4f(1 , 1 , 1 , 1) ) \r
+               };\r
+               mof::Animation<mof::Color4f>::Handler handler(new mof::KeyFrameAnimation<mof::Color4f>(keyFrames[0] , keyFrames[1]));\r
+               handler = mof::makeOffsetHandler< mof::Color4f >( handler , -frame );\r
+        foreach(mof::Sprite*& pSprite , pages.at(currentPage) ){\r
+                       pSprite->setColor(handler);\r
+               }\r
+       }\r
+//}}}\r
+//{{{ closePage\r
+       void closePage(bool last){\r
+               mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] = {\r
+                       mof::makeKeyFrame(0 , mof::Color4f(1 , 1 , 1 , 1) ) ,\r
+                       mof::makeKeyFrame(last ? 10*2 : 10*2 , mof::Color4f(0 , 1 , 1 , 1) ) \r
+               };\r
+               mof::Animation<mof::Color4f>::Handler handler(new mof::KeyFrameAnimation<mof::Color4f>(keyFrames[0] , keyFrames[1]));\r
+        DEBUG_PRINT( frame);\r
+           handler = mof::makeOffsetHandler< mof::Color4f >( handler , -frame );\r
+               foreach(mof::Sprite*& pSprite , pages.at(currentPage) ){\r
+                       pSprite->setColor(handler);\r
+               }\r
+       }\r
+\r
+//}}}\r
+    };\r
+//{{{ Pager\r
+    Pager::Pager\r
+    (\r
+           const mof::Rectangle<int>& bounds ,\r
+           mof::LayoutManager* pLayout\r
+    )\r
+    : m_pImpl( new Impl( bounds ) )\r
+    {\r
+           m_pImpl->pLayout = pLayout;\r
+    }\r
+//}}} \r
+//{{{ ~Pager\r
+    Pager::~Pager( )\r
+    {\r
+    }\r
+//}}} \r
+//{{{ show\r
+    void Pager::show( )\r
+    {\r
+        m_pImpl->currentPage = -1;\r
+           m_pImpl->currentPage++;\r
+           m_pImpl->showPage(true);\r
+    }\r
+//}}} \r
+//{{{ close \r
+       void Pager::close( )\r
+    {\r
+           if(m_pImpl->currentPage < 0)return;\r
+           m_pImpl->closePage(true);\r
+    }\r
+//}}} \r
+//{{{ nextPage\r
+       void Pager::nextPage( )\r
+    {\r
+        if(m_pImpl->currentPage < 0){\r
+                   show();\r
+                   return;\r
+           }\r
+           m_pImpl->closePage(false);\r
+           if(m_pImpl->currentPage >= static_cast<signed int>(m_pImpl->pages.size()) -1 ){\r
+                   close();\r
+                   return;\r
+           }\r
+           m_pImpl->currentPage++;\r
+           m_pImpl->showPage(false);\r
+    }\r
+//}}} \r
+//{{{ addPage\r
+       void Pager::addPage( const mof::PageRequest& page )\r
+    {\r
+        m_pImpl->pages.push_back(std::vector<mof::Sprite*>());\r
+           mof::compileText( page.message , page.font , m_pImpl->pages.back() );\r
+               \r
+           std::vector< mof::Rectangle<int> > boundList;\r
+       \r
+        foreach(mof::Sprite*& pSprite , m_pImpl->pages.back() ){\r
+            pSprite->setFrameNumber( m_pImpl->frame );\r
+                   mof::Rectangle<int> bounds = pSprite->getWorldTransform().toBoundingBox();                  \r
+                   boundList.push_back(bounds);\r
+           }\r
+         \r
+        mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+           m_pImpl->pLayout->replace\r
+        (\r
+            scaling.x , scaling.y ,\r
+            boundList.front() , boundList.back()\r
+        );\r
+    \r
+           for(unsigned int j = 0 ; j < m_pImpl->pLayout->getLength( ) ; ++j)\r
+        {\r
+                   mof::Animation<mof::Matrix2D>::Handler children[] =\r
+            {\r
+                           mof::makeConstantHandler\r
+                ( \r
+                    mof::Matrix2D::createScaling\r
+                    (\r
+                                       mof::Vector2D(boundList.at(j).getWidth( ) , boundList.at(j).getHeight( ) )\r
+                    )\r
+                       ) ,\r
+                m_pImpl->translation , \r
+                mof::makeConstantHandler\r
+                (\r
+                               mof::Matrix2D::createTranslation( m_pImpl->pLayout->getPosition(j) )\r
+                           )\r
+               }; // array children\r
+\r
+                   mof::Animation<mof::Matrix2D>::Handler handler\r
+            (\r
+                       new mof::CascadingAnimation<mof::Matrix2D>( children[0] , mof::lastOf( children ) )\r
+                   );\r
+\r
+            m_pImpl->pages.back().at(j)->setWorldTransform( handler );\r
+               m_pImpl->pages.back().at(j)->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+\r
+        } // for       \r
+\r
+    }\r
+//}}} \r
+//{{{ draw\r
+       void Pager::draw( ) const\r
+    {\r
+           if(m_pImpl->currentPage < 0)return;\r
+       \r
+           if(m_pImpl->currentPage > 0){\r
+                   foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage-1) ){\r
+                           pSprite->draw();\r
+                   }\r
+           }\r
+           foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage) ){\r
+                   pSprite->draw();\r
+           }\r
+    }\r
+//}}} \r
+//{{{ update\r
+       void Pager::update( )\r
+    {\r
+           if(m_pImpl->currentPage < 0)return;\r
+           if(m_pImpl->currentPage > 0){\r
+                   foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage-1) ){\r
+                           pSprite->update();\r
+                   }\r
+           }\r
+           foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage) ){\r
+                   pSprite->update();\r
+           }\r
+        m_pImpl->frame++;\r
+    }\r
+//}}} \r
+//{{{ hasNextPage\r
+       bool Pager::hasNextPage( ) const\r
+    {   \r
+           return m_pImpl->currentPage < static_cast<signed int>(m_pImpl->pages.size()) -1;\r
+    }\r
+//}}} \r
+//{{{ hasPreviousPage\r
+       bool Pager::hasPreviousPage( ) const\r
+    {   \r
+           return m_pImpl->currentPage >= 0;\r
+    }\r
+//}}} \r
+\r
+//{{{ setPosition\r
+    void Pager::setPosition( const mof::Animation<mof::Vector2D>::Handler& handler )\r
+    {\r
+        m_pImpl->translation->set( handler );\r
+    }\r
+//}}} \r
+//{{{ setSize\r
+    void Pager::setSize( const mof::Animation<mof::Vector2D>::Handler& handler )\r
+    {\r
+        m_pImpl->scaling->set( handler );\r
+    }\r
+//}}} \r
+//{{{ getBounds\r
+    mof::Rectangle<int> Pager::getBounds( )\r
+    {\r
+        mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+        mof::Vector2D translation = m_pImpl->translation->get( )->getValue( m_pImpl->frame );\r
+        return mof::Rectangle<int>( translation.x , translation.y , translation.x + scaling.x , translation.y + scaling.y );\r
+    }\r
+//}}} \r
+} //namepsace mof\r
+\r
diff --git a/moftmp/widget/Pager.cpp~ b/moftmp/widget/Pager.cpp~
new file mode 100755 (executable)
index 0000000..32ede49
--- /dev/null
@@ -0,0 +1,254 @@
+#include "mof/Pager.hpp"\r
+#include "mof/Sprite.hpp"\r
+#include "mof/utilities.hpp"\r
+#include <vector>\r
+#include "mof/widgets.hpp"\r
+#include "mof/mofAnimations.hpp"\r
+#include "mof/mofGraphics.hpp"\r
+#include "mof/ConsoleIO.hpp"\r
+\r
+namespace mof\r
+{\r
+    struct Pager::Impl\r
+    {\r
+           std::vector< std::vector<mof::Sprite*> > pages;\r
+        mof::FrameNumber frame;\r
+        int currentPage;\r
+           mof::LayoutManager* pLayout;\r
+        mof::TranslationAnimation2D::Handler translation;\r
+        mof::ScalingAnimation2D::Handler scaling;\r
+\r
+//{{{ Impl\r
+        Impl( const mof::Rectangle<int>& _bounds )\r
+        : \r
+                   currentPage(-1) ,\r
+            pLayout(NULL) ,\r
+            frame( 0 )\r
+        {\r
+               translation = mof::TranslationAnimation2D::Handler\r
+            (\r
+                new mof::TranslationAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D(_bounds.beginX , _bounds.beginY )\r
+                               )\r
+                )\r
+            );\r
+\r
+            scaling = mof::ScalingAnimation2D::Handler\r
+            (\r
+                new mof::ScalingAnimation2D\r
+                (\r
+                    mof::makeConstantHandler\r
+                    (\r
+                                   mof::Vector2D(_bounds.getWidth( ) , _bounds.getHeight( ) )\r
+                               )\r
+                )\r
+            );\r
+\r
+           }\r
+//}}}\r
+//{{{ ~Impl\r
+        ~Impl(){\r
+                   delete pLayout;\r
+                   foreach(std::vector<mof::Sprite*>& page , pages ){\r
+                           foreach(mof::Sprite*& pSprite , page ){\r
+                                   delete pSprite;\r
+                           }\r
+                   }\r
+           }\r
+//}}}\r
+//{{{ showPage\r
+    void showPage(bool first)\r
+    {\r
+               mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] = {\r
+                       mof::makeKeyFrame(first ? 0 : 10*2 , mof::Color4f(0 , 1 , 1 , 1) ) ,\r
+                       mof::makeKeyFrame(first ? 30*2 : 90 , mof::Color4f(1 , 1 , 1 , 1) ) \r
+               };\r
+               mof::Animation<mof::Color4f>::Handler handler(new mof::KeyFrameAnimation<mof::Color4f>(keyFrames[0] , keyFrames[1]));\r
+               handler = mof::makeOffsetHandler< mof::Color4f >( handler , -frame );\r
+        foreach(mof::Sprite*& pSprite , pages.at(currentPage) ){\r
+                       pSprite->setColor(handler);\r
+               }\r
+       }\r
+//}}}\r
+//{{{ closePage\r
+       void closePage(bool last){\r
+               mof::KeyFrameAnimation<mof::Color4f>::KeyFrame keyFrames[] = {\r
+                       mof::makeKeyFrame(0 , mof::Color4f(1 , 1 , 1 , 1) ) ,\r
+                       mof::makeKeyFrame(last ? 10*2 : 10*2 , mof::Color4f(0 , 1 , 1 , 1) ) \r
+               };\r
+               mof::Animation<mof::Color4f>::Handler handler(new mof::KeyFrameAnimation<mof::Color4f>(keyFrames[0] , keyFrames[1]));\r
+        DEBUG_PRINT( frame);\r
+           handler = mof::makeOffsetHandler< mof::Color4f >( handler , -frame );\r
+               foreach(mof::Sprite*& pSprite , pages.at(currentPage) ){\r
+                       pSprite->setColor(handler);\r
+               }\r
+       }\r
+\r
+//}}}\r
+    };\r
+//{{{ Pager\r
+    Pager::Pager\r
+    (\r
+           const mof::Rectangle<int>& bounds ,\r
+           mof::LayoutManager* pLayout\r
+    )\r
+    : m_pImpl( new Impl( bounds ) )\r
+    {\r
+           m_pImpl->pLayout = pLayout;\r
+    }\r
+//}}} \r
+//{{{ ~Pager\r
+    Pager::~Pager( )\r
+    {\r
+    }\r
+//}}} \r
+//{{{ show\r
+    void Pager::show( )\r
+    {\r
+        m_pImpl->currentPage = -1;\r
+           m_pImpl->currentPage++;\r
+           m_pImpl->showPage(true);\r
+    }\r
+//}}} \r
+//{{{ close \r
+       void Pager::close( )\r
+    {\r
+           if(m_pImpl->currentPage < 0)return;\r
+           m_pImpl->closePage(true);\r
+    }\r
+//}}} \r
+//{{{ nextPage\r
+       void Pager::nextPage( )\r
+    {\r
+        if(m_pImpl->currentPage < 0){\r
+                   show();\r
+                   return;\r
+           }\r
+           m_pImpl->closePage(false);\r
+           if(m_pImpl->currentPage >= static_cast<signed int>(m_pImpl->pages.size()) -1 ){\r
+                   close();\r
+                   return;\r
+           }\r
+           m_pImpl->currentPage++;\r
+           m_pImpl->showPage(false);\r
+    }\r
+//}}} \r
+//{{{ addPage\r
+       void Pager::addPage( const mof::PageRequest& page )\r
+    {\r
+        m_pImpl->pages.push_back(std::vector<mof::Sprite*>());\r
+           mof::compileText( page.message , page.font , m_pImpl->pages.back() );\r
+               \r
+           std::vector< mof::Rectangle<int> > boundList;\r
+       \r
+        foreach(mof::Sprite*& pSprite , m_pImpl->pages.back() ){\r
+            pSprite->setFrameNumber( m_pImpl->frame );\r
+                   mof::Rectangle<int> bounds = pSprite->getWorldTransform().toBoundingBox();                  \r
+                   boundList.push_back(bounds);\r
+           }\r
+         \r
+        mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+           m_pImpl->pLayout->replace\r
+        (\r
+            scaling.x , scaling.y ,\r
+            boundList.front() , boundList.back()\r
+        );\r
+    \r
+           for(unsigned int j = 0 ; j < m_pImpl->pLayout->getLength( ) ; ++j)\r
+        {\r
+                   mof::Animation<mof::Matrix2D>::Handler children[] =\r
+            {\r
+                           mof::makeConstantHandler\r
+                ( \r
+                    mof::Matrix2D::createScaling\r
+                    (\r
+                                       mof::Vector2D(boundList.at(j).getWidth( ) , boundList.at(j).getHeight( ) )\r
+                    )\r
+                       ) ,\r
+                m_pImpl->translation , \r
+                mof::makeConstantHandler\r
+                (\r
+                               mof::Matrix2D::createTranslation( m_pImpl->pLayout->getPosition(j) )\r
+                           )\r
+               }; // array children\r
+\r
+                   mof::Animation<mof::Matrix2D>::Handler handler\r
+            (\r
+                       new mof::CascadingAnimation<mof::Matrix2D>( children[0] , mof::lastOf( children ) )\r
+                   );\r
+\r
+            m_pImpl->pages.back().at(j)->setWorldTransform( handler );\r
+               m_pImpl->pages.back().at(j)->setColor(mof::Color4f(0 , 1 , 1 , 1));\r
+\r
+        } // for       \r
+\r
+    }\r
+//}}} \r
+//{{{ draw\r
+       void Pager::draw( ) const\r
+    {\r
+           if(m_pImpl->currentPage < 0)return;\r
+       \r
+           if(m_pImpl->currentPage > 0){\r
+                   foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage-1) ){\r
+                           pSprite->draw();\r
+                   }\r
+           }\r
+           foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage) ){\r
+                   pSprite->draw();\r
+           }\r
+    }\r
+//}}} \r
+//{{{ update\r
+       void Pager::update( )\r
+    {\r
+           if(m_pImpl->currentPage < 0)return;\r
+           if(m_pImpl->currentPage > 0){\r
+                   foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage-1) ){\r
+                           pSprite->update();\r
+                   }\r
+           }\r
+           foreach(mof::Sprite*& pSprite , m_pImpl->pages.at(m_pImpl->currentPage) ){\r
+                   pSprite->update();\r
+           }\r
+        m_pImpl->frame++;\r
+    }\r
+//}}} \r
+//{{{ hasNextPage\r
+       bool Pager::hasNextPage( ) const\r
+    {   \r
+           return m_pImpl->currentPage < static_cast<signed int>(m_pImpl->pages.size()) -1;\r
+    }\r
+//}}} \r
+//{{{ hasPreviousPage\r
+       bool Pager::hasPreviousPage( ) const\r
+    {   \r
+           return m_pImpl->currentPage >= 0;\r
+    }\r
+//}}} \r
+\r
+//{{{ setPosition\r
+    void Pager::setPosition( const mof::Animation<mof::Vector2D>::Handler& handler )\r
+    {\r
+        m_pImpl->translation->set( handler );\r
+    }\r
+//}}} \r
+//{{{ setSize\r
+    void Pager::setSize( const mof::Animation<mof::Vector2D>::Handler& handler )\r
+    {\r
+        m_pImpl->scaling->set( handler );\r
+    }\r
+//}}} \r
+//{{{ getBounds\r
+    mof::Rectangle<int> Pager::getBounds( )\r
+    {\r
+        mof::Vector2D scaling = m_pImpl->scaling->get( )->getValue( m_pImpl->frame );\r
+        mof::Vector2D translation = m_pImpl->translation->get( )->getValue( m_pImpl->frame );\r
+        return mof::Rectangle<int>( translation.x , translation.y , translation.x + scaling.x , translation.y + scaling.y );\r
+    }\r
+//}}} \r
+} //namepsace mof\r
+\r
diff --git a/moftmp/widget/Pager.hpp b/moftmp/widget/Pager.hpp
new file mode 100755 (executable)
index 0000000..15300e2
--- /dev/null
@@ -0,0 +1,44 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/tstring.hpp"\r
+#include "mof/Font.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include "mof/stream/Manipulator.hpp"\r
+#include "mof/Vector2D.hpp"\r
+\r
+\r
+namespace mof\r
+{\r
+    struct PageRequest;        \r
+    class LayoutManager;\r
+\r
+    /** \83y\81[\83W\82©\82ç\r
+     */\r
+    class Pager\r
+    {\r
+    public:\r
+        Pager\r
+        ( \r
+                       const mof::Rectangle<int>& bounds ,\r
+            mof::LayoutManager* pLayout\r
+               );\r
+\r
+        ~Pager( );\r
+\r
+        void show( );\r
+               void close( );\r
+               void nextPage( );\r
+               void addPage( const mof::PageRequest& page );\r
+               void draw( ) const;\r
+               void update( );\r
+               bool hasNextPage( ) const;\r
+               bool hasPreviousPage( ) const;\r
+        void setPosition( const mof::Animation<mof::Vector2D>::Handler& handler ); \r
+        void setSize( const mof::Animation<mof::Vector2D>::Handler& handler ); \r
+        mof::Rectangle<int> getBounds( ); \r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+    };\r
+\r
+}\r
diff --git a/moftmp/widget/Pager.hpp~ b/moftmp/widget/Pager.hpp~
new file mode 100755 (executable)
index 0000000..9403a68
--- /dev/null
@@ -0,0 +1,44 @@
+#pragma once\r
+#include <boost/scoped_ptr.hpp>\r
+#include "mof/tstring.hpp"\r
+#include "mof/Font.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include "mof/Animation.hpp"\r
+#include "mof/Vector2D.hpp"\r
+\r
+\r
+namespace mof\r
+{\r
+    struct PageRequest;        \r
+    class LayoutManager;\r
+\r
+    /** \83y\81[\83W\82©\82ç\r
+     */\r
+    class Pager\r
+    {\r
+    public:\r
+        Pager\r
+        ( \r
+                       const mof::Rectangle<int>& bounds ,\r
+            mof::LayoutManager* pLayout\r
+               );\r
+\r
+        ~Pager( );\r
+\r
+        void show( );\r
+               void close( );\r
+               void nextPage( );\r
+               void addPage( const mof::PageRequest& page );\r
+               void draw( ) const;\r
+               void update( );\r
+               bool hasNextPage( ) const;\r
+               bool hasPreviousPage( ) const;\r
+        void setPosition( const mof::Animation<mof::Vector2D>::Handler& handler ); \r
+        void setSize( const mof::Animation<mof::Vector2D>::Handler& handler ); \r
+        mof::Rectangle<int> getBounds( ); \r
+    private:\r
+        struct Impl;\r
+        boost::scoped_ptr<Impl> m_pImpl;\r
+    };\r
+\r
+}\r
diff --git a/moftmp/widget/Widget.hpp b/moftmp/widget/Widget.hpp
new file mode 100755 (executable)
index 0000000..734c96f
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/stream/Manipulator.hpp>\r
+#include <boost/utility.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class Widget : public boost::noncopyable \r
+    {\r
+       public:\r
+               virtual ~Widget(){}\r
+               virtual FrameNumber show(bool imidiately = false) = 0;\r
+               virtual FrameNumber hide(bool imidiately = false) = 0;\r
+        virtual const boost::shared_ptr<WidgetView> getView() const = 0;\r
+        virtual boost::shared_ptr<WidgetView> getView() = 0;\r
+               virtual void update() = 0;\r
+       };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/Widget.hpp~ b/moftmp/widget/Widget.hpp~
new file mode 100755 (executable)
index 0000000..ac27e42
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/stream/Manipulator.hpp>\r
+#include <boost/utility.hpp>\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class Widget : public boost::noncopyable \r
+    {\r
+       public:\r
+               virtual ~Widget(){}\r
+               virtual FrameNumber show(bool imidiately = false) = 0;\r
+               virtual FrameNumber hide(bool imidiately = false) = 0;\r
+        virtual const shared_ptr<WidgetView> getView() const = 0;\r
+        virtual shared_ptr<WidgetView> getView() = 0;\r
+               virtual void update() = 0;\r
+       };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/WidgetView.hpp b/moftmp/widget/WidgetView.hpp
new file mode 100755 (executable)
index 0000000..1ac57cf
--- /dev/null
@@ -0,0 +1,36 @@
+#pragma once\r
+#include "mof/Component2D.hpp"\r
+#include "mof/ColorComponent.hpp"\r
+#include "mof/Drawable.hpp"\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class WidgetView  \r
+    :\r
+        public Component2D ,\r
+        public ColorComponent ,\r
+        public Drawable \r
+    {\r
+       public:\r
+\r
+               virtual ~WidgetView(){};\r
+\r
+               // TODO \83\8c\83C\83A\83E\83g\82Ì\83A\83j\83\81\82Æ\83C\83x\83\93\83g\8e\9e\82Ì\83A\83j\83\81\81A\82»\82ê\82¼\82ê\82Ç\82±\82Å\82Ç\82Ì\82æ\82¤\82É\90Ý\92è\82·\82é\82©\r
+               // TODO \83G\83t\83F\83N\83g\82ð\8aO\82©\82ç\90Ý\92è\82Å\82«\82é\82æ\82¤\82É\82·\82é\r
+               // TODO \93Á\8eê\82È\83R\83\93\83|\81[\83l\83\93\83g\82à\8aO\82©\82ç\90Ý\92è\82Å\82«\82é\82æ\82¤\82É\r
+               // TODO \83X\83v\83\89\83C\83g\82Í\82Ç\82±\82ª\8e\9d\82Â\82©\r
+        virtual FrameNumber show( bool imidiately = false ) = 0; \r
+        virtual FrameNumber hide( bool imidiately = false ) = 0;\r
+        virtual FrameNumber focus( bool imidiately = false ) = 0; \r
+        virtual FrameNumber blur( bool imidiately = false ) = 0;\r
+        virtual FrameNumber click( bool imidiately = false ) = 0;\r
+\r
+               virtual void update() = 0;\r
+               virtual void draw() const = 0;\r
+       };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/WidgetView.hpp~ b/moftmp/widget/WidgetView.hpp~
new file mode 100755 (executable)
index 0000000..359f58b
--- /dev/null
@@ -0,0 +1,36 @@
+#pragma once\r
+#include "mof/Component2D.hpp"\r
+#include "mof/ColorComponent.hpp"\r
+#include "mof/Drawable.hpp"\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+\r
+       class WidgetView  \r
+    :\r
+        public Component2D ,\r
+        public ColorComponent ,\r
+        public Drawable \r
+    {\r
+       public:\r
+\r
+               virtual ~WidgetView() = 0;\r
+\r
+               // TODO \83\8c\83C\83A\83E\83g\82Ì\83A\83j\83\81\82Æ\83C\83x\83\93\83g\8e\9e\82Ì\83A\83j\83\81\81A\82»\82ê\82¼\82ê\82Ç\82±\82Å\82Ç\82Ì\82æ\82¤\82É\90Ý\92è\82·\82é\82©\r
+               // TODO \83G\83t\83F\83N\83g\82ð\8aO\82©\82ç\90Ý\92è\82Å\82«\82é\82æ\82¤\82É\82·\82é\r
+               // TODO \93Á\8eê\82È\83R\83\93\83|\81[\83l\83\93\83g\82à\8aO\82©\82ç\90Ý\92è\82Å\82«\82é\82æ\82¤\82É\r
+               // TODO \83X\83v\83\89\83C\83g\82Í\82Ç\82±\82ª\8e\9d\82Â\82©\r
+        virtual FrameNumber show( bool imidiately = false ) = 0; \r
+        virtual FrameNumber hide( bool imidiately = false ) = 0;\r
+        virtual FrameNumber focus( bool imidiately = false ) = 0; \r
+        virtual FrameNumber blur( bool imidiately = false ) = 0;\r
+        virtual FrameNumber click( bool imidiately = false ) = 0;\r
+\r
+               virtual void update() = 0;\r
+               virtual void draw() const = 0;\r
+       };\r
+\r
+}\r
+}\r
diff --git a/moftmp/widget/[ b/moftmp/widget/[
new file mode 100755 (executable)
index 0000000..0d5a87f
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once\r
+\r
+#include "mof/Vector2D.hpp"\r
+#include "mof/Rectangle.hpp"\r
+#include <boost/shared_ptr.hpp>\r
+\r
+namespace mof\r
+{\r
+namespace widget\r
+{\r
+    class WidgetView;\r
+\r
+    class Layout\r
+    {\r
+\r
+       public:\r
+        enum DependencyType\r
+        {\r
+            PARENT_LEADING ,\r
+            CHILD_LEADING\r
+        };\r
+\r
+               virtual ~Layout(){}\r
+               //virtual void add(const Vector2D& size) = 0;\r
+               //virtual Vector2D getPositionOf(int index) const = 0 ;\r
+               //virtual Vector2D getSizeOf(int index) const = 0 ;\r
+        //virtual Vector2D getBounds() const = 0;\r
+               virtual void add(boost::shared_ptr<WidgetView> pView) = 0;\r
+        virtual Vector2D getPreferredSize() = 0;\r
+        virtual DependencyType getSizeDependencyType() = 0;\r
+        virtual void connect( boost::shared_ptr<WidgetView> pParentView) = 0;\r
+               virtual size_t getLength() const = 0;\r
+        virtual int getAdjacencyAsUp(int index) const = 0;\r
+        virtual int getAdjacencyAsDown(int index) const = 0;\r
+        virtual int getAdjacencyAsLeft(int index) const = 0;\r
+        virtual int getAdjacencyAsRight(int index) const = 0;\r
+       };\r
+}\r
+}\r
diff --git a/moftmp/widget/utilities.cpp b/moftmp/widget/utilities.cpp
new file mode 100755 (executable)
index 0000000..a059edb
--- /dev/null
@@ -0,0 +1,20 @@
+#include "mof/widget/utilities.hpp"\r
+#include "mof/widget/WidgetView.hpp"\r
+#include "mof/Sprite.hpp"\r
+\r
+namespace mof\r
+{\r
+/*\r
+    void setStreamAsChild( Sprite* sprite , const WidgetView* view )\r
+    {\r
+        sprite->getColorStream( ) << view->getColorStream( );\r
+        sprite->getPositionStream() << view->getPositionStream( );\r
+    }\r
+    \r
+    void setStreamAsChild( WidgetView* child , const WidgetView* parent )\r
+    {\r
+        child->getColorStream() << parent->getColorStream( );\r
+        child->getPositionStream() << parent->getPositionStream( );\r
+    }\r
+*/\r
+}\r
diff --git a/moftmp/widget/utilities.cpp~ b/moftmp/widget/utilities.cpp~
new file mode 100755 (executable)
index 0000000..20a2a60
--- /dev/null
@@ -0,0 +1,20 @@
+#include "mof/widget/utilities.hpp"\r
+#include "mof/widget/WidgetView.hpp"\r
+#include "mof/Sprite.hpp"\r
+\r
+namespace mof\r
+{\r
+\r
+    void setStreamAsChild( Sprite* sprite , const WidgetView* view )\r
+    {\r
+        sprite->getColorStream( ) << view->getColorStream( );\r
+        sprite->getPositionStream() << view->getPositionStream( );\r
+    }\r
+    \r
+    void setStreamAsChild( WidgetView* child , const WidgetView* parent )\r
+    {\r
+        child->getColorStream() << parent->getColorStream( );\r
+        child->getPositionStream() << parent->getPositionStream( );\r
+    }\r
+\r
+}\r
diff --git a/moftmp/widget/utilities.hpp b/moftmp/widget/utilities.hpp
new file mode 100755 (executable)
index 0000000..1c11ef7
--- /dev/null
@@ -0,0 +1,19 @@
+#pragma once\r
+#include <boost/function.hpp>\r
+#include <mof/widget/WidgetView.hpp>\r
+\r
+\r
+namespace mof\r
+{\r
+    class WidgetView;\r
+    class Sprite;\r
+/*\r
+    void setStreamAsChild( Sprite* spritem , const WidgetView* view );\r
+\r
+    void setStreamAsChild( WidgetView* child , const WidgetView* parent );\r
+*/\r
+}\r
+\r
+\r
+\r
+\r
diff --git a/moftmp/widget/utilities.hpp~ b/moftmp/widget/utilities.hpp~
new file mode 100755 (executable)
index 0000000..d8be549
--- /dev/null
@@ -0,0 +1,21 @@
+#pragma once\r
+#include <boost/function.hpp>\r
+#include <mof/widget/WidgetView.hpp>\r
+#include <mof/FactoryMethod.hpp>\r
+\r
+\r
+namespace mof\r
+{\r
+    class WidgetView;\r
+    class Sprite;\r
+    typedef <WidgetView* (void)> WidgetViewFactoryMethod;\r
+/*\r
+    void setStreamAsChild( Sprite* spritem , const WidgetView* view );\r
+\r
+    void setStreamAsChild( WidgetView* child , const WidgetView* parent );\r
+*/\r
+}\r
+\r
+\r
+\r
+\r
diff --git a/moftmp/widgets.hpp b/moftmp/widgets.hpp
new file mode 100755 (executable)
index 0000000..b02112f
--- /dev/null
@@ -0,0 +1,18 @@
+#pragma once\r
+#include "mof/Message.hpp"\r
+//#include "mof/Pager.hpp"\r
+//#include "mof/Page.hpp"\r
+//#include "mof/PlainWidgetView.hpp"\r
+//#include "mof/TextCompiler.hpp"\r
+#include "mof/widget/Widget.hpp"\r
+#include "mof/widget/Menu.hpp"\r
+#include "mof/widget/Frame.hpp"\r
+#include "mof/widget/FrameBuilder.hpp"\r
+#include "mof/widget/WidgetView.hpp"\r
+#include "mof/widget/ImageView.hpp"\r
+#include "mof/widget/Container.hpp"\r
+#include "mof/widget/Layout.hpp"\r
+#include "mof/widget/GridLayout.hpp"\r
+#include "mof/widget/OverlapLayout.hpp"\r
+#include "mof/widget/Widget.hpp"\r
+#include "mof/widget/utilities.hpp"\r