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"
20 using namespace mof::widget;
21 using namespace boost;
26 boost::shared_ptr<mof::InputReceiver> m_pInputReceiver;
27 mof::EventScheduler m_scheduler;
29 shared_ptr<Menu> m_pWidget;
40 mof::widget::MenuItem menuItems[] = {
43 ::createMenuView(_T("
\83L
\81[
\83{
\81[
\83h
\82Ì
\81ª
\81«
\82Å
\81A"))
47 ::createMenuView(_T("
\91I
\91ð
\8e\88\82ð
\95Ï
\8dX
\82Å
\82«
\82Ü
\82·
\81B"))
51 ::createMenuView(_T("
\83t
\83H
\81[
\83J
\83X
\82³
\82ê
\82½
\91I
\91ð
\8e\88\82Í
\83A
\83j
\83\81\81[
\83V
\83\87\83\93\82ª
\81A"))
55 ::createMenuView(_T("
\83A
\81[
\83N
\83X
\83\8c\83C
\83\84\81[ +128"))
60 m_pWidget = make_shared<Menu>( menuItems[0] , mof::lastOf( menuItems ) );
65 _T("
\91I
\91ð
\83\81\83j
\83\85\81[
\82Ì
\83f
\83\82") ,
66 _T("image/frame0.png") ,
67 _T("image/frame3.png") ,
73 m_pView->getView()->getPositionStream() << mof::makeConstantHandler( mof::Vector2D(100, 100) );
78 m_pInputReceiver = boost::shared_ptr<mof::InputReceiver>(mof::InputDevice::getInputReceiver());
80 mof::GraphicsDevice::lightEnable(false);
81 mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA);
85 //---input event
\82Ì
\90Ý
\92è
88 new mof::KeyPressedEventCondition( mof::InputReceiver::ESCAPE , m_pInputReceiver ) ,
89 &mof::Application::quit
93 new mof::KeyPressedEventCondition( mof::InputReceiver::UP , m_pInputReceiver ) ,
94 boost::bind( &Menu::up , m_pWidget )
98 new mof::KeyPressedEventCondition( mof::InputReceiver::DOWN , m_pInputReceiver ) ,
99 boost::bind( &Menu::down , m_pWidget )
103 new mof::KeyPressedEventCondition( mof::InputReceiver::LEFT , m_pInputReceiver ) ,
104 boost::bind( &Menu::left , m_pWidget )
108 new mof::KeyPressedEventCondition( mof::InputReceiver::RIGHT , m_pInputReceiver ) ,
109 boost::bind( &Menu::right , m_pWidget )
117 mof::safe_delete( m_pView );
124 m_scheduler.update();
125 m_pInputReceiver->update();
131 mof::VertexXYZRHWC vertices[] =
133 mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) ,
134 mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) ,
135 mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) ,
136 mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0))
138 mof::GraphicsDevice::setTexture(NULL);
139 mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP );
141 m_pView->getView()->draw( );