OSDN Git Service

fix build system ofmoflib1 and saisei1
[moflib/moflib.git] / saisei-1.0 / src / oldcode / Demo2.cpp~
1 #include "Demo2.hpp"
2 #include "configure.hpp"
3 #include "MyInstructionSet.hpp"
4 #include "mof/Interpreter.hpp"
5 #include "mof/EventScheduler.hpp"
6 #include "mof/mofInput.hpp"
7 #include "mof/mofGraphics.hpp"
8 #include "mof/Application.hpp"
9 #include "mof/utilities.hpp"
10 #include "mof/widgets.hpp"
11 #include "mof/Font.hpp"
12 #include "resource.hpp"
13 #include <mof/streams.hpp>
14 #include <mof/FactoryMethod.hpp>
15 #include <boost/bind.hpp> 
16 #include <boost/make_shared.hpp> 
17 #include "widget/createMenuView.hpp"
18 #include "widget/createFrame.hpp"
19
20 using namespace mof::widget;
21 using namespace boost;
22
23 namespace
24 {
25         
26         boost::shared_ptr<mof::InputReceiver> m_pInputReceiver;
27         mof::EventScheduler m_scheduler;
28     Frame* m_pView;
29 }
30         
31 namespace Demo2
32 {
33
34     void initialize()
35     {
36
37
38         {
39             shared_ptr<Message> pWidget =
40                 make_shared<Message>
41                 (
42                     make_shared<TextCompiler>
43                     (
44                         mof::Font(FONT_NAME_UME , 18)
45
46                     )
47                 );  
48
49             pWidget->addPage("\83E\83B\83\93\83h\83E\83V\83X\83e\83\80\82Ì\83f\83\82\82Å\82·\81B<nl/>\95\8e\9a\97ñ\82Ì\92·\82³\82É\89\9e\82\82Ä\83E\83B\83\93\83h\83E\83T\83C\83Y\82ª\8e©\93®\82Å\8c\88\82Ü\82è\82Ü\82·\81B");
50
51             m_pView = 
52                 createFrame
53                 (
54                     _T("My Demo") ,
55                     _T("image/frame0.png") ,
56                     _T("image/frame3.png") ,
57                     pWidget->getView()
58                 ).release();
59         }
60
61         {
62             mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] =
63             {
64                 mof::makeKeyFrame( 0 , mof::Vector2D( 0 , 50 ) ) ,
65                 mof::makeKeyFrame( 300 , mof::Vector2D( 150 , 200 ) ) ,
66             };
67             m_pView->getView()->getPositionStream() << mof::makeKeyFrameAnimationHandler( keyFrames[0] , mof::lastOf( keyFrames ) );
68         }
69         m_pView->show();
70
71         m_pInputReceiver = boost::shared_ptr<mof::InputReceiver>(mof::InputDevice::getInputReceiver());
72             
73             mof::GraphicsDevice::lightEnable(false);
74             mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA);
75
76     }
77
78     void finalize( )
79     {
80         mof::safe_delete( m_pView );
81     }
82     
83     
84
85     void update()
86     {
87         m_scheduler.update();
88         m_pInputReceiver->update();
89         m_pView->update( );
90         
91     }
92
93     void draw()
94     {
95             mof::VertexXYZRHWC vertices[] = 
96             {
97                 mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) ,
98                 mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) ,
99                 mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) ,
100                 mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0))
101             };
102             mof::GraphicsDevice::setTexture(NULL);
103             mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP );
104         
105         m_pView->getView()->draw( );
106     }
107
108 } // namespace Demo2
109
110