2 #include "configure.hpp"
3 #include "mof/EventScheduler.hpp"
4 #include "mof/mofInput.hpp"
5 #include "mof/mofGraphics.hpp"
6 #include "mof/Application.hpp"
7 #include "mof/utilities.hpp"
8 #include "mof/widgets.hpp"
9 #include "resource.hpp"
10 #include <mof/streams.hpp>
11 #include <mof/FactoryMethod.hpp>
12 #include <boost/bind.hpp>
14 #include <mof/ConsoleIO.hpp>
15 #include <mof/script/LuaInterpreter.hpp>
16 #include "script/MyEnvironment.hpp"
18 #include "CharacterBoard.hpp"
20 using namespace mof::widget;
21 using namespace boost;
26 std::shared_ptr<mof::script::LuaInterpreter> interpreter_;
27 std::shared_ptr<mof::script::Environment> environment_;
28 std::shared_ptr<mof::InputReceiver> m_pInputReceiver;
29 mof::Graphics3D::ptr field_;
30 mof::EventScheduler m_scheduler;
31 mof::Camera::ptr camera_;
32 mof::Light::ptr light_;
40 mof::Application::InputMode mode = mof::Application::input_mode();
41 if (mode == mof::Application::INPUT_MODE_DEVICE) {
42 m_pInputReceiver = std::shared_ptr<mof::InputReceiver>(mof::InputDevice::getInputReceiver());
44 else if (mode == mof::Application::INPUT_MODE_LOGGING) {
45 m_pInputReceiver = std::make_shared<mof::LoggingInputReceiver>((TCHAR*)_T("inputLog.txt"));
47 else if (mode == mof::Application::INPUT_MODE_LOGGED) {
48 m_pInputReceiver = std::make_shared<mof::LoggedInputReceiver>((TCHAR*)_T("inputLog.txt"));
51 environment_ = std::make_shared<script::MyEnvironment>(m_pInputReceiver);
52 interpreter_ = std::make_shared<mof::script::LuaInterpreter>(_T("script/effect_test.lua"));
53 interpreter_->start("main");
54 interpreter_->bind(environment_);
55 mof::GraphicsDevice::lightEnable(false);
56 mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA);
58 field_ = std::shared_ptr<mof::Graphics3D>(mof::MeshBuilder("model/floor.x").construct());
60 // 3D
\83V
\81[
\83\93\82Ì
\90Ý
\92è
61 //mof::GraphicsDevice::lightEnable(true);
62 camera_ = std::make_shared<mof::Camera>(mof::Vector3D(0, 1, -2), mof::Vector3D(0, 0, 0), mof::Vector3D(0, 1, 0));
63 //light_ = std::make_shared<mof::AmbientLight>(mof::Color4f(mof::createColor(255 , 255 , 255)));
77 m_pInputReceiver->update();
79 if(!environment_->isWaiting()) interpreter_->update();
80 environment_->update();
87 mof::Rectangle<int> cr = mof::GraphicsDevice::getClientRegion();
88 mof::VertexXYZRHWC vertices[] =
90 mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(127 , 127 , 127)) ,
91 mof::VertexXYZRHWC(mof::Vector2D(cr.getWidth() , 0) , mof::createColor(127 , 127 , 127)) ,
92 mof::VertexXYZRHWC(mof::Vector2D(0 , cr.getHeight()) , mof::createColor(255 , 255 , 255)) ,
93 mof::VertexXYZRHWC(mof::Vector2D(cr.getWidth() , cr.getHeight()) , mof::createColor(255 , 255 , 255))
95 mof::GraphicsDevice::setViewTransform(camera_->getViewMatrix());
96 mof::GraphicsDevice::setTexture(NULL);
97 mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP );
98 mof::GraphicsDevice::clearZBuffer();
100 environment_->draw();