From: U-TOMOHIRO\TomohiroYasuda Date: Sat, 16 Oct 2010 07:54:06 +0000 (+0900) Subject: rename top dirs X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4700a6840586cae64c5f6365192fa384ed796e7c;p=moflib%2Fmoflib.git rename top dirs --- diff --git a/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.cpp b/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.cpp index 519be23..5e34502 100644 --- a/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.cpp @@ -1,58 +1,58 @@ -#include "BattlerWindow.h" -#include "MyWindow.h" -#include "mof/GraphicsDevice.h" -#include "mof/KeyFrameAnimation.h" -#include -#include - -et::BattlerWindow::BattlerWindow( mof::TextureManager* pTextureManager , et::BattlerFacade* pBattler ) -: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame1.png"))) -{ - m_pTextureManager = pTextureManager; - m_pBattler = pBattler; - - add(new et::MyWindow(mof::Sprite::createSpriteFromText(m_pBattler->getParameter().name , 12) , m_pTextureManager)); - m_pContent = new et::MyWindow(mof::Sprite::createSpriteFromText( _T(""), 12) , m_pTextureManager); - resetView(); - add(m_pContent); - setMargin(4); - m_timeStamp = pBattler->getTimeStamp(); - - //”wŒiF - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setColor(0 , mof::createColor(127 , 255 , 255 , 255)); - this->setAnimation( 0 , mof::AnimationResource(pAnimation)); - setVisible(true); -} - -et::BattlerWindow::~BattlerWindow(void) -{ - -} - -bool et::BattlerWindow::draw(){ - if(!m_pBattler->getParameter().alive)return false; - mof::Vector2D position = mof::GraphicsDevice::getInstance()->to2DPosition(m_pBattler->getPosition()); - position.x -= 32; - position.y += 0; - setPosition(position); - return MyFrame::draw(); -} - -bool et::BattlerWindow::update(){ - if(m_pBattler->getTimeStamp() != m_timeStamp){ - m_timeStamp = m_pBattler->getTimeStamp(); - resetView(); - } - return et::MyFrame::update(); - -} - -void et::BattlerWindow::resetView(){ - std::basic_ostringstream stream; - if(m_pBattler->getType() != et::IDEAL){//_—ì‚ÍHP•\Ž¦‚Í‚È‚¢ - stream << _T("HP:") << std::setw(4) << m_pBattler->getParameter().hp << _T("/") << std::setw(4) << m_pBattler->getParameter().maxHp ; - } - stream << _T(" AP:") << m_pBattler->getParameter().actionPoint; - m_pContent->setContent(mof::Sprite::createSpriteFromText(stream.str() , 12)); +#include "BattlerWindow.h" +#include "MyWindow.h" +#include "mof/GraphicsDevice.h" +#include "mof/KeyFrameAnimation.h" +#include +#include + +et::BattlerWindow::BattlerWindow( mof::TextureManager* pTextureManager , et::BattlerFacade* pBattler ) +: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame1.png"))) +{ + m_pTextureManager = pTextureManager; + m_pBattler = pBattler; + + add(new et::MyWindow(mof::Sprite::createSpriteFromText(m_pBattler->getParameter().name , 12) , m_pTextureManager)); + m_pContent = new et::MyWindow(mof::Sprite::createSpriteFromText( _T(""), 12) , m_pTextureManager); + resetView(); + add(m_pContent); + setMargin(4); + m_timeStamp = pBattler->getTimeStamp(); + + //”wŒiF + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setColor(0 , mof::createColor(127 , 255 , 255 , 255)); + this->setAnimation( 0 , mof::AnimationResource(pAnimation)); + setVisible(true); +} + +et::BattlerWindow::~BattlerWindow(void) +{ + +} + +bool et::BattlerWindow::draw(){ + if(!m_pBattler->getParameter().alive)return false; + mof::Vector2D position = mof::GraphicsDevice::getInstance()->to2DPosition(m_pBattler->getPosition()); + position.x -= 32; + position.y += 0; + setPosition(position); + return MyFrame::draw(); +} + +bool et::BattlerWindow::update(){ + if(m_pBattler->getTimeStamp() != m_timeStamp){ + m_timeStamp = m_pBattler->getTimeStamp(); + resetView(); + } + return et::MyFrame::update(); + +} + +void et::BattlerWindow::resetView(){ + std::basic_ostringstream stream; + if(m_pBattler->getType() != et::IDEAL){//_—ì‚ÍHP•\Ž¦‚Í‚È‚¢ + stream << _T("HP:") << std::setw(4) << m_pBattler->getParameter().hp << _T("/") << std::setw(4) << m_pBattler->getParameter().maxHp ; + } + stream << _T(" AP:") << m_pBattler->getParameter().actionPoint; + m_pContent->setContent(mof::Sprite::createSpriteFromText(stream.str() , 12)); } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.h b/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.h index 8d6be1c..5497ad1 100644 --- a/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.h +++ b/saisei-1_0/rpg/rpg/oldcode/BattlerWindow.h @@ -1,23 +1,23 @@ -#pragma once -#include "MyFrame.h" -#include "MyWindow.h" -#include "BattlerFacade.h" - -namespace et{ - - class BattlerWindow : public MyFrame - { - mof::TextureManager* m_pTextureManager; - et::BattlerFacade* m_pBattler; - MyWindow* m_pContent; - int m_timeStamp; - - void resetView(); - public: - BattlerWindow( mof::TextureManager* pTextureManager , et::BattlerFacade* pBattler ); - virtual ~BattlerWindow(void); - virtual bool draw(); - virtual bool update(); - }; - -} +#pragma once +#include "MyFrame.h" +#include "MyWindow.h" +#include "BattlerFacade.h" + +namespace et{ + + class BattlerWindow : public MyFrame + { + mof::TextureManager* m_pTextureManager; + et::BattlerFacade* m_pBattler; + MyWindow* m_pContent; + int m_timeStamp; + + void resetView(); + public: + BattlerWindow( mof::TextureManager* pTextureManager , et::BattlerFacade* pBattler ); + virtual ~BattlerWindow(void); + virtual bool draw(); + virtual bool update(); + }; + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp b/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp index a234faa..2942b9a 100644 --- a/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp @@ -1,216 +1,216 @@ -#include "CharacterBoard.hpp" -#include "mof/Matrix3D.hpp" -#include "mof/ConsoleIO.hpp" -#include "mof/KeyFrameAnimation.hpp" -#include "mof/RotationAnimation3D.hpp" -#include "mof/TranslationAnimation3D.hpp" -#include "mof/ScalingAnimation3D.hpp" -#include "mof/Constant.hpp" -#include "mof/CascadingAnimation.hpp" -#include "mof/LoopAnimation.hpp" -#include "mof/Interpolation.hpp" -#include "mof/Font.hpp" -#include "mof/Vector2D.hpp" -#include "mof/utilities.hpp" -#include - - -struct ::CharacterBoard::Impl{ - std::vector list; - mof::Animation::Handler worldMatrix; - mof::FrameNumber frame; - - Impl() - : frame(0) , - worldMatrix(mof::makeConstantHandler(mof::Matrix3D::createIdentity())) - { - } - - ~Impl(){ - for(std::vector::iterator itr = list.begin() ; - itr != list.end() ; - ++itr ){ - delete *itr; - } - - } -}; - -::CharacterBoard::CharacterBoard( const mof::tstring& text) -: m_pImpl(new Impl()) -{ - - - mof::Board* pBoard; - pBoard = new mof::Board(); - pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.3f , 0.3f , 1))); - m_pImpl->list.push_back(pBoard); - - pBoard = new mof::Board(); - pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.6f , 0.6f , 1))); - m_pImpl->list.push_back(pBoard); - - mof::Font font(mof::Font::MS_GOTHIC , 70); - std::shared_ptr pPixelMap( font.createText(text) ); - mof::Vector2D sizeVec(pPixelMap->shape()[0] , pPixelMap->shape()[1]); - std::shared_ptr pTexture(new mof::Texture( pPixelMap)); - float endX = static_cast(pPixelMap->shape()[0]) / pTexture->getWidth(); - float endY = static_cast(pPixelMap->shape()[1]) / pTexture->getHeight(); - - pBoard = new mof::Board(); - pBoard->setColor(mof::makeConstantHandler(mof::Color4f(1 , 1 , 1))); - pBoard->setTexture(pTexture); - pBoard->setTextureCoordinates(mof::Rectangle(0 , 0 , endX , endY)); - m_pImpl->list.push_back(pBoard); -} - -::CharacterBoard::~CharacterBoard(){ - -} - -void ::CharacterBoard::setFrameNumber(mof::FrameNumber frame){ - m_pImpl->frame = frame; - for(std::vector::iterator itr = m_pImpl->list.begin() ; - itr != m_pImpl->list.end() ; - ++itr ){ - (*itr)->setFrameNumber(frame); - } -} - - -void ::CharacterBoard::nextFrame(){ - setFrameNumber(m_pImpl->frame + 1); -} - - -void ::CharacterBoard::prevFrame(){ - if(m_pImpl->frame > 0)setFrameNumber(m_pImpl->frame - 1); -} - - -void ::CharacterBoard::update(){ - m_pImpl->frame++; - for(std::vector::iterator itr = m_pImpl->list.begin() ; - itr != m_pImpl->list.end() ; - ++itr ){ - (*itr)->update(); - } -} - - -void ::CharacterBoard::setWorldMatrix(const mof::Animation::Handler& handler){ - m_pImpl->worldMatrix = handler; - std::vector::Handler> handlers; - handlers.push_back( mof::makeConstantHandler( - mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0)) - )); - handlers.push_back( handler); - - - m_pImpl->list.at(0)->setWorldMatrix( - mof::Animation::Handler( - new mof::CascadingAnimation>(handlers.front() , handlers.back()) - ) - ); - - handlers.clear(); - handlers.push_back( mof::makeConstantHandler( - mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0.01f)) - )); - handlers.push_back(mof::makeConstantHandler( - mof::Matrix3D::createRotation(mof::Vector3D(0 , mof::deg2rad(180) , 0)) - )); - handlers.push_back(handler); - - m_pImpl->list.at(1)->setWorldMatrix( - mof::Animation::Handler( - new mof::CascadingAnimation>(handlers.front() , handlers.back()) - ) - ); - - handlers.clear(); - handlers.push_back( mof::makeConstantHandler( - mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , -0.01f)) - )); - handlers.push_back( handler); - - - m_pImpl->list.at(2)->setWorldMatrix( - mof::Animation::Handler( - new mof::CascadingAnimation>(handlers.front() , handlers.back()) - ) - ); - -} - - -mof::Matrix3D CharacterBoard::getWorldMatrix() const{ - return m_pImpl->worldMatrix->getValue(m_pImpl->frame); -} - -mof::Vector3D CharacterBoard::getPosition() const{ - mof::Matrix3D m = getWorldMatrix(); - return mof::Vector3D(m.at(3 , 0) , m.at(3 , 1) , m.at(3 , 2)); -} - -void ::CharacterBoard::append(std::list& list_){ - list_.insert(list_.begin() , m_pImpl->list.begin(), m_pImpl->list.end()); - -} - -void ::CharacterBoard::setFinishColor(mof::FrameNumber delay , mof::FrameNumber interval){ - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0.3f , 0.3f , 1) ) , - std::pair( delay + interval , mof::Color4f(1 , 1 , 1) ) - }; - m_pImpl->list.at(0)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(1 , 1 , 1) ) , - std::pair( delay + interval , mof::Color4f(0.3f , 0.3f , 1) ) - }; - m_pImpl->list.at(2)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - -} - - -void ::CharacterBoard::setPartColor(mof::FrameNumber delay , mof::FrameNumber interval){ - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , - std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) - }; - m_pImpl->list.at(0)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , - std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) - }; - m_pImpl->list.at(1)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0.8f , 0.5f , 0.2f) ) , - std::pair( delay + interval , mof::Color4f(0.8f , 0.5f , 0.2f) ) - }; - m_pImpl->list.at(2)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - -} +#include "CharacterBoard.hpp" +#include "mof/Matrix3D.hpp" +#include "mof/ConsoleIO.hpp" +#include "mof/KeyFrameAnimation.hpp" +#include "mof/RotationAnimation3D.hpp" +#include "mof/TranslationAnimation3D.hpp" +#include "mof/ScalingAnimation3D.hpp" +#include "mof/Constant.hpp" +#include "mof/CascadingAnimation.hpp" +#include "mof/LoopAnimation.hpp" +#include "mof/Interpolation.hpp" +#include "mof/Font.hpp" +#include "mof/Vector2D.hpp" +#include "mof/utilities.hpp" +#include + + +struct ::CharacterBoard::Impl{ + std::vector list; + mof::Animation::Handler worldMatrix; + mof::FrameNumber frame; + + Impl() + : frame(0) , + worldMatrix(mof::makeConstantHandler(mof::Matrix3D::createIdentity())) + { + } + + ~Impl(){ + for(std::vector::iterator itr = list.begin() ; + itr != list.end() ; + ++itr ){ + delete *itr; + } + + } +}; + +::CharacterBoard::CharacterBoard( const mof::tstring& text) +: m_pImpl(new Impl()) +{ + + + mof::Board* pBoard; + pBoard = new mof::Board(); + pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.3f , 0.3f , 1))); + m_pImpl->list.push_back(pBoard); + + pBoard = new mof::Board(); + pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.6f , 0.6f , 1))); + m_pImpl->list.push_back(pBoard); + + mof::Font font(mof::Font::MS_GOTHIC , 70); + std::shared_ptr pPixelMap( font.createText(text) ); + mof::Vector2D sizeVec(pPixelMap->shape()[0] , pPixelMap->shape()[1]); + std::shared_ptr pTexture(new mof::Texture( pPixelMap)); + float endX = static_cast(pPixelMap->shape()[0]) / pTexture->getWidth(); + float endY = static_cast(pPixelMap->shape()[1]) / pTexture->getHeight(); + + pBoard = new mof::Board(); + pBoard->setColor(mof::makeConstantHandler(mof::Color4f(1 , 1 , 1))); + pBoard->setTexture(pTexture); + pBoard->setTextureCoordinates(mof::Rectangle(0 , 0 , endX , endY)); + m_pImpl->list.push_back(pBoard); +} + +::CharacterBoard::~CharacterBoard(){ + +} + +void ::CharacterBoard::setFrameNumber(mof::FrameNumber frame){ + m_pImpl->frame = frame; + for(std::vector::iterator itr = m_pImpl->list.begin() ; + itr != m_pImpl->list.end() ; + ++itr ){ + (*itr)->setFrameNumber(frame); + } +} + + +void ::CharacterBoard::nextFrame(){ + setFrameNumber(m_pImpl->frame + 1); +} + + +void ::CharacterBoard::prevFrame(){ + if(m_pImpl->frame > 0)setFrameNumber(m_pImpl->frame - 1); +} + + +void ::CharacterBoard::update(){ + m_pImpl->frame++; + for(std::vector::iterator itr = m_pImpl->list.begin() ; + itr != m_pImpl->list.end() ; + ++itr ){ + (*itr)->update(); + } +} + + +void ::CharacterBoard::setWorldMatrix(const mof::Animation::Handler& handler){ + m_pImpl->worldMatrix = handler; + std::vector::Handler> handlers; + handlers.push_back( mof::makeConstantHandler( + mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0)) + )); + handlers.push_back( handler); + + + m_pImpl->list.at(0)->setWorldMatrix( + mof::Animation::Handler( + new mof::CascadingAnimation>(handlers.front() , handlers.back()) + ) + ); + + handlers.clear(); + handlers.push_back( mof::makeConstantHandler( + mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0.01f)) + )); + handlers.push_back(mof::makeConstantHandler( + mof::Matrix3D::createRotation(mof::Vector3D(0 , mof::deg2rad(180) , 0)) + )); + handlers.push_back(handler); + + m_pImpl->list.at(1)->setWorldMatrix( + mof::Animation::Handler( + new mof::CascadingAnimation>(handlers.front() , handlers.back()) + ) + ); + + handlers.clear(); + handlers.push_back( mof::makeConstantHandler( + mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , -0.01f)) + )); + handlers.push_back( handler); + + + m_pImpl->list.at(2)->setWorldMatrix( + mof::Animation::Handler( + new mof::CascadingAnimation>(handlers.front() , handlers.back()) + ) + ); + +} + + +mof::Matrix3D CharacterBoard::getWorldMatrix() const{ + return m_pImpl->worldMatrix->getValue(m_pImpl->frame); +} + +mof::Vector3D CharacterBoard::getPosition() const{ + mof::Matrix3D m = getWorldMatrix(); + return mof::Vector3D(m.at(3 , 0) , m.at(3 , 1) , m.at(3 , 2)); +} + +void ::CharacterBoard::append(std::list& list_){ + list_.insert(list_.begin() , m_pImpl->list.begin(), m_pImpl->list.end()); + +} + +void ::CharacterBoard::setFinishColor(mof::FrameNumber delay , mof::FrameNumber interval){ + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0.3f , 0.3f , 1) ) , + std::pair( delay + interval , mof::Color4f(1 , 1 , 1) ) + }; + m_pImpl->list.at(0)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(1 , 1 , 1) ) , + std::pair( delay + interval , mof::Color4f(0.3f , 0.3f , 1) ) + }; + m_pImpl->list.at(2)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + +} + + +void ::CharacterBoard::setPartColor(mof::FrameNumber delay , mof::FrameNumber interval){ + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , + std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) + }; + m_pImpl->list.at(0)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , + std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) + }; + m_pImpl->list.at(1)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0.8f , 0.5f , 0.2f) ) , + std::pair( delay + interval , mof::Color4f(0.8f , 0.5f , 0.2f) ) + }; + m_pImpl->list.at(2)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp~ b/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp~ index d6b6d31..8e3b1ed 100644 --- a/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.cpp~ @@ -1,215 +1,215 @@ -#include "CharacterBoard.hpp" -#include "mof/Matrix3D.hpp" -#include "mof/ConsoleIO.hpp" -#include "mof/KeyFrameAnimation.hpp" -#include "mof/RotationAnimation3D.hpp" -#include "mof/TranslationAnimation3D.hpp" -#include "mof/ScalingAnimation3D.hpp" -#include "mof/Constant.hpp" -#include "mof/CascadingAnimation.hpp" -#include "mof/LoopAnimation.hpp" -#include "mof/Interpolation.hpp" -#include "mof/Font.hpp" -#include "mof/Vector2D.hpp" -#include - - -struct ::CharacterBoard::Impl{ - std::vector list; - mof::Animation::Handler worldMatrix; - mof::FrameNumber frame; - - Impl() - : frame(0) , - worldMatrix(mof::makeConstantHandler(mof::Matrix3D::createIdentity())) - { - } - - ~Impl(){ - for(std::vector::iterator itr = list.begin() ; - itr != list.end() ; - ++itr ){ - delete *itr; - } - - } -}; - -::CharacterBoard::CharacterBoard( const mof::tstring& text) -: m_pImpl(new Impl()) -{ - - - mof::Board* pBoard; - pBoard = new mof::Board(); - pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.3f , 0.3f , 1))); - m_pImpl->list.push_back(pBoard); - - pBoard = new mof::Board(); - pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.6f , 0.6f , 1))); - m_pImpl->list.push_back(pBoard); - - mof::Font font(mof::Font::MS_GOTHIC , 70); - boost::shared_ptr pPixelMap( font.createText(text) ); - mof::Vector2D sizeVec(pPixelMap->shape()[0] , pPixelMap->shape()[1]); - boost::shared_ptr pTexture(new mof::Texture( pPixelMap)); - float endX = static_cast(pPixelMap->shape()[0]) / pTexture->getWidth(); - float endY = static_cast(pPixelMap->shape()[1]) / pTexture->getHeight(); - - pBoard = new mof::Board(); - pBoard->setColor(mof::makeConstantHandler(mof::Color4f(1 , 1 , 1))); - pBoard->setTexture(pTexture); - pBoard->setTextureCoordinates(mof::Rectangle(0 , 0 , endX , endY)); - m_pImpl->list.push_back(pBoard); -} - -::CharacterBoard::~CharacterBoard(){ - -} - -void ::CharacterBoard::setFrameNumber(mof::FrameNumber frame){ - m_pImpl->frame = frame; - for(std::vector::iterator itr = m_pImpl->list.begin() ; - itr != m_pImpl->list.end() ; - ++itr ){ - (*itr)->setFrameNumber(frame); - } -} - - -void ::CharacterBoard::nextFrame(){ - setFrameNumber(m_pImpl->frame + 1); -} - - -void ::CharacterBoard::prevFrame(){ - if(m_pImpl->frame > 0)setFrameNumber(m_pImpl->frame - 1); -} - - -void ::CharacterBoard::update(){ - m_pImpl->frame++; - for(std::vector::iterator itr = m_pImpl->list.begin() ; - itr != m_pImpl->list.end() ; - ++itr ){ - (*itr)->update(); - } -} - - -void ::CharacterBoard::setWorldMatrix(const mof::Animation::Handler& handler){ - m_pImpl->worldMatrix = handler; - std::vector::Handler> handlers; - handlers.push_back( mof::makeConstantHandler( - mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0)) - )); - handlers.push_back( handler); - - - m_pImpl->list.at(0)->setWorldMatrix( - mof::Animation::Handler( - new mof::CascadingAnimation>(handlers.front() , handlers.back()) - ) - ); - - handlers.clear(); - handlers.push_back( mof::makeConstantHandler( - mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0.01f)) - )); - handlers.push_back(mof::makeConstantHandler( - mof::Matrix3D::createRotation(mof::Vector3D(0 , mof::deg2rad(180) , 0)) - )); - handlers.push_back(handler); - - m_pImpl->list.at(1)->setWorldMatrix( - mof::Animation::Handler( - new mof::CascadingAnimation>(handlers.front() , handlers.back()) - ) - ); - - handlers.clear(); - handlers.push_back( mof::makeConstantHandler( - mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , -0.01f)) - )); - handlers.push_back( handler); - - - m_pImpl->list.at(2)->setWorldMatrix( - mof::Animation::Handler( - new mof::CascadingAnimation>(handlers.front() , handlers.back()) - ) - ); - -} - - -mof::Matrix3D CharacterBoard::getWorldMatrix() const{ - return m_pImpl->worldMatrix->getValue(m_pImpl->frame); -} - -mof::Vector3D CharacterBoard::getPosition() const{ - mof::Matrix3D m = getWorldMatrix(); - return mof::Vector3D(m.at(3 , 0) , m.at(3 , 1) , m.at(3 , 2)); -} - -void ::CharacterBoard::append(std::list& list_){ - list_.insert(list_.begin() , m_pImpl->list.begin(), m_pImpl->list.end()); - -} - -void ::CharacterBoard::setFinishColor(mof::FrameNumber delay , mof::FrameNumber interval){ - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0.3f , 0.3f , 1) ) , - std::pair( delay + interval , mof::Color4f(1 , 1 , 1) ) - }; - m_pImpl->list.at(0)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(1 , 1 , 1) ) , - std::pair( delay + interval , mof::Color4f(0.3f , 0.3f , 1) ) - }; - m_pImpl->list.at(2)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - -} - - -void ::CharacterBoard::setPartColor(mof::FrameNumber delay , mof::FrameNumber interval){ - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , - std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) - }; - m_pImpl->list.at(0)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , - std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) - }; - m_pImpl->list.at(1)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - - { - std::pair keyFrames[] = { - std::pair( delay , mof::Color4f(0.8f , 0.5f , 0.2f) ) , - std::pair( delay + interval , mof::Color4f(0.8f , 0.5f , 0.2f) ) - }; - m_pImpl->list.at(2)->setColor( - mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) - ); - } - -} +#include "CharacterBoard.hpp" +#include "mof/Matrix3D.hpp" +#include "mof/ConsoleIO.hpp" +#include "mof/KeyFrameAnimation.hpp" +#include "mof/RotationAnimation3D.hpp" +#include "mof/TranslationAnimation3D.hpp" +#include "mof/ScalingAnimation3D.hpp" +#include "mof/Constant.hpp" +#include "mof/CascadingAnimation.hpp" +#include "mof/LoopAnimation.hpp" +#include "mof/Interpolation.hpp" +#include "mof/Font.hpp" +#include "mof/Vector2D.hpp" +#include + + +struct ::CharacterBoard::Impl{ + std::vector list; + mof::Animation::Handler worldMatrix; + mof::FrameNumber frame; + + Impl() + : frame(0) , + worldMatrix(mof::makeConstantHandler(mof::Matrix3D::createIdentity())) + { + } + + ~Impl(){ + for(std::vector::iterator itr = list.begin() ; + itr != list.end() ; + ++itr ){ + delete *itr; + } + + } +}; + +::CharacterBoard::CharacterBoard( const mof::tstring& text) +: m_pImpl(new Impl()) +{ + + + mof::Board* pBoard; + pBoard = new mof::Board(); + pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.3f , 0.3f , 1))); + m_pImpl->list.push_back(pBoard); + + pBoard = new mof::Board(); + pBoard->setColor(mof::makeConstantHandler(mof::Color4f(0.6f , 0.6f , 1))); + m_pImpl->list.push_back(pBoard); + + mof::Font font(mof::Font::MS_GOTHIC , 70); + boost::shared_ptr pPixelMap( font.createText(text) ); + mof::Vector2D sizeVec(pPixelMap->shape()[0] , pPixelMap->shape()[1]); + boost::shared_ptr pTexture(new mof::Texture( pPixelMap)); + float endX = static_cast(pPixelMap->shape()[0]) / pTexture->getWidth(); + float endY = static_cast(pPixelMap->shape()[1]) / pTexture->getHeight(); + + pBoard = new mof::Board(); + pBoard->setColor(mof::makeConstantHandler(mof::Color4f(1 , 1 , 1))); + pBoard->setTexture(pTexture); + pBoard->setTextureCoordinates(mof::Rectangle(0 , 0 , endX , endY)); + m_pImpl->list.push_back(pBoard); +} + +::CharacterBoard::~CharacterBoard(){ + +} + +void ::CharacterBoard::setFrameNumber(mof::FrameNumber frame){ + m_pImpl->frame = frame; + for(std::vector::iterator itr = m_pImpl->list.begin() ; + itr != m_pImpl->list.end() ; + ++itr ){ + (*itr)->setFrameNumber(frame); + } +} + + +void ::CharacterBoard::nextFrame(){ + setFrameNumber(m_pImpl->frame + 1); +} + + +void ::CharacterBoard::prevFrame(){ + if(m_pImpl->frame > 0)setFrameNumber(m_pImpl->frame - 1); +} + + +void ::CharacterBoard::update(){ + m_pImpl->frame++; + for(std::vector::iterator itr = m_pImpl->list.begin() ; + itr != m_pImpl->list.end() ; + ++itr ){ + (*itr)->update(); + } +} + + +void ::CharacterBoard::setWorldMatrix(const mof::Animation::Handler& handler){ + m_pImpl->worldMatrix = handler; + std::vector::Handler> handlers; + handlers.push_back( mof::makeConstantHandler( + mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0)) + )); + handlers.push_back( handler); + + + m_pImpl->list.at(0)->setWorldMatrix( + mof::Animation::Handler( + new mof::CascadingAnimation>(handlers.front() , handlers.back()) + ) + ); + + handlers.clear(); + handlers.push_back( mof::makeConstantHandler( + mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , 0.01f)) + )); + handlers.push_back(mof::makeConstantHandler( + mof::Matrix3D::createRotation(mof::Vector3D(0 , mof::deg2rad(180) , 0)) + )); + handlers.push_back(handler); + + m_pImpl->list.at(1)->setWorldMatrix( + mof::Animation::Handler( + new mof::CascadingAnimation>(handlers.front() , handlers.back()) + ) + ); + + handlers.clear(); + handlers.push_back( mof::makeConstantHandler( + mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0.5f , -0.01f)) + )); + handlers.push_back( handler); + + + m_pImpl->list.at(2)->setWorldMatrix( + mof::Animation::Handler( + new mof::CascadingAnimation>(handlers.front() , handlers.back()) + ) + ); + +} + + +mof::Matrix3D CharacterBoard::getWorldMatrix() const{ + return m_pImpl->worldMatrix->getValue(m_pImpl->frame); +} + +mof::Vector3D CharacterBoard::getPosition() const{ + mof::Matrix3D m = getWorldMatrix(); + return mof::Vector3D(m.at(3 , 0) , m.at(3 , 1) , m.at(3 , 2)); +} + +void ::CharacterBoard::append(std::list& list_){ + list_.insert(list_.begin() , m_pImpl->list.begin(), m_pImpl->list.end()); + +} + +void ::CharacterBoard::setFinishColor(mof::FrameNumber delay , mof::FrameNumber interval){ + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0.3f , 0.3f , 1) ) , + std::pair( delay + interval , mof::Color4f(1 , 1 , 1) ) + }; + m_pImpl->list.at(0)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(1 , 1 , 1) ) , + std::pair( delay + interval , mof::Color4f(0.3f , 0.3f , 1) ) + }; + m_pImpl->list.at(2)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + +} + + +void ::CharacterBoard::setPartColor(mof::FrameNumber delay , mof::FrameNumber interval){ + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , + std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) + }; + m_pImpl->list.at(0)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0 , 1 , 1 , 1) ) , + std::pair( delay + interval , mof::Color4f(0 , 1 , 1 , 1) ) + }; + m_pImpl->list.at(1)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + + { + std::pair keyFrames[] = { + std::pair( delay , mof::Color4f(0.8f , 0.5f , 0.2f) ) , + std::pair( delay + interval , mof::Color4f(0.8f , 0.5f , 0.2f) ) + }; + m_pImpl->list.at(2)->setColor( + mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])) + ); + } + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.hpp b/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.hpp index 9695cd0..53428c2 100644 --- a/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.hpp +++ b/saisei-1_0/rpg/rpg/oldcode/CharacterBoard.hpp @@ -1,35 +1,35 @@ -#ifndef CHARACTER_BOARD_HPP -#define CHARACTER_BOARD_HPP -#include -#include "mof/Component3D.hpp" -#include -#include "mof/Board.hpp" -#include "mof/AnimationPlayer.hpp" - - -class CharacterBoard : public mof::AnimationPlayer -{ - struct Impl; - boost::scoped_ptr m_pImpl; -public: - CharacterBoard( const mof::tstring& text); - virtual ~CharacterBoard(); - - virtual void setFrameNumber(mof::FrameNumber frame); - virtual void nextFrame(); - virtual void prevFrame(); - - virtual void update(); - - - void setWorldMatrix(const mof::Animation::Handler& handler); - mof::Matrix3D getWorldMatrix() const; - mof::Vector3D getPosition() const; - void append(std::list& list); - - void setFinishColor(mof::FrameNumber delay , mof::FrameNumber interval); - void setPartColor(mof::FrameNumber delay , mof::FrameNumber interval); -}; - - +#ifndef CHARACTER_BOARD_HPP +#define CHARACTER_BOARD_HPP +#include +#include "mof/Component3D.hpp" +#include +#include "mof/Board.hpp" +#include "mof/AnimationPlayer.hpp" + + +class CharacterBoard : public mof::AnimationPlayer +{ + struct Impl; + boost::scoped_ptr m_pImpl; +public: + CharacterBoard( const mof::tstring& text); + virtual ~CharacterBoard(); + + virtual void setFrameNumber(mof::FrameNumber frame); + virtual void nextFrame(); + virtual void prevFrame(); + + virtual void update(); + + + void setWorldMatrix(const mof::Animation::Handler& handler); + mof::Matrix3D getWorldMatrix() const; + mof::Vector3D getPosition() const; + void append(std::list& list); + + void setFinishColor(mof::FrameNumber delay , mof::FrameNumber interval); + void setPartColor(mof::FrameNumber delay , mof::FrameNumber interval); +}; + + #endif \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/CommandMenu.cpp b/saisei-1_0/rpg/rpg/oldcode/CommandMenu.cpp index 39e3683..3c30558 100644 --- a/saisei-1_0/rpg/rpg/oldcode/CommandMenu.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/CommandMenu.cpp @@ -1,87 +1,87 @@ -#include "CommandMenu.h" -#include "mof/KeyFrameAnimation.h" -#include "MyWindow.h" -#include "FightingMenu.h" -#include "BattlerGroup.h" -#include "BattlerFacade.h" -#include "BattleData.h" - -et::CommandMenu::CommandMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) -: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) -{ - m_pBattleData = pBattleData; - m_pSelector = NULL; - m_pTextureManager = pTextureManager; - std::vector selectables; - - mof::Window* pSelectable = NULL; - addSelectableTextItem(this , selectables , _T("‚½‚½‚©‚¤") , 16); - addSelectableTextItem(this , selectables , _T("‚½‚¢‚«") , 16); - pSelectable = addSelectableTextItem(this , selectables , _T("‚É‚°‚é") , 16); - pSelectable->setAvailable(false); - pSelectable = addSelectableTextItem(this , selectables , _T("ƒI[ƒg") , 16); - pSelectable->setAvailable(false); - m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); - setVisible(true); -} - -et::CommandMenu::~CommandMenu(void) -{ - delete m_pSelector; -} - - - - - -void et::CommandMenu::setVisible(bool visible){ - et::MyFrame::setVisible(visible); - if(visible){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(-200 ,370)); - pAnimation->setPosition(15 , mof::Vector2D(10 , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(10 , 370)); - pAnimation->setPosition(15 , mof::Vector2D(-200 , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } -} - -et::MyFrame* et::CommandMenu::performAction(){ - - switch(getSelectionModel()->getSelectingIndex()){ - case 0 : //‚½‚½‚©‚¤ - setVisible(false); - return new FightingMenu(m_pTextureManager , m_pBattleData); - case 1 : //‚½‚¢‚« - { - et::BattleAction action; - action.type = et::BattleAction::WAIT; - m_pBattleData->setBattleAction(action); - return this; - } - case 2 : //‚É‚°‚é - return this; - case 3 : //ƒI[ƒg - return this; - default : - DEBUG_PRINT("–¢’è‹`‚̃AƒNƒVƒ‡ƒ“‚ª—v‹‚³‚ê‚Ü‚µ‚½"); - return NULL; - } -} - - - -mof::Window* et::CommandMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ - mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); - pOwner->add(pSelectable); - selectables.push_back(pSelectable); - return pSelectable; +#include "CommandMenu.h" +#include "mof/KeyFrameAnimation.h" +#include "MyWindow.h" +#include "FightingMenu.h" +#include "BattlerGroup.h" +#include "BattlerFacade.h" +#include "BattleData.h" + +et::CommandMenu::CommandMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) +: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) +{ + m_pBattleData = pBattleData; + m_pSelector = NULL; + m_pTextureManager = pTextureManager; + std::vector selectables; + + mof::Window* pSelectable = NULL; + addSelectableTextItem(this , selectables , _T("‚½‚½‚©‚¤") , 16); + addSelectableTextItem(this , selectables , _T("‚½‚¢‚«") , 16); + pSelectable = addSelectableTextItem(this , selectables , _T("‚É‚°‚é") , 16); + pSelectable->setAvailable(false); + pSelectable = addSelectableTextItem(this , selectables , _T("ƒI[ƒg") , 16); + pSelectable->setAvailable(false); + m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); + setVisible(true); +} + +et::CommandMenu::~CommandMenu(void) +{ + delete m_pSelector; +} + + + + + +void et::CommandMenu::setVisible(bool visible){ + et::MyFrame::setVisible(visible); + if(visible){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(-200 ,370)); + pAnimation->setPosition(15 , mof::Vector2D(10 , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(10 , 370)); + pAnimation->setPosition(15 , mof::Vector2D(-200 , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } +} + +et::MyFrame* et::CommandMenu::performAction(){ + + switch(getSelectionModel()->getSelectingIndex()){ + case 0 : //‚½‚½‚©‚¤ + setVisible(false); + return new FightingMenu(m_pTextureManager , m_pBattleData); + case 1 : //‚½‚¢‚« + { + et::BattleAction action; + action.type = et::BattleAction::WAIT; + m_pBattleData->setBattleAction(action); + return this; + } + case 2 : //‚É‚°‚é + return this; + case 3 : //ƒI[ƒg + return this; + default : + DEBUG_PRINT("–¢’è‹`‚̃AƒNƒVƒ‡ƒ“‚ª—v‹‚³‚ê‚Ü‚µ‚½"); + return NULL; + } +} + + + +mof::Window* et::CommandMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ + mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); + pOwner->add(pSelectable); + selectables.push_back(pSelectable); + return pSelectable; } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/CommandMenu.h b/saisei-1_0/rpg/rpg/oldcode/CommandMenu.h index eb9dea9..6af05e4 100644 --- a/saisei-1_0/rpg/rpg/oldcode/CommandMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/CommandMenu.h @@ -1,24 +1,24 @@ -#pragma once -#include "MyFrame.h" -#include "mof/Texture.h" - -namespace et{ - class BattleData; - - class CommandMenu : public MyFrame - { - mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); - - mof::SelectionModel* m_pSelector; - mof::TextureManager* m_pTextureManager; - et::BattleData* m_pBattleData; - public: - CommandMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); - virtual ~CommandMenu(void); - virtual void setVisible(bool visible); - virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} - virtual MyFrame* performAction(); - }; - - +#pragma once +#include "MyFrame.h" +#include "mof/Texture.h" + +namespace et{ + class BattleData; + + class CommandMenu : public MyFrame + { + mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); + + mof::SelectionModel* m_pSelector; + mof::TextureManager* m_pTextureManager; + et::BattleData* m_pBattleData; + public: + CommandMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); + virtual ~CommandMenu(void); + virtual void setVisible(bool visible); + virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} + virtual MyFrame* performAction(); + }; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/Common.h b/saisei-1_0/rpg/rpg/oldcode/Common.h index ae7b664..9799d5e 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Common.h +++ b/saisei-1_0/rpg/rpg/oldcode/Common.h @@ -1,21 +1,21 @@ -#pragma once - -#include "mof/TextureResource.h" -#include "mof/MeshResource.h" -#include "mof/DataRow.h" - - -namespace et{ - struct Common{ - mof::TextureManager* m_pTextureManager; - mof::MeshManager* m_pMeshManager; - mof::DataResourceManager* m_pDataResourceManager; - - Common(mof::TextureManager* pTextureManager , mof::MeshManager* pMeshManager , mof::DataResourceManager* pDataResourceManager){ - m_pTextureManager = pTextureManager; - m_pMeshManager = pMeshManager; - m_pDataResourceManager = pDataResourceManager; - } - }; - +#pragma once + +#include "mof/TextureResource.h" +#include "mof/MeshResource.h" +#include "mof/DataRow.h" + + +namespace et{ + struct Common{ + mof::TextureManager* m_pTextureManager; + mof::MeshManager* m_pMeshManager; + mof::DataResourceManager* m_pDataResourceManager; + + Common(mof::TextureManager* pTextureManager , mof::MeshManager* pMeshManager , mof::DataResourceManager* pDataResourceManager){ + m_pTextureManager = pTextureManager; + m_pMeshManager = pMeshManager; + m_pDataResourceManager = pDataResourceManager; + } + }; + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.cpp b/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.cpp index 74de063..c1ec3f7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.cpp @@ -1,120 +1,120 @@ -#include "DataBasedAction.h" -#include "BattlerFacade.h" -#include "mof/DataBasedAnimation.h" -#include "mof/KeyFrameAnimation.h" - -et::DataBasedAction::DataBasedAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , mof::DataRow& actionRow , int category) -: et::Action(pBattler , pTarget , actionRow.getIntegerData(_T("Cost")) ) -{ - m_actionRow = actionRow; - m_category = category; -} - -et::DataBasedAction::~DataBasedAction(void) -{ -} - - - -int et::DataBasedAction::doActionTo(et::BattlerFacade* pTarget){ - float correction = (float)m_actionRow.getIntegerData(_T("Coefficient")) / 100.0; - float totalPower = (float)m_pBattler->getParameter().attack; - int damage = (int)totalPower - pTarget->getParameter().diffence; - if(m_pBattler->getParameter().critical)damage = (int)totalPower; - if(pTarget->getParameter().guard)damage *= 0.5;//ƒK[ƒh’†‚Ȃǃ_ƒ[ƒW‚ª”¼•ª‚É - if(damage < 0)damage = 0; - int effect = -damage; - - et::BattlerParameter parameter = pTarget->getParameter(); - if(parameter.hp <= damage){ - parameter.hp = 0; - parameter.alive = false; - } - else parameter.hp -= damage; - parameter.dActionPoint += 1; - pTarget->setParameter(parameter); - return effect; -} - -mof::AnimationResource et::DataBasedAction::createApproachAnimation(){ - mof::Vector3D targetPosition = getTargetList().front()->getPosition(); - targetPosition.x += (m_pBattler->getType() == et::ENEMY ? -1 : 1 )* (isDirectAttack() ? 0.2f : 0.5f); - return m_pBattler->setMovingAnimation(targetPosition , 15); -} - - -mof::AnimationResource et::DataBasedAction::createExecuteAnimation(){ - return m_pBattler->setCastAnimation(m_category); -} - -mof::tstring et::DataBasedAction::getActionMessage(){ - mof::tstring message = m_actionRow.getData(_T("Message")); - if(message == _T("novalue"))return mof::tstring(); - else return message; -} - - -bool et::DataBasedAction::isDirectAttack(){ - return (m_category < 2); -} - - -mof::GraphicsSchedule* et::DataBasedAction::createEffect(et::Common& common){ - mof::tstring effect = m_actionRow.getData(_T("Effect")); - /*if(effect == _T("Inherit")){ - //ƒ‚ƒ“ƒXƒ^[ƒ^ƒCƒv‚©‚çˆø‚«Œp‚® - }*/ - mof::DataResource effectTable = common.m_pDataResourceManager->getResource(effect); - - mof::GraphicsSchedule* pSchedule = new mof::GraphicsSchedule(); - - for(int i = 0 ; i < effectTable->getNumberOfRows() ; i++){ - mof::DataRow effectRow = mof::DataRow(effectTable , i); - - //---ƒ‚[ƒVƒ‡ƒ“‚̍\¬ - mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); - - mof::KeyFrameAnimation* pCommonAnimation = new mof::KeyFrameAnimation(); - mof::Vector3D targetPosition = getTargetList().front()->getPosition(); - mof::Vector3D basePosition = m_pBattler->getGraphicsObject()->getPosition(); - //ƒXƒP[ƒ‹‚ðŒvŽZ - mof::Vector3D scale = targetPosition - basePosition; - scale.y = 1.0; - pCommonAnimation->setPosition(0 , basePosition); - mof::AnimationResource resource(pCommonAnimation); - - mof::tstring motionName(effectRow.getData(_T("Motion"))); - mof::DataBasedAnimation* pMotionAnimation = new mof::DataBasedAnimation(motionName.c_str() , scale); - pCascadeAnimation->setElement(0 , mof::AnimationResource(pMotionAnimation)); - - - pCascadeAnimation->setElement(1 , resource); - mof::AnimationResource animation(pCascadeAnimation); - - //---ƒIƒuƒWƒFƒNƒg‚̍\¬ - mof::tstring className(effectRow.getData(_T("Class"))); - - mof::tstring textureName(effectRow.getData(_T("Texture"))); - if(textureName == _T(""))textureName = _T("null"); - mof::TextureResource texture = common.m_pTextureManager->getResource(textureName.c_str()); - - if(className == _T("Billboard")){ - //ƒrƒ‹ƒ{[ƒh - mof::GraphicsObject* pModel = new mof::Billboard(mof::Billboard::Y_FIXED , texture); - pModel->setAnimation(0 , animation); - pSchedule->add(effectRow.getIntegerData(_T("Delay")) , mof::GraphicsModelPtr(pModel) , animation); - } - else { - //ƒƒbƒVƒ…(className‚ªPath) - mof::MeshResource pModel = common.m_pMeshManager->getResource(className.c_str()); - pModel->setTexture(0 , texture); - pModel->setAnimation(0 , animation); - pSchedule->add(effectRow.getIntegerData(_T("Delay")) , mof::GraphicsModelPtr(pModel) , animation); - } - - } - - - return pSchedule; - +#include "DataBasedAction.h" +#include "BattlerFacade.h" +#include "mof/DataBasedAnimation.h" +#include "mof/KeyFrameAnimation.h" + +et::DataBasedAction::DataBasedAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , mof::DataRow& actionRow , int category) +: et::Action(pBattler , pTarget , actionRow.getIntegerData(_T("Cost")) ) +{ + m_actionRow = actionRow; + m_category = category; +} + +et::DataBasedAction::~DataBasedAction(void) +{ +} + + + +int et::DataBasedAction::doActionTo(et::BattlerFacade* pTarget){ + float correction = (float)m_actionRow.getIntegerData(_T("Coefficient")) / 100.0; + float totalPower = (float)m_pBattler->getParameter().attack; + int damage = (int)totalPower - pTarget->getParameter().diffence; + if(m_pBattler->getParameter().critical)damage = (int)totalPower; + if(pTarget->getParameter().guard)damage *= 0.5;//ƒK[ƒh’†‚Ȃǃ_ƒ[ƒW‚ª”¼•ª‚É + if(damage < 0)damage = 0; + int effect = -damage; + + et::BattlerParameter parameter = pTarget->getParameter(); + if(parameter.hp <= damage){ + parameter.hp = 0; + parameter.alive = false; + } + else parameter.hp -= damage; + parameter.dActionPoint += 1; + pTarget->setParameter(parameter); + return effect; +} + +mof::AnimationResource et::DataBasedAction::createApproachAnimation(){ + mof::Vector3D targetPosition = getTargetList().front()->getPosition(); + targetPosition.x += (m_pBattler->getType() == et::ENEMY ? -1 : 1 )* (isDirectAttack() ? 0.2f : 0.5f); + return m_pBattler->setMovingAnimation(targetPosition , 15); +} + + +mof::AnimationResource et::DataBasedAction::createExecuteAnimation(){ + return m_pBattler->setCastAnimation(m_category); +} + +mof::tstring et::DataBasedAction::getActionMessage(){ + mof::tstring message = m_actionRow.getData(_T("Message")); + if(message == _T("novalue"))return mof::tstring(); + else return message; +} + + +bool et::DataBasedAction::isDirectAttack(){ + return (m_category < 2); +} + + +mof::GraphicsSchedule* et::DataBasedAction::createEffect(et::Common& common){ + mof::tstring effect = m_actionRow.getData(_T("Effect")); + /*if(effect == _T("Inherit")){ + //ƒ‚ƒ“ƒXƒ^[ƒ^ƒCƒv‚©‚çˆø‚«Œp‚® + }*/ + mof::DataResource effectTable = common.m_pDataResourceManager->getResource(effect); + + mof::GraphicsSchedule* pSchedule = new mof::GraphicsSchedule(); + + for(int i = 0 ; i < effectTable->getNumberOfRows() ; i++){ + mof::DataRow effectRow = mof::DataRow(effectTable , i); + + //---ƒ‚[ƒVƒ‡ƒ“‚̍\¬ + mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); + + mof::KeyFrameAnimation* pCommonAnimation = new mof::KeyFrameAnimation(); + mof::Vector3D targetPosition = getTargetList().front()->getPosition(); + mof::Vector3D basePosition = m_pBattler->getGraphicsObject()->getPosition(); + //ƒXƒP[ƒ‹‚ðŒvŽZ + mof::Vector3D scale = targetPosition - basePosition; + scale.y = 1.0; + pCommonAnimation->setPosition(0 , basePosition); + mof::AnimationResource resource(pCommonAnimation); + + mof::tstring motionName(effectRow.getData(_T("Motion"))); + mof::DataBasedAnimation* pMotionAnimation = new mof::DataBasedAnimation(motionName.c_str() , scale); + pCascadeAnimation->setElement(0 , mof::AnimationResource(pMotionAnimation)); + + + pCascadeAnimation->setElement(1 , resource); + mof::AnimationResource animation(pCascadeAnimation); + + //---ƒIƒuƒWƒFƒNƒg‚̍\¬ + mof::tstring className(effectRow.getData(_T("Class"))); + + mof::tstring textureName(effectRow.getData(_T("Texture"))); + if(textureName == _T(""))textureName = _T("null"); + mof::TextureResource texture = common.m_pTextureManager->getResource(textureName.c_str()); + + if(className == _T("Billboard")){ + //ƒrƒ‹ƒ{[ƒh + mof::GraphicsObject* pModel = new mof::Billboard(mof::Billboard::Y_FIXED , texture); + pModel->setAnimation(0 , animation); + pSchedule->add(effectRow.getIntegerData(_T("Delay")) , mof::GraphicsModelPtr(pModel) , animation); + } + else { + //ƒƒbƒVƒ…(className‚ªPath) + mof::MeshResource pModel = common.m_pMeshManager->getResource(className.c_str()); + pModel->setTexture(0 , texture); + pModel->setAnimation(0 , animation); + pSchedule->add(effectRow.getIntegerData(_T("Delay")) , mof::GraphicsModelPtr(pModel) , animation); + } + + } + + + return pSchedule; + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.h b/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.h index ef42231..abdd40d 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.h +++ b/saisei-1_0/rpg/rpg/oldcode/DataBasedAction.h @@ -1,22 +1,22 @@ -#pragma once -#include "Action.h" -#include "mof/DataRow.h" - -namespace et{ - class DataBasedAction : public Action - { - mof::DataRow m_actionRow; - int m_category; - public: - DataBasedAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , mof::DataRow& actionRow , int category); - virtual ~DataBasedAction(void); - virtual int doActionTo(et::BattlerFacade* pTarget); - virtual mof::AnimationResource createApproachAnimation(); - virtual mof::AnimationResource createExecuteAnimation(); - virtual mof::tstring getActionMessage(); - virtual bool isDirectAttack(); - virtual mof::GraphicsSchedule* createEffect(et::Common& common); - }; - - +#pragma once +#include "Action.h" +#include "mof/DataRow.h" + +namespace et{ + class DataBasedAction : public Action + { + mof::DataRow m_actionRow; + int m_category; + public: + DataBasedAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , mof::DataRow& actionRow , int category); + virtual ~DataBasedAction(void); + virtual int doActionTo(et::BattlerFacade* pTarget); + virtual mof::AnimationResource createApproachAnimation(); + virtual mof::AnimationResource createExecuteAnimation(); + virtual mof::tstring getActionMessage(); + virtual bool isDirectAttack(); + virtual mof::GraphicsSchedule* createEffect(et::Common& common); + }; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.cpp b/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.cpp index 39d8cb8..5261b86 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.cpp @@ -1,189 +1,189 @@ -#include "DataBasedBattler.h" -#include "mof/KeyFrameAnimation.h" -#include "mof/DataBasedAnimation.h" -#include -#include "NormalAI.h" -//#include "AttackerAI.h" - -et::DataBasedBattler::DataBasedBattler(const TCHAR* pName , mof::DataResourceManager* pDataResourceManager , mof::TextureManager* pTextureManager , TCHAR serialCode) -: BattlerFacade(et::ENEMY) -{ - m_pDataResourceManager = pDataResourceManager; - mof::DataResource resource = m_pDataResourceManager->getResource(_T("data/monster.csv")); - m_targetRow = mof::DataRow(resource , pName); - m_pAI = NULL; - - std::basic_ostringstream stream; - stream << m_targetRow.getData( _T("Name")) << serialCode; - BattlerParameter parameter; - parameter.hp = m_targetRow.getIntegerData(_T("Hp")); - parameter.maxHp = parameter.hp; - parameter.attack = m_targetRow.getIntegerData(_T("Offense")); - parameter.diffence = m_targetRow.getIntegerData(_T("Defense")); - parameter.name = stream.str(); - parameter.speed = m_targetRow.getIntegerData(_T("Speed")); - parameter.actionPoint = 3; - parameter.dActionPoint = 0; - setParameter(parameter); - - mof::DataResource typeResource = m_pDataResourceManager->getResource(_T("data/monster.type.csv")); - m_typeRow = mof::DataRow(typeResource , m_targetRow.getData(_T("Type")).c_str()); - std::basic_ostringstream stream2; - stream2 << _T("image/") << m_typeRow.getData(_T("Image")); - m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(stream2.str())); - - - updateAI(m_targetRow.getData(_T("AI")).c_str()); - - - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setScale(0 , mof::Vector3D(0.3f , 0.3f , 0.3f)); - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - getGraphicsObject()->setAnimation( 0 , mof::AnimationResource(pAnimation)); - -} - -et::DataBasedBattler::~DataBasedBattler(void) -{ - -} - - -void et::DataBasedBattler::updateAI(const TCHAR* const pName){ - delete m_pAI; - - //AIƒIƒuƒWƒFƒNƒg‚ð‚‚­‚é - mof::tstring ai = m_targetRow.getData(_T("AI")); - if(ai == _T("ƒUƒRƒ^ƒCƒv"))m_pAI = new NormalAI(m_pDataResourceManager); - else if(ai == _T("ƒAƒ^ƒbƒJ["))m_pAI = new NormalAI(m_pDataResourceManager); -} - - -mof::AnimationResource et::DataBasedBattler::setMovingAnimation(mof::Vector3D& goal , int nFrame){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , getPosition()); - pAnimation->setPosition(nFrame-1 , goal); - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; -} - -mof::AnimationResource et::DataBasedBattler::setAidlingAnimation(mof::Vector3D& position ){ - if(!getParameter().alive){ - //‰½‚à•\Ž¦‚µ‚È‚¢ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); - pAnimation->setPosition(0 , position); - pAnimation->setTextureRectangle(0 , mof::Line2D(1 , 1 , 1 , 1)); - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - } - else if(getParameter().guard && getType() == et::HERO){ - //ƒK[ƒh - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); - pAnimation->setPosition(0 , position); - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 64*2 , 64 , 64*3)); - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - } - else { - mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); - { - mof::KeyFrameAnimation* pBaseAnimation = new mof::KeyFrameAnimation(true); - pBaseAnimation->setPosition(0 , mof::Vector3D(position)); - pCascadeAnimation->setElement(0 , mof::AnimationResource(pBaseAnimation)); - } - - pCascadeAnimation->setElement(1 , mof::AnimationResource( - new mof::DataBasedAnimation(m_typeRow.getData(_T("AidlingMotion")).c_str() , true))); - - mof::AnimationResource resource(pCascadeAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - } -} - -mof::AnimationResource et::DataBasedBattler::setCastAnimation(int category){ - - const TCHAR* const table[] = {_T("DirectAttack1Motion") , _T("DirectAttack2Motion") , - _T("SpecialAttack1Motion") , _T("SpecialAttack2Motion")}; - - mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); - { - mof::KeyFrameAnimation* pBaseAnimation = new mof::KeyFrameAnimation(); - pBaseAnimation->setPosition(0 , mof::Vector3D(getPosition())); - //pBaseAnimation->setFinalKey(20); - pCascadeAnimation->setElement(0 , mof::AnimationResource(pBaseAnimation)); - } - pCascadeAnimation->setElement(1 , mof::AnimationResource( - new mof::DataBasedAnimation(m_typeRow.getData(table[category] ).c_str() ))); - mof::AnimationResource resource(pCascadeAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - -} - -mof::AnimationResource et::DataBasedBattler::setDamagedAnimation(int level){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - if(level == 0){ - //’ʏí - mof::Vector3D backPosition = getPosition(); - backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; - pAnimation->setPosition(0 , getPosition()); - pAnimation->setPosition(10 , backPosition); - pAnimation->setPosition(40 , backPosition); - pAnimation->setPosition(60 , getPosition()); - - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(16 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(26 , mof::Line2D(0 , 0 , 64 , 64)); - - } - else if(level == 1){ - //Ž€–S - /*if(getType() == et::HERO){ - //ƒCƒGƒAƒAƒAƒAƒA - mof::Vector3D backPosition = getPosition(); - backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; - pAnimation->setPosition(0 , getPosition()); - pAnimation->setPosition(10 , backPosition); - pAnimation->setPosition(20 , backPosition); - backPosition.y += 0.4; - pAnimation->setPosition(100 , backPosition); - - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(14 , mof::Line2D(64*3 , 64 , 256 , 64*2)); - pAnimation->setTextureRectangle(150 , mof::Line2D(64*3 , 64 , 256 , 64*2)); - } - else{*/ - mof::Vector3D backPosition = getPosition(); - backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; - pAnimation->setPosition(0 , getPosition()); - pAnimation->setPosition(10 , backPosition); - - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(25 , mof::Line2D(1 , 1 , 1 , 1)); - //} - } - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; -} - - -et::Action* et::DataBasedBattler::createAction(BattlerGroup* pGroup ) { - return m_pAI->createAction(this , pGroup); -} - +#include "DataBasedBattler.h" +#include "mof/KeyFrameAnimation.h" +#include "mof/DataBasedAnimation.h" +#include +#include "NormalAI.h" +//#include "AttackerAI.h" + +et::DataBasedBattler::DataBasedBattler(const TCHAR* pName , mof::DataResourceManager* pDataResourceManager , mof::TextureManager* pTextureManager , TCHAR serialCode) +: BattlerFacade(et::ENEMY) +{ + m_pDataResourceManager = pDataResourceManager; + mof::DataResource resource = m_pDataResourceManager->getResource(_T("data/monster.csv")); + m_targetRow = mof::DataRow(resource , pName); + m_pAI = NULL; + + std::basic_ostringstream stream; + stream << m_targetRow.getData( _T("Name")) << serialCode; + BattlerParameter parameter; + parameter.hp = m_targetRow.getIntegerData(_T("Hp")); + parameter.maxHp = parameter.hp; + parameter.attack = m_targetRow.getIntegerData(_T("Offense")); + parameter.diffence = m_targetRow.getIntegerData(_T("Defense")); + parameter.name = stream.str(); + parameter.speed = m_targetRow.getIntegerData(_T("Speed")); + parameter.actionPoint = 3; + parameter.dActionPoint = 0; + setParameter(parameter); + + mof::DataResource typeResource = m_pDataResourceManager->getResource(_T("data/monster.type.csv")); + m_typeRow = mof::DataRow(typeResource , m_targetRow.getData(_T("Type")).c_str()); + std::basic_ostringstream stream2; + stream2 << _T("image/") << m_typeRow.getData(_T("Image")); + m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(stream2.str())); + + + updateAI(m_targetRow.getData(_T("AI")).c_str()); + + + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setScale(0 , mof::Vector3D(0.3f , 0.3f , 0.3f)); + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + getGraphicsObject()->setAnimation( 0 , mof::AnimationResource(pAnimation)); + +} + +et::DataBasedBattler::~DataBasedBattler(void) +{ + +} + + +void et::DataBasedBattler::updateAI(const TCHAR* const pName){ + delete m_pAI; + + //AIƒIƒuƒWƒFƒNƒg‚ð‚‚­‚é + mof::tstring ai = m_targetRow.getData(_T("AI")); + if(ai == _T("ƒUƒRƒ^ƒCƒv"))m_pAI = new NormalAI(m_pDataResourceManager); + else if(ai == _T("ƒAƒ^ƒbƒJ["))m_pAI = new NormalAI(m_pDataResourceManager); +} + + +mof::AnimationResource et::DataBasedBattler::setMovingAnimation(mof::Vector3D& goal , int nFrame){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , getPosition()); + pAnimation->setPosition(nFrame-1 , goal); + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; +} + +mof::AnimationResource et::DataBasedBattler::setAidlingAnimation(mof::Vector3D& position ){ + if(!getParameter().alive){ + //‰½‚à•\Ž¦‚µ‚È‚¢ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); + pAnimation->setPosition(0 , position); + pAnimation->setTextureRectangle(0 , mof::Line2D(1 , 1 , 1 , 1)); + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + } + else if(getParameter().guard && getType() == et::HERO){ + //ƒK[ƒh + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); + pAnimation->setPosition(0 , position); + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 64*2 , 64 , 64*3)); + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + } + else { + mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); + { + mof::KeyFrameAnimation* pBaseAnimation = new mof::KeyFrameAnimation(true); + pBaseAnimation->setPosition(0 , mof::Vector3D(position)); + pCascadeAnimation->setElement(0 , mof::AnimationResource(pBaseAnimation)); + } + + pCascadeAnimation->setElement(1 , mof::AnimationResource( + new mof::DataBasedAnimation(m_typeRow.getData(_T("AidlingMotion")).c_str() , true))); + + mof::AnimationResource resource(pCascadeAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + } +} + +mof::AnimationResource et::DataBasedBattler::setCastAnimation(int category){ + + const TCHAR* const table[] = {_T("DirectAttack1Motion") , _T("DirectAttack2Motion") , + _T("SpecialAttack1Motion") , _T("SpecialAttack2Motion")}; + + mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); + { + mof::KeyFrameAnimation* pBaseAnimation = new mof::KeyFrameAnimation(); + pBaseAnimation->setPosition(0 , mof::Vector3D(getPosition())); + //pBaseAnimation->setFinalKey(20); + pCascadeAnimation->setElement(0 , mof::AnimationResource(pBaseAnimation)); + } + pCascadeAnimation->setElement(1 , mof::AnimationResource( + new mof::DataBasedAnimation(m_typeRow.getData(table[category] ).c_str() ))); + mof::AnimationResource resource(pCascadeAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + +} + +mof::AnimationResource et::DataBasedBattler::setDamagedAnimation(int level){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + if(level == 0){ + //’ʏí + mof::Vector3D backPosition = getPosition(); + backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; + pAnimation->setPosition(0 , getPosition()); + pAnimation->setPosition(10 , backPosition); + pAnimation->setPosition(40 , backPosition); + pAnimation->setPosition(60 , getPosition()); + + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(16 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(26 , mof::Line2D(0 , 0 , 64 , 64)); + + } + else if(level == 1){ + //Ž€–S + /*if(getType() == et::HERO){ + //ƒCƒGƒAƒAƒAƒAƒA + mof::Vector3D backPosition = getPosition(); + backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; + pAnimation->setPosition(0 , getPosition()); + pAnimation->setPosition(10 , backPosition); + pAnimation->setPosition(20 , backPosition); + backPosition.y += 0.4; + pAnimation->setPosition(100 , backPosition); + + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(14 , mof::Line2D(64*3 , 64 , 256 , 64*2)); + pAnimation->setTextureRectangle(150 , mof::Line2D(64*3 , 64 , 256 , 64*2)); + } + else{*/ + mof::Vector3D backPosition = getPosition(); + backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; + pAnimation->setPosition(0 , getPosition()); + pAnimation->setPosition(10 , backPosition); + + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(25 , mof::Line2D(1 , 1 , 1 , 1)); + //} + } + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; +} + + +et::Action* et::DataBasedBattler::createAction(BattlerGroup* pGroup ) { + return m_pAI->createAction(this , pGroup); +} + diff --git a/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.h b/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.h index 3ed7fa6..0e5ef42 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.h +++ b/saisei-1_0/rpg/rpg/oldcode/DataBasedBattler.h @@ -1,29 +1,29 @@ -#pragma once -#include "BattlerFacade.h" -#include "mof/DataTable.h" -#include "mof/DataRow.h" - -namespace et{ - class BattleAI; - class DataBasedBattler : public BattlerFacade - { - mof::DataResourceManager* m_pDataResourceManager; - mof::DataRow m_targetRow; - mof::DataRow m_typeRow; - BattleAI* m_pAI; - - void updateAI(const TCHAR* const name); - public: - DataBasedBattler(const TCHAR* pName , mof::DataResourceManager* pDataResourceManager , mof::TextureManager* pTextureManager, TCHAR serialCode); - virtual ~DataBasedBattler(void); - - virtual mof::AnimationResource setMovingAnimation(mof::Vector3D& goal , int nFrame); - virtual mof::AnimationResource setAidlingAnimation(mof::Vector3D& position); - virtual mof::AnimationResource setCastAnimation(int category); - virtual mof::AnimationResource setDamagedAnimation(int level); - virtual Action* createAction(BattlerGroup* pGroup ); - mof::DataRow getDataRow(){return m_targetRow;} - - }; - -} +#pragma once +#include "BattlerFacade.h" +#include "mof/DataTable.h" +#include "mof/DataRow.h" + +namespace et{ + class BattleAI; + class DataBasedBattler : public BattlerFacade + { + mof::DataResourceManager* m_pDataResourceManager; + mof::DataRow m_targetRow; + mof::DataRow m_typeRow; + BattleAI* m_pAI; + + void updateAI(const TCHAR* const name); + public: + DataBasedBattler(const TCHAR* pName , mof::DataResourceManager* pDataResourceManager , mof::TextureManager* pTextureManager, TCHAR serialCode); + virtual ~DataBasedBattler(void); + + virtual mof::AnimationResource setMovingAnimation(mof::Vector3D& goal , int nFrame); + virtual mof::AnimationResource setAidlingAnimation(mof::Vector3D& position); + virtual mof::AnimationResource setCastAnimation(int category); + virtual mof::AnimationResource setDamagedAnimation(int level); + virtual Action* createAction(BattlerGroup* pGroup ); + mof::DataRow getDataRow(){return m_targetRow;} + + }; + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/Demo1.cpp~ b/saisei-1_0/rpg/rpg/oldcode/Demo1.cpp~ index 181bc94..0adbe51 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Demo1.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/Demo1.cpp~ @@ -1,146 +1,146 @@ -#include "Demo1.hpp" -#include "configure.hpp" -#include "MyInstructionSet.hpp" -#include "mof/Interpreter.hpp" -#include "mof/EventScheduler.hpp" -#include "mof/mofInput.hpp" -#include "mof/mofGraphics.hpp" -#include "mof/Application.hpp" -#include "mof/utilities.hpp" -#include "mof/widgets.hpp" -#include "mof/Font.hpp" -#include "resource.hpp" -#include -#include -#include -#include -#include "widget/createMenuView.hpp" -#include "widget/createFrame.hpp" - -using namespace mof::widget; -using namespace boost; - -namespace -{ - - boost::shared_ptr m_pInputReceiver; - mof::EventScheduler m_scheduler; - Frame* m_pView; - shared_ptr m_pWidget; -} - -namespace Demo1 -{ - - void initialize() - { - - - { - mof::widget::MenuItem menuItems[] = { - mof::widget::MenuItem - ( - ::createMenuView(_T("ƒL[ƒ{[ƒh‚́ª«‚ŁA")) - ) , - mof::widget::MenuItem - ( - ::createMenuView(_T("‘I‘ðŽˆ‚ð•ÏX‚Å‚«‚Ü‚·B")) - ) , - mof::widget::MenuItem - ( - ::createMenuView(_T("ƒtƒH[ƒJƒX‚³‚ꂽ‘I‘ðŽˆ‚ÍƒAƒjƒ[ƒVƒ‡ƒ“‚ªA")) - ) , - mof::widget::MenuItem - ( - ::createMenuView(_T("ƒA[ƒNƒXƒŒƒCƒ„[ +128")) - ) , - - - }; - m_pWidget = make_shared( menuItems[0] , mof::lastOf( menuItems ) ); - - m_pView = - createFrame - ( - _T("‘I‘ðƒƒjƒ…[‚̃fƒ‚") , - _T("image/frame0.png") , - _T("image/frame3.png") , - m_pWidget->getView() - ).release(); - } - - { - m_pView->getView()->getPositionStream() << mof::makeConstantHandler( mof::Vector2D(100, 100) ); - } - - m_pView->show(); - - m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); - - mof::GraphicsDevice::lightEnable(false); - mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); - - - - //---input event‚̐ݒè - m_scheduler.addEvent - ( - new mof::KeyPressedEventCondition( mof::InputReceiver::ESCAPE , m_pInputReceiver ) , - &mof::Application::quit - ); - m_scheduler.addEvent - ( - new mof::KeyPressedEventCondition( mof::InputReceiver::UP , m_pInputReceiver ) , - boost::bind( &Menu::up , m_pWidget ) - ); - m_scheduler.addEvent - ( - new mof::KeyPressedEventCondition( mof::InputReceiver::DOWN , m_pInputReceiver ) , - boost::bind( &Menu::down , m_pWidget ) - ); - m_scheduler.addEvent - ( - new mof::KeyPressedEventCondition( mof::InputReceiver::LEFT , m_pInputReceiver ) , - boost::bind( &Menu::left , m_pWidget ) - ); - m_scheduler.addEvent - ( - new mof::KeyPressedEventCondition( mof::InputReceiver::RIGHT , m_pInputReceiver ) , - boost::bind( &Menu::right , m_pWidget ) - ); - - - } - - void finalize( ) - { - mof::safe_delete( m_pView ); - } - - - - void update() - { - m_scheduler.update(); - m_pInputReceiver->update(); - m_pView->update( ); - } - - void draw() - { - mof::VertexXYZRHWC vertices[] = - { - mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) , - mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) , - mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) , - mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0)) - }; - mof::GraphicsDevice::setTexture(NULL); - mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP ); - - m_pView->getView()->draw( ); - } - -} // namespace Demo1 - - +#include "Demo1.hpp" +#include "configure.hpp" +#include "MyInstructionSet.hpp" +#include "mof/Interpreter.hpp" +#include "mof/EventScheduler.hpp" +#include "mof/mofInput.hpp" +#include "mof/mofGraphics.hpp" +#include "mof/Application.hpp" +#include "mof/utilities.hpp" +#include "mof/widgets.hpp" +#include "mof/Font.hpp" +#include "resource.hpp" +#include +#include +#include +#include +#include "widget/createMenuView.hpp" +#include "widget/createFrame.hpp" + +using namespace mof::widget; +using namespace boost; + +namespace +{ + + boost::shared_ptr m_pInputReceiver; + mof::EventScheduler m_scheduler; + Frame* m_pView; + shared_ptr m_pWidget; +} + +namespace Demo1 +{ + + void initialize() + { + + + { + mof::widget::MenuItem menuItems[] = { + mof::widget::MenuItem + ( + ::createMenuView(_T("ƒL[ƒ{[ƒh‚́ª«‚ŁA")) + ) , + mof::widget::MenuItem + ( + ::createMenuView(_T("‘I‘ðŽˆ‚ð•ÏX‚Å‚«‚Ü‚·B")) + ) , + mof::widget::MenuItem + ( + ::createMenuView(_T("ƒtƒH[ƒJƒX‚³‚ꂽ‘I‘ðŽˆ‚ÍƒAƒjƒ[ƒVƒ‡ƒ“‚ªA")) + ) , + mof::widget::MenuItem + ( + ::createMenuView(_T("ƒA[ƒNƒXƒŒƒCƒ„[ +128")) + ) , + + + }; + m_pWidget = make_shared( menuItems[0] , mof::lastOf( menuItems ) ); + + m_pView = + createFrame + ( + _T("‘I‘ðƒƒjƒ…[‚̃fƒ‚") , + _T("image/frame0.png") , + _T("image/frame3.png") , + m_pWidget->getView() + ).release(); + } + + { + m_pView->getView()->getPositionStream() << mof::makeConstantHandler( mof::Vector2D(100, 100) ); + } + + m_pView->show(); + + m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); + + mof::GraphicsDevice::lightEnable(false); + mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); + + + + //---input event‚̐ݒè + m_scheduler.addEvent + ( + new mof::KeyPressedEventCondition( mof::InputReceiver::ESCAPE , m_pInputReceiver ) , + &mof::Application::quit + ); + m_scheduler.addEvent + ( + new mof::KeyPressedEventCondition( mof::InputReceiver::UP , m_pInputReceiver ) , + boost::bind( &Menu::up , m_pWidget ) + ); + m_scheduler.addEvent + ( + new mof::KeyPressedEventCondition( mof::InputReceiver::DOWN , m_pInputReceiver ) , + boost::bind( &Menu::down , m_pWidget ) + ); + m_scheduler.addEvent + ( + new mof::KeyPressedEventCondition( mof::InputReceiver::LEFT , m_pInputReceiver ) , + boost::bind( &Menu::left , m_pWidget ) + ); + m_scheduler.addEvent + ( + new mof::KeyPressedEventCondition( mof::InputReceiver::RIGHT , m_pInputReceiver ) , + boost::bind( &Menu::right , m_pWidget ) + ); + + + } + + void finalize( ) + { + mof::safe_delete( m_pView ); + } + + + + void update() + { + m_scheduler.update(); + m_pInputReceiver->update(); + m_pView->update( ); + } + + void draw() + { + mof::VertexXYZRHWC vertices[] = + { + mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) , + mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) , + mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) , + mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0)) + }; + mof::GraphicsDevice::setTexture(NULL); + mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP ); + + m_pView->getView()->draw( ); + } + +} // namespace Demo1 + + diff --git a/saisei-1_0/rpg/rpg/oldcode/Demo1.hpp~ b/saisei-1_0/rpg/rpg/oldcode/Demo1.hpp~ index 830b1c6..cc73ac7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Demo1.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/Demo1.hpp~ @@ -1,9 +1,9 @@ -#pragma once - -namespace Demo2 -{ - void initialize( ); - void finalize( ); - void update( ); - void draw( ); -} +#pragma once + +namespace Demo2 +{ + void initialize( ); + void finalize( ); + void update( ); + void draw( ); +} diff --git a/saisei-1_0/rpg/rpg/oldcode/Demo2.cpp~ b/saisei-1_0/rpg/rpg/oldcode/Demo2.cpp~ index 9b98898..5322a0a 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Demo2.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/Demo2.cpp~ @@ -1,110 +1,110 @@ -#include "Demo2.hpp" -#include "configure.hpp" -#include "MyInstructionSet.hpp" -#include "mof/Interpreter.hpp" -#include "mof/EventScheduler.hpp" -#include "mof/mofInput.hpp" -#include "mof/mofGraphics.hpp" -#include "mof/Application.hpp" -#include "mof/utilities.hpp" -#include "mof/widgets.hpp" -#include "mof/Font.hpp" -#include "resource.hpp" -#include -#include -#include -#include -#include "widget/createMenuView.hpp" -#include "widget/createFrame.hpp" - -using namespace mof::widget; -using namespace boost; - -namespace -{ - - boost::shared_ptr m_pInputReceiver; - mof::EventScheduler m_scheduler; - Frame* m_pView; -} - -namespace Demo2 -{ - - void initialize() - { - - - { - shared_ptr pWidget = - make_shared - ( - make_shared - ( - mof::Font(FONT_NAME_UME , 18) - - ) - ); - - pWidget->addPage("ƒEƒBƒ“ƒhƒEƒVƒXƒeƒ€‚̃fƒ‚‚Å‚·B•¶Žš—ñ‚Ì’·‚³‚ɉž‚¶‚ăEƒBƒ“ƒhƒEƒTƒCƒY‚ªŽ©“®‚ÅŒˆ‚Ü‚è‚Ü‚·B"); - - m_pView = - createFrame - ( - _T("My Demo") , - _T("image/frame0.png") , - _T("image/frame3.png") , - pWidget->getView() - ).release(); - } - - { - mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = - { - mof::makeKeyFrame( 0 , mof::Vector2D( 0 , 50 ) ) , - mof::makeKeyFrame( 300 , mof::Vector2D( 150 , 200 ) ) , - }; - m_pView->getView()->getPositionStream() << mof::makeKeyFrameAnimationHandler( keyFrames[0] , mof::lastOf( keyFrames ) ); - } - m_pView->show(); - - m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); - - mof::GraphicsDevice::lightEnable(false); - mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); - - } - - void finalize( ) - { - mof::safe_delete( m_pView ); - } - - - - void update() - { - m_scheduler.update(); - m_pInputReceiver->update(); - m_pView->update( ); - - } - - void draw() - { - mof::VertexXYZRHWC vertices[] = - { - mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) , - mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) , - mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) , - mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0)) - }; - mof::GraphicsDevice::setTexture(NULL); - mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP ); - - m_pView->getView()->draw( ); - } - -} // namespace Demo2 - - +#include "Demo2.hpp" +#include "configure.hpp" +#include "MyInstructionSet.hpp" +#include "mof/Interpreter.hpp" +#include "mof/EventScheduler.hpp" +#include "mof/mofInput.hpp" +#include "mof/mofGraphics.hpp" +#include "mof/Application.hpp" +#include "mof/utilities.hpp" +#include "mof/widgets.hpp" +#include "mof/Font.hpp" +#include "resource.hpp" +#include +#include +#include +#include +#include "widget/createMenuView.hpp" +#include "widget/createFrame.hpp" + +using namespace mof::widget; +using namespace boost; + +namespace +{ + + boost::shared_ptr m_pInputReceiver; + mof::EventScheduler m_scheduler; + Frame* m_pView; +} + +namespace Demo2 +{ + + void initialize() + { + + + { + shared_ptr pWidget = + make_shared + ( + make_shared + ( + mof::Font(FONT_NAME_UME , 18) + + ) + ); + + pWidget->addPage("ƒEƒBƒ“ƒhƒEƒVƒXƒeƒ€‚̃fƒ‚‚Å‚·B•¶Žš—ñ‚Ì’·‚³‚ɉž‚¶‚ăEƒBƒ“ƒhƒEƒTƒCƒY‚ªŽ©“®‚ÅŒˆ‚Ü‚è‚Ü‚·B"); + + m_pView = + createFrame + ( + _T("My Demo") , + _T("image/frame0.png") , + _T("image/frame3.png") , + pWidget->getView() + ).release(); + } + + { + mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = + { + mof::makeKeyFrame( 0 , mof::Vector2D( 0 , 50 ) ) , + mof::makeKeyFrame( 300 , mof::Vector2D( 150 , 200 ) ) , + }; + m_pView->getView()->getPositionStream() << mof::makeKeyFrameAnimationHandler( keyFrames[0] , mof::lastOf( keyFrames ) ); + } + m_pView->show(); + + m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); + + mof::GraphicsDevice::lightEnable(false); + mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); + + } + + void finalize( ) + { + mof::safe_delete( m_pView ); + } + + + + void update() + { + m_scheduler.update(); + m_pInputReceiver->update(); + m_pView->update( ); + + } + + void draw() + { + mof::VertexXYZRHWC vertices[] = + { + mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) , + mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) , + mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) , + mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0)) + }; + mof::GraphicsDevice::setTexture(NULL); + mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP ); + + m_pView->getView()->draw( ); + } + +} // namespace Demo2 + + diff --git a/saisei-1_0/rpg/rpg/oldcode/Demo2.hpp~ b/saisei-1_0/rpg/rpg/oldcode/Demo2.hpp~ index d090aef..eb228f0 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Demo2.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/Demo2.hpp~ @@ -1,9 +1,9 @@ -#pragma once - -namespace Demo1 -{ - void initialize( ); - void finalize( ); - void update( ); - void draw( ); -} +#pragma once + +namespace Demo1 +{ + void initialize( ); + void finalize( ); + void update( ); + void draw( ); +} diff --git a/saisei-1_0/rpg/rpg/oldcode/Demo3.cpp~ b/saisei-1_0/rpg/rpg/oldcode/Demo3.cpp~ index 4a232b1..063497e 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Demo3.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/Demo3.cpp~ @@ -1,206 +1,206 @@ -#include "Demo2.hpp" -#include "configure.hpp" -#include "MyInstructionSet.hpp" -#include "mof/Interpreter.hpp" -#include "mof/EventScheduler.hpp" -#include "mof/mofInput.hpp" -#include "mof/mofGraphics.hpp" -#include "mof/Application.hpp" -#include "mof/utilities.hpp" -#include "mof/widgets.hpp" -#include -#include "mof/Font.hpp" -#include "resource.hpp" -#include -#include -#include -#include -#include "widget/createMenuView.hpp" -#include "widget/createFrame.hpp" -#include -#include - -using namespace mof::widget; -using namespace boost; - -namespace -{ - - boost::shared_ptr m_pInputReceiver; - mof::EventScheduler m_scheduler; - Frame* m_pView; -} - -namespace Demo3 -{ -//{{{ initialize - void initialize() - { - - - { - shared_ptr pWidget = - make_shared - ( - make_shared - ( - mof::Font(FONT_NAME_UME, 18) - - ) - ); - - //pWidget->addPage("@"); - pWidget->addPage("ƒEƒBƒ“ƒhƒE‚̃Aƒjƒ[ƒVƒ‡ƒ“‚ÍŠO•”‚©‚çÝ’è‚Å‚«‚Ü‚·B‚±‚ê‚̓Lƒƒƒ‰ƒNƒ^[‚̃ZƒŠƒt•\Ž¦‚ð‘z’肵‚½ƒAƒjƒ[ƒVƒ‡ƒ“"); - - m_pView = - createFrame - ( - _T("@") , - _T("image/frame0.png") , - _T("image/frame3.png") , - pWidget->getView() - ).release(); - } - - { - mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = - { - mof::makeKeyFrame(0, mof::Vector2D(250, 50)), - mof::makeKeyFrame(15, mof::Vector2D(0 , 50)), - mof::makeKeyFrame(20, mof::Vector2D(0, 0)), - }; - m_pView->getView()->getPositionStream() - << mof::makeConstantHandler(mof::Vector2D(30, 60)) - << mof::makeKeyFrameAnimationHandler( keyFrames[0], mof::lastOf( keyFrames ) ); - } - { - mof::Vector2D base = m_pView->getView()->getSizeStream().value(); - mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = - { - mof::makeKeyFrame(0, mof::Vector2D(50, 50) - base ) , - mof::makeKeyFrame(15, mof::Vector2D(550, 50) - base ) , - mof::makeKeyFrame(20, mof::Vector2D(550, 150) - base ) , - }; - m_pView->getView()->getSizeStream() << mof::makeKeyFrameAnimationHandler( keyFrames[0] , mof::lastOf( keyFrames ) ); - } - - m_pView->show(); - - m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); - - mof::GraphicsDevice::lightEnable(false); - mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); - - } -//}}} -/* -//{{{ initialize - void initialize() - { - { - using namespace mof::widget; - - boost::shared_ptr contents[] = - { - boost::make_shared(mof::Vector2D(32, 64), mof::createColor(255, 0, 0)), - boost::make_shared(mof::Vector2D(24, 64), mof::createColor(0, 255, 0)), - boost::make_shared(mof::Vector2D(12, 80), mof::createColor(0, 0, 255)), - }; - - boost::shared_ptr container = - make_shared - ( - contents[0], - mof::lastOf(contents), - mof::makeFactoryMethod(GridLayout::VERTICAL, 0, 10) - ); - - - //boost::shared_ptr container = - // boost::make_shared(mof::Vector2D(32, 64), mof::createColor(255, 0, 0)); - - m_pView = - createFrame - ( - _T("My Demo") , - _T("image/frame0.png") , - _T("image/frame3.png") , - container - ).release(); - } - - { - mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = - { - mof::makeKeyFrame(0, mof::Vector2D(250, 50)), - mof::makeKeyFrame(50, mof::Vector2D(0 , 50)), - mof::makeKeyFrame(60, mof::Vector2D(0, 0)), - }; - m_pView->getView()->getPositionStream() - << mof::makeConstantHandler(mof::Vector2D(30, 60)) - << mof::makeKeyFrameAnimationHandler( keyFrames[0], mof::lastOf( keyFrames ) ); - } - { - mof::Vector2D base = m_pView->getView()->getPreferredSize(); - mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = - { - //mof::makeKeyFrame(0, mof::Vector2D(50, 50) - base ) , - //mof::makeKeyFrame(50, mof::Vector2D(550, 50) - base ) , - //mof::makeKeyFrame(60, mof::Vector2D(550, 150) - base ) , - mof::makeKeyFrame(0, mof::Vector2D(0,0) ) , - mof::makeKeyFrame(30, mof::Vector2D(0,100) ) , - mof::makeKeyFrame(50, mof::Vector2D(0, -200) ) , - }; - m_pView->getView()->getSizeStream() - << - boost::make_shared> - ( - mof::makeKeyFrameAnimationHandler(keyFrames[0] , mof::lastOf( keyFrames )), - 100 - ); - } - - m_pView->show(); - - m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); - - mof::GraphicsDevice::lightEnable(false); - mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); - - } -*/ -//}}} - - void finalize( ) - { - mof::safe_delete( m_pView ); - } - - - - void update() - { - m_scheduler.update(); - m_pInputReceiver->update(); - m_pView->update( ); - - } - - void draw() - { - mof::VertexXYZRHWC vertices[] = - { - mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) , - mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) , - mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) , - mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0)) - }; - mof::GraphicsDevice::setTexture(NULL); - mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP ); - - m_pView->getView()->draw( ); - } - -} // namespace Demo2 - - +#include "Demo2.hpp" +#include "configure.hpp" +#include "MyInstructionSet.hpp" +#include "mof/Interpreter.hpp" +#include "mof/EventScheduler.hpp" +#include "mof/mofInput.hpp" +#include "mof/mofGraphics.hpp" +#include "mof/Application.hpp" +#include "mof/utilities.hpp" +#include "mof/widgets.hpp" +#include +#include "mof/Font.hpp" +#include "resource.hpp" +#include +#include +#include +#include +#include "widget/createMenuView.hpp" +#include "widget/createFrame.hpp" +#include +#include + +using namespace mof::widget; +using namespace boost; + +namespace +{ + + boost::shared_ptr m_pInputReceiver; + mof::EventScheduler m_scheduler; + Frame* m_pView; +} + +namespace Demo3 +{ +//{{{ initialize + void initialize() + { + + + { + shared_ptr pWidget = + make_shared + ( + make_shared + ( + mof::Font(FONT_NAME_UME, 18) + + ) + ); + + //pWidget->addPage("@"); + pWidget->addPage("ƒEƒBƒ“ƒhƒE‚̃Aƒjƒ[ƒVƒ‡ƒ“‚ÍŠO•”‚©‚çÝ’è‚Å‚«‚Ü‚·B‚±‚ê‚̓Lƒƒƒ‰ƒNƒ^[‚̃ZƒŠƒt•\Ž¦‚ð‘z’肵‚½ƒAƒjƒ[ƒVƒ‡ƒ“"); + + m_pView = + createFrame + ( + _T("@") , + _T("image/frame0.png") , + _T("image/frame3.png") , + pWidget->getView() + ).release(); + } + + { + mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = + { + mof::makeKeyFrame(0, mof::Vector2D(250, 50)), + mof::makeKeyFrame(15, mof::Vector2D(0 , 50)), + mof::makeKeyFrame(20, mof::Vector2D(0, 0)), + }; + m_pView->getView()->getPositionStream() + << mof::makeConstantHandler(mof::Vector2D(30, 60)) + << mof::makeKeyFrameAnimationHandler( keyFrames[0], mof::lastOf( keyFrames ) ); + } + { + mof::Vector2D base = m_pView->getView()->getSizeStream().value(); + mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = + { + mof::makeKeyFrame(0, mof::Vector2D(50, 50) - base ) , + mof::makeKeyFrame(15, mof::Vector2D(550, 50) - base ) , + mof::makeKeyFrame(20, mof::Vector2D(550, 150) - base ) , + }; + m_pView->getView()->getSizeStream() << mof::makeKeyFrameAnimationHandler( keyFrames[0] , mof::lastOf( keyFrames ) ); + } + + m_pView->show(); + + m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); + + mof::GraphicsDevice::lightEnable(false); + mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); + + } +//}}} +/* +//{{{ initialize + void initialize() + { + { + using namespace mof::widget; + + boost::shared_ptr contents[] = + { + boost::make_shared(mof::Vector2D(32, 64), mof::createColor(255, 0, 0)), + boost::make_shared(mof::Vector2D(24, 64), mof::createColor(0, 255, 0)), + boost::make_shared(mof::Vector2D(12, 80), mof::createColor(0, 0, 255)), + }; + + boost::shared_ptr container = + make_shared + ( + contents[0], + mof::lastOf(contents), + mof::makeFactoryMethod(GridLayout::VERTICAL, 0, 10) + ); + + + //boost::shared_ptr container = + // boost::make_shared(mof::Vector2D(32, 64), mof::createColor(255, 0, 0)); + + m_pView = + createFrame + ( + _T("My Demo") , + _T("image/frame0.png") , + _T("image/frame3.png") , + container + ).release(); + } + + { + mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = + { + mof::makeKeyFrame(0, mof::Vector2D(250, 50)), + mof::makeKeyFrame(50, mof::Vector2D(0 , 50)), + mof::makeKeyFrame(60, mof::Vector2D(0, 0)), + }; + m_pView->getView()->getPositionStream() + << mof::makeConstantHandler(mof::Vector2D(30, 60)) + << mof::makeKeyFrameAnimationHandler( keyFrames[0], mof::lastOf( keyFrames ) ); + } + { + mof::Vector2D base = m_pView->getView()->getPreferredSize(); + mof::KeyFrameAnimation< mof::Vector2D >::KeyFrame keyFrames[] = + { + //mof::makeKeyFrame(0, mof::Vector2D(50, 50) - base ) , + //mof::makeKeyFrame(50, mof::Vector2D(550, 50) - base ) , + //mof::makeKeyFrame(60, mof::Vector2D(550, 150) - base ) , + mof::makeKeyFrame(0, mof::Vector2D(0,0) ) , + mof::makeKeyFrame(30, mof::Vector2D(0,100) ) , + mof::makeKeyFrame(50, mof::Vector2D(0, -200) ) , + }; + m_pView->getView()->getSizeStream() + << + boost::make_shared> + ( + mof::makeKeyFrameAnimationHandler(keyFrames[0] , mof::lastOf( keyFrames )), + 100 + ); + } + + m_pView->show(); + + m_pInputReceiver = boost::shared_ptr(mof::InputDevice::getInputReceiver()); + + mof::GraphicsDevice::lightEnable(false); + mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); + + } +*/ +//}}} + + void finalize( ) + { + mof::safe_delete( m_pView ); + } + + + + void update() + { + m_scheduler.update(); + m_pInputReceiver->update(); + m_pView->update( ); + + } + + void draw() + { + mof::VertexXYZRHWC vertices[] = + { + mof::VertexXYZRHWC(mof::Vector2D(0 , 0) , mof::createColor(0 , 0 , 127)) , + mof::VertexXYZRHWC(mof::Vector2D(640 , 0) , mof::createColor(0 , 0 , 127)) , + mof::VertexXYZRHWC(mof::Vector2D(0 , 480) , mof::createColor(0 , 0 , 0)) , + mof::VertexXYZRHWC(mof::Vector2D(640 , 480) , mof::createColor(0 , 0 , 0)) + }; + mof::GraphicsDevice::setTexture(NULL); + mof::GraphicsDevice::drawVertexArray(vertices[0] , vertices[3] , mof::PRIMITIVE_TYPE_TRIANGLESTRIP ); + + m_pView->getView()->draw( ); + } + +} // namespace Demo2 + + diff --git a/saisei-1_0/rpg/rpg/oldcode/Demo3.hpp~ b/saisei-1_0/rpg/rpg/oldcode/Demo3.hpp~ index 830b1c6..cc73ac7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Demo3.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/Demo3.hpp~ @@ -1,9 +1,9 @@ -#pragma once - -namespace Demo2 -{ - void initialize( ); - void finalize( ); - void update( ); - void draw( ); -} +#pragma once + +namespace Demo2 +{ + void initialize( ); + void finalize( ); + void update( ); + void draw( ); +} diff --git a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.cpp b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.cpp index 085cacc..116a8a0 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.cpp @@ -1,44 +1,44 @@ -#include "DungeonBuilder.h" -#include "mof/SoftVertexBufferImpl.h" -#include "mof/HardVertexBufferImpl.h" - - -et::DungeonBuilder::DungeonBuilder(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale) -: MapBuilder(pTextureManager , scale , map.getWidth() , map.getHeight() ) , m_map(map) -{ - m_blockWidth = map.getWidth(); - m_blockHeight = map.getHeight(); -} - -et::DungeonBuilder::~DungeonBuilder(void) -{ -} - -void et::DungeonBuilder::setBlockSize(int width , int height){ - m_blockWidth = width; - m_blockHeight = height; -} - - - -et::DungeonBuffer* et::DungeonBuilder::createBlock(int _x , int _y){ - - int beginX = _x * m_blockWidth; - int endX = (_x+1) * m_blockWidth; - if(endX > m_map.getWidth())endX = m_map.getWidth(); - int beginY = _y * m_blockHeight; - int endY = (_y+1) * m_blockHeight; - if(endY > m_map.getHeight())endY = m_map.getHeight(); - - std::vector vertices; - - for(int x = beginX ; x < endX ; x++){ - for(int y = beginY ; y < endY ; y++){ - addParts(vertices , x , y); - } - } - - return new mof::SoftVertexBuffer(et::DungeonBuffer::PRIMITIVE_TYPE_TRIANGLELIST , vertices); -} - - +#include "DungeonBuilder.h" +#include "mof/SoftVertexBufferImpl.h" +#include "mof/HardVertexBufferImpl.h" + + +et::DungeonBuilder::DungeonBuilder(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale) +: MapBuilder(pTextureManager , scale , map.getWidth() , map.getHeight() ) , m_map(map) +{ + m_blockWidth = map.getWidth(); + m_blockHeight = map.getHeight(); +} + +et::DungeonBuilder::~DungeonBuilder(void) +{ +} + +void et::DungeonBuilder::setBlockSize(int width , int height){ + m_blockWidth = width; + m_blockHeight = height; +} + + + +et::DungeonBuffer* et::DungeonBuilder::createBlock(int _x , int _y){ + + int beginX = _x * m_blockWidth; + int endX = (_x+1) * m_blockWidth; + if(endX > m_map.getWidth())endX = m_map.getWidth(); + int beginY = _y * m_blockHeight; + int endY = (_y+1) * m_blockHeight; + if(endY > m_map.getHeight())endY = m_map.getHeight(); + + std::vector vertices; + + for(int x = beginX ; x < endX ; x++){ + for(int y = beginY ; y < endY ; y++){ + addParts(vertices , x , y); + } + } + + return new mof::SoftVertexBuffer(et::DungeonBuffer::PRIMITIVE_TYPE_TRIANGLELIST , vertices); +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.h b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.h index 7ea4b6a..e9e78c9 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.h +++ b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilder.h @@ -1,24 +1,24 @@ -#pragma once -#include "mof/PixelMap.h" -#include "MapBuilder.h" - - -namespace et{ - typedef VertexTypeMap VertexTypeDungeon; - typedef MapBuffer DungeonBuffer; - class DungeonBuilder : public MapBuilder - { - mof::PixelMap m_map; - int m_blockWidth , m_blockHeight; - protected : - mof::PixelMap& getMap(){return m_map;} - public: - DungeonBuilder(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale); - virtual ~DungeonBuilder(void); - void setBlockSize(int width , int height); - DungeonBuffer* createBlock(int x , int y); - mof::Color getMapImageColor(int x , int y){return m_map.get(x , y);} - }; - - +#pragma once +#include "mof/PixelMap.h" +#include "MapBuilder.h" + + +namespace et{ + typedef VertexTypeMap VertexTypeDungeon; + typedef MapBuffer DungeonBuffer; + class DungeonBuilder : public MapBuilder + { + mof::PixelMap m_map; + int m_blockWidth , m_blockHeight; + protected : + mof::PixelMap& getMap(){return m_map;} + public: + DungeonBuilder(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale); + virtual ~DungeonBuilder(void); + void setBlockSize(int width , int height); + DungeonBuffer* createBlock(int x , int y); + mof::Color getMapImageColor(int x , int y){return m_map.get(x , y);} + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.cpp b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.cpp index 171f941..dc2e6be 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.cpp @@ -1,99 +1,99 @@ -#include "DungeonBuilderA.h" -#include "MapImageColor.h" - -et::DungeonBuilderA::DungeonBuilderA(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale) -: et::DungeonBuilder(map , pTextureManager , scale) -{ -} - -et::DungeonBuilderA::~DungeonBuilderA(void) -{ -} - -void et::DungeonBuilderA::addParts(std::vector& vertices , int x , int y){ - mof::PixelMap map = getMap(); - const float SCALE = getScale(); - et::VertexTypeDungeon vertex; - vertex.y = 0.0f; - float t = 0.0001f;//ƒeƒNƒXƒ`ƒƒ‹«ŠE•â³ - vertex.color = mof::createColor(255 , 255 , 255); - float tableX[]={ 0.0f , SCALE , SCALE , SCALE , 0.0f , 0.0f}; - float tableZ[]={ 0.0f , 0.0f , -SCALE , -SCALE , -SCALE , 0.0f}; - float tableTU[]={ 0.25f+t , 0.5f-t , 0.5f-t , 0.5f-t , 0.25f+t , 0.25f+t}; - float tableTV[]={ 0.0f+t, 0.0f+t , 0.25f-t , 0.25f-t , 0.25f-t , 0.0f+t}; - - - if(et::isWalkableColor(map.get(x , y))){ - for(int i = 0 ; i < 6 ; i++){ - vertex.x = tableX[i] + SCALE * x; - vertex.z = tableZ[i] - SCALE * y; - vertex.tu = tableTU[i]; - vertex.tv = tableTV[i]; - vertices.push_back(vertex); - } - return; - } - else if(map.get(x , y) == mof::createColor( 255 , 0 , 0)){ - - for(int i = 0 ; i < 6 ; i++){ - vertex.x = tableX[i] + SCALE * x; - vertex.y = SCALE; - vertex.z = tableZ[i] - 0.3f * y; - vertex.tu = tableTU[i] -0.25f; - vertex.tv = tableTV[i]; - vertices.push_back(vertex); - } - - //•Ç‚ð’ljÁ - if(y > 0 && map.get(x , y-1) != mof::createColor(255 , 0 , 0)){ - //ã•ûŒü‚É•Ç - for(int i = 0 ; i < 6 ; i++){ - vertex.x = tableX[i] + SCALE * x; - vertex.y = tableZ[i] +SCALE; - vertex.z = - SCALE * y; - vertex.tu = tableTU[i] - 0.25f; - vertex.tv = tableTV[i]; - vertices.push_back(vertex); - } - } - if(y < map.getHeight() && map.get(x , y+1) != mof::createColor(255 , 0 , 0)){ - //‰º•ûŒü‚É•Ç - for(int i = 0 ; i < 6 ; i++){ - vertex.x = tableX[i] + SCALE * x; - vertex.y = tableZ[i] + SCALE; - vertex.z = - SCALE * (y+1); - if(et::isWalkableColor(map.get(x , y+1)))vertex.tu = tableTU[i] + 0.5f; - else vertex.tu = tableTU[i] - 0.25f; - vertex.tv = tableTV[i]; - vertices.push_back(vertex); - } - } - if(x > 0 && map.get(x-1 , y) != mof::createColor(255 , 0 , 0)){ - //¶•ûŒü‚É•Ç - for(int i = 0 ; i < 6 ; i++){ - vertex.x = SCALE * x; - vertex.y = tableZ[5-i] + SCALE; - vertex.z = -SCALE * (y+1) + tableX[5-i]; - if(et::isWalkableColor(map.get(x-1 , y)))vertex.tu = tableTU[5-i] + 0.5f; - else vertex.tu = tableTU[5-i] - 0.25f; - vertex.tv = tableTV[5-i]; - vertices.push_back(vertex); - } - } - if(x < map.getWidth() && map.get(x+1 , y) != mof::createColor(255 , 0 , 0)){ - //‰E•ûŒü‚É•Ç - for(int i = 0 ; i < 6 ; i++){ - vertex.x = SCALE * (x+1); - vertex.y = tableZ[i] + SCALE; - vertex.z = -SCALE * (y+1) + tableX[i]; - if(et::isWalkableColor(map.get(x+1 , y)))vertex.tu = tableTU[i] + 0.5f; - else vertex.tu = tableTU[i] - 0.25f; - vertex.tv = tableTV[i]; - vertices.push_back(vertex); - } - } - } - else return; - - +#include "DungeonBuilderA.h" +#include "MapImageColor.h" + +et::DungeonBuilderA::DungeonBuilderA(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale) +: et::DungeonBuilder(map , pTextureManager , scale) +{ +} + +et::DungeonBuilderA::~DungeonBuilderA(void) +{ +} + +void et::DungeonBuilderA::addParts(std::vector& vertices , int x , int y){ + mof::PixelMap map = getMap(); + const float SCALE = getScale(); + et::VertexTypeDungeon vertex; + vertex.y = 0.0f; + float t = 0.0001f;//ƒeƒNƒXƒ`ƒƒ‹«ŠE•â³ + vertex.color = mof::createColor(255 , 255 , 255); + float tableX[]={ 0.0f , SCALE , SCALE , SCALE , 0.0f , 0.0f}; + float tableZ[]={ 0.0f , 0.0f , -SCALE , -SCALE , -SCALE , 0.0f}; + float tableTU[]={ 0.25f+t , 0.5f-t , 0.5f-t , 0.5f-t , 0.25f+t , 0.25f+t}; + float tableTV[]={ 0.0f+t, 0.0f+t , 0.25f-t , 0.25f-t , 0.25f-t , 0.0f+t}; + + + if(et::isWalkableColor(map.get(x , y))){ + for(int i = 0 ; i < 6 ; i++){ + vertex.x = tableX[i] + SCALE * x; + vertex.z = tableZ[i] - SCALE * y; + vertex.tu = tableTU[i]; + vertex.tv = tableTV[i]; + vertices.push_back(vertex); + } + return; + } + else if(map.get(x , y) == mof::createColor( 255 , 0 , 0)){ + + for(int i = 0 ; i < 6 ; i++){ + vertex.x = tableX[i] + SCALE * x; + vertex.y = SCALE; + vertex.z = tableZ[i] - 0.3f * y; + vertex.tu = tableTU[i] -0.25f; + vertex.tv = tableTV[i]; + vertices.push_back(vertex); + } + + //•Ç‚ð’ljÁ + if(y > 0 && map.get(x , y-1) != mof::createColor(255 , 0 , 0)){ + //ã•ûŒü‚É•Ç + for(int i = 0 ; i < 6 ; i++){ + vertex.x = tableX[i] + SCALE * x; + vertex.y = tableZ[i] +SCALE; + vertex.z = - SCALE * y; + vertex.tu = tableTU[i] - 0.25f; + vertex.tv = tableTV[i]; + vertices.push_back(vertex); + } + } + if(y < map.getHeight() && map.get(x , y+1) != mof::createColor(255 , 0 , 0)){ + //‰º•ûŒü‚É•Ç + for(int i = 0 ; i < 6 ; i++){ + vertex.x = tableX[i] + SCALE * x; + vertex.y = tableZ[i] + SCALE; + vertex.z = - SCALE * (y+1); + if(et::isWalkableColor(map.get(x , y+1)))vertex.tu = tableTU[i] + 0.5f; + else vertex.tu = tableTU[i] - 0.25f; + vertex.tv = tableTV[i]; + vertices.push_back(vertex); + } + } + if(x > 0 && map.get(x-1 , y) != mof::createColor(255 , 0 , 0)){ + //¶•ûŒü‚É•Ç + for(int i = 0 ; i < 6 ; i++){ + vertex.x = SCALE * x; + vertex.y = tableZ[5-i] + SCALE; + vertex.z = -SCALE * (y+1) + tableX[5-i]; + if(et::isWalkableColor(map.get(x-1 , y)))vertex.tu = tableTU[5-i] + 0.5f; + else vertex.tu = tableTU[5-i] - 0.25f; + vertex.tv = tableTV[5-i]; + vertices.push_back(vertex); + } + } + if(x < map.getWidth() && map.get(x+1 , y) != mof::createColor(255 , 0 , 0)){ + //‰E•ûŒü‚É•Ç + for(int i = 0 ; i < 6 ; i++){ + vertex.x = SCALE * (x+1); + vertex.y = tableZ[i] + SCALE; + vertex.z = -SCALE * (y+1) + tableX[i]; + if(et::isWalkableColor(map.get(x+1 , y)))vertex.tu = tableTU[i] + 0.5f; + else vertex.tu = tableTU[i] - 0.25f; + vertex.tv = tableTV[i]; + vertices.push_back(vertex); + } + } + } + else return; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.h b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.h index 08b66e8..28885ab 100644 --- a/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.h +++ b/saisei-1_0/rpg/rpg/oldcode/DungeonBuilderA.h @@ -1,20 +1,20 @@ -#pragma once -#include "DungeonBuilder.h" - -namespace et{ - - class DungeonBuilderA : - public DungeonBuilder - { - protected: - - virtual void addParts(std::vector& vertices , int x , int y); - public: - DungeonBuilderA(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale); - virtual ~DungeonBuilderA(void); - }; - - - - +#pragma once +#include "DungeonBuilder.h" + +namespace et{ + + class DungeonBuilderA : + public DungeonBuilder + { + protected: + + virtual void addParts(std::vector& vertices , int x , int y); + public: + DungeonBuilderA(mof::PixelMap& map , mof::TextureManager* pTextureManager , float scale); + virtual ~DungeonBuilderA(void); + }; + + + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/FightingMenu.cpp b/saisei-1_0/rpg/rpg/oldcode/FightingMenu.cpp index bfbcd1d..723e1c1 100644 --- a/saisei-1_0/rpg/rpg/oldcode/FightingMenu.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/FightingMenu.cpp @@ -1,104 +1,104 @@ -#include "FightingMenu.h" -#include "mof/KeyFrameAnimation.h" -#include "MyWindow.h" -#include "TargetMenu.h" -#include "IdealMenu.h" -#include "UsingBattleItemMenu.h" -#include "ItemMenu.h" -#include "BattlerGroup.h" -#include "BattlerFacade.h" - -et::FightingMenu::FightingMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) -: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) -{ - m_pBattleData = pBattleData; - - m_pSelector = NULL; - m_pTextureManager = pTextureManager; - std::vector selectables; - - mof::Window* pSelectable = NULL; - et::BattlerFacade* pHero = m_pBattleData->getBattlerGroup()->getHeroBattler(); - pSelectable = addSelectableTextItem(this , selectables , _T("‚±‚¤‚°‚«(AP-3)") , 16); - if(pHero->getParameter().actionPoint < 3)pSelectable->setAvailable(false); - pSelectable = addSelectableTextItem(this , selectables , _T("_—ì(AP-5)") , 16); - if(pHero->getParameter().actionPoint < 5)pSelectable->setAvailable(false); - pSelectable = addSelectableTextItem(this , selectables , _T("ƒAƒCƒeƒ€(AP-2)") , 16); - if(pHero->getParameter().actionPoint < 2)pSelectable->setAvailable(false); - pSelectable = addSelectableTextItem(this , selectables , _T("‚Ú‚¤‚¬‚å(AP-1)") , 16); - if(pHero->getParameter().actionPoint < 1)pSelectable->setAvailable(false); - m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); - setVisible(true); -} - -et::FightingMenu::~FightingMenu(void) -{ - delete m_pSelector; -} - - - - - -void et::FightingMenu::setVisible(bool visible){ - et::MyFrame::setVisible(visible); - if(visible){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(-200 ,370)); - pAnimation->setPosition(15 , mof::Vector2D(10 , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(10 , 370)); - pAnimation->setPosition(15 , mof::Vector2D(-200 , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } -} - -et::MyFrame* et::FightingMenu::performAction(){ - - switch(getSelectionModel()->getSelectingIndex()){ - case 0 : //‚±‚¤‚°‚« - { - et::BattleAction action; - action.type = et::BattleAction::ATTACK_WEAPON; - return new TargetMenu(m_pTextureManager , m_pBattleData , action , 160); - } - case 1 : //‚µ‚ñ‚ê‚¢ - return new IdealMenu(m_pTextureManager , m_pBattleData); - case 2 : //ƒAƒCƒeƒ€ - { - et::ItemOperatorFactory* pOperationMenuFactory = new UsingBattleItemMenuFactory(m_pTextureManager , m_pBattleData); - return new et::ItemMenu( m_pTextureManager , m_pBattleData->getItemList() , pOperationMenuFactory); - } - case 3 : //‚Ú‚¤‚¬‚å - { - et::BattleAction action; - action.type = et::BattleAction::GUARD; - //ƒK[ƒhó‘Ô‚É - et::BattlerParameter parameter = m_pBattleData->getBattlerGroup()->getHeroBattler()->getParameter(); - parameter.guard = true; - parameter.dActionPoint -= 1; - m_pBattleData->getBattlerGroup()->getHeroBattler()->setParameter(parameter); - m_pBattleData->setBattleAction(action); - return this; - } - default : - DEBUG_PRINT("–¢’è‹`‚̃AƒNƒVƒ‡ƒ“‚ª—v‹‚³‚ê‚Ü‚µ‚½"); - return NULL; - } -} - - - -mof::Window* et::FightingMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ - mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); - pOwner->add(pSelectable); - selectables.push_back(pSelectable); - return pSelectable; +#include "FightingMenu.h" +#include "mof/KeyFrameAnimation.h" +#include "MyWindow.h" +#include "TargetMenu.h" +#include "IdealMenu.h" +#include "UsingBattleItemMenu.h" +#include "ItemMenu.h" +#include "BattlerGroup.h" +#include "BattlerFacade.h" + +et::FightingMenu::FightingMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) +: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) +{ + m_pBattleData = pBattleData; + + m_pSelector = NULL; + m_pTextureManager = pTextureManager; + std::vector selectables; + + mof::Window* pSelectable = NULL; + et::BattlerFacade* pHero = m_pBattleData->getBattlerGroup()->getHeroBattler(); + pSelectable = addSelectableTextItem(this , selectables , _T("‚±‚¤‚°‚«(AP-3)") , 16); + if(pHero->getParameter().actionPoint < 3)pSelectable->setAvailable(false); + pSelectable = addSelectableTextItem(this , selectables , _T("_—ì(AP-5)") , 16); + if(pHero->getParameter().actionPoint < 5)pSelectable->setAvailable(false); + pSelectable = addSelectableTextItem(this , selectables , _T("ƒAƒCƒeƒ€(AP-2)") , 16); + if(pHero->getParameter().actionPoint < 2)pSelectable->setAvailable(false); + pSelectable = addSelectableTextItem(this , selectables , _T("‚Ú‚¤‚¬‚å(AP-1)") , 16); + if(pHero->getParameter().actionPoint < 1)pSelectable->setAvailable(false); + m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); + setVisible(true); +} + +et::FightingMenu::~FightingMenu(void) +{ + delete m_pSelector; +} + + + + + +void et::FightingMenu::setVisible(bool visible){ + et::MyFrame::setVisible(visible); + if(visible){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(-200 ,370)); + pAnimation->setPosition(15 , mof::Vector2D(10 , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(10 , 370)); + pAnimation->setPosition(15 , mof::Vector2D(-200 , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } +} + +et::MyFrame* et::FightingMenu::performAction(){ + + switch(getSelectionModel()->getSelectingIndex()){ + case 0 : //‚±‚¤‚°‚« + { + et::BattleAction action; + action.type = et::BattleAction::ATTACK_WEAPON; + return new TargetMenu(m_pTextureManager , m_pBattleData , action , 160); + } + case 1 : //‚µ‚ñ‚ê‚¢ + return new IdealMenu(m_pTextureManager , m_pBattleData); + case 2 : //ƒAƒCƒeƒ€ + { + et::ItemOperatorFactory* pOperationMenuFactory = new UsingBattleItemMenuFactory(m_pTextureManager , m_pBattleData); + return new et::ItemMenu( m_pTextureManager , m_pBattleData->getItemList() , pOperationMenuFactory); + } + case 3 : //‚Ú‚¤‚¬‚å + { + et::BattleAction action; + action.type = et::BattleAction::GUARD; + //ƒK[ƒhó‘Ô‚É + et::BattlerParameter parameter = m_pBattleData->getBattlerGroup()->getHeroBattler()->getParameter(); + parameter.guard = true; + parameter.dActionPoint -= 1; + m_pBattleData->getBattlerGroup()->getHeroBattler()->setParameter(parameter); + m_pBattleData->setBattleAction(action); + return this; + } + default : + DEBUG_PRINT("–¢’è‹`‚̃AƒNƒVƒ‡ƒ“‚ª—v‹‚³‚ê‚Ü‚µ‚½"); + return NULL; + } +} + + + +mof::Window* et::FightingMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ + mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); + pOwner->add(pSelectable); + selectables.push_back(pSelectable); + return pSelectable; } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/FightingMenu.h b/saisei-1_0/rpg/rpg/oldcode/FightingMenu.h index fdf5cc2..d59e9d9 100644 --- a/saisei-1_0/rpg/rpg/oldcode/FightingMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/FightingMenu.h @@ -1,24 +1,24 @@ -#pragma once -#include "MyFrame.h" -#include "mof/Texture.h" -#include "BattleData.h" - -namespace et{ - - class FightingMenu : public MyFrame - { - mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); - - mof::SelectionModel* m_pSelector; - mof::TextureManager* m_pTextureManager; - et::BattleData* m_pBattleData; - public: - FightingMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); - virtual ~FightingMenu(void); - virtual void setVisible(bool visible); - virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} - virtual MyFrame* performAction(); - }; - - +#pragma once +#include "MyFrame.h" +#include "mof/Texture.h" +#include "BattleData.h" + +namespace et{ + + class FightingMenu : public MyFrame + { + mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); + + mof::SelectionModel* m_pSelector; + mof::TextureManager* m_pTextureManager; + et::BattleData* m_pBattleData; + public: + FightingMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); + virtual ~FightingMenu(void); + virtual void setVisible(bool visible); + virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} + virtual MyFrame* performAction(); + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/FixedBattler.cpp b/saisei-1_0/rpg/rpg/oldcode/FixedBattler.cpp index 451a8de..7ac34e7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/FixedBattler.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/FixedBattler.cpp @@ -1,187 +1,187 @@ -#include "FixedBattler.h" -#include "mof/KeyFrameAnimation.h" -#include "AttackAction.h" -#include "SpecialAction.h" -#include "BattlerGroup.h" -#include "GameData.h" -#include "AttackAction.h" -#include "SpecialAction.h" - -et::FixedBattler::FixedBattler(BattlerType type , et::BattlerParameter& parameter , mof::TextureManager* pTextureManager , et::GameData* pGameData) -: BattlerFacade(type) , m_pGameData(pGameData) -{ - m_command.type = et::BattleAction::NONE; - setParameter(parameter); - - if(getType() == et::HERO){ - m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hero0.png"))); - } - else if(getType() == et::ENEMY){ - m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hd.png"))); - } - else if(getType() == et::IDEAL){ - m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/ideal.png"))); - } - - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setScale(0 , mof::Vector3D(0.3f , 0.3f , 0.3f)); - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - getGraphicsObject()->setAnimation( 0 , mof::AnimationResource(pAnimation)); - - -} - - - - -mof::AnimationResource et::FixedBattler::setMovingAnimation(mof::Vector3D& goal , int nFrame){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , getPosition()); - pAnimation->setPosition(nFrame-1 , goal); - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; -} - -mof::AnimationResource et::FixedBattler::setAidlingAnimation(mof::Vector3D& position ){ - if(!getParameter().alive){ - //‰½‚à•\Ž¦‚µ‚È‚¢ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); - pAnimation->setPosition(0 , position); - pAnimation->setTextureRectangle(0 , mof::Line2D(1 , 1 , 1 , 1)); - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - } - else if(getParameter().guard && getType() == et::HERO){ - //ƒK[ƒh - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); - pAnimation->setPosition(0 , position); - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 64*2 , 64 , 64*3)); - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); - pAnimation->setPosition(0 , position); - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - pAnimation->setTextureRectangle(15 , mof::Line2D(0 , 64 , 64 , 64*2)); - pAnimation->setTextureRectangle(30-1 , mof::Line2D(0 , 0 , 64 , 64)); - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - } -} - -mof::AnimationResource et::FixedBattler::setCastAnimation(int category){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - - if(category == 0){ - //’ʏíUŒ‚ - pAnimation->setPosition(0 , getPosition()); - pAnimation->setTextureRectangle(0 , mof::Line2D(64 , 0 , 128 , 64)); - pAnimation->setTextureRectangle(10 , mof::Line2D(64 , 64 , 128 , 64*2)); - pAnimation->setTextureRectangle(20 , mof::Line2D(64 , 128 , 128 , 64*3)); - pAnimation->setFinalKey(20); - } - else if(category == 1){ - pAnimation->setPosition(0 , getPosition()); - pAnimation->setTextureRectangle(0 , mof::Line2D(64*2 , 0 , 64*3 , 64)); - pAnimation->setTextureRectangle(40 , mof::Line2D(0 , 0 , 64 , 64)); - pAnimation->setFinalKey(20); - } - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; - -} - -mof::AnimationResource et::FixedBattler::setDamagedAnimation(int level){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - if(level == 0){ - //’ʏí - mof::Vector3D backPosition = getPosition(); - backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; - pAnimation->setPosition(0 , getPosition()); - pAnimation->setPosition(10 , backPosition); - pAnimation->setPosition(40 , backPosition); - pAnimation->setPosition(60 , getPosition()); - - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(16 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(26 , mof::Line2D(0 , 0 , 64 , 64)); - - } - else if(level == 1){ - //Ž€–S - - mof::Vector3D backPosition = getPosition(); - backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; - pAnimation->setPosition(0 , getPosition()); - pAnimation->setPosition(10 , backPosition); - - pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); - pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); - pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); - pAnimation->setTextureRectangle(25 , mof::Line2D(1 , 1 , 1 , 1)); - - } - mof::AnimationResource resource(pAnimation); - getGraphicsObject()->setAnimation( 1 , resource); - return resource; -} - -void et::FixedBattler::setBattleCommand(BattleAction& action){ - m_command = action; -} - -et::Action* et::FixedBattler::createAction(BattlerGroup* pGroup ){ - - if(m_command.type == et::BattleAction::ATTACK_WEAPON){ - return new AttackAction(this , m_command.pTarget , 3); - } - else if(m_command.type == et::BattleAction::WAIT || m_command.type == et::BattleAction::GUARD){ - return NULL; - } - else if(m_command.type == et::BattleAction::CAST){ - et::BattlerFacade* pIdeal = pGroup->getIdealBattlerAt(m_command.idealIndex); - et::BattlerParameter parameter = pIdeal->getParameter(); - parameter.dActionPoint -= 5; - pIdeal->setParameter(parameter); - std::vector targetList; - if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget); - else targetList = pGroup->getEnemyBattlerListAlive(); - - //“ÁŽê‹Z‚ÌŽí—ނ𓾂é - return new SpecialAction(this , targetList , 5 , m_command.idealIndex); - } - else if(m_command.type == et::BattleAction::USE_ITEM){ - //ƒAƒCƒeƒ€‚ð‚È‚­‚· - std::list &refList = m_pGameData->getBattleItemList(); - for(std::list::iterator itr = refList.begin() ; itr != refList.end() ; ++itr){ - if(m_command.pTargetItem == &(*itr)){ - refList.erase(itr); - break; - } - } - std::vector targetList; - if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget); - else targetList = pGroup->getEnemyBattlerListAlive(); - - //“ÁŽê‹Z‚ÌŽí—ނ𓾂é - return new SpecialAction(this , targetList , 2 , 3); - } - else return NULL; -} -/*et::Action* et::FixedBattler::createNextAction(std::list& enemy , std::list& ally){ -//if(pBattler->getParameter().actionPoint >= 3)return new AttackAction(pBattler , getHeroBattler() , 3 , 1.0f); - //else return NULL; - return NULL; +#include "FixedBattler.h" +#include "mof/KeyFrameAnimation.h" +#include "AttackAction.h" +#include "SpecialAction.h" +#include "BattlerGroup.h" +#include "GameData.h" +#include "AttackAction.h" +#include "SpecialAction.h" + +et::FixedBattler::FixedBattler(BattlerType type , et::BattlerParameter& parameter , mof::TextureManager* pTextureManager , et::GameData* pGameData) +: BattlerFacade(type) , m_pGameData(pGameData) +{ + m_command.type = et::BattleAction::NONE; + setParameter(parameter); + + if(getType() == et::HERO){ + m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hero0.png"))); + } + else if(getType() == et::ENEMY){ + m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/hd.png"))); + } + else if(getType() == et::IDEAL){ + m_pGraphicsObject = new mof::Billboard(mof::Billboard::Y_FIXED , pTextureManager->getResource(_T("image/ideal.png"))); + } + + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setScale(0 , mof::Vector3D(0.3f , 0.3f , 0.3f)); + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + getGraphicsObject()->setAnimation( 0 , mof::AnimationResource(pAnimation)); + + +} + + + + +mof::AnimationResource et::FixedBattler::setMovingAnimation(mof::Vector3D& goal , int nFrame){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , getPosition()); + pAnimation->setPosition(nFrame-1 , goal); + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; +} + +mof::AnimationResource et::FixedBattler::setAidlingAnimation(mof::Vector3D& position ){ + if(!getParameter().alive){ + //‰½‚à•\Ž¦‚µ‚È‚¢ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); + pAnimation->setPosition(0 , position); + pAnimation->setTextureRectangle(0 , mof::Line2D(1 , 1 , 1 , 1)); + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + } + else if(getParameter().guard && getType() == et::HERO){ + //ƒK[ƒh + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); + pAnimation->setPosition(0 , position); + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 64*2 , 64 , 64*3)); + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); + pAnimation->setPosition(0 , position); + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + pAnimation->setTextureRectangle(15 , mof::Line2D(0 , 64 , 64 , 64*2)); + pAnimation->setTextureRectangle(30-1 , mof::Line2D(0 , 0 , 64 , 64)); + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + } +} + +mof::AnimationResource et::FixedBattler::setCastAnimation(int category){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + + if(category == 0){ + //’ʏíUŒ‚ + pAnimation->setPosition(0 , getPosition()); + pAnimation->setTextureRectangle(0 , mof::Line2D(64 , 0 , 128 , 64)); + pAnimation->setTextureRectangle(10 , mof::Line2D(64 , 64 , 128 , 64*2)); + pAnimation->setTextureRectangle(20 , mof::Line2D(64 , 128 , 128 , 64*3)); + pAnimation->setFinalKey(20); + } + else if(category == 1){ + pAnimation->setPosition(0 , getPosition()); + pAnimation->setTextureRectangle(0 , mof::Line2D(64*2 , 0 , 64*3 , 64)); + pAnimation->setTextureRectangle(40 , mof::Line2D(0 , 0 , 64 , 64)); + pAnimation->setFinalKey(20); + } + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; + +} + +mof::AnimationResource et::FixedBattler::setDamagedAnimation(int level){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + if(level == 0){ + //’ʏí + mof::Vector3D backPosition = getPosition(); + backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; + pAnimation->setPosition(0 , getPosition()); + pAnimation->setPosition(10 , backPosition); + pAnimation->setPosition(40 , backPosition); + pAnimation->setPosition(60 , getPosition()); + + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(16 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(26 , mof::Line2D(0 , 0 , 64 , 64)); + + } + else if(level == 1){ + //Ž€–S + + mof::Vector3D backPosition = getPosition(); + backPosition.x += (getType() == et::ENEMY)? -0.1f : 0.1f; + pAnimation->setPosition(0 , getPosition()); + pAnimation->setPosition(10 , backPosition); + + pAnimation->setTextureRectangle(0 , mof::Line2D(0 , 0 , 64 , 64)); + pAnimation->setTextureRectangle(8 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(10 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(12 , mof::Line2D(64*3 , 0 , 256 , 64)); + pAnimation->setTextureRectangle(14 , mof::Line2D(1 , 1 , 1 , 1)); + pAnimation->setTextureRectangle(25 , mof::Line2D(1 , 1 , 1 , 1)); + + } + mof::AnimationResource resource(pAnimation); + getGraphicsObject()->setAnimation( 1 , resource); + return resource; +} + +void et::FixedBattler::setBattleCommand(BattleAction& action){ + m_command = action; +} + +et::Action* et::FixedBattler::createAction(BattlerGroup* pGroup ){ + + if(m_command.type == et::BattleAction::ATTACK_WEAPON){ + return new AttackAction(this , m_command.pTarget , 3); + } + else if(m_command.type == et::BattleAction::WAIT || m_command.type == et::BattleAction::GUARD){ + return NULL; + } + else if(m_command.type == et::BattleAction::CAST){ + et::BattlerFacade* pIdeal = pGroup->getIdealBattlerAt(m_command.idealIndex); + et::BattlerParameter parameter = pIdeal->getParameter(); + parameter.dActionPoint -= 5; + pIdeal->setParameter(parameter); + std::vector targetList; + if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget); + else targetList = pGroup->getEnemyBattlerListAlive(); + + //“ÁŽê‹Z‚ÌŽí—ނ𓾂é + return new SpecialAction(this , targetList , 5 , m_command.idealIndex); + } + else if(m_command.type == et::BattleAction::USE_ITEM){ + //ƒAƒCƒeƒ€‚ð‚È‚­‚· + std::list &refList = m_pGameData->getBattleItemList(); + for(std::list::iterator itr = refList.begin() ; itr != refList.end() ; ++itr){ + if(m_command.pTargetItem == &(*itr)){ + refList.erase(itr); + break; + } + } + std::vector targetList; + if(m_command.pTarget != NULL)targetList.push_back(m_command.pTarget); + else targetList = pGroup->getEnemyBattlerListAlive(); + + //“ÁŽê‹Z‚ÌŽí—ނ𓾂é + return new SpecialAction(this , targetList , 2 , 3); + } + else return NULL; +} +/*et::Action* et::FixedBattler::createNextAction(std::list& enemy , std::list& ally){ +//if(pBattler->getParameter().actionPoint >= 3)return new AttackAction(pBattler , getHeroBattler() , 3 , 1.0f); + //else return NULL; + return NULL; }*/ \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/FixedBattler.h b/saisei-1_0/rpg/rpg/oldcode/FixedBattler.h index 4bfdd6f..50114ed 100644 --- a/saisei-1_0/rpg/rpg/oldcode/FixedBattler.h +++ b/saisei-1_0/rpg/rpg/oldcode/FixedBattler.h @@ -1,29 +1,29 @@ -#pragma once -#include "BattlerFacade.h" -#include "BattlerType.h" -#include "BattleData.h" - -namespace et{ - class Action; - class GameData; - - class FixedBattler : public BattlerFacade - { - GameData* m_pGameData; - BattleAction m_command; - public: - - FixedBattler(BattlerType type , et::BattlerParameter& parameter , mof::TextureManager* pTextureManager , GameData* pGameData = NULL); - - virtual mof::AnimationResource setMovingAnimation(mof::Vector3D& goal , int nFrame); - virtual mof::AnimationResource setAidlingAnimation(mof::Vector3D& position); - virtual mof::AnimationResource setCastAnimation(int category); - virtual mof::AnimationResource setDamagedAnimation(int level); - virtual Action* createAction(BattlerGroup* pGroup ) ; - - void setBattleCommand(BattleAction& action); - }; - - -} - +#pragma once +#include "BattlerFacade.h" +#include "BattlerType.h" +#include "BattleData.h" + +namespace et{ + class Action; + class GameData; + + class FixedBattler : public BattlerFacade + { + GameData* m_pGameData; + BattleAction m_command; + public: + + FixedBattler(BattlerType type , et::BattlerParameter& parameter , mof::TextureManager* pTextureManager , GameData* pGameData = NULL); + + virtual mof::AnimationResource setMovingAnimation(mof::Vector3D& goal , int nFrame); + virtual mof::AnimationResource setAidlingAnimation(mof::Vector3D& position); + virtual mof::AnimationResource setCastAnimation(int category); + virtual mof::AnimationResource setDamagedAnimation(int level); + virtual Action* createAction(BattlerGroup* pGroup ) ; + + void setBattleCommand(BattleAction& action); + }; + + +} + diff --git a/saisei-1_0/rpg/rpg/oldcode/GameData.cpp b/saisei-1_0/rpg/rpg/oldcode/GameData.cpp index bc4da56..1e5ebed 100644 --- a/saisei-1_0/rpg/rpg/oldcode/GameData.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/GameData.cpp @@ -1,18 +1,18 @@ -#include "GameData.h" -#include - - -et::GameData::GameData(void) -{ - m_battleItemList.push_back(et::ItemData(_T("‚¢‚Ì‚¿‚̉ʎÀ") , _T("") , 20 , et::ItemData::POTION)); -} - -et::GameData::~GameData(void) -{ - -} - - -et::World* et::GameData::createWorld(){ - return new et::World(m_regenerationHistory); -} +#include "GameData.h" +#include + + +et::GameData::GameData(void) +{ + m_battleItemList.push_back(et::ItemData(_T("‚¢‚Ì‚¿‚̉ʎÀ") , _T("") , 20 , et::ItemData::POTION)); +} + +et::GameData::~GameData(void) +{ + +} + + +et::World* et::GameData::createWorld(){ + return new et::World(m_regenerationHistory); +} diff --git a/saisei-1_0/rpg/rpg/oldcode/GameData.h b/saisei-1_0/rpg/rpg/oldcode/GameData.h index 04198a1..3f88b19 100644 --- a/saisei-1_0/rpg/rpg/oldcode/GameData.h +++ b/saisei-1_0/rpg/rpg/oldcode/GameData.h @@ -1,28 +1,28 @@ -#pragma once -#include "Area.h" -#include "World.h" -#include "mof/Vector2D.h" -#include -#include -#include "ItemData.h" - - - -namespace et{ - - class GameData - { - std::vector m_regenerationHistory; - std::list m_battleItemList; - public: - GameData(void); - virtual ~GameData(void); - - et::World* createWorld(); - void addRegenerationEvent(RegenerationEvent& event){m_regenerationHistory.push_back(event);} - std::list& getBattleItemList(){return m_battleItemList;} - - }; - - +#pragma once +#include "Area.h" +#include "World.h" +#include "mof/Vector2D.h" +#include +#include +#include "ItemData.h" + + + +namespace et{ + + class GameData + { + std::vector m_regenerationHistory; + std::list m_battleItemList; + public: + GameData(void); + virtual ~GameData(void); + + et::World* createWorld(); + void addRegenerationEvent(RegenerationEvent& event){m_regenerationHistory.push_back(event);} + std::list& getBattleItemList(){return m_battleItemList;} + + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/GameScene.cpp b/saisei-1_0/rpg/rpg/oldcode/GameScene.cpp index 332887a..bbc1a74 100644 --- a/saisei-1_0/rpg/rpg/oldcode/GameScene.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/GameScene.cpp @@ -1,52 +1,52 @@ -#include "GameScene.h" - - - - - -et::GameScene::GameScene(void) -: mof::AbstractScene() -{ - m_pCapturer = NULL; - m_pGameData = NULL; - m_pInputReceiver = NULL; - m_pMeshManager = NULL; - m_pTextureManager = NULL; - m_pDataResourceManager = NULL; -} - -et::GameScene::~GameScene(void) -{ -} - - - -void et::GameScene::setMeshManager(mof::MeshManager* pMeshManager){ - m_pMeshManager = pMeshManager; - -} - -void et::GameScene::setTextureManager(mof::TextureManager* pTextureManager){ - m_pTextureManager = pTextureManager; - -} - -void et::GameScene::setDataResourceManager(mof::DataResourceManager* pDataResourceManager){ - m_pDataResourceManager = pDataResourceManager; -} - -void et::GameScene::setCapturer(mof::Capturer* pCapturer){ - m_pCapturer = pCapturer; -} - - -void et::GameScene::setGameData(GameData* pGameData){ - m_pGameData = pGameData; -} - - -void et::GameScene::setInputReceiver(mof::InputReceiver* pInputReceiver){ - m_pInputReceiver = pInputReceiver; - -} - +#include "GameScene.h" + + + + + +et::GameScene::GameScene(void) +: mof::AbstractScene() +{ + m_pCapturer = NULL; + m_pGameData = NULL; + m_pInputReceiver = NULL; + m_pMeshManager = NULL; + m_pTextureManager = NULL; + m_pDataResourceManager = NULL; +} + +et::GameScene::~GameScene(void) +{ +} + + + +void et::GameScene::setMeshManager(mof::MeshManager* pMeshManager){ + m_pMeshManager = pMeshManager; + +} + +void et::GameScene::setTextureManager(mof::TextureManager* pTextureManager){ + m_pTextureManager = pTextureManager; + +} + +void et::GameScene::setDataResourceManager(mof::DataResourceManager* pDataResourceManager){ + m_pDataResourceManager = pDataResourceManager; +} + +void et::GameScene::setCapturer(mof::Capturer* pCapturer){ + m_pCapturer = pCapturer; +} + + +void et::GameScene::setGameData(GameData* pGameData){ + m_pGameData = pGameData; +} + + +void et::GameScene::setInputReceiver(mof::InputReceiver* pInputReceiver){ + m_pInputReceiver = pInputReceiver; + +} + diff --git a/saisei-1_0/rpg/rpg/oldcode/GameScene.h b/saisei-1_0/rpg/rpg/oldcode/GameScene.h index c808887..df910b4 100644 --- a/saisei-1_0/rpg/rpg/oldcode/GameScene.h +++ b/saisei-1_0/rpg/rpg/oldcode/GameScene.h @@ -1,33 +1,33 @@ -#pragma once -#include "mof/AbstractScene.h" -#include "mof/Graphics.h" -#include "mof/InputReceiver.h" -#include "GameData.h" -#include "mof/Capturer.h" -#include "mof/DataTable.h" - -namespace et{ - class GameScene : - public mof::AbstractScene - { - protected: - mof::Capturer* m_pCapturer; - GameData* m_pGameData; - mof::InputReceiver* m_pInputReceiver; - mof::MeshManager* m_pMeshManager; - mof::TextureManager* m_pTextureManager; - mof::DataResourceManager* m_pDataResourceManager; - public: - GameScene(void); - virtual ~GameScene(void); - - void setMeshManager(mof::MeshManager* pMeshManager); - void setTextureManager(mof::TextureManager* pTextureManager); - void setGameData(GameData* pGameData); - void setCapturer(mof::Capturer* pCapturer); - void setInputReceiver(mof::InputReceiver* pInputReceiver); - void setDataResourceManager(mof::DataResourceManager* pDataResourceManager); - }; - - +#pragma once +#include "mof/AbstractScene.h" +#include "mof/Graphics.h" +#include "mof/InputReceiver.h" +#include "GameData.h" +#include "mof/Capturer.h" +#include "mof/DataTable.h" + +namespace et{ + class GameScene : + public mof::AbstractScene + { + protected: + mof::Capturer* m_pCapturer; + GameData* m_pGameData; + mof::InputReceiver* m_pInputReceiver; + mof::MeshManager* m_pMeshManager; + mof::TextureManager* m_pTextureManager; + mof::DataResourceManager* m_pDataResourceManager; + public: + GameScene(void); + virtual ~GameScene(void); + + void setMeshManager(mof::MeshManager* pMeshManager); + void setTextureManager(mof::TextureManager* pTextureManager); + void setGameData(GameData* pGameData); + void setCapturer(mof::Capturer* pCapturer); + void setInputReceiver(mof::InputReceiver* pInputReceiver); + void setDataResourceManager(mof::DataResourceManager* pDataResourceManager); + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/IdealMenu.cpp b/saisei-1_0/rpg/rpg/oldcode/IdealMenu.cpp index 8d98367..44a4e19 100644 --- a/saisei-1_0/rpg/rpg/oldcode/IdealMenu.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/IdealMenu.cpp @@ -1,91 +1,91 @@ -#include "IdealMenu.h" -#include "mof/KeyFrameAnimation.h" -#include "MyWindow.h" -#include "TargetMenu.h" -#include "BattlerGroup.h" -#include "BattlerFacade.h" - - -mof::Window* et::IdealMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ - mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); - pOwner->add(pSelectable); - selectables.push_back(pSelectable); - return pSelectable; -} - -et::IdealMenu::IdealMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) -: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) -{ - m_pBattleData = pBattleData; - - m_pSelector = NULL; - m_pTextureManager = pTextureManager; - std::vector selectables; - - mof::Window* pSelectable = NULL; - //_—ì‚̃ŠƒXƒgì¬ - for(std::vector::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ; - itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){ - if((*itr)->getType() != et::IDEAL || !(*itr)->getParameter().alive)continue; - pSelectable = addSelectableTextItem(this , selectables , (TCHAR*)(*itr)->getParameter().name.c_str() , 16); - if((*itr)->getParameter().actionPoint < 5)pSelectable->setAvailable(false); - - } - m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); - setVisible(true); -} - -et::IdealMenu::~IdealMenu(void) -{ - delete m_pSelector; -} - - - - - -void et::IdealMenu::setVisible(bool visible){ - et::MyFrame::setVisible(visible); - if(visible){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(160 ,500)); - pAnimation->setPosition(10 , mof::Vector2D(160 , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(160 , 370)); - pAnimation->setPosition(10 , mof::Vector2D(160 , 500)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } -} - -et::MyFrame* et::IdealMenu::performAction(){ - int index = getSelectionModel()->getSelectingIndex(); - et::BattleAction action; - action.type = et::BattleAction::CAST; - int cntIdeal = 0; - for(std::vector::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ; - itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){ - if((*itr)->getType() != et::IDEAL || !(*itr)->getParameter().alive)continue; - else if(index == cntIdeal++)action.idealIndex = index; - } - - if(action.idealIndex == 0)return new et::TargetMenu(m_pTextureManager , m_pBattleData , action , 300);//’P‘Ì - else if(action.idealIndex == 1){ - action.pTarget = NULL; - m_pBattleData->setBattleAction(action); - return this; - } - else if(action.idealIndex == 2){ - action.pTarget = m_pBattleData->getBattlerGroup()->getHeroBattler(); - m_pBattleData->setBattleAction(action); - return this; - } -} - - +#include "IdealMenu.h" +#include "mof/KeyFrameAnimation.h" +#include "MyWindow.h" +#include "TargetMenu.h" +#include "BattlerGroup.h" +#include "BattlerFacade.h" + + +mof::Window* et::IdealMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ + mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); + pOwner->add(pSelectable); + selectables.push_back(pSelectable); + return pSelectable; +} + +et::IdealMenu::IdealMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) +: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) +{ + m_pBattleData = pBattleData; + + m_pSelector = NULL; + m_pTextureManager = pTextureManager; + std::vector selectables; + + mof::Window* pSelectable = NULL; + //_—ì‚̃ŠƒXƒgì¬ + for(std::vector::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ; + itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){ + if((*itr)->getType() != et::IDEAL || !(*itr)->getParameter().alive)continue; + pSelectable = addSelectableTextItem(this , selectables , (TCHAR*)(*itr)->getParameter().name.c_str() , 16); + if((*itr)->getParameter().actionPoint < 5)pSelectable->setAvailable(false); + + } + m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); + setVisible(true); +} + +et::IdealMenu::~IdealMenu(void) +{ + delete m_pSelector; +} + + + + + +void et::IdealMenu::setVisible(bool visible){ + et::MyFrame::setVisible(visible); + if(visible){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(160 ,500)); + pAnimation->setPosition(10 , mof::Vector2D(160 , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(160 , 370)); + pAnimation->setPosition(10 , mof::Vector2D(160 , 500)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } +} + +et::MyFrame* et::IdealMenu::performAction(){ + int index = getSelectionModel()->getSelectingIndex(); + et::BattleAction action; + action.type = et::BattleAction::CAST; + int cntIdeal = 0; + for(std::vector::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ; + itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){ + if((*itr)->getType() != et::IDEAL || !(*itr)->getParameter().alive)continue; + else if(index == cntIdeal++)action.idealIndex = index; + } + + if(action.idealIndex == 0)return new et::TargetMenu(m_pTextureManager , m_pBattleData , action , 300);//’P‘Ì + else if(action.idealIndex == 1){ + action.pTarget = NULL; + m_pBattleData->setBattleAction(action); + return this; + } + else if(action.idealIndex == 2){ + action.pTarget = m_pBattleData->getBattlerGroup()->getHeroBattler(); + m_pBattleData->setBattleAction(action); + return this; + } +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/IdealMenu.h b/saisei-1_0/rpg/rpg/oldcode/IdealMenu.h index f132ad8..a2a45da 100644 --- a/saisei-1_0/rpg/rpg/oldcode/IdealMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/IdealMenu.h @@ -1,25 +1,25 @@ -#pragma once -#include "MyFrame.h" -#include "mof/Texture.h" -#include "BattleData.h" - -namespace et{ - - class IdealMenu : public MyFrame - { - mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); - - mof::SelectionModel* m_pSelector; - mof::TextureManager* m_pTextureManager; - et::BattleData* m_pBattleData; - - public: - IdealMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); - virtual ~IdealMenu(void); - virtual void setVisible(bool visible); - virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} - virtual MyFrame* performAction(); - }; - - +#pragma once +#include "MyFrame.h" +#include "mof/Texture.h" +#include "BattleData.h" + +namespace et{ + + class IdealMenu : public MyFrame + { + mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); + + mof::SelectionModel* m_pSelector; + mof::TextureManager* m_pTextureManager; + et::BattleData* m_pBattleData; + + public: + IdealMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); + virtual ~IdealMenu(void); + virtual void setVisible(bool visible); + virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} + virtual MyFrame* performAction(); + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.cpp b/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.cpp index 6d3e666..c9779e5 100644 --- a/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.cpp @@ -1,35 +1,35 @@ -#include "InputSymbolController.h" - - -et::InputSymbolController::InputSymbolController(mof::InputReceiver* pInput) -: SymbolController() -{ - m_pInput = pInput; -} - -et::InputSymbolController::~InputSymbolController(void) -{ -} - -void et::InputSymbolController::move(Symbol* pSymbol){ - - - mof::Vector3D nextPosition = pSymbol->getPosition(); - //‚Æ‚è‚ ‚¦‚¸ˆÚ“®‚³‚¹‚Ă݂āA•Ç‚ª‚«‚½‚çÃŽ~‚³‚¹‚é - if(m_pInput->checkKeyState(mof::InputReceiver::UP)){ - nextPosition.z += 0.15f; - pSymbol->move(et::Symbol::UP , nextPosition , 6); - } - else if(m_pInput->checkKeyState(mof::InputReceiver::DOWN)){ - nextPosition.z -= 0.15f; - pSymbol->move(et::Symbol::DOWN , nextPosition , 6); - } - else if(m_pInput->checkKeyState(mof::InputReceiver::LEFT)){ - nextPosition.x -= 0.15f; - pSymbol->move(et::Symbol::LEFT , nextPosition , 6); - } - else if(m_pInput->checkKeyState(mof::InputReceiver::RIGHT)){ - nextPosition.x += 0.15f; - pSymbol->move(et::Symbol::RIGHT , nextPosition , 6); - } -} +#include "InputSymbolController.h" + + +et::InputSymbolController::InputSymbolController(mof::InputReceiver* pInput) +: SymbolController() +{ + m_pInput = pInput; +} + +et::InputSymbolController::~InputSymbolController(void) +{ +} + +void et::InputSymbolController::move(Symbol* pSymbol){ + + + mof::Vector3D nextPosition = pSymbol->getPosition(); + //‚Æ‚è‚ ‚¦‚¸ˆÚ“®‚³‚¹‚Ă݂āA•Ç‚ª‚«‚½‚çÃŽ~‚³‚¹‚é + if(m_pInput->checkKeyState(mof::InputReceiver::UP)){ + nextPosition.z += 0.15f; + pSymbol->move(et::Symbol::UP , nextPosition , 6); + } + else if(m_pInput->checkKeyState(mof::InputReceiver::DOWN)){ + nextPosition.z -= 0.15f; + pSymbol->move(et::Symbol::DOWN , nextPosition , 6); + } + else if(m_pInput->checkKeyState(mof::InputReceiver::LEFT)){ + nextPosition.x -= 0.15f; + pSymbol->move(et::Symbol::LEFT , nextPosition , 6); + } + else if(m_pInput->checkKeyState(mof::InputReceiver::RIGHT)){ + nextPosition.x += 0.15f; + pSymbol->move(et::Symbol::RIGHT , nextPosition , 6); + } +} diff --git a/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.h b/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.h index c9b965b..01e0e9a 100644 --- a/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.h +++ b/saisei-1_0/rpg/rpg/oldcode/InputSymbolController.h @@ -1,17 +1,17 @@ -#pragma once -#include "SymbolController.h" -#include "mof/InputReceiver.h" - -namespace et{ - class InputSymbolController : public SymbolController - { - mof::InputReceiver* m_pInput; - virtual void move(Symbol* pSymbol); - public: - InputSymbolController(mof::InputReceiver* pInput); - virtual ~InputSymbolController(void); - - }; - - +#pragma once +#include "SymbolController.h" +#include "mof/InputReceiver.h" + +namespace et{ + class InputSymbolController : public SymbolController + { + mof::InputReceiver* m_pInput; + virtual void move(Symbol* pSymbol); + public: + InputSymbolController(mof::InputReceiver* pInput); + virtual ~InputSymbolController(void); + + }; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/ItemData.h b/saisei-1_0/rpg/rpg/oldcode/ItemData.h index e46ed97..eefcccb 100644 --- a/saisei-1_0/rpg/rpg/oldcode/ItemData.h +++ b/saisei-1_0/rpg/rpg/oldcode/ItemData.h @@ -1,32 +1,32 @@ -#pragma once -#include "mof/tstring.h" - -namespace et{ - struct ItemData - { - enum ItemType{ - POTION , ARMS - }; - - mof::tstring name; - mof::tstring explanation; - int effect; - ItemType type; - - ItemData() - : name(_T("")) , explanation(_T("")) , effect(0) , type(ItemData::POTION) - { - - } - - ItemData(const TCHAR* _name , const TCHAR* _explanation , const int _effect , ItemType _type) - : name(_name) , explanation(_explanation) , effect(_effect) , type(_type) - { - - } - - - }; - - +#pragma once +#include "mof/tstring.h" + +namespace et{ + struct ItemData + { + enum ItemType{ + POTION , ARMS + }; + + mof::tstring name; + mof::tstring explanation; + int effect; + ItemType type; + + ItemData() + : name(_T("")) , explanation(_T("")) , effect(0) , type(ItemData::POTION) + { + + } + + ItemData(const TCHAR* _name , const TCHAR* _explanation , const int _effect , ItemType _type) + : name(_name) , explanation(_explanation) , effect(_effect) , type(_type) + { + + } + + + }; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/ItemMenu.cpp b/saisei-1_0/rpg/rpg/oldcode/ItemMenu.cpp index d2d6ba4..cafa85b 100644 --- a/saisei-1_0/rpg/rpg/oldcode/ItemMenu.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/ItemMenu.cpp @@ -1,91 +1,91 @@ -#include "ItemMenu.h" -#include "mof/KeyFrameAnimation.h" -#include "MyWindow.h" -#include "TargetMenu.h" - - - -mof::Window* et::ItemMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ - mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); - pOwner->add(pSelectable); - selectables.push_back(pSelectable); - return pSelectable; -} - -et::ItemMenu::ItemMenu( mof::TextureManager* pTextureManager , std::list& itemDataList , et::ItemOperatorFactory* pNextMenuFactory ) -: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) , m_itemDataList(itemDataList) -{ - setColumn(2); - setPaddingX(10); - setPaddingY(5); - /*for(std::list::iterator itr = itemDataList.begin() ; itr != itemDataList.end() ; ++itr){ - m_itemDataList.push_back(*itr); - }*/ - m_pNextMenuFactory = pNextMenuFactory; - - m_pSelector = NULL; - m_pTextureManager = pTextureManager; - std::vector selectables; - - mof::Window* pSelectable = NULL; - //ƒAƒCƒeƒ€‚̃ŠƒXƒgì¬ - for(std::list::iterator itr = itemDataList.begin() ; itr != itemDataList.end() ; ++itr){ - pSelectable = addSelectableTextItem(this , selectables , (TCHAR*)(*itr).name.c_str() , 16); - } - - if(selectables.size() == 0){ - pSelectable = addSelectableTextItem(this , selectables , _T("@@@@@@@@") , 16); - pSelectable->setAvailable(false); - } - if(selectables.size() % 2 != 0){//—vC³ - pSelectable = addSelectableTextItem(this , selectables , _T("@@@@@@@@") , 16); - pSelectable->setAvailable(false); - } - m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource() , 2); - setVisible(true); -} - -et::ItemMenu::~ItemMenu(void) -{ - delete m_pSelector; - delete m_pNextMenuFactory; -} - - - - - -void et::ItemMenu::setVisible(bool visible){ - et::MyFrame::setVisible(visible); - if(visible){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(160 ,500)); - pAnimation->setPosition(10 , mof::Vector2D(160 , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(160 , 370)); - pAnimation->setPosition(10 , mof::Vector2D(160 , 500)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } -} - -et::MyFrame* et::ItemMenu::performAction(){ - if(m_itemDataList.empty())return this; - int index = getSelectionModel()->getSelectingIndex(); - - et::ItemOperationMenu* pOperationMenu = m_pNextMenuFactory->create(); - int i = 0; - for(std::list::iterator itr = m_itemDataList.begin() ; itr != m_itemDataList.end() ; ++itr , ++i){ - if(i == index)pOperationMenu->setTargetItem(&(*itr)); - - } - return pOperationMenu; -} - - +#include "ItemMenu.h" +#include "mof/KeyFrameAnimation.h" +#include "MyWindow.h" +#include "TargetMenu.h" + + + +mof::Window* et::ItemMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ + mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); + pOwner->add(pSelectable); + selectables.push_back(pSelectable); + return pSelectable; +} + +et::ItemMenu::ItemMenu( mof::TextureManager* pTextureManager , std::list& itemDataList , et::ItemOperatorFactory* pNextMenuFactory ) +: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) , m_itemDataList(itemDataList) +{ + setColumn(2); + setPaddingX(10); + setPaddingY(5); + /*for(std::list::iterator itr = itemDataList.begin() ; itr != itemDataList.end() ; ++itr){ + m_itemDataList.push_back(*itr); + }*/ + m_pNextMenuFactory = pNextMenuFactory; + + m_pSelector = NULL; + m_pTextureManager = pTextureManager; + std::vector selectables; + + mof::Window* pSelectable = NULL; + //ƒAƒCƒeƒ€‚̃ŠƒXƒgì¬ + for(std::list::iterator itr = itemDataList.begin() ; itr != itemDataList.end() ; ++itr){ + pSelectable = addSelectableTextItem(this , selectables , (TCHAR*)(*itr).name.c_str() , 16); + } + + if(selectables.size() == 0){ + pSelectable = addSelectableTextItem(this , selectables , _T("@@@@@@@@") , 16); + pSelectable->setAvailable(false); + } + if(selectables.size() % 2 != 0){//—vC³ + pSelectable = addSelectableTextItem(this , selectables , _T("@@@@@@@@") , 16); + pSelectable->setAvailable(false); + } + m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource() , 2); + setVisible(true); +} + +et::ItemMenu::~ItemMenu(void) +{ + delete m_pSelector; + delete m_pNextMenuFactory; +} + + + + + +void et::ItemMenu::setVisible(bool visible){ + et::MyFrame::setVisible(visible); + if(visible){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(160 ,500)); + pAnimation->setPosition(10 , mof::Vector2D(160 , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(160 , 370)); + pAnimation->setPosition(10 , mof::Vector2D(160 , 500)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } +} + +et::MyFrame* et::ItemMenu::performAction(){ + if(m_itemDataList.empty())return this; + int index = getSelectionModel()->getSelectingIndex(); + + et::ItemOperationMenu* pOperationMenu = m_pNextMenuFactory->create(); + int i = 0; + for(std::list::iterator itr = m_itemDataList.begin() ; itr != m_itemDataList.end() ; ++itr , ++i){ + if(i == index)pOperationMenu->setTargetItem(&(*itr)); + + } + return pOperationMenu; +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/ItemMenu.h b/saisei-1_0/rpg/rpg/oldcode/ItemMenu.h index cc68f69..8b7f077 100644 --- a/saisei-1_0/rpg/rpg/oldcode/ItemMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/ItemMenu.h @@ -1,26 +1,26 @@ -#pragma once -#include "MyFrame.h" -#include "mof/Texture.h" -#include "ItemOperationMenu.h" - -namespace et{ - - class ItemMenu : public MyFrame - { - mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); - - mof::SelectionModel* m_pSelector; - mof::TextureManager* m_pTextureManager; - - std::list& m_itemDataList; - et::ItemOperatorFactory* m_pNextMenuFactory; - public: - ItemMenu(mof::TextureManager* pTextureManager , std::list& itemDataList , et::ItemOperatorFactory* pNextMenuFactory); - virtual ~ItemMenu(void); - virtual void setVisible(bool visible); - virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} - virtual MyFrame* performAction(); - }; - - +#pragma once +#include "MyFrame.h" +#include "mof/Texture.h" +#include "ItemOperationMenu.h" + +namespace et{ + + class ItemMenu : public MyFrame + { + mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); + + mof::SelectionModel* m_pSelector; + mof::TextureManager* m_pTextureManager; + + std::list& m_itemDataList; + et::ItemOperatorFactory* m_pNextMenuFactory; + public: + ItemMenu(mof::TextureManager* pTextureManager , std::list& itemDataList , et::ItemOperatorFactory* pNextMenuFactory); + virtual ~ItemMenu(void); + virtual void setVisible(bool visible); + virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} + virtual MyFrame* performAction(); + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/ItemOperationMenu.h b/saisei-1_0/rpg/rpg/oldcode/ItemOperationMenu.h index 072e5ac..d29158b 100644 --- a/saisei-1_0/rpg/rpg/oldcode/ItemOperationMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/ItemOperationMenu.h @@ -1,28 +1,28 @@ -#pragma once -#include "MyFrame.h" -#include "mof/Texture.h" -#include "ItemData.h" - -namespace et{ - - - class ItemOperationMenu : public MyFrame - { - protected: - et::ItemData* m_pItemData; - - public: - ItemOperationMenu(mof::TextureResource& pTexture ) - : MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTexture) , m_pItemData(NULL){ - } - void setTargetItem(et::ItemData* pItemData){m_pItemData = pItemData;} - virtual ~ItemOperationMenu(void){;} - }; - - class ItemOperatorFactory{ - public: - virtual ~ItemOperatorFactory(){;} - virtual ItemOperationMenu* create() = 0; - }; - +#pragma once +#include "MyFrame.h" +#include "mof/Texture.h" +#include "ItemData.h" + +namespace et{ + + + class ItemOperationMenu : public MyFrame + { + protected: + et::ItemData* m_pItemData; + + public: + ItemOperationMenu(mof::TextureResource& pTexture ) + : MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTexture) , m_pItemData(NULL){ + } + void setTargetItem(et::ItemData* pItemData){m_pItemData = pItemData;} + virtual ~ItemOperationMenu(void){;} + }; + + class ItemOperatorFactory{ + public: + virtual ~ItemOperatorFactory(){;} + virtual ItemOperationMenu* create() = 0; + }; + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/MapBuilder.cpp b/saisei-1_0/rpg/rpg/oldcode/MapBuilder.cpp index f6d6116..49961f1 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MapBuilder.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/MapBuilder.cpp @@ -1,36 +1,36 @@ -#include "MapBuilder.h" -#include "mof/SoftVertexBufferImpl.h" -#include "mof/HardVertexBufferImpl.h" - - - -et::MapBuilder::MapBuilder( mof::TextureManager* pTextureManager , float scale , int width , int height) -: m_scale(scale) , m_pTextureManager(pTextureManager) , m_width(width) , m_height(height) -{ - -} - -et::MapBuilder::~MapBuilder(void) -{ -} - - - -et::MapBuffer* et::MapBuilder::create(){ - - - std::vector vertices; - - for(int x = 0 ; x < m_width ; x++){ - for(int y = 0 ; y < m_height ; y++){ - addParts(vertices , x , y); - } - } - - return new mof::SoftVertexBuffer(et::MapBuffer::PRIMITIVE_TYPE_TRIANGLELIST , vertices); -} - - -float et::MapBuilder::getScale(){ - return m_scale; +#include "MapBuilder.h" +#include "mof/SoftVertexBufferImpl.h" +#include "mof/HardVertexBufferImpl.h" + + + +et::MapBuilder::MapBuilder( mof::TextureManager* pTextureManager , float scale , int width , int height) +: m_scale(scale) , m_pTextureManager(pTextureManager) , m_width(width) , m_height(height) +{ + +} + +et::MapBuilder::~MapBuilder(void) +{ +} + + + +et::MapBuffer* et::MapBuilder::create(){ + + + std::vector vertices; + + for(int x = 0 ; x < m_width ; x++){ + for(int y = 0 ; y < m_height ; y++){ + addParts(vertices , x , y); + } + } + + return new mof::SoftVertexBuffer(et::MapBuffer::PRIMITIVE_TYPE_TRIANGLELIST , vertices); +} + + +float et::MapBuilder::getScale(){ + return m_scale; } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/MapBuilder.h b/saisei-1_0/rpg/rpg/oldcode/MapBuilder.h index c715fda..d13a705 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MapBuilder.h +++ b/saisei-1_0/rpg/rpg/oldcode/MapBuilder.h @@ -1,30 +1,30 @@ -#pragma once -#include -#include "mof/Graphics.h" - - -namespace et{ - typedef mof::VertexXYZCUV VertexTypeMap; - typedef mof::VertexBuffer MapBuffer; - class MapBuilder - { - - float m_scale; - int m_width; - int m_height; - - protected : - mof::TextureManager* m_pTextureManager; - virtual void addParts(std::vector& vertices , int x , int y) = 0; - public: - MapBuilder( mof::TextureManager* pTextureManager , float scale , int width , int height); - virtual ~MapBuilder(void); - MapBuffer* create(); - float getScale(); - - int getWidth(){return m_width;} - int getHeight(){return m_height;} - }; - - +#pragma once +#include +#include "mof/Graphics.h" + + +namespace et{ + typedef mof::VertexXYZCUV VertexTypeMap; + typedef mof::VertexBuffer MapBuffer; + class MapBuilder + { + + float m_scale; + int m_width; + int m_height; + + protected : + mof::TextureManager* m_pTextureManager; + virtual void addParts(std::vector& vertices , int x , int y) = 0; + public: + MapBuilder( mof::TextureManager* pTextureManager , float scale , int width , int height); + virtual ~MapBuilder(void); + MapBuffer* create(); + float getScale(); + + int getWidth(){return m_width;} + int getHeight(){return m_height;} + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/MapImageColor.h b/saisei-1_0/rpg/rpg/oldcode/MapImageColor.h index 6898a6a..80e0548 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MapImageColor.h +++ b/saisei-1_0/rpg/rpg/oldcode/MapImageColor.h @@ -1,14 +1,14 @@ -#pragma once -#include "mof/Color.h" - -namespace et{ - - bool inline isWalkableColor(mof::Color color){ - if(color == mof::createColor(255 , 255 , 255) || - color == mof::createColor(0 , 255 , 0))return true; - else return false; - } - - - +#pragma once +#include "mof/Color.h" + +namespace et{ + + bool inline isWalkableColor(mof::Color color){ + if(color == mof::createColor(255 , 255 , 255) || + color == mof::createColor(0 , 255 , 0))return true; + else return false; + } + + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/Menu.hpp~ b/saisei-1_0/rpg/rpg/oldcode/Menu.hpp~ index b2284e7..c185a9d 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Menu.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/Menu.hpp~ @@ -1,39 +1,39 @@ -#pragma once -#include -#include -#include "mof/MenuView.hpp" -#include "mof/MenuItemInfo.hpp" - -namespace mof{ - - class LayoutManager; - class WidgetView; - - class Menu : boost::noncopyable{ - struct Impl; - boost::scoped_ptr m_pImpl; - public: - - typedef boost::function0 Action; - struct MenuItem{ - MenuView* pView; - Action action; - }; - - Menu( - mof::WidgetView* pBackgroundView , - const tstring& front , const tstring& back , - ); - ~Menu(); - FrameNumber show(bool imidiately = false); - FrameNumber hide(bool imidiately = false); - void up(); - void down(); - void left(); - void right(); - void performAction() const; - void draw() const; - void update(); - - }; -} +#pragma once +#include +#include +#include "mof/MenuView.hpp" +#include "mof/MenuItemInfo.hpp" + +namespace mof{ + + class LayoutManager; + class WidgetView; + + class Menu : boost::noncopyable{ + struct Impl; + boost::scoped_ptr m_pImpl; + public: + + typedef boost::function0 Action; + struct MenuItem{ + MenuView* pView; + Action action; + }; + + Menu( + mof::WidgetView* pBackgroundView , + const tstring& front , const tstring& back , + ); + ~Menu(); + FrameNumber show(bool imidiately = false); + FrameNumber hide(bool imidiately = false); + void up(); + void down(); + void left(); + void right(); + void performAction() const; + void draw() const; + void update(); + + }; +} diff --git a/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp b/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp index 22e15f2..e66c8aa 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp +++ b/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp @@ -1,12 +1,12 @@ -#pragma once -#include "mof/tstring.hpp" - -namespace mof{ - - struct MenuItemInfo{ - int id; - mof::tstring caption; - }; - - -} +#pragma once +#include "mof/tstring.hpp" + +namespace mof{ + + struct MenuItemInfo{ + int id; + mof::tstring caption; + }; + + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp~ b/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp~ index aebd356..1bcb02a 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/MenuItemInfo.hpp~ @@ -1,12 +1,12 @@ -#pragma once -#include "mof/tstring.hpp" - -namespace mof{ - - struct MenuItemInfo{ - int id; - mof::tstring caption; - }; - - +#pragma once +#include "mof/tstring.hpp" + +namespace mof{ + + struct MenuItemInfo{ + int id; + mof::tstring caption; + }; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/MenuView.hpp~ b/saisei-1_0/rpg/rpg/oldcode/MenuView.hpp~ index 0b7be63..7047b89 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MenuView.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/MenuView.hpp~ @@ -1,37 +1,37 @@ -#pragma once -#include -#include -#include "mof/tstring.hpp" -#include "mof/Animation.hpp" -#include "mof/Matrix2D.hpp" -#include "mof/Rectangle.hpp" - -namespace mof{ - - struct MenuItemInfo; - struct Vector2D; - class Effect; - - struct MenuState{ - mof::Animation::Handler worldTransform; - }; - - class MenuView : boost::noncopyable{ - public: - virtual ~MenuView(){} - virtual mof::Rectangle initialize() = 0; - virtual void show() = 0; - virtual void close() = 0; - virtual void focus() = 0; - virtual void blur() = 0; - virtual void setPosition( - const mof::Animation::Handler& handler - ) = 0; - virtual const mof::Effect* getEffect() const = 0; - virtual void update() = 0; - - - }; - - -} +#pragma once +#include +#include +#include "mof/tstring.hpp" +#include "mof/Animation.hpp" +#include "mof/Matrix2D.hpp" +#include "mof/Rectangle.hpp" + +namespace mof{ + + struct MenuItemInfo; + struct Vector2D; + class Effect; + + struct MenuState{ + mof::Animation::Handler worldTransform; + }; + + class MenuView : boost::noncopyable{ + public: + virtual ~MenuView(){} + virtual mof::Rectangle initialize() = 0; + virtual void show() = 0; + virtual void close() = 0; + virtual void focus() = 0; + virtual void blur() = 0; + virtual void setPosition( + const mof::Animation::Handler& handler + ) = 0; + virtual const mof::Effect* getEffect() const = 0; + virtual void update() = 0; + + + }; + + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp b/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp index b86c344..b7b376d 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp +++ b/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp @@ -1,67 +1,67 @@ -#pragma once -#include - -namespace mof{ - - - class MenuWidget - { - public: - virtual ~MenuWidget(){} - virtual FrameNumber show(bool imidiately = false) = 0; - virtual FrameNumber hide(bool imidiately = false) = 0; - virtual const WidgetView& getView() const = 0; - virtual WidgetView& getView() = 0; - virtual void update() = 0; - - virtual void up() = 0; - virtual void down() = 0; - virtual void left() = 0; - virtual void right() = 0; - virtual void performAction() const = 0; - - }; - -} -/* -#pragma once -#include -#include -#include "mof/MenuView.hpp" -#include "mof/MenuItemInfo.hpp" - -namespace mof{ - - class LayoutManager; - class WidgetView; - - class Menu : boost::noncopyable{ - struct Impl; - boost::scoped_ptr m_pImpl; - public: - - typedef boost::function0 Action; - struct MenuItem{ - MenuView* pView; - Action action; - }; - - Menu( - mof::WidgetView* pBackgroundView , - const tstring& front , const tstring& back , - ); - ~Menu(); - FrameNumber show(bool imidiately = false); - FrameNumber hide(bool imidiately = false); - void up(); - void down(); - void left(); - void right(); - void performAction() const; - void draw() const; - void update(); - - }; -} - -*/ +#pragma once +#include + +namespace mof{ + + + class MenuWidget + { + public: + virtual ~MenuWidget(){} + virtual FrameNumber show(bool imidiately = false) = 0; + virtual FrameNumber hide(bool imidiately = false) = 0; + virtual const WidgetView& getView() const = 0; + virtual WidgetView& getView() = 0; + virtual void update() = 0; + + virtual void up() = 0; + virtual void down() = 0; + virtual void left() = 0; + virtual void right() = 0; + virtual void performAction() const = 0; + + }; + +} +/* +#pragma once +#include +#include +#include "mof/MenuView.hpp" +#include "mof/MenuItemInfo.hpp" + +namespace mof{ + + class LayoutManager; + class WidgetView; + + class Menu : boost::noncopyable{ + struct Impl; + boost::scoped_ptr m_pImpl; + public: + + typedef boost::function0 Action; + struct MenuItem{ + MenuView* pView; + Action action; + }; + + Menu( + mof::WidgetView* pBackgroundView , + const tstring& front , const tstring& back , + ); + ~Menu(); + FrameNumber show(bool imidiately = false); + FrameNumber hide(bool imidiately = false); + void up(); + void down(); + void left(); + void right(); + void performAction() const; + void draw() const; + void update(); + + }; +} + +*/ diff --git a/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp~ b/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp~ index a06157b..14edab1 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/MenuWidget.hpp~ @@ -1,67 +1,67 @@ -#pragma once -#include - -namespace mof{ - - - class MenuWidget - { - public: - virtual ~MenuWidget(){} - virtual FrameNumber show(bool imidiately = false) = 0; - virtual FrameNumber hide(bool imidiately = false) = 0; - virtual const WidgetView& getView() const = 0; - virtual WidgetView& getView() = 0; - virtual void update() = 0; - - virtual void up(); - virtual void down(); - virtual void left(); - virtual void right(); - virtual void performAction() const; - - }; - -} -/* -#pragma once -#include -#include -#include "mof/MenuView.hpp" -#include "mof/MenuItemInfo.hpp" - -namespace mof{ - - class LayoutManager; - class WidgetView; - - class Menu : boost::noncopyable{ - struct Impl; - boost::scoped_ptr m_pImpl; - public: - - typedef boost::function0 Action; - struct MenuItem{ - MenuView* pView; - Action action; - }; - - Menu( - mof::WidgetView* pBackgroundView , - const tstring& front , const tstring& back , - ); - ~Menu(); - FrameNumber show(bool imidiately = false); - FrameNumber hide(bool imidiately = false); - void up(); - void down(); - void left(); - void right(); - void performAction() const; - void draw() const; - void update(); - - }; -} - -*/ +#pragma once +#include + +namespace mof{ + + + class MenuWidget + { + public: + virtual ~MenuWidget(){} + virtual FrameNumber show(bool imidiately = false) = 0; + virtual FrameNumber hide(bool imidiately = false) = 0; + virtual const WidgetView& getView() const = 0; + virtual WidgetView& getView() = 0; + virtual void update() = 0; + + virtual void up(); + virtual void down(); + virtual void left(); + virtual void right(); + virtual void performAction() const; + + }; + +} +/* +#pragma once +#include +#include +#include "mof/MenuView.hpp" +#include "mof/MenuItemInfo.hpp" + +namespace mof{ + + class LayoutManager; + class WidgetView; + + class Menu : boost::noncopyable{ + struct Impl; + boost::scoped_ptr m_pImpl; + public: + + typedef boost::function0 Action; + struct MenuItem{ + MenuView* pView; + Action action; + }; + + Menu( + mof::WidgetView* pBackgroundView , + const tstring& front , const tstring& back , + ); + ~Menu(); + FrameNumber show(bool imidiately = false); + FrameNumber hide(bool imidiately = false); + void up(); + void down(); + void left(); + void right(); + void performAction() const; + void draw() const; + void update(); + + }; +} + +*/ diff --git a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp index d19a64c..7ceeb28 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp @@ -1,108 +1,108 @@ -#include "MyInstructionSet.hpp" -//#include "mof/ImageTileWidgetView.hpp" -#include "mof/utilities.hpp" -#include "mof/LayoutManager.hpp" -#include "mof/Deleter.hpp" -#include "mof/mofInput.hpp" -#include "mof/mofGraphics.hpp" -#include -#include "mof/EventScheduler.hpp" -#include -#include "mof/ConsoleIO.hpp" -#include "mof/widgets.hpp" - -struct MyInstructionSet::Impl -{ - std::list > inactiveResources; - mof::EventScheduler scheduler; - std::list > messages; - - Impl() - { - } - - ~Impl() - { - } - - -}; - -MyInstructionSet::MyInstructionSet( ) -: m_pImpl(new Impl() ) -{ -} - - -MyInstructionSet::~MyInstructionSet( ) -{ -} -//{{{ createMessageWidget -std::shared_ptr -MyInstructionSet::createMessageWidget( ) -{ - mof::LayoutManager* pLayout = new mof::LayoutManager( mof::LayoutManager::HORIZONTAL , 1); - mof::WidgetView* pBackgroundView = new mof::ImageTileWidgetView( _T("image/frame0.png") ); - - - std::shared_ptr p - ( - new mof::MessageWidget - ( - pBackgroundView , - mof::Rectangle(70+20 , 300 , 570+20 , 450) , pLayout - ) - ); - - m_pImpl->messages.push_back(p); - return p; - -} -//}}} -//{{{ addMessageWidgetPage -int -MyInstructionSet::addMessageWidgetPage -( - std::shared_ptr& message , - const mof::tstring &title , - const mof::tstring &text -) -{ - mof::PageRequest page(text , mof::Font(_T("”~UIƒSƒVƒbƒN") , 25) ); - message->addPage( page ); - return 30;// TODO ƒy[ƒWŠJ‚­‚Ì‚É‚©‚©‚鎞ŠÔ -} -//}}} - -void MyInstructionSet::inactive( std::shared_ptr& message ) -{ - - /*mof::Deleter del(message); - - m_pImpl->inactiveResources.push_back(del.getWeak()); - m_pImpl->scheduler.addEvent( 40 , del );*/ - //m_pImpl->scheduler.addEvent( 40 , boost::bind( &mof::Interpreter::doNextCommand , this ) ); -} - -void MyInstructionSet::update( ) -{ - m_pImpl->scheduler.update( ); - foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) - { - if(resource.lock())resource.lock()->update(); - } -} - -void MyInstructionSet::draw() const -{ - foreach(std::shared_ptr& resource , m_pImpl->messages ) - { - resource->draw(); - } - foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) - { - if(resource.lock())resource.lock()->draw(); - } -} - - +#include "MyInstructionSet.hpp" +//#include "mof/ImageTileWidgetView.hpp" +#include "mof/utilities.hpp" +#include "mof/LayoutManager.hpp" +#include "mof/Deleter.hpp" +#include "mof/mofInput.hpp" +#include "mof/mofGraphics.hpp" +#include +#include "mof/EventScheduler.hpp" +#include +#include "mof/ConsoleIO.hpp" +#include "mof/widgets.hpp" + +struct MyInstructionSet::Impl +{ + std::list > inactiveResources; + mof::EventScheduler scheduler; + std::list > messages; + + Impl() + { + } + + ~Impl() + { + } + + +}; + +MyInstructionSet::MyInstructionSet( ) +: m_pImpl(new Impl() ) +{ +} + + +MyInstructionSet::~MyInstructionSet( ) +{ +} +//{{{ createMessageWidget +std::shared_ptr +MyInstructionSet::createMessageWidget( ) +{ + mof::LayoutManager* pLayout = new mof::LayoutManager( mof::LayoutManager::HORIZONTAL , 1); + mof::WidgetView* pBackgroundView = new mof::ImageTileWidgetView( _T("image/frame0.png") ); + + + std::shared_ptr p + ( + new mof::MessageWidget + ( + pBackgroundView , + mof::Rectangle(70+20 , 300 , 570+20 , 450) , pLayout + ) + ); + + m_pImpl->messages.push_back(p); + return p; + +} +//}}} +//{{{ addMessageWidgetPage +int +MyInstructionSet::addMessageWidgetPage +( + std::shared_ptr& message , + const mof::tstring &title , + const mof::tstring &text +) +{ + mof::PageRequest page(text , mof::Font(_T("”~UIƒSƒVƒbƒN") , 25) ); + message->addPage( page ); + return 30;// TODO ƒy[ƒWŠJ‚­‚Ì‚É‚©‚©‚鎞ŠÔ +} +//}}} + +void MyInstructionSet::inactive( std::shared_ptr& message ) +{ + + /*mof::Deleter del(message); + + m_pImpl->inactiveResources.push_back(del.getWeak()); + m_pImpl->scheduler.addEvent( 40 , del );*/ + //m_pImpl->scheduler.addEvent( 40 , boost::bind( &mof::Interpreter::doNextCommand , this ) ); +} + +void MyInstructionSet::update( ) +{ + m_pImpl->scheduler.update( ); + foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) + { + if(resource.lock())resource.lock()->update(); + } +} + +void MyInstructionSet::draw() const +{ + foreach(std::shared_ptr& resource , m_pImpl->messages ) + { + resource->draw(); + } + foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) + { + if(resource.lock())resource.lock()->draw(); + } +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp~ b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp~ index e8ba774..17ee2ce 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.cpp~ @@ -1,108 +1,108 @@ -#include "MyInstructionSet.hpp" -#include "mof/ImageTileWidgetView.hpp" -#include "mof/utilities.hpp" -#include "mof/LayoutManager.hpp" -#include "mof/Deleter.hpp" -#include "mof/mofInput.hpp" -#include "mof/mofGraphics.hpp" -#include -#include "mof/EventScheduler.hpp" -#include -#include "mof/ConsoleIO.hpp" -#include "mof/widgets.hpp" - -struct MyInstructionSet::Impl -{ - std::list > inactiveResources; - mof::EventScheduler scheduler; - std::list > messages; - - Impl() - { - } - - ~Impl() - { - } - - -}; - -MyInstructionSet::MyInstructionSet( ) -: m_pImpl(new Impl() ) -{ -} - - -MyInstructionSet::~MyInstructionSet( ) -{ -} -//{{{ createMessageWidget -boost::shared_ptr -MyInstructionSet::createMessageWidget( ) -{ - mof::LayoutManager* pLayout = new mof::LayoutManager( mof::LayoutManager::HORIZONTAL , 1); - mof::WidgetView* pBackgroundView = new mof::ImageTileWidgetView( _T("image/frame0.png") ); - - - boost::shared_ptr p - ( - new mof::MessageWidget - ( - pBackgroundView , - mof::Rectangle(70+20 , 300 , 570+20 , 450) , pLayout - ) - ); - - m_pImpl->messages.push_back(p); - return p; - -} -//}}} -//{{{ addMessageWidgetPage -int -MyInstructionSet::addMessageWidgetPage -( - boost::shared_ptr& message , - const mof::tstring &title , - const mof::tstring &text -) -{ - mof::PageRequest page(text , mof::Font(_T("”~UIƒSƒVƒbƒN") , 25) ); - message->addPage( page ); - return 30;// TODO ƒy[ƒWŠJ‚­‚Ì‚É‚©‚©‚鎞ŠÔ -} -//}}} - -void MyInstructionSet::inactive( boost::shared_ptr& message ) -{ - - /*mof::Deleter del(message); - - m_pImpl->inactiveResources.push_back(del.getWeak()); - m_pImpl->scheduler.addEvent( 40 , del );*/ - //m_pImpl->scheduler.addEvent( 40 , boost::bind( &mof::Interpreter::doNextCommand , this ) ); -} - -void MyInstructionSet::update( ) -{ - m_pImpl->scheduler.update( ); - foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) - { - if(resource.lock())resource.lock()->update(); - } -} - -void MyInstructionSet::draw() const -{ - foreach(boost::shared_ptr& resource , m_pImpl->messages ) - { - resource->draw(); - } - foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) - { - if(resource.lock())resource.lock()->draw(); - } -} - - +#include "MyInstructionSet.hpp" +#include "mof/ImageTileWidgetView.hpp" +#include "mof/utilities.hpp" +#include "mof/LayoutManager.hpp" +#include "mof/Deleter.hpp" +#include "mof/mofInput.hpp" +#include "mof/mofGraphics.hpp" +#include +#include "mof/EventScheduler.hpp" +#include +#include "mof/ConsoleIO.hpp" +#include "mof/widgets.hpp" + +struct MyInstructionSet::Impl +{ + std::list > inactiveResources; + mof::EventScheduler scheduler; + std::list > messages; + + Impl() + { + } + + ~Impl() + { + } + + +}; + +MyInstructionSet::MyInstructionSet( ) +: m_pImpl(new Impl() ) +{ +} + + +MyInstructionSet::~MyInstructionSet( ) +{ +} +//{{{ createMessageWidget +boost::shared_ptr +MyInstructionSet::createMessageWidget( ) +{ + mof::LayoutManager* pLayout = new mof::LayoutManager( mof::LayoutManager::HORIZONTAL , 1); + mof::WidgetView* pBackgroundView = new mof::ImageTileWidgetView( _T("image/frame0.png") ); + + + boost::shared_ptr p + ( + new mof::MessageWidget + ( + pBackgroundView , + mof::Rectangle(70+20 , 300 , 570+20 , 450) , pLayout + ) + ); + + m_pImpl->messages.push_back(p); + return p; + +} +//}}} +//{{{ addMessageWidgetPage +int +MyInstructionSet::addMessageWidgetPage +( + boost::shared_ptr& message , + const mof::tstring &title , + const mof::tstring &text +) +{ + mof::PageRequest page(text , mof::Font(_T("”~UIƒSƒVƒbƒN") , 25) ); + message->addPage( page ); + return 30;// TODO ƒy[ƒWŠJ‚­‚Ì‚É‚©‚©‚鎞ŠÔ +} +//}}} + +void MyInstructionSet::inactive( boost::shared_ptr& message ) +{ + + /*mof::Deleter del(message); + + m_pImpl->inactiveResources.push_back(del.getWeak()); + m_pImpl->scheduler.addEvent( 40 , del );*/ + //m_pImpl->scheduler.addEvent( 40 , boost::bind( &mof::Interpreter::doNextCommand , this ) ); +} + +void MyInstructionSet::update( ) +{ + m_pImpl->scheduler.update( ); + foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) + { + if(resource.lock())resource.lock()->update(); + } +} + +void MyInstructionSet::draw() const +{ + foreach(boost::shared_ptr& resource , m_pImpl->messages ) + { + resource->draw(); + } + foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) + { + if(resource.lock())resource.lock()->draw(); + } +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp index 6d01175..4839f05 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp +++ b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp @@ -1,33 +1,33 @@ -#pragma once -#include "mof/InstructionSet.hpp" -#include - - -class MyInstructionSet : public mof::InstructionSet -{ - -public: - - virtual boost::shared_ptr createMessageWidget( ); - - virtual int addMessageWidgetPage - ( - boost::shared_ptr& message , - const mof::tstring& title , - const mof::tstring& text - ); - - virtual void inactive( boost::shared_ptr& message ); - - MyInstructionSet( ); - virtual ~MyInstructionSet(); - - void update(); - void draw() const; - -private: - struct Impl; - boost::scoped_ptr m_pImpl; - -}; - +#pragma once +#include "mof/InstructionSet.hpp" +#include + + +class MyInstructionSet : public mof::InstructionSet +{ + +public: + + virtual boost::shared_ptr createMessageWidget( ); + + virtual int addMessageWidgetPage + ( + boost::shared_ptr& message , + const mof::tstring& title , + const mof::tstring& text + ); + + virtual void inactive( boost::shared_ptr& message ); + + MyInstructionSet( ); + virtual ~MyInstructionSet(); + + void update(); + void draw() const; + +private: + struct Impl; + boost::scoped_ptr m_pImpl; + +}; + diff --git a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp~ b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp~ index e56bdb2..defd588 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/MyInstructionSet.hpp~ @@ -1,32 +1,32 @@ -#pragma once -#include "mof/InstructionSet.hpp" -#include - - -class MyInstructionSet : public mof::InstructionSet -{ - - private: - struct Impl; - boost::scoped_ptr m_pImpl; - - virtual boost::shared_ptr createMessageWidget( ); - - virtual int addMessageWidgetPage - ( - boost::shared_ptr& message , - const mof::tstring& title , - const mof::tstring& text - ); - - virtual void inactive( boost::shared_ptr& message ); - -public: - MyInstructionSet( ); - virtual ~MyInstructionSet(); - - void update(); - void draw() const; - -}; - +#pragma once +#include "mof/InstructionSet.hpp" +#include + + +class MyInstructionSet : public mof::InstructionSet +{ + + private: + struct Impl; + boost::scoped_ptr m_pImpl; + + virtual boost::shared_ptr createMessageWidget( ); + + virtual int addMessageWidgetPage + ( + boost::shared_ptr& message , + const mof::tstring& title , + const mof::tstring& text + ); + + virtual void inactive( boost::shared_ptr& message ); + +public: + MyInstructionSet( ); + virtual ~MyInstructionSet(); + + void update(); + void draw() const; + +}; + diff --git a/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.cpp~ b/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.cpp~ index 09a0cb0..d05eac9 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.cpp~ @@ -1,99 +1,99 @@ -#include "MyInterpreter.hpp" -#include "mof/ImageTileWidgetView.hpp" -#include "mof/utilities.hpp" -#include "mof/LayoutManager.hpp" -#include "mof/Deleter.hpp" -#include "mof/mofInput.hpp" -#include "mof/mofGraphics.hpp" -#include -#include "mof/EventScheduler.hpp" -#include -#include "mof/ConsoleIO.hpp" - -struct MyInterpreter::Impl -{ - std::list > inactiveResources; - mof::EventScheduler scheduler; - std::list > messages; - - Impl() - { - } - - ~Impl() - { - } - - -}; - -MyInterpreter::MyInterpreter( ) -: m_pImpl(new Impl() ) -{ -} - - -MyInterpreter::~MyInterpreter() -{ -} - -boost::shared_ptr -MyInterpreter::createMessageWidget(const mof::tstring &title, const mof::tstring &text) -{ - mof::LayoutManager* pLayout = new mof::LayoutManager(10 , 35 , mof::LayoutManager::HORIZONTAL , 1); - mof::WidgetView* pBackgroundView = new mof::ImageTileWidgetView( _T("image/frame0.png") , title); - - std::vector pages; - - //foreach(const mof::tstring& text , text) - //{ - mof::MessageWidget::Page tmp(text , mof::Font(_T("”~UIƒSƒVƒbƒN") , 25) ); - pages.push_back(tmp); - //} - - boost::shared_ptr p - ( - new mof::MessageWidget - ( - pBackgroundView , - pages.front() , pages.back() , mof::Rectangle(70+20 , 300 , 570+20 , 450) , pLayout - ) - ); - - m_pImpl->messages.push_back(p); - return p; - -} - -void MyInterpreter::inactive( boost::shared_ptr& message ) -{ - - mof::Deleter del(message); - - m_pImpl->inactiveResources.push_back(del.getWeak()); - m_pImpl->scheduler.addEvent( 40 , del ); - m_pImpl->scheduler.addEvent( 40 , boost::bind( &mof::Interpreter::doNextCommand , this ) ); -} - -void MyInterpreter::update() -{ - m_pImpl->scheduler.update(); - Interpreter::update(); - foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) - { - if(resource.lock())resource.lock()->update(); - } -} - -void MyInterpreter::draw() const -{ - foreach(boost::shared_ptr& resource , m_pImpl->messages ) - { - resource->draw(); - } - foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) - { - if(resource.lock())resource.lock()->draw(); - } -} - +#include "MyInterpreter.hpp" +#include "mof/ImageTileWidgetView.hpp" +#include "mof/utilities.hpp" +#include "mof/LayoutManager.hpp" +#include "mof/Deleter.hpp" +#include "mof/mofInput.hpp" +#include "mof/mofGraphics.hpp" +#include +#include "mof/EventScheduler.hpp" +#include +#include "mof/ConsoleIO.hpp" + +struct MyInterpreter::Impl +{ + std::list > inactiveResources; + mof::EventScheduler scheduler; + std::list > messages; + + Impl() + { + } + + ~Impl() + { + } + + +}; + +MyInterpreter::MyInterpreter( ) +: m_pImpl(new Impl() ) +{ +} + + +MyInterpreter::~MyInterpreter() +{ +} + +boost::shared_ptr +MyInterpreter::createMessageWidget(const mof::tstring &title, const mof::tstring &text) +{ + mof::LayoutManager* pLayout = new mof::LayoutManager(10 , 35 , mof::LayoutManager::HORIZONTAL , 1); + mof::WidgetView* pBackgroundView = new mof::ImageTileWidgetView( _T("image/frame0.png") , title); + + std::vector pages; + + //foreach(const mof::tstring& text , text) + //{ + mof::MessageWidget::Page tmp(text , mof::Font(_T("”~UIƒSƒVƒbƒN") , 25) ); + pages.push_back(tmp); + //} + + boost::shared_ptr p + ( + new mof::MessageWidget + ( + pBackgroundView , + pages.front() , pages.back() , mof::Rectangle(70+20 , 300 , 570+20 , 450) , pLayout + ) + ); + + m_pImpl->messages.push_back(p); + return p; + +} + +void MyInterpreter::inactive( boost::shared_ptr& message ) +{ + + mof::Deleter del(message); + + m_pImpl->inactiveResources.push_back(del.getWeak()); + m_pImpl->scheduler.addEvent( 40 , del ); + m_pImpl->scheduler.addEvent( 40 , boost::bind( &mof::Interpreter::doNextCommand , this ) ); +} + +void MyInterpreter::update() +{ + m_pImpl->scheduler.update(); + Interpreter::update(); + foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) + { + if(resource.lock())resource.lock()->update(); + } +} + +void MyInterpreter::draw() const +{ + foreach(boost::shared_ptr& resource , m_pImpl->messages ) + { + resource->draw(); + } + foreach(boost::weak_ptr& resource , m_pImpl->inactiveResources) + { + if(resource.lock())resource.lock()->draw(); + } +} + diff --git a/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.hpp~ b/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.hpp~ index f2dce50..596520e 100644 --- a/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/MyInterpreter.hpp~ @@ -1,23 +1,23 @@ -#pragma once -#include "mof/InstructionSet.hpp" - - - -class MyInstructionSet : public mof::InstructionSet -{ - -public: - MyInstructionSet( const boost::shared_ptr & pInput ); - virtual ~MyInterpreter(); - - - virtual boost::shared_ptr - createMessageWidget( const mof::tstring& title , const mof::tstring& text ); - - virtual void inactive( boost::shared_ptr& message ); - -private: - struct Impl; - boost::scoped_ptr m_pImpl; -}; - +#pragma once +#include "mof/InstructionSet.hpp" + + + +class MyInstructionSet : public mof::InstructionSet +{ + +public: + MyInstructionSet( const boost::shared_ptr & pInput ); + virtual ~MyInterpreter(); + + + virtual boost::shared_ptr + createMessageWidget( const mof::tstring& title , const mof::tstring& text ); + + virtual void inactive( boost::shared_ptr& message ); + +private: + struct Impl; + boost::scoped_ptr m_pImpl; +}; + diff --git a/saisei-1_0/rpg/rpg/oldcode/NormalAI.cpp b/saisei-1_0/rpg/rpg/oldcode/NormalAI.cpp index 2323562..780d379 100644 --- a/saisei-1_0/rpg/rpg/oldcode/NormalAI.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/NormalAI.cpp @@ -1,79 +1,79 @@ -#include "NormalAI.h" -#include "AttackAction.h" -#include -#include "BattlerGroup.h" -#include "DataBasedBattler.h" -#include "DataBasedAction.h" - -et::NormalAI::NormalAI(mof::DataResourceManager* pDataResourceManager) -: BattleAI(pDataResourceManager) -{ -} - -et::NormalAI::~NormalAI(){ - -} - - -et::Action* et::NormalAI::createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup){ - mof::DataRow targetRow = pOwn->getDataRow(); - //‘I‘ð‰Â”\‚ȃAƒNƒVƒ‡ƒ“‚Ì’†‚ōłàŠú‘Ò’l‚̍‚‚¢‚à‚Ì‚ð‘I‚Ô - mof::DataResource monsterAction = m_pDataResourceManager->getResource(_T("data/monster.action.csv")); - const TCHAR* const table[] = {_T("DirectAttack1") , _T("DirectAttack2") , _T("SpecialAttack1") , _T("SpecialAttack1")}; - int ap = pOwn->getParameter().actionPoint; - - int coefficient = -1; - int selectedIndex = -1; - mof::DataRow selectedAction; - mof::DataRow targetAction; - - for(int i = 0 ; i < sizeof(table)/sizeof(table[0]) ; i++){ - mof::tstring action = targetRow.getData(table[i]); - if(action == _T(""))continue; - targetAction = mof::DataRow(monsterAction , action.c_str()); - - int cost = targetAction.getIntegerData( _T("Cost")); - if(ap >= cost){ - int tmpCoefficient = targetAction.getIntegerData( _T("Coefficient")); - if(coefficient < tmpCoefficient){ - //‘I‘ðƒAƒNƒVƒ‡ƒ“‚ðXV - coefficient = tmpCoefficient; - selectedIndex = i; - selectedAction = targetAction; - } - - } - } - if(selectedIndex == -1)return NULL; - - return new DataBasedAction(pOwn , pGroup->getHeroBattler() , selectedAction , selectedIndex); -} - -/* -et::Action* et::NormalAI::createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup){ - mof::DataRow targetRow = pOwn->getDataRow(); - - //‘I‘ð‰Â”\‚ȃAƒNƒVƒ‡ƒ“‚Ì’†‚©‚烉ƒ“ƒ_ƒ€‚Å‘I‚Ô - mof::DataResource monsterAction = m_pDataResourceManager->getResource(_T("data/monster.action.csv")); - const TCHAR* const table[] = {_T("DirectAttack1") , _T("DirectAttack2") , _T("SpecialAttack1") , _T("SpecialAttack1")}; - int ap = pOwn->getParameter().actionPoint; - - mof::DataRow targetAction; - - std::vector selectableList; - - for(int i = 0 ; i < sizeof(table)/sizeof(table[0]) ; i++){ - mof::tstring action = targetRow.getData(table[i]); - if(action == _T(""))continue; - targetAction = mof::DataRow(monsterAction , action.c_str()); - - int cost = targetAction.getIntegerData( _T("Cost")); - DEBUG_PRINT(cost); - if(ap >= cost)selectableList.push_back(i); - } - if(selectableList.size() == 0)return NULL; - - int selectedIndex = rand() % selectableList.size(); - return new DataBasedAction(pOwn , pGroup->getHeroBattler() , - mof::DataRow(monsterAction , targetRow.getData(table[selectedIndex]).c_str()) , selectedIndex); +#include "NormalAI.h" +#include "AttackAction.h" +#include +#include "BattlerGroup.h" +#include "DataBasedBattler.h" +#include "DataBasedAction.h" + +et::NormalAI::NormalAI(mof::DataResourceManager* pDataResourceManager) +: BattleAI(pDataResourceManager) +{ +} + +et::NormalAI::~NormalAI(){ + +} + + +et::Action* et::NormalAI::createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup){ + mof::DataRow targetRow = pOwn->getDataRow(); + //‘I‘ð‰Â”\‚ȃAƒNƒVƒ‡ƒ“‚Ì’†‚ōłàŠú‘Ò’l‚̍‚‚¢‚à‚Ì‚ð‘I‚Ô + mof::DataResource monsterAction = m_pDataResourceManager->getResource(_T("data/monster.action.csv")); + const TCHAR* const table[] = {_T("DirectAttack1") , _T("DirectAttack2") , _T("SpecialAttack1") , _T("SpecialAttack1")}; + int ap = pOwn->getParameter().actionPoint; + + int coefficient = -1; + int selectedIndex = -1; + mof::DataRow selectedAction; + mof::DataRow targetAction; + + for(int i = 0 ; i < sizeof(table)/sizeof(table[0]) ; i++){ + mof::tstring action = targetRow.getData(table[i]); + if(action == _T(""))continue; + targetAction = mof::DataRow(monsterAction , action.c_str()); + + int cost = targetAction.getIntegerData( _T("Cost")); + if(ap >= cost){ + int tmpCoefficient = targetAction.getIntegerData( _T("Coefficient")); + if(coefficient < tmpCoefficient){ + //‘I‘ðƒAƒNƒVƒ‡ƒ“‚ðXV + coefficient = tmpCoefficient; + selectedIndex = i; + selectedAction = targetAction; + } + + } + } + if(selectedIndex == -1)return NULL; + + return new DataBasedAction(pOwn , pGroup->getHeroBattler() , selectedAction , selectedIndex); +} + +/* +et::Action* et::NormalAI::createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup){ + mof::DataRow targetRow = pOwn->getDataRow(); + + //‘I‘ð‰Â”\‚ȃAƒNƒVƒ‡ƒ“‚Ì’†‚©‚烉ƒ“ƒ_ƒ€‚Å‘I‚Ô + mof::DataResource monsterAction = m_pDataResourceManager->getResource(_T("data/monster.action.csv")); + const TCHAR* const table[] = {_T("DirectAttack1") , _T("DirectAttack2") , _T("SpecialAttack1") , _T("SpecialAttack1")}; + int ap = pOwn->getParameter().actionPoint; + + mof::DataRow targetAction; + + std::vector selectableList; + + for(int i = 0 ; i < sizeof(table)/sizeof(table[0]) ; i++){ + mof::tstring action = targetRow.getData(table[i]); + if(action == _T(""))continue; + targetAction = mof::DataRow(monsterAction , action.c_str()); + + int cost = targetAction.getIntegerData( _T("Cost")); + DEBUG_PRINT(cost); + if(ap >= cost)selectableList.push_back(i); + } + if(selectableList.size() == 0)return NULL; + + int selectedIndex = rand() % selectableList.size(); + return new DataBasedAction(pOwn , pGroup->getHeroBattler() , + mof::DataRow(monsterAction , targetRow.getData(table[selectedIndex]).c_str()) , selectedIndex); }*/ \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/NormalAI.h b/saisei-1_0/rpg/rpg/oldcode/NormalAI.h index b56a3c0..c6141a7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/NormalAI.h +++ b/saisei-1_0/rpg/rpg/oldcode/NormalAI.h @@ -1,18 +1,18 @@ -#pragma once -#include "BattleAI.h" - -namespace et{ - class Action; - - - class NormalAI : public BattleAI - { - protected: - - public: - NormalAI(mof::DataResourceManager* pDataResoourceManager); - ~NormalAI(); - virtual Action* createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup); - }; - -} +#pragma once +#include "BattleAI.h" + +namespace et{ + class Action; + + + class NormalAI : public BattleAI + { + protected: + + public: + NormalAI(mof::DataResourceManager* pDataResoourceManager); + ~NormalAI(); + virtual Action* createAction(DataBasedBattler* pOwn , BattlerGroup* pGroup); + }; + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.cpp b/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.cpp index f14f718..af86988 100644 --- a/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.cpp @@ -1,38 +1,38 @@ -#include "RandomSymbolController.h" -#include - - -et::RandomSymbolController::RandomSymbolController(void) -{ -} - -et::RandomSymbolController::~RandomSymbolController(void) -{ -} - -void et::RandomSymbolController::move(Symbol* pSymbol){ - - - if(rand()%5)return; - mof::Vector3D nextPosition = pSymbol->getPosition(); - int direction = rand()%4; - - switch(direction){ - case 0: - nextPosition.z += 0.15f; - pSymbol->move(et::Symbol::UP , nextPosition , 6); - break; - case 1: - nextPosition.z -= 0.15f; - pSymbol->move(et::Symbol::DOWN , nextPosition , 6); - break; - case 2: - nextPosition.x -= 0.15f; - pSymbol->move(et::Symbol::LEFT , nextPosition , 6); - break; - case 3: - nextPosition.x += 0.15f; - pSymbol->move(et::Symbol::RIGHT , nextPosition , 6); - break; - } -} +#include "RandomSymbolController.h" +#include + + +et::RandomSymbolController::RandomSymbolController(void) +{ +} + +et::RandomSymbolController::~RandomSymbolController(void) +{ +} + +void et::RandomSymbolController::move(Symbol* pSymbol){ + + + if(rand()%5)return; + mof::Vector3D nextPosition = pSymbol->getPosition(); + int direction = rand()%4; + + switch(direction){ + case 0: + nextPosition.z += 0.15f; + pSymbol->move(et::Symbol::UP , nextPosition , 6); + break; + case 1: + nextPosition.z -= 0.15f; + pSymbol->move(et::Symbol::DOWN , nextPosition , 6); + break; + case 2: + nextPosition.x -= 0.15f; + pSymbol->move(et::Symbol::LEFT , nextPosition , 6); + break; + case 3: + nextPosition.x += 0.15f; + pSymbol->move(et::Symbol::RIGHT , nextPosition , 6); + break; + } +} diff --git a/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.h b/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.h index 35b0b13..21db8c5 100644 --- a/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.h +++ b/saisei-1_0/rpg/rpg/oldcode/RandomSymbolController.h @@ -1,13 +1,13 @@ -#pragma once -#include "SymbolController.h" - -namespace et{ - class RandomSymbolController : public SymbolController - { - virtual void move(Symbol* pSymbol); - public: - RandomSymbolController(void); - virtual ~RandomSymbolController(void); - }; - -} +#pragma once +#include "SymbolController.h" + +namespace et{ + class RandomSymbolController : public SymbolController + { + virtual void move(Symbol* pSymbol); + public: + RandomSymbolController(void); + virtual ~RandomSymbolController(void); + }; + +} diff --git a/saisei-1_0/rpg/rpg/oldcode/SpecialAction.cpp b/saisei-1_0/rpg/rpg/oldcode/SpecialAction.cpp index d839d06..c68c6db 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SpecialAction.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/SpecialAction.cpp @@ -1,139 +1,139 @@ -#include "SpecialAction.h" -#include "BattlerFacade.h" -#include "mof/DataRow.h" -#include "mof/DataBasedAnimation.h" -#include "mof/KeyFrameAnimation.h" - - -et::SpecialAction::SpecialAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , int cost , int skillID) -: Action(pBattler , pTarget , cost) -{ - m_skillID = skillID; -} - -et::SpecialAction::SpecialAction(et::BattlerFacade* pBattler , std::vector& targetList , int cost , int skillID) -: Action(pBattler , targetList , cost) -{ - m_skillID = skillID; -} - -et::SpecialAction::~SpecialAction(void) -{ -} - - -int et::SpecialAction::doActionTo(et::BattlerFacade* pTarget){ - float totalPower; - switch(m_skillID){ - case 0 : totalPower = -40; - break; - case 1 : totalPower = -20; - break; - case 2 : totalPower = 60; - break; - default : totalPower = 100; - } - - int damage = (int)-totalPower; - if(pTarget->getParameter().guard)damage *= 0.5;//ƒK[ƒh’†‚Ȃǃ_ƒ[ƒW‚ª”¼•ª‚É - int effect = -damage; - - et::BattlerParameter parameter = pTarget->getParameter(); - if(parameter.hp <= damage){ - parameter.hp = 0; - parameter.alive = false; - } - else parameter.hp -= damage; - if(parameter.hp > parameter.maxHp)parameter.hp = parameter.maxHp; - parameter.dActionPoint += 1; - pTarget->setParameter(parameter); - return effect; -} - -mof::AnimationResource et::SpecialAction::createApproachAnimation(){ - mof::Vector3D targetPosition = m_pBattler->getPosition(); - targetPosition.x += (m_pBattler->getType() == et::ENEMY)? 0.2f : -0.2f; - return m_pBattler->setMovingAnimation(targetPosition , 15); -} - -mof::AnimationResource et::SpecialAction::createExecuteAnimation(){ - return m_pBattler->setCastAnimation(1); -} - - - -mof::GraphicsSchedule* et::SpecialAction::createEffect(et::Common& common){ - - mof::DataResource effectTable; - switch(m_skillID){ - case 0 : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/flame.csv")); - break; - case 1 : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/flame.csv")); - break; - case 2 : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/shock.csv")); - break; - default : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/shock.csv")); - } - - mof::GraphicsSchedule* pSchedule = new mof::GraphicsSchedule(); - - for(int i = 0 ; i < effectTable->getNumberOfRows() ; i++){ - mof::DataRow effectRow = mof::DataRow(effectTable , i); - std::vector targetList = getTargetList(); - for(std::vector::iterator itr = targetList.begin() ; itr != targetList.end() ; ++itr){ - //---ƒ‚[ƒVƒ‡ƒ“‚̍\¬ - mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); - - mof::KeyFrameAnimation* pCommonAnimation = new mof::KeyFrameAnimation(); - mof::Vector3D targetPosition = (*itr)->getPosition(); - mof::Vector3D basePosition = m_pBattler->getGraphicsObject()->getPosition(); - //ƒXƒP[ƒ‹‚ðŒvŽZ - mof::Vector3D scale = targetPosition - basePosition; - scale.y = 1.0; - pCommonAnimation->setPosition(0 , basePosition); - mof::AnimationResource resource(pCommonAnimation); - - mof::tstring motionName(effectRow.getData(_T("Motion"))); - mof::DataBasedAnimation* pMotionAnimation = new mof::DataBasedAnimation(motionName.c_str() , scale); - pCascadeAnimation->setElement(0 , mof::AnimationResource(pMotionAnimation)); - - pCascadeAnimation->setElement(1 , resource); - mof::AnimationResource animation(pCascadeAnimation); - - //---ƒIƒuƒWƒFƒNƒg‚̍\¬ - mof::tstring className(effectRow.getData(_T("Class"))); - - mof::tstring textureName(effectRow.getData(_T("Texture"))); - if(textureName == _T(""))textureName = _T("null"); - mof::TextureResource texture = common.m_pTextureManager->getResource(textureName.c_str()); - - if(className == _T("Billboard")){ - //ƒrƒ‹ƒ{[ƒh - mof::GraphicsObject* pModel = new mof::Billboard(mof::Billboard::Y_FIXED , texture); - pModel->setAnimation(0 , animation); - pSchedule->add(20 , mof::GraphicsModelPtr(pModel) , animation); - } - else { - //ƒƒbƒVƒ…(className‚ªPath) - mof::MeshResource pModel = common.m_pMeshManager->getResource(className.c_str()); - pModel->setTexture(0 , texture); - pModel->setAnimation(0 , animation); - pSchedule->add(20 , mof::GraphicsModelPtr(pModel) , animation); - } - } - - } - - - return pSchedule; -} - -mof::tstring et::SpecialAction::getActionMessage(){ - switch(m_skillID){ - case 0 : return mof::tstring(_T("ƒAƒTƒ‹ƒgƒtƒŒƒCƒ€")); - case 1 : return mof::tstring(_T("ƒCƒOƒjƒbƒVƒ‡ƒ“")); - case 2 : return mof::tstring(_T("ƒq[ƒŠƒ“ƒO")); - default : return mof::tstring(_T("‚¢‚Ì‚¿‚̉ʎÀ")); - } - +#include "SpecialAction.h" +#include "BattlerFacade.h" +#include "mof/DataRow.h" +#include "mof/DataBasedAnimation.h" +#include "mof/KeyFrameAnimation.h" + + +et::SpecialAction::SpecialAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , int cost , int skillID) +: Action(pBattler , pTarget , cost) +{ + m_skillID = skillID; +} + +et::SpecialAction::SpecialAction(et::BattlerFacade* pBattler , std::vector& targetList , int cost , int skillID) +: Action(pBattler , targetList , cost) +{ + m_skillID = skillID; +} + +et::SpecialAction::~SpecialAction(void) +{ +} + + +int et::SpecialAction::doActionTo(et::BattlerFacade* pTarget){ + float totalPower; + switch(m_skillID){ + case 0 : totalPower = -40; + break; + case 1 : totalPower = -20; + break; + case 2 : totalPower = 60; + break; + default : totalPower = 100; + } + + int damage = (int)-totalPower; + if(pTarget->getParameter().guard)damage *= 0.5;//ƒK[ƒh’†‚Ȃǃ_ƒ[ƒW‚ª”¼•ª‚É + int effect = -damage; + + et::BattlerParameter parameter = pTarget->getParameter(); + if(parameter.hp <= damage){ + parameter.hp = 0; + parameter.alive = false; + } + else parameter.hp -= damage; + if(parameter.hp > parameter.maxHp)parameter.hp = parameter.maxHp; + parameter.dActionPoint += 1; + pTarget->setParameter(parameter); + return effect; +} + +mof::AnimationResource et::SpecialAction::createApproachAnimation(){ + mof::Vector3D targetPosition = m_pBattler->getPosition(); + targetPosition.x += (m_pBattler->getType() == et::ENEMY)? 0.2f : -0.2f; + return m_pBattler->setMovingAnimation(targetPosition , 15); +} + +mof::AnimationResource et::SpecialAction::createExecuteAnimation(){ + return m_pBattler->setCastAnimation(1); +} + + + +mof::GraphicsSchedule* et::SpecialAction::createEffect(et::Common& common){ + + mof::DataResource effectTable; + switch(m_skillID){ + case 0 : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/flame.csv")); + break; + case 1 : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/flame.csv")); + break; + case 2 : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/shock.csv")); + break; + default : effectTable = common.m_pDataResourceManager->getResource(_T("data/effect/shock.csv")); + } + + mof::GraphicsSchedule* pSchedule = new mof::GraphicsSchedule(); + + for(int i = 0 ; i < effectTable->getNumberOfRows() ; i++){ + mof::DataRow effectRow = mof::DataRow(effectTable , i); + std::vector targetList = getTargetList(); + for(std::vector::iterator itr = targetList.begin() ; itr != targetList.end() ; ++itr){ + //---ƒ‚[ƒVƒ‡ƒ“‚̍\¬ + mof::CascadeAnimation* pCascadeAnimation = new mof::CascadeAnimation(); + + mof::KeyFrameAnimation* pCommonAnimation = new mof::KeyFrameAnimation(); + mof::Vector3D targetPosition = (*itr)->getPosition(); + mof::Vector3D basePosition = m_pBattler->getGraphicsObject()->getPosition(); + //ƒXƒP[ƒ‹‚ðŒvŽZ + mof::Vector3D scale = targetPosition - basePosition; + scale.y = 1.0; + pCommonAnimation->setPosition(0 , basePosition); + mof::AnimationResource resource(pCommonAnimation); + + mof::tstring motionName(effectRow.getData(_T("Motion"))); + mof::DataBasedAnimation* pMotionAnimation = new mof::DataBasedAnimation(motionName.c_str() , scale); + pCascadeAnimation->setElement(0 , mof::AnimationResource(pMotionAnimation)); + + pCascadeAnimation->setElement(1 , resource); + mof::AnimationResource animation(pCascadeAnimation); + + //---ƒIƒuƒWƒFƒNƒg‚̍\¬ + mof::tstring className(effectRow.getData(_T("Class"))); + + mof::tstring textureName(effectRow.getData(_T("Texture"))); + if(textureName == _T(""))textureName = _T("null"); + mof::TextureResource texture = common.m_pTextureManager->getResource(textureName.c_str()); + + if(className == _T("Billboard")){ + //ƒrƒ‹ƒ{[ƒh + mof::GraphicsObject* pModel = new mof::Billboard(mof::Billboard::Y_FIXED , texture); + pModel->setAnimation(0 , animation); + pSchedule->add(20 , mof::GraphicsModelPtr(pModel) , animation); + } + else { + //ƒƒbƒVƒ…(className‚ªPath) + mof::MeshResource pModel = common.m_pMeshManager->getResource(className.c_str()); + pModel->setTexture(0 , texture); + pModel->setAnimation(0 , animation); + pSchedule->add(20 , mof::GraphicsModelPtr(pModel) , animation); + } + } + + } + + + return pSchedule; +} + +mof::tstring et::SpecialAction::getActionMessage(){ + switch(m_skillID){ + case 0 : return mof::tstring(_T("ƒAƒTƒ‹ƒgƒtƒŒƒCƒ€")); + case 1 : return mof::tstring(_T("ƒCƒOƒjƒbƒVƒ‡ƒ“")); + case 2 : return mof::tstring(_T("ƒq[ƒŠƒ“ƒO")); + default : return mof::tstring(_T("‚¢‚Ì‚¿‚̉ʎÀ")); + } + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/SpecialAction.h b/saisei-1_0/rpg/rpg/oldcode/SpecialAction.h index cc33a81..cf5b619 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SpecialAction.h +++ b/saisei-1_0/rpg/rpg/oldcode/SpecialAction.h @@ -1,22 +1,22 @@ -#pragma once -#include "Action.h" - - -namespace et{ - class SpecialAction : public Action - { - int m_skillID; - public: - SpecialAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , int cost , int skillID); - SpecialAction(et::BattlerFacade* pBattler , std::vector& targetList , int cost , int skillID); - virtual ~SpecialAction(void); - virtual int doActionTo(et::BattlerFacade* pTarget); - virtual mof::AnimationResource createApproachAnimation(); - virtual mof::AnimationResource createExecuteAnimation(); - virtual mof::tstring getActionMessage(); - - virtual mof::GraphicsSchedule* createEffect(et::Common& common); - }; - - +#pragma once +#include "Action.h" + + +namespace et{ + class SpecialAction : public Action + { + int m_skillID; + public: + SpecialAction(et::BattlerFacade* pBattler , et::BattlerFacade* pTarget , int cost , int skillID); + SpecialAction(et::BattlerFacade* pBattler , std::vector& targetList , int cost , int skillID); + virtual ~SpecialAction(void); + virtual int doActionTo(et::BattlerFacade* pTarget); + virtual mof::AnimationResource createApproachAnimation(); + virtual mof::AnimationResource createExecuteAnimation(); + virtual mof::tstring getActionMessage(); + + virtual mof::GraphicsSchedule* createEffect(et::Common& common); + }; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/StageScene.cpp b/saisei-1_0/rpg/rpg/oldcode/StageScene.cpp index cf34b5b..a11306f 100644 --- a/saisei-1_0/rpg/rpg/oldcode/StageScene.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/StageScene.cpp @@ -1,188 +1,188 @@ -#include "StageScene.h" -#include "mof/GraphicsDevice.h" -#include "mof/AmbientLight.h" -#include "mof/InputDevice.h" -#include "mof/ConsoleIO.h" -#include -#include "mof/System.h" -#include "DungeonBuilderA.h" -#include "mof/AmbientLight.h" -#include "mof/KeyFrameAnimation.h" -#include "MapImageColor.h" -#include "mof/Sprite.h" - -/*inline int roundUpCast(float f){ - if(f - (float)((int)f) > 0.0f)return (int)f + 1; - else return (int)f; -}*/ - -et::StageScene::StageScene() -: et::GameScene() , m_blockWidth(16) , m_blockHeight(16) -//, m_symbolScale(mof::Matrix3D::createScaling(0.2f , 0.4f , 0.2f)) -{ - - m_pMiniMap = NULL; - m_pMapBlocks = new mof::VertexBuffer*[m_blockWidth * m_blockHeight]; - for(int x = 0 ; x < m_blockWidth ; x++){ - for(int y = 0 ; y < m_blockHeight ; y++)m_pMapBlocks[y * m_blockWidth + x] = NULL; - } - m_pCamera = NULL; - m_pSymbolManager = NULL; - m_pInputReceiver = NULL; - m_pMapBuilder = NULL; - - m_pHero = NULL; - m_pHeroController = NULL; - m_pTest = mof::Sprite::createSpriteFromText(_T("u‚Ü‚à‚́Bv") , 32); - -} - -et::StageScene::~StageScene(void) -{ - - delete m_pMiniMap; - for(int x = 0 ; x < m_blockWidth ; x++){ - for(int y = 0 ; y < m_blockHeight ; y++)delete m_pMapBlocks[y * m_blockWidth + x]; - } - delete[] m_pMapBlocks; - delete m_pCamera; - //delete m_pHero; - //delete m_pHeroController; - //delete m_pInputReceiver; - delete m_pSymbolManager; - delete m_pMapBuilder; - delete m_pTest; - -} - - -bool et::StageScene::initialize(){ - - //m_pInputReceiver = mof::InputDevice::getInstance()->getInputReceiver(); - - mof::TextureResource pTexture( new mof::Texture(mof::tstring(_T("image/map.png")))); - std::shared_ptrmap = pTexture->getPixelMap(); - - - //ƒ_ƒ“ƒWƒ‡ƒ“ƒ}ƒbƒvì¬ - m_pMapBuilder = new et::DungeonBuilderA(*(map.get()) , m_pTextureManager , 0.3f); - m_pMapBuilder->setBlockSize(16 , 16); - for(int x = 0 ; x < m_blockWidth ; x++){ - for(int y = 0 ; y < m_blockHeight ; y++)m_pMapBlocks[y * m_blockWidth + x] = m_pMapBuilder->createBlock(x , y); - } - m_pCamera = new mof::Camera(mof::Vector3D(0.0f , 0.7f*2 , -1.0f*2) , mof::Vector3D(0.0f , 0.0f , 0.0f) , mof::Vector3D(0.0f , 1.0f , 0.0f)); - m_pCamera->reflect(); - - //mof::AmbientLight(mof::createColor(255 , 255 , 255)).reflect(); - mof::GraphicsDevice::getInstance()->setProjectionTransform(0.01f , 50.0f); - - m_pTexture = m_pTextureManager->getResource(_T("image/maptip0.png")); - - //ƒVƒ“ƒ{ƒ‹‚̍쐬 - m_pSymbolManager = new et::SymbolManager(m_pTextureManager , m_pMapBuilder); - mof::Billboard* pBillboard = new mof::Billboard(mof::Billboard::Y_FIXED , m_pTextureManager->getResource(_T("image/chara.png"))); - pBillboard->setTextureRectangle(mof::Line2D(0 , 0 ,32 , 64)); - m_pHero = new et::Symbol( pBillboard , mof::Vector3D(0.2f , 0.4f , 0.2f)); - - //m_pHeroController = new et::RandomSymbolController(); - m_pHeroController = new et::InputSymbolController(m_pInputReceiver); - m_pHeroController->add(m_pHero); - m_pSymbolManager->add(m_pHeroController); - - - - //ƒ~ƒjƒ}ƒbƒv‚̍쐬 - const int tWidth = pTexture->getWidth(); - const int tHeight = pTexture->getHeight(); - for(int x = 0 ; x < tWidth ; x++){ - for(int y = 0 ; y < tHeight ; y++){ - if(map->get(x , y) == mof::createColor(0 , 255 , 0)){ - //ŽålŒöˆÊ’u‚Æ‘å‚«‚³‚ðÝ’è - mof::Vector3D position(((float)x+0.5f) * m_pMapBuilder->getScale() , 0.0f , (-(float)y+0.5f) * m_pMapBuilder->getScale()); - m_pHero->setPosition(position , et::Symbol::DOWN );//ÃŽ~‚³‚¹‚é - m_pHero->update(); - } - if(et::isWalkableColor(map->get(x , y)) ){ - mof::Color color = mof::createColor(55 , 50 , 255); - map->set(x , y , color); - } - else{ - mof::Color color = mof::createColor(100 , 0 , 0 , 255); - map->set(x , y , color); - } - } - } - pTexture = mof::TextureResource(new mof::Texture(mof::tstring(_T("")) , *(map.get()))); - m_pMiniMap = new mof::Sprite(mof::Line2D(32 , 32 , tWidth*2 +32, tHeight*2 + 32) , mof::Line2D(0 , 0 , tWidth , tHeight) , pTexture); - - //“GƒVƒ“ƒ{ƒ‹”z’u - for(int i = 0 ; i < 100 ; i++)m_pSymbolManager->create(); - - - return true; -} - -bool et::StageScene::draw(){ - //m_pCapturer->capture(); - mof::GraphicsDevice* pDevice = mof::GraphicsDevice::getInstance(); - pDevice->clearRenderTarget(mof::createColor(27 , 27 , 27));//27 - pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_BASIC); - pDevice->setZBuffer(true); - pDevice->clearZBuffer(); - pDevice->setLight(false); - - - m_pTexture->setTextureToDevice(); - for(int x = 0 ; x < m_blockWidth ; x++){ - for(int y = 0 ; y < m_blockHeight ; y++){ - //•K—v‚ȃuƒƒbƒN‚Ì‚Ý•`‰æ‚·‚é(Direct3D‚̃NƒŠƒbƒsƒ“ƒO‚É”C‚¹‚é) - - //if(x == blockPos.x && y == blockPos.y) - m_pMapBlocks[y * m_blockWidth + x]->draw(mof::Matrix3D()); - } - } - - - m_pSymbolManager->draw(); - m_pMiniMap->draw(); - - //ƒVƒ“ƒ{ƒ‹ˆÊ’uƒ|ƒCƒ“ƒg‚Ì•`‰æ - std::vector* pList = m_pSymbolManager->getSymbolList(); - for(int i = 0 ; i < pList->size() ; i++){ - mof::Vector3D pos3D = pList->at(i)->getPosition(); - mof::Vector2D pos2D(pos3D.x / m_pMapBuilder->getScale() , -pos3D.z / m_pMapBuilder->getScale()); - pos2D.x = 32 + pos2D.x * 2; - pos2D.y = 32 + pos2D.y * 2; - mof::Sprite point(mof::Line2D(pos2D.x , pos2D.y , pos2D.x + 2 , pos2D.y + 2), - mof::Line2D(0 , 0 , 1 , 1) , m_pTextureManager->getResource(_T("null"))); - if(pList->at(i) != m_pHero)point.setCornerColor(mof::createColor(255 , 0 , 0)); - point.draw(); - } - - m_pTest->draw(); - return true; -} - - -bool et::StageScene::update(){ - - m_pSymbolManager->update(); - - std::vector touchedList = m_pSymbolManager->testCollision(m_pHero); - m_pTest->setPosition(mof::Vector2D(650 , 50)); - for(int i = 0 ; i < touchedList.size() ; i++){ - if(touchedList.at(i) == m_pHero)continue; - //í“¬“Ë“ü` - m_pTest->setPosition(mof::Vector2D(400 , 50)); - } - - m_pCamera->setWorldTransform(mof::Matrix3D::createTranslation(m_pHero->getPosition()));//ŽålŒöƒVƒ“ƒ{ƒ‹‚̈ʒu‚ªƒJƒƒ‰‚̈ʒu - m_pCamera->reflect(); - - mof::Billboard::updateBillboardDirection(m_pCamera); - - - return true; -} - - +#include "StageScene.h" +#include "mof/GraphicsDevice.h" +#include "mof/AmbientLight.h" +#include "mof/InputDevice.h" +#include "mof/ConsoleIO.h" +#include +#include "mof/System.h" +#include "DungeonBuilderA.h" +#include "mof/AmbientLight.h" +#include "mof/KeyFrameAnimation.h" +#include "MapImageColor.h" +#include "mof/Sprite.h" + +/*inline int roundUpCast(float f){ + if(f - (float)((int)f) > 0.0f)return (int)f + 1; + else return (int)f; +}*/ + +et::StageScene::StageScene() +: et::GameScene() , m_blockWidth(16) , m_blockHeight(16) +//, m_symbolScale(mof::Matrix3D::createScaling(0.2f , 0.4f , 0.2f)) +{ + + m_pMiniMap = NULL; + m_pMapBlocks = new mof::VertexBuffer*[m_blockWidth * m_blockHeight]; + for(int x = 0 ; x < m_blockWidth ; x++){ + for(int y = 0 ; y < m_blockHeight ; y++)m_pMapBlocks[y * m_blockWidth + x] = NULL; + } + m_pCamera = NULL; + m_pSymbolManager = NULL; + m_pInputReceiver = NULL; + m_pMapBuilder = NULL; + + m_pHero = NULL; + m_pHeroController = NULL; + m_pTest = mof::Sprite::createSpriteFromText(_T("u‚Ü‚à‚́Bv") , 32); + +} + +et::StageScene::~StageScene(void) +{ + + delete m_pMiniMap; + for(int x = 0 ; x < m_blockWidth ; x++){ + for(int y = 0 ; y < m_blockHeight ; y++)delete m_pMapBlocks[y * m_blockWidth + x]; + } + delete[] m_pMapBlocks; + delete m_pCamera; + //delete m_pHero; + //delete m_pHeroController; + //delete m_pInputReceiver; + delete m_pSymbolManager; + delete m_pMapBuilder; + delete m_pTest; + +} + + +bool et::StageScene::initialize(){ + + //m_pInputReceiver = mof::InputDevice::getInstance()->getInputReceiver(); + + mof::TextureResource pTexture( new mof::Texture(mof::tstring(_T("image/map.png")))); + std::shared_ptrmap = pTexture->getPixelMap(); + + + //ƒ_ƒ“ƒWƒ‡ƒ“ƒ}ƒbƒvì¬ + m_pMapBuilder = new et::DungeonBuilderA(*(map.get()) , m_pTextureManager , 0.3f); + m_pMapBuilder->setBlockSize(16 , 16); + for(int x = 0 ; x < m_blockWidth ; x++){ + for(int y = 0 ; y < m_blockHeight ; y++)m_pMapBlocks[y * m_blockWidth + x] = m_pMapBuilder->createBlock(x , y); + } + m_pCamera = new mof::Camera(mof::Vector3D(0.0f , 0.7f*2 , -1.0f*2) , mof::Vector3D(0.0f , 0.0f , 0.0f) , mof::Vector3D(0.0f , 1.0f , 0.0f)); + m_pCamera->reflect(); + + //mof::AmbientLight(mof::createColor(255 , 255 , 255)).reflect(); + mof::GraphicsDevice::getInstance()->setProjectionTransform(0.01f , 50.0f); + + m_pTexture = m_pTextureManager->getResource(_T("image/maptip0.png")); + + //ƒVƒ“ƒ{ƒ‹‚̍쐬 + m_pSymbolManager = new et::SymbolManager(m_pTextureManager , m_pMapBuilder); + mof::Billboard* pBillboard = new mof::Billboard(mof::Billboard::Y_FIXED , m_pTextureManager->getResource(_T("image/chara.png"))); + pBillboard->setTextureRectangle(mof::Line2D(0 , 0 ,32 , 64)); + m_pHero = new et::Symbol( pBillboard , mof::Vector3D(0.2f , 0.4f , 0.2f)); + + //m_pHeroController = new et::RandomSymbolController(); + m_pHeroController = new et::InputSymbolController(m_pInputReceiver); + m_pHeroController->add(m_pHero); + m_pSymbolManager->add(m_pHeroController); + + + + //ƒ~ƒjƒ}ƒbƒv‚̍쐬 + const int tWidth = pTexture->getWidth(); + const int tHeight = pTexture->getHeight(); + for(int x = 0 ; x < tWidth ; x++){ + for(int y = 0 ; y < tHeight ; y++){ + if(map->get(x , y) == mof::createColor(0 , 255 , 0)){ + //ŽålŒöˆÊ’u‚Æ‘å‚«‚³‚ðÝ’è + mof::Vector3D position(((float)x+0.5f) * m_pMapBuilder->getScale() , 0.0f , (-(float)y+0.5f) * m_pMapBuilder->getScale()); + m_pHero->setPosition(position , et::Symbol::DOWN );//ÃŽ~‚³‚¹‚é + m_pHero->update(); + } + if(et::isWalkableColor(map->get(x , y)) ){ + mof::Color color = mof::createColor(55 , 50 , 255); + map->set(x , y , color); + } + else{ + mof::Color color = mof::createColor(100 , 0 , 0 , 255); + map->set(x , y , color); + } + } + } + pTexture = mof::TextureResource(new mof::Texture(mof::tstring(_T("")) , *(map.get()))); + m_pMiniMap = new mof::Sprite(mof::Line2D(32 , 32 , tWidth*2 +32, tHeight*2 + 32) , mof::Line2D(0 , 0 , tWidth , tHeight) , pTexture); + + //“GƒVƒ“ƒ{ƒ‹”z’u + for(int i = 0 ; i < 100 ; i++)m_pSymbolManager->create(); + + + return true; +} + +bool et::StageScene::draw(){ + //m_pCapturer->capture(); + mof::GraphicsDevice* pDevice = mof::GraphicsDevice::getInstance(); + pDevice->clearRenderTarget(mof::createColor(27 , 27 , 27));//27 + pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_BASIC); + pDevice->setZBuffer(true); + pDevice->clearZBuffer(); + pDevice->setLight(false); + + + m_pTexture->setTextureToDevice(); + for(int x = 0 ; x < m_blockWidth ; x++){ + for(int y = 0 ; y < m_blockHeight ; y++){ + //•K—v‚ȃuƒƒbƒN‚Ì‚Ý•`‰æ‚·‚é(Direct3D‚̃NƒŠƒbƒsƒ“ƒO‚É”C‚¹‚é) + + //if(x == blockPos.x && y == blockPos.y) + m_pMapBlocks[y * m_blockWidth + x]->draw(mof::Matrix3D()); + } + } + + + m_pSymbolManager->draw(); + m_pMiniMap->draw(); + + //ƒVƒ“ƒ{ƒ‹ˆÊ’uƒ|ƒCƒ“ƒg‚Ì•`‰æ + std::vector* pList = m_pSymbolManager->getSymbolList(); + for(int i = 0 ; i < pList->size() ; i++){ + mof::Vector3D pos3D = pList->at(i)->getPosition(); + mof::Vector2D pos2D(pos3D.x / m_pMapBuilder->getScale() , -pos3D.z / m_pMapBuilder->getScale()); + pos2D.x = 32 + pos2D.x * 2; + pos2D.y = 32 + pos2D.y * 2; + mof::Sprite point(mof::Line2D(pos2D.x , pos2D.y , pos2D.x + 2 , pos2D.y + 2), + mof::Line2D(0 , 0 , 1 , 1) , m_pTextureManager->getResource(_T("null"))); + if(pList->at(i) != m_pHero)point.setCornerColor(mof::createColor(255 , 0 , 0)); + point.draw(); + } + + m_pTest->draw(); + return true; +} + + +bool et::StageScene::update(){ + + m_pSymbolManager->update(); + + std::vector touchedList = m_pSymbolManager->testCollision(m_pHero); + m_pTest->setPosition(mof::Vector2D(650 , 50)); + for(int i = 0 ; i < touchedList.size() ; i++){ + if(touchedList.at(i) == m_pHero)continue; + //í“¬“Ë“ü` + m_pTest->setPosition(mof::Vector2D(400 , 50)); + } + + m_pCamera->setWorldTransform(mof::Matrix3D::createTranslation(m_pHero->getPosition()));//ŽålŒöƒVƒ“ƒ{ƒ‹‚̈ʒu‚ªƒJƒƒ‰‚̈ʒu + m_pCamera->reflect(); + + mof::Billboard::updateBillboardDirection(m_pCamera); + + + return true; +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/StageScene.h b/saisei-1_0/rpg/rpg/oldcode/StageScene.h index d0abefc..10f90a1 100644 --- a/saisei-1_0/rpg/rpg/oldcode/StageScene.h +++ b/saisei-1_0/rpg/rpg/oldcode/StageScene.h @@ -1,47 +1,47 @@ -#pragma once -#include "GameScene.h" -#include "mof/TextureResource.h" -#include "mof/Camera.h" -#include "mof/VertexBuffer.h" -#include "mof/VertexTypes.h" -#include "mof/Billboard.h" -#include "SymbolManager.h" -#include "mof/InputReceiver.h" -#include "DungeonBuilder.h" - -#include "mof/Capturer.h" -#include "InputSymbolController.h" -#include "RandomSymbolController.h" - -namespace et{ - - class StageScene - : public et::GameScene - { - mof::Sprite* m_pMiniMap; - mof::VertexBuffer** m_pMapBlocks; - const int m_blockWidth , m_blockHeight; - mof::Camera* m_pCamera; - mof::TextureResource m_pTexture; - SymbolManager* m_pSymbolManager; - et::DungeonBuilder* m_pMapBuilder; - - Symbol* m_pHero; - et::SymbolController* m_pHeroController; - - //mof::InputReceiver* m_pInputReceiver; - mof::Sprite* m_pTest; - public: - StageScene(); - virtual ~StageScene(void); - - - - virtual bool initialize(); - virtual bool draw(); - virtual bool update(); - - - }; - -}; +#pragma once +#include "GameScene.h" +#include "mof/TextureResource.h" +#include "mof/Camera.h" +#include "mof/VertexBuffer.h" +#include "mof/VertexTypes.h" +#include "mof/Billboard.h" +#include "SymbolManager.h" +#include "mof/InputReceiver.h" +#include "DungeonBuilder.h" + +#include "mof/Capturer.h" +#include "InputSymbolController.h" +#include "RandomSymbolController.h" + +namespace et{ + + class StageScene + : public et::GameScene + { + mof::Sprite* m_pMiniMap; + mof::VertexBuffer** m_pMapBlocks; + const int m_blockWidth , m_blockHeight; + mof::Camera* m_pCamera; + mof::TextureResource m_pTexture; + SymbolManager* m_pSymbolManager; + et::DungeonBuilder* m_pMapBuilder; + + Symbol* m_pHero; + et::SymbolController* m_pHeroController; + + //mof::InputReceiver* m_pInputReceiver; + mof::Sprite* m_pTest; + public: + StageScene(); + virtual ~StageScene(void); + + + + virtual bool initialize(); + virtual bool draw(); + virtual bool update(); + + + }; + +}; diff --git a/saisei-1_0/rpg/rpg/oldcode/Symbol.cpp b/saisei-1_0/rpg/rpg/oldcode/Symbol.cpp index d0848fb..791a668 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Symbol.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/Symbol.cpp @@ -1,167 +1,167 @@ -#include "Symbol.h" -#include -#include "mof/KeyFrameAnimation.h" -#include "mof/ConsoleIO.h" - - -et::Symbol::Symbol(mof::Component3D* pBody , float scale) -: mof::Component3D() -{ - m_pBody = pBody; - m_nextRunningKey = 0; - setDirection(et::Symbol::DOWN); - m_scale = mof::Vector3D(scale , scale , scale); - - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); - pAnimation->setScale(0 , m_scale); - setAnimation(0 , mof::AnimationResource(pAnimation)); - -} - - - -et::Symbol::Symbol(mof::Component3D* pBody , mof::Vector3D& scale) -: mof::Component3D() -{ - m_pBody = pBody; - m_nextRunningKey = 0; - setDirection(et::Symbol::DOWN); - m_scale = scale; - - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); - pAnimation->setScale(0 , mof::Vector3D(scale.x , scale.y , scale.z)); - setAnimation(0 , mof::AnimationResource(pAnimation)); -} - - -et::Symbol::~Symbol(void) -{ - delete m_pBody; -} - - -/* -void et::Symbol::move(et::Symbol::Direction direction , float span , int length){ - m_direction = direction; - mof::AnimationResource pAnimation = getAnimation(2); - if(pAnimation.get() != NULL && !pAnimation->isFinalized())return; - - - const float SPEED_X = span; - const float SPEED_Y = span; - const float tableX[] = {0.0f , 0.0f , -SPEED_X , SPEED_X}; - const float tableZ[] = {SPEED_Y , -SPEED_Y , 0.0f , 0.0f}; - - mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); - pKeyFrameAnimation->setVelocity(0 , mof::Vector3D(tableX[direction] , 0.0f , tableZ[direction] )); - pKeyFrameAnimation->setVelocity(length ,mof::Vector3D( 0.0f , 0.0f , 0.0f)); - - - - - setAnimation(3 , mof::AnimationResource(pKeyFrameAnimation)); - - -}*/ - - - -void et::Symbol::move(Direction direction , mof::Vector3D& position , int length) -{ - m_direction = direction; - mof::AnimationResource pAnimation = getAnimation(3); - if(pAnimation.get() != NULL && !pAnimation->isFinalized())return; - - mof::Vector3D current = getPosition(); - mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); - pKeyFrameAnimation->setPosition(0 , current); - pKeyFrameAnimation->setPosition(length , position); - pKeyFrameAnimation->update();//ŽŸ‚̍XV‚ňړ®‚·‚é - - setAnimation( 3 , mof::AnimationResource(pKeyFrameAnimation)); - - pKeyFrameAnimation = new mof::KeyFrameAnimation(); - - const int tableRunningY[] = {3 , 2 , 1 , 2 , 3 , 3 , 2 , 1 , 2 , 3}; - const int tableRunningX[] = {0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1}; - const int lengthOfRunning = 10; - for(int i = 0 ; i < 1 ; i++){ - int key = (m_nextRunningKey + i) % lengthOfRunning; - mof::Vector2D begin(32 * direction + 128 * tableRunningX[key] , tableRunningY[key] * 64 ); - mof::Vector2D end(32 * (direction+1) + 128 * tableRunningX[key] , (tableRunningY[key]+1) * 64 ); - pKeyFrameAnimation->setTextureRectangle(i*6 , mof::Line2D(begin , end)); - } - m_nextRunningKey = (m_nextRunningKey + 1) % lengthOfRunning; - - pKeyFrameAnimation->setTextureRectangle(length+1 , mof::Line2D(32 * direction , 0 , 32 * (direction+1) , 64)); - pKeyFrameAnimation->setFinalKey(length); - - setAnimation( 2 , mof::AnimationResource(pKeyFrameAnimation)); - - -} - -bool et::Symbol::update(){ - - return m_pBody->update(); - -} - -bool et::Symbol::draw(){ - return m_pBody->draw(m_worldTransform); -} - -bool et::Symbol::draw(mof::Matrix3D& transform){ - return m_pBody->draw(m_worldTransform * transform); -} - - - -void et::Symbol::setAnimation(int index , mof::AnimationResource& pAnimation){ - mof::GraphicsObject::setAnimation(index , pAnimation); - m_pBody->setAnimation(index , pAnimation); - -} - -void et::Symbol::setWorldTransform(mof::Matrix3D& matrix){ - m_pBody->setWorldTransform( matrix); -} - - -mof::Vector3D et::Symbol::getPosition(){ - return m_pBody->getPosition(); -} - -/* -void et::Symbol::setPosition(mof::Vector3D& position){ - m_pBody->setPosition(position); -}*/ - -void et::Symbol::setPosition(mof::Vector3D& position , et::Symbol::Direction direction){ - - setDirection(direction); - mof::Vector3D current = getPosition(); - mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); - pKeyFrameAnimation->setPosition(0 , position); - setAnimation( 3 , mof::AnimationResource(pKeyFrameAnimation)); - -} - - -et::Symbol::Direction et::Symbol::getDirection(){ - return m_direction; -} - -void et::Symbol::setDirection(et::Symbol::Direction direction){ - mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); - pKeyFrameAnimation->setTextureRectangle(0 , mof::Line2D(32 * direction , 0 , 32 * (direction+1) , 64)); - setAnimation(2 , mof::AnimationResource(pKeyFrameAnimation)); - m_direction = direction; - -} - -mof::Vector3D& et::Symbol::getScale(){ - return m_scale; -} - - +#include "Symbol.h" +#include +#include "mof/KeyFrameAnimation.h" +#include "mof/ConsoleIO.h" + + +et::Symbol::Symbol(mof::Component3D* pBody , float scale) +: mof::Component3D() +{ + m_pBody = pBody; + m_nextRunningKey = 0; + setDirection(et::Symbol::DOWN); + m_scale = mof::Vector3D(scale , scale , scale); + + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); + pAnimation->setScale(0 , m_scale); + setAnimation(0 , mof::AnimationResource(pAnimation)); + +} + + + +et::Symbol::Symbol(mof::Component3D* pBody , mof::Vector3D& scale) +: mof::Component3D() +{ + m_pBody = pBody; + m_nextRunningKey = 0; + setDirection(et::Symbol::DOWN); + m_scale = scale; + + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(true); + pAnimation->setScale(0 , mof::Vector3D(scale.x , scale.y , scale.z)); + setAnimation(0 , mof::AnimationResource(pAnimation)); +} + + +et::Symbol::~Symbol(void) +{ + delete m_pBody; +} + + +/* +void et::Symbol::move(et::Symbol::Direction direction , float span , int length){ + m_direction = direction; + mof::AnimationResource pAnimation = getAnimation(2); + if(pAnimation.get() != NULL && !pAnimation->isFinalized())return; + + + const float SPEED_X = span; + const float SPEED_Y = span; + const float tableX[] = {0.0f , 0.0f , -SPEED_X , SPEED_X}; + const float tableZ[] = {SPEED_Y , -SPEED_Y , 0.0f , 0.0f}; + + mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); + pKeyFrameAnimation->setVelocity(0 , mof::Vector3D(tableX[direction] , 0.0f , tableZ[direction] )); + pKeyFrameAnimation->setVelocity(length ,mof::Vector3D( 0.0f , 0.0f , 0.0f)); + + + + + setAnimation(3 , mof::AnimationResource(pKeyFrameAnimation)); + + +}*/ + + + +void et::Symbol::move(Direction direction , mof::Vector3D& position , int length) +{ + m_direction = direction; + mof::AnimationResource pAnimation = getAnimation(3); + if(pAnimation.get() != NULL && !pAnimation->isFinalized())return; + + mof::Vector3D current = getPosition(); + mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); + pKeyFrameAnimation->setPosition(0 , current); + pKeyFrameAnimation->setPosition(length , position); + pKeyFrameAnimation->update();//ŽŸ‚̍XV‚ňړ®‚·‚é + + setAnimation( 3 , mof::AnimationResource(pKeyFrameAnimation)); + + pKeyFrameAnimation = new mof::KeyFrameAnimation(); + + const int tableRunningY[] = {3 , 2 , 1 , 2 , 3 , 3 , 2 , 1 , 2 , 3}; + const int tableRunningX[] = {0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1}; + const int lengthOfRunning = 10; + for(int i = 0 ; i < 1 ; i++){ + int key = (m_nextRunningKey + i) % lengthOfRunning; + mof::Vector2D begin(32 * direction + 128 * tableRunningX[key] , tableRunningY[key] * 64 ); + mof::Vector2D end(32 * (direction+1) + 128 * tableRunningX[key] , (tableRunningY[key]+1) * 64 ); + pKeyFrameAnimation->setTextureRectangle(i*6 , mof::Line2D(begin , end)); + } + m_nextRunningKey = (m_nextRunningKey + 1) % lengthOfRunning; + + pKeyFrameAnimation->setTextureRectangle(length+1 , mof::Line2D(32 * direction , 0 , 32 * (direction+1) , 64)); + pKeyFrameAnimation->setFinalKey(length); + + setAnimation( 2 , mof::AnimationResource(pKeyFrameAnimation)); + + +} + +bool et::Symbol::update(){ + + return m_pBody->update(); + +} + +bool et::Symbol::draw(){ + return m_pBody->draw(m_worldTransform); +} + +bool et::Symbol::draw(mof::Matrix3D& transform){ + return m_pBody->draw(m_worldTransform * transform); +} + + + +void et::Symbol::setAnimation(int index , mof::AnimationResource& pAnimation){ + mof::GraphicsObject::setAnimation(index , pAnimation); + m_pBody->setAnimation(index , pAnimation); + +} + +void et::Symbol::setWorldTransform(mof::Matrix3D& matrix){ + m_pBody->setWorldTransform( matrix); +} + + +mof::Vector3D et::Symbol::getPosition(){ + return m_pBody->getPosition(); +} + +/* +void et::Symbol::setPosition(mof::Vector3D& position){ + m_pBody->setPosition(position); +}*/ + +void et::Symbol::setPosition(mof::Vector3D& position , et::Symbol::Direction direction){ + + setDirection(direction); + mof::Vector3D current = getPosition(); + mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); + pKeyFrameAnimation->setPosition(0 , position); + setAnimation( 3 , mof::AnimationResource(pKeyFrameAnimation)); + +} + + +et::Symbol::Direction et::Symbol::getDirection(){ + return m_direction; +} + +void et::Symbol::setDirection(et::Symbol::Direction direction){ + mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); + pKeyFrameAnimation->setTextureRectangle(0 , mof::Line2D(32 * direction , 0 , 32 * (direction+1) , 64)); + setAnimation(2 , mof::AnimationResource(pKeyFrameAnimation)); + m_direction = direction; + +} + +mof::Vector3D& et::Symbol::getScale(){ + return m_scale; +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/Symbol.h b/saisei-1_0/rpg/rpg/oldcode/Symbol.h index 91db351..91247c6 100644 --- a/saisei-1_0/rpg/rpg/oldcode/Symbol.h +++ b/saisei-1_0/rpg/rpg/oldcode/Symbol.h @@ -1,46 +1,46 @@ -#pragma once -#include "mof/Component3D.h" - -namespace et{ - class Symbol : public mof::Component3D - { - public: - typedef enum{ - UP = 0, - DOWN , LEFT , RIGHT - } Direction; - protected: - Component3D* m_pBody; - int m_nextRunningKey; - Direction m_direction; - mof::Vector3D m_scale; - //body‚ÆAnimation‚ð‹¤—L‚·‚é - - public: - Symbol(Component3D* pBody , float scale); - Symbol(Component3D* pBody , mof::Vector3D& scale); - virtual ~Symbol(void); - - //void move(Direction direction , float span , int length);//span--1ƒtƒŒ[ƒ€‚̈ړ®•ª length--ƒtƒŒ[ƒ€” - void move(Direction direction , mof::Vector3D& position , int length); - - virtual bool update(); - virtual bool draw(); - virtual bool draw(mof::Matrix3D& transform); - virtual void setAnimation(int index , mof::AnimationResource& pAnimation); - virtual void setWorldTransform(mof::Matrix3D& matrix); - virtual mof::Vector3D getPosition(); - //virtual void setPosition(mof::Vector3D& position); - virtual void setPosition(mof::Vector3D& position , Direction direction); - mof::Vector3D& getScale(); - Direction getDirection(); - void setDirection(Direction direction); - - - - - - }; - - +#pragma once +#include "mof/Component3D.h" + +namespace et{ + class Symbol : public mof::Component3D + { + public: + typedef enum{ + UP = 0, + DOWN , LEFT , RIGHT + } Direction; + protected: + Component3D* m_pBody; + int m_nextRunningKey; + Direction m_direction; + mof::Vector3D m_scale; + //body‚ÆAnimation‚ð‹¤—L‚·‚é + + public: + Symbol(Component3D* pBody , float scale); + Symbol(Component3D* pBody , mof::Vector3D& scale); + virtual ~Symbol(void); + + //void move(Direction direction , float span , int length);//span--1ƒtƒŒ[ƒ€‚̈ړ®•ª length--ƒtƒŒ[ƒ€” + void move(Direction direction , mof::Vector3D& position , int length); + + virtual bool update(); + virtual bool draw(); + virtual bool draw(mof::Matrix3D& transform); + virtual void setAnimation(int index , mof::AnimationResource& pAnimation); + virtual void setWorldTransform(mof::Matrix3D& matrix); + virtual mof::Vector3D getPosition(); + //virtual void setPosition(mof::Vector3D& position); + virtual void setPosition(mof::Vector3D& position , Direction direction); + mof::Vector3D& getScale(); + Direction getDirection(); + void setDirection(Direction direction); + + + + + + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/SymbolController.cpp b/saisei-1_0/rpg/rpg/oldcode/SymbolController.cpp index c4c863a..c9051ab 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SymbolController.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/SymbolController.cpp @@ -1,33 +1,33 @@ -#include "SymbolController.h" - - -et::SymbolController::SymbolController(){ - - -} - - -et::SymbolController::~SymbolController(){ - -} - - -void et::SymbolController::add(Symbol* pSymbol){ - m_symbols.push_back(pSymbol); -} - -int et::SymbolController::getSize(){ - return m_symbols.size(); -} - - -et::Symbol* et::SymbolController::get(int index){ - return m_symbols.at(index); -} - -void et::SymbolController::update(){ - for(int i = 0 ; i < getSize() ; i++){ - move(get(i)); - } -} - +#include "SymbolController.h" + + +et::SymbolController::SymbolController(){ + + +} + + +et::SymbolController::~SymbolController(){ + +} + + +void et::SymbolController::add(Symbol* pSymbol){ + m_symbols.push_back(pSymbol); +} + +int et::SymbolController::getSize(){ + return m_symbols.size(); +} + + +et::Symbol* et::SymbolController::get(int index){ + return m_symbols.at(index); +} + +void et::SymbolController::update(){ + for(int i = 0 ; i < getSize() ; i++){ + move(get(i)); + } +} + diff --git a/saisei-1_0/rpg/rpg/oldcode/SymbolController.h b/saisei-1_0/rpg/rpg/oldcode/SymbolController.h index 1c3fd92..959c409 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SymbolController.h +++ b/saisei-1_0/rpg/rpg/oldcode/SymbolController.h @@ -1,21 +1,21 @@ -#pragma once -#include -#include "Symbol.h" - -namespace et{ - class SymbolController - { - std::vector m_symbols; - protected: - virtual void move(Symbol* pSymbol) = 0; - public: - SymbolController(); - virtual ~SymbolController(void) = 0; - void update(); - void add(Symbol* pSymbol); - int getSize(); - Symbol* get(int index); - }; - - +#pragma once +#include +#include "Symbol.h" + +namespace et{ + class SymbolController + { + std::vector m_symbols; + protected: + virtual void move(Symbol* pSymbol) = 0; + public: + SymbolController(); + virtual ~SymbolController(void) = 0; + void update(); + void add(Symbol* pSymbol); + int getSize(); + Symbol* get(int index); + }; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/SymbolManager.cpp b/saisei-1_0/rpg/rpg/oldcode/SymbolManager.cpp index 235bf1e..d6f9642 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SymbolManager.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/SymbolManager.cpp @@ -1,99 +1,99 @@ -#include "SymbolManager.h" -#include "MapImageColor.h" -#include "mof/Billboard.h" -#include "RandomSymbolController.h" -#include - -et::SymbolManager::SymbolManager(mof::TextureManager* pTextureManager , et::DungeonBuilder* pMapBuilder) -{ - m_pTextureManager = pTextureManager; - m_pMapBuilder = pMapBuilder; -} - -et::SymbolManager::~SymbolManager(void) -{ - for(int i = 0 ; i < m_symbols.size() ; i++)delete m_symbols.at(i); - for(int i = 0 ; i < m_controllers.size() ; i++)delete m_controllers.at(i); -} - -void et::SymbolManager::update(){ - for(int i = 0 ; i < m_controllers.size() ; i++)m_controllers.at(i)->update();//ˆÚ“®ƒAƒjƒÝ’è - for(int i = 0 ; i < m_symbols.size() ; i++){ - et::Symbol* pSymbol = m_symbols.at(i); - mof::Vector3D prePos3D = pSymbol->getPosition(); - pSymbol->update();//‚±‚±‚ÅŽÀÛ‚Ɉړ® - - mof::Vector3D pos3D = pSymbol->getPosition(); - //‚S’¸“_‚Å“–‚½‚è”»’è - float tableX[] = { -pSymbol->getScale().x / 2 , -pSymbol->getScale().x / 2 , pSymbol->getScale().x / 2 , pSymbol->getScale().x / 2}; - float tableZ[] = { -pSymbol->getScale().z / 2 , pSymbol->getScale().z / 2 , -pSymbol->getScale().z / 2 , pSymbol->getScale().z / 2}; - for(int i = 0 ; i < 4 ; i++){ - - mof::Vector2D pos2D((pos3D.x + tableX[i]) / m_pMapBuilder->getScale() , -(pos3D.z + tableZ[i]) / m_pMapBuilder->getScale()); - if(!et::isWalkableColor(m_pMapBuilder->getMapImageColor(pos2D.x , pos2D.y))){ - //is‹t•ûŒü‚ɉŸ‚µ–ß‚· - //if(m_pHero->getDirection() == et::Symbol::UP)prePos3D.z = -(pos2D.y+1) * m_pMapBuilder->getScale() - tableZ[1]*1.1; - //else if(m_pHero->getDirection() == et::Symbol::DOWN)prePos3D.z = -(pos2D.y) * m_pMapBuilder->getScale() - tableZ[0]*1.1; - //else if(m_pHero->getDirection() == et::Symbol::LEFT)prePos3D.x= (pos2D.x+1) * m_pMapBuilder->getScale() - tableX[0]*1.1; - //else if(m_pHero->getDirection() == et::Symbol::RIGHT)prePos3D.x= (pos2D.x) * m_pMapBuilder->getScale() - tableX[2]*1.1; - - pSymbol->setPosition(prePos3D , pSymbol->getDirection() );//ÃŽ~‚³‚¹‚é - pSymbol->update();//‰Ÿ‚µ–ß‚µƒAƒjƒ‚ð“K—p - break; - } - - } - } -} - -bool compareTo( et::Symbol* &a , et::Symbol* &b){ - return (*a).getPosition().z > (*b).getPosition().z; - } - -void et::SymbolManager::draw(){ - //zÀ•W‚Ń\[ƒg‚µ‚Ä•`‰æ - - std::sort(m_symbols.begin() , m_symbols.end() , compareTo); - for(int i = 0 ; i < m_symbols.size() ; i++)m_symbols.at(i)->draw(); -} - -void et::SymbolManager::add(et::SymbolController* pController){ - m_controllers.push_back(pController); - for(int i = 0 ; i < pController->getSize() ; i++)m_symbols.push_back(pController->get(i)); -} - - -std::vector et::SymbolManager::testCollision(et::Symbol* pSymbol){ - std::vector touchedList; - for(int i = 0 ; i < m_symbols.size() ; i++){ - Symbol* pTarget = m_symbols.at(i); - //‰~“¯Žm‚Å“–‚½‚è”»’è - if(fabs(pTarget->getPosition().x - pSymbol->getPosition().x) > (pTarget->getScale().x/2 + pSymbol->getScale().x/2))continue; - else if(fabs(pTarget->getPosition().z - pSymbol->getPosition().z) > (pTarget->getScale().z/2 + pSymbol->getScale().z/2))continue; - else touchedList.push_back(pTarget); - - } - return touchedList; -} - -void et::SymbolManager::create(){ - //ƒ‰ƒ“ƒ_ƒ€‚É“GƒVƒ“ƒ{ƒ‹”z’u - while(true){ - int x = rand()%m_pMapBuilder->getWidth(); - int y = rand()%m_pMapBuilder->getHeight(); - if(!et::isWalkableColor(m_pMapBuilder->getMapImageColor(x , y)))continue; - mof::Billboard* pBillboard = new mof::Billboard(mof::Billboard::Y_FIXED , m_pTextureManager->getResource(_T("image/chara2.png"))); - //pBillboard->setTextureRectangle(mof::Line2D(0 , 0 ,32 , 64)); - Symbol* pSymbol = new et::Symbol( pBillboard , mof::Vector3D(0.2f , 0.4f , 0.2f)); - SymbolController* pController = new et::RandomSymbolController(); - - pController->add(pSymbol); - - mof::Vector3D position(((float)x+0.5f) * m_pMapBuilder->getScale() , 0.0f , (-(float)(y+1)+0.5f) * m_pMapBuilder->getScale()); - pSymbol->setPosition(position , et::Symbol::DOWN );//ÃŽ~‚³‚¹‚é - pSymbol->update(); - - add(pController); - break; - } +#include "SymbolManager.h" +#include "MapImageColor.h" +#include "mof/Billboard.h" +#include "RandomSymbolController.h" +#include + +et::SymbolManager::SymbolManager(mof::TextureManager* pTextureManager , et::DungeonBuilder* pMapBuilder) +{ + m_pTextureManager = pTextureManager; + m_pMapBuilder = pMapBuilder; +} + +et::SymbolManager::~SymbolManager(void) +{ + for(int i = 0 ; i < m_symbols.size() ; i++)delete m_symbols.at(i); + for(int i = 0 ; i < m_controllers.size() ; i++)delete m_controllers.at(i); +} + +void et::SymbolManager::update(){ + for(int i = 0 ; i < m_controllers.size() ; i++)m_controllers.at(i)->update();//ˆÚ“®ƒAƒjƒÝ’è + for(int i = 0 ; i < m_symbols.size() ; i++){ + et::Symbol* pSymbol = m_symbols.at(i); + mof::Vector3D prePos3D = pSymbol->getPosition(); + pSymbol->update();//‚±‚±‚ÅŽÀÛ‚Ɉړ® + + mof::Vector3D pos3D = pSymbol->getPosition(); + //‚S’¸“_‚Å“–‚½‚è”»’è + float tableX[] = { -pSymbol->getScale().x / 2 , -pSymbol->getScale().x / 2 , pSymbol->getScale().x / 2 , pSymbol->getScale().x / 2}; + float tableZ[] = { -pSymbol->getScale().z / 2 , pSymbol->getScale().z / 2 , -pSymbol->getScale().z / 2 , pSymbol->getScale().z / 2}; + for(int i = 0 ; i < 4 ; i++){ + + mof::Vector2D pos2D((pos3D.x + tableX[i]) / m_pMapBuilder->getScale() , -(pos3D.z + tableZ[i]) / m_pMapBuilder->getScale()); + if(!et::isWalkableColor(m_pMapBuilder->getMapImageColor(pos2D.x , pos2D.y))){ + //is‹t•ûŒü‚ɉŸ‚µ–ß‚· + //if(m_pHero->getDirection() == et::Symbol::UP)prePos3D.z = -(pos2D.y+1) * m_pMapBuilder->getScale() - tableZ[1]*1.1; + //else if(m_pHero->getDirection() == et::Symbol::DOWN)prePos3D.z = -(pos2D.y) * m_pMapBuilder->getScale() - tableZ[0]*1.1; + //else if(m_pHero->getDirection() == et::Symbol::LEFT)prePos3D.x= (pos2D.x+1) * m_pMapBuilder->getScale() - tableX[0]*1.1; + //else if(m_pHero->getDirection() == et::Symbol::RIGHT)prePos3D.x= (pos2D.x) * m_pMapBuilder->getScale() - tableX[2]*1.1; + + pSymbol->setPosition(prePos3D , pSymbol->getDirection() );//ÃŽ~‚³‚¹‚é + pSymbol->update();//‰Ÿ‚µ–ß‚µƒAƒjƒ‚ð“K—p + break; + } + + } + } +} + +bool compareTo( et::Symbol* &a , et::Symbol* &b){ + return (*a).getPosition().z > (*b).getPosition().z; + } + +void et::SymbolManager::draw(){ + //zÀ•W‚Ń\[ƒg‚µ‚Ä•`‰æ + + std::sort(m_symbols.begin() , m_symbols.end() , compareTo); + for(int i = 0 ; i < m_symbols.size() ; i++)m_symbols.at(i)->draw(); +} + +void et::SymbolManager::add(et::SymbolController* pController){ + m_controllers.push_back(pController); + for(int i = 0 ; i < pController->getSize() ; i++)m_symbols.push_back(pController->get(i)); +} + + +std::vector et::SymbolManager::testCollision(et::Symbol* pSymbol){ + std::vector touchedList; + for(int i = 0 ; i < m_symbols.size() ; i++){ + Symbol* pTarget = m_symbols.at(i); + //‰~“¯Žm‚Å“–‚½‚è”»’è + if(fabs(pTarget->getPosition().x - pSymbol->getPosition().x) > (pTarget->getScale().x/2 + pSymbol->getScale().x/2))continue; + else if(fabs(pTarget->getPosition().z - pSymbol->getPosition().z) > (pTarget->getScale().z/2 + pSymbol->getScale().z/2))continue; + else touchedList.push_back(pTarget); + + } + return touchedList; +} + +void et::SymbolManager::create(){ + //ƒ‰ƒ“ƒ_ƒ€‚É“GƒVƒ“ƒ{ƒ‹”z’u + while(true){ + int x = rand()%m_pMapBuilder->getWidth(); + int y = rand()%m_pMapBuilder->getHeight(); + if(!et::isWalkableColor(m_pMapBuilder->getMapImageColor(x , y)))continue; + mof::Billboard* pBillboard = new mof::Billboard(mof::Billboard::Y_FIXED , m_pTextureManager->getResource(_T("image/chara2.png"))); + //pBillboard->setTextureRectangle(mof::Line2D(0 , 0 ,32 , 64)); + Symbol* pSymbol = new et::Symbol( pBillboard , mof::Vector3D(0.2f , 0.4f , 0.2f)); + SymbolController* pController = new et::RandomSymbolController(); + + pController->add(pSymbol); + + mof::Vector3D position(((float)x+0.5f) * m_pMapBuilder->getScale() , 0.0f , (-(float)(y+1)+0.5f) * m_pMapBuilder->getScale()); + pSymbol->setPosition(position , et::Symbol::DOWN );//ÃŽ~‚³‚¹‚é + pSymbol->update(); + + add(pController); + break; + } } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/SymbolManager.h b/saisei-1_0/rpg/rpg/oldcode/SymbolManager.h index e83267f..4dc16da 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SymbolManager.h +++ b/saisei-1_0/rpg/rpg/oldcode/SymbolManager.h @@ -1,28 +1,28 @@ -#pragma once -#include "Symbol.h" -#include "mof/Graphics.h" -#include -#include "SymbolController.h" -#include "DungeonBuilder.h" - -namespace et{ - - class SymbolManager - { - std::vector m_symbols; - std::vector m_controllers; - mof::TextureManager* m_pTextureManager; - et::DungeonBuilder* m_pMapBuilder; - public: - SymbolManager(mof::TextureManager* pTextureManager , et::DungeonBuilder* pMapBuilder); - virtual ~SymbolManager(void); - virtual void update(); - virtual void draw(); - void add(SymbolController* pController); - std::vector testCollision(et::Symbol* pSymbol ); - std::vector* getSymbolList(){return &m_symbols;} - void create(); - }; - - +#pragma once +#include "Symbol.h" +#include "mof/Graphics.h" +#include +#include "SymbolController.h" +#include "DungeonBuilder.h" + +namespace et{ + + class SymbolManager + { + std::vector m_symbols; + std::vector m_controllers; + mof::TextureManager* m_pTextureManager; + et::DungeonBuilder* m_pMapBuilder; + public: + SymbolManager(mof::TextureManager* pTextureManager , et::DungeonBuilder* pMapBuilder); + virtual ~SymbolManager(void); + virtual void update(); + virtual void draw(); + void add(SymbolController* pController); + std::vector testCollision(et::Symbol* pSymbol ); + std::vector* getSymbolList(){return &m_symbols;} + void create(); + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/SystemFrame.hpp~ b/saisei-1_0/rpg/rpg/oldcode/SystemFrame.hpp~ index 59b4540..33cc6db 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SystemFrame.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/SystemFrame.hpp~ @@ -1,54 +1,54 @@ -#pragma once -#include "mof/widget/WidgetView.hpp" -#include "mof/FactoryMethod.hpp" -#include "mof/graphics/utilities.hpp" -#include "mof/widget/utilities.hpp" -#include - -class HighlightMenuView -: - public mof::WidgetView -{ -public: - HighlightMenuView( const mof::FactoryMethod& child ); - virtual ~HighlightMenuView( ); - - virtual mof::FrameNumber show( bool imidiately = false ); - virtual mof::FrameNumber hide( bool imidiately = false ); - virtual mof::FrameNumber focus( bool imidiately = false ); - virtual mof::FrameNumber blur( bool imidiately = false ); - virtual void update( ); - virtual void draw( ) const; - -private: - struct Impl; - boost::scoped_ptr m_pImpl; - -}; - - -#include -#include - -namespace mof{ - - struct MenuItemInfo; - struct Vector2D; - class Effect; - - class SystemMenuView : public MenuWidget - { - public: - virtual SystemMenuView( const mof::FactoryMethod& ); - virtual ~SystemMenuView(); - virtual mof::Rectangle initialize() = 0; - virtual void show() = 0; - virtual void close() = 0; - virtual void focus() = 0; - virtual void blur() = 0; - - - }; - - -} // namespace mof +#pragma once +#include "mof/widget/WidgetView.hpp" +#include "mof/FactoryMethod.hpp" +#include "mof/graphics/utilities.hpp" +#include "mof/widget/utilities.hpp" +#include + +class HighlightMenuView +: + public mof::WidgetView +{ +public: + HighlightMenuView( const mof::FactoryMethod& child ); + virtual ~HighlightMenuView( ); + + virtual mof::FrameNumber show( bool imidiately = false ); + virtual mof::FrameNumber hide( bool imidiately = false ); + virtual mof::FrameNumber focus( bool imidiately = false ); + virtual mof::FrameNumber blur( bool imidiately = false ); + virtual void update( ); + virtual void draw( ) const; + +private: + struct Impl; + boost::scoped_ptr m_pImpl; + +}; + + +#include +#include + +namespace mof{ + + struct MenuItemInfo; + struct Vector2D; + class Effect; + + class SystemMenuView : public MenuWidget + { + public: + virtual SystemMenuView( const mof::FactoryMethod& ); + virtual ~SystemMenuView(); + virtual mof::Rectangle initialize() = 0; + virtual void show() = 0; + virtual void close() = 0; + virtual void focus() = 0; + virtual void blur() = 0; + + + }; + + +} // namespace mof diff --git a/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.cpp~ b/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.cpp~ index 78bda1a..ce38d87 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.cpp~ @@ -1,127 +1,127 @@ -#pragma once -#include "widget/SystemMenuWidget.hpp" -#include -#include - -//{{{ Impl -struct SystemMenuWidget::Impl -{ - std::vector< boost::function0 > actions; - mof::ContainerWidgetView* pView; - int currentIndex; - - Impl() - : pView(NULL) , currentIndex(0) - {} -}; -//}}} -//{{{ constructor -SystemMenuWidget::SystemMenuWidget -( - const mof::MenuItem& front , - const mof::MenuItem& back -) -: m_pImpl(new Impl) -{ - int length = &back - &front + 1; - std::vector< mof::FactoryMethod > views; - for(int i = 0 ; i < length ; i++) - { - views.push_back((&front + i)->view); - } - - m_pImpl->pView = new mof::ContainerWidgetView - ( - views.front() , views.back() , - mof::makeFactoryMethod - ( - mof::GridLayout::VERTICAL , 0 - ) - ); - - m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); -} -//}}} -//{{{ destructor -SystemMenuWidget::~SystemMenuWidget() -{ - delete m_pImpl->pView; -} -//}}} -//{{{ show -mof::FrameNumber SystemMenuWidget::show(bool imidiately) -{ - return m_pImpl->pView->show(imidiately); -} -//}}} -//{{{ hide -mof::FrameNumber SystemMenuWidget::hide(bool imidiately) -{ - return m_pImpl->pView->hide(imidiately); -} -//}}} -//{{{ getView -const mof::WidgetView& SystemMenuWidget::getView() const -{ - return *m_pImpl->pView; -} -//}}} -//{{{ getView -mof::WidgetView& SystemMenuWidget::getView() -{ - return *m_pImpl->pView; -} -//}}} -//{{{ update -void SystemMenuWidget::update() -{ - m_pImpl->pView->update(); -} -//}}} -//{{{ up -void SystemMenuWidget::up() -{ - int index = m_pImpl->pView->getAdjacencyAsUp(); - if(index == m_pImpl->currentIndex)return; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); - m_pImpl->currentIndex = index; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); -} -//}}} -//{{{ down -void SystemMenuWidget::down() -{ - int index = m_pImpl->pView->getAdjacencyAsDown(); - if(index == m_pImpl->currentIndex)return; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); - m_pImpl->currentIndex = index; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); -} -//}}} -//{{{ left -void SystemMenuWidget::left() -{ - int index = m_pImpl->pView->getAdjacencyAsLeft(); - if(index == m_pImpl->currentIndex)return; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); - m_pImpl->currentIndex = index; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); -} -//}}} -//{{{ right -void SystemMenuWidget::right() -{ - int index = m_pImpl->pView->getAdjacencyAsRight(); - if(index == m_pImpl->currentIndex)return; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); - m_pImpl->currentIndex = index; - m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); -} -//}}} -//{{{ performAction -void SystemMenuWidget::performAction() const -{ - m_pImpl->actions[m_pImpl->currentIndex](); -} -//}}} - +#pragma once +#include "widget/SystemMenuWidget.hpp" +#include +#include + +//{{{ Impl +struct SystemMenuWidget::Impl +{ + std::vector< boost::function0 > actions; + mof::ContainerWidgetView* pView; + int currentIndex; + + Impl() + : pView(NULL) , currentIndex(0) + {} +}; +//}}} +//{{{ constructor +SystemMenuWidget::SystemMenuWidget +( + const mof::MenuItem& front , + const mof::MenuItem& back +) +: m_pImpl(new Impl) +{ + int length = &back - &front + 1; + std::vector< mof::FactoryMethod > views; + for(int i = 0 ; i < length ; i++) + { + views.push_back((&front + i)->view); + } + + m_pImpl->pView = new mof::ContainerWidgetView + ( + views.front() , views.back() , + mof::makeFactoryMethod + ( + mof::GridLayout::VERTICAL , 0 + ) + ); + + m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); +} +//}}} +//{{{ destructor +SystemMenuWidget::~SystemMenuWidget() +{ + delete m_pImpl->pView; +} +//}}} +//{{{ show +mof::FrameNumber SystemMenuWidget::show(bool imidiately) +{ + return m_pImpl->pView->show(imidiately); +} +//}}} +//{{{ hide +mof::FrameNumber SystemMenuWidget::hide(bool imidiately) +{ + return m_pImpl->pView->hide(imidiately); +} +//}}} +//{{{ getView +const mof::WidgetView& SystemMenuWidget::getView() const +{ + return *m_pImpl->pView; +} +//}}} +//{{{ getView +mof::WidgetView& SystemMenuWidget::getView() +{ + return *m_pImpl->pView; +} +//}}} +//{{{ update +void SystemMenuWidget::update() +{ + m_pImpl->pView->update(); +} +//}}} +//{{{ up +void SystemMenuWidget::up() +{ + int index = m_pImpl->pView->getAdjacencyAsUp(); + if(index == m_pImpl->currentIndex)return; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); + m_pImpl->currentIndex = index; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); +} +//}}} +//{{{ down +void SystemMenuWidget::down() +{ + int index = m_pImpl->pView->getAdjacencyAsDown(); + if(index == m_pImpl->currentIndex)return; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); + m_pImpl->currentIndex = index; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); +} +//}}} +//{{{ left +void SystemMenuWidget::left() +{ + int index = m_pImpl->pView->getAdjacencyAsLeft(); + if(index == m_pImpl->currentIndex)return; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); + m_pImpl->currentIndex = index; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); +} +//}}} +//{{{ right +void SystemMenuWidget::right() +{ + int index = m_pImpl->pView->getAdjacencyAsRight(); + if(index == m_pImpl->currentIndex)return; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->blur(); + m_pImpl->currentIndex = index; + m_pImpl->pView->getAt(m_pImpl->currentIndex)->focus(); +} +//}}} +//{{{ performAction +void SystemMenuWidget::performAction() const +{ + m_pImpl->actions[m_pImpl->currentIndex](); +} +//}}} + diff --git a/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp b/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp index 013c00c..fce35f5 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp +++ b/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp @@ -1,32 +1,32 @@ -#pragma once -#include -#include -#include -#include -#include -#include - - - -class SystemMenuWidget : public mof::MenuWidget -{ -public: - SystemMenuWidget(const mof::MenuItem& front , const mof::MenuItem& back); - virtual ~SystemMenuWidget(); - virtual mof::FrameNumber show(bool imidiately); - virtual mof::FrameNumber hide(bool imidiately); - virtual const mof::WidgetView& getView() const; - virtual mof::WidgetView& getView(); - virtual void update(); - - virtual void up(); - virtual void down(); - virtual void left(); - virtual void right(); - virtual void performAction() const; - -private: - struct Impl; - boost::scoped_ptr m_pImpl; -}; - +#pragma once +#include +#include +#include +#include +#include +#include + + + +class SystemMenuWidget : public mof::MenuWidget +{ +public: + SystemMenuWidget(const mof::MenuItem& front , const mof::MenuItem& back); + virtual ~SystemMenuWidget(); + virtual mof::FrameNumber show(bool imidiately); + virtual mof::FrameNumber hide(bool imidiately); + virtual const mof::WidgetView& getView() const; + virtual mof::WidgetView& getView(); + virtual void update(); + + virtual void up(); + virtual void down(); + virtual void left(); + virtual void right(); + virtual void performAction() const; + +private: + struct Impl; + boost::scoped_ptr m_pImpl; +}; + diff --git a/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp~ b/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp~ index b139026..adc45b8 100644 --- a/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/SystemMenuWidget.hpp~ @@ -1,32 +1,32 @@ -#pragma once -#include -#include -#include -#include -#include -#include - - - -class SystemMenuWidget : public mof::MenuWidget -{ -public: - SystemMenuWidget(const mof::MenuItem& front , const mof::MenuItem& back); - virtual ~SystemMenuWidget(); - virtual mof::FrameNumber show(bool imidiately = false); - virtual mof::FrameNumber hide(bool imidiately = false); - virtual const mof::WidgetView& getView() const; - virtual mof::WidgetView& getView(); - virtual void update(); - - virtual void up(); - virtual void down(); - virtual void left(); - virtual void right(); - virtual void performAction() const; - -private: - struct Impl; - boost::scoped_ptr m_pImpl; -}; - +#pragma once +#include +#include +#include +#include +#include +#include + + + +class SystemMenuWidget : public mof::MenuWidget +{ +public: + SystemMenuWidget(const mof::MenuItem& front , const mof::MenuItem& back); + virtual ~SystemMenuWidget(); + virtual mof::FrameNumber show(bool imidiately = false); + virtual mof::FrameNumber hide(bool imidiately = false); + virtual const mof::WidgetView& getView() const; + virtual mof::WidgetView& getView(); + virtual void update(); + + virtual void up(); + virtual void down(); + virtual void left(); + virtual void right(); + virtual void performAction() const; + +private: + struct Impl; + boost::scoped_ptr m_pImpl; +}; + diff --git a/saisei-1_0/rpg/rpg/oldcode/TargetMenu.cpp b/saisei-1_0/rpg/rpg/oldcode/TargetMenu.cpp index 1ebcd49..05edfb6 100644 --- a/saisei-1_0/rpg/rpg/oldcode/TargetMenu.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/TargetMenu.cpp @@ -1,80 +1,80 @@ -#include "TargetMenu.h" -#include "mof/KeyFrameAnimation.h" -#include "MyWindow.h" -#include "BattlerGroup.h" -#include "BattlerFacade.h" - -mof::Window* addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , - mof::Sprite* pSprite , mof::TextureManager* pTextureManager){ - mof::Window* pSelectable = new et::MyWindow(pSprite , pTextureManager); - pOwner->add(pSelectable); - selectables.push_back(pSelectable); - return pSelectable; -} - -et::TargetMenu::TargetMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData , et::BattleAction& action , int position ) -: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) -{ - m_action = action; - m_position = position; - m_pBattleData = pBattleData; - - m_pSelector = NULL; - m_pTextureManager = pTextureManager; - std::vector selectables; - - mof::Window* pSelectable = NULL; - //“Gƒ‚ƒ“ƒXƒ^[‚̃ŠƒXƒgì¬ - std::vector battlerList = m_pBattleData->getBattlerGroup()->getEnemyBattlerListAlive(); - for(std::vector::const_iterator itr = battlerList.begin() ; itr != battlerList.end() ; ++itr){ - addSelectableTextItem(this , selectables , mof::Sprite::createSpriteFromText((mof::tstring)(*itr)->getParameter().name , 16) , m_pTextureManager); - - } - m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); - setVisible(true); -} - -et::TargetMenu::~TargetMenu(void) -{ - delete m_pSelector; -} - - - - - -void et::TargetMenu::setVisible(bool visible){ - et::MyFrame::setVisible(visible); - if(visible){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(m_position ,500)); - pAnimation->setPosition(10 , mof::Vector2D(m_position , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(m_position , 370)); - pAnimation->setPosition(10 , mof::Vector2D(m_position , 500)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } -} - -et::MyFrame* et::TargetMenu::performAction(){ - int index = getSelectionModel()->getSelectingIndex(); - - int cntEnemy = 0; - for(std::vector::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ; - itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){ - if((*itr)->getType() != et::ENEMY || !(*itr)->getParameter().alive)continue; - else if(index == cntEnemy++)m_action.pTarget = *itr; - } - m_pBattleData->setBattleAction(m_action); - - return this; -} - - +#include "TargetMenu.h" +#include "mof/KeyFrameAnimation.h" +#include "MyWindow.h" +#include "BattlerGroup.h" +#include "BattlerFacade.h" + +mof::Window* addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , + mof::Sprite* pSprite , mof::TextureManager* pTextureManager){ + mof::Window* pSelectable = new et::MyWindow(pSprite , pTextureManager); + pOwner->add(pSelectable); + selectables.push_back(pSelectable); + return pSelectable; +} + +et::TargetMenu::TargetMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData , et::BattleAction& action , int position ) +: et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) ) +{ + m_action = action; + m_position = position; + m_pBattleData = pBattleData; + + m_pSelector = NULL; + m_pTextureManager = pTextureManager; + std::vector selectables; + + mof::Window* pSelectable = NULL; + //“Gƒ‚ƒ“ƒXƒ^[‚̃ŠƒXƒgì¬ + std::vector battlerList = m_pBattleData->getBattlerGroup()->getEnemyBattlerListAlive(); + for(std::vector::const_iterator itr = battlerList.begin() ; itr != battlerList.end() ; ++itr){ + addSelectableTextItem(this , selectables , mof::Sprite::createSpriteFromText((mof::tstring)(*itr)->getParameter().name , 16) , m_pTextureManager); + + } + m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); + setVisible(true); +} + +et::TargetMenu::~TargetMenu(void) +{ + delete m_pSelector; +} + + + + + +void et::TargetMenu::setVisible(bool visible){ + et::MyFrame::setVisible(visible); + if(visible){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(m_position ,500)); + pAnimation->setPosition(10 , mof::Vector2D(m_position , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(m_position , 370)); + pAnimation->setPosition(10 , mof::Vector2D(m_position , 500)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } +} + +et::MyFrame* et::TargetMenu::performAction(){ + int index = getSelectionModel()->getSelectingIndex(); + + int cntEnemy = 0; + for(std::vector::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ; + itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){ + if((*itr)->getType() != et::ENEMY || !(*itr)->getParameter().alive)continue; + else if(index == cntEnemy++)m_action.pTarget = *itr; + } + m_pBattleData->setBattleAction(m_action); + + return this; +} + + diff --git a/saisei-1_0/rpg/rpg/oldcode/TargetMenu.h b/saisei-1_0/rpg/rpg/oldcode/TargetMenu.h index cf45872..3f91ae7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/TargetMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/TargetMenu.h @@ -1,26 +1,26 @@ -#pragma once -#include "MyFrame.h" -#include "mof/Texture.h" -#include "BattleData.h" - -namespace et{ - - class TargetMenu : public MyFrame - { - - mof::SelectionModel* m_pSelector; - mof::TextureManager* m_pTextureManager; - et::BattleData* m_pBattleData; - - et::BattleAction m_action; - int m_position; - public: - TargetMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData , et::BattleAction& action , int position); - virtual ~TargetMenu(void); - virtual void setVisible(bool visible); - virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} - virtual MyFrame* performAction(); - }; - - +#pragma once +#include "MyFrame.h" +#include "mof/Texture.h" +#include "BattleData.h" + +namespace et{ + + class TargetMenu : public MyFrame + { + + mof::SelectionModel* m_pSelector; + mof::TextureManager* m_pTextureManager; + et::BattleData* m_pBattleData; + + et::BattleAction m_action; + int m_position; + public: + TargetMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData , et::BattleAction& action , int position); + virtual ~TargetMenu(void); + virtual void setVisible(bool visible); + virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} + virtual MyFrame* performAction(); + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/TestScene.cpp~ b/saisei-1_0/rpg/rpg/oldcode/TestScene.cpp~ index 7c82dc8..98f95db 100644 --- a/saisei-1_0/rpg/rpg/oldcode/TestScene.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/TestScene.cpp~ @@ -1,314 +1,314 @@ -#include "TestScene.hpp" -#include "mof/GraphicsDevice.hpp" -#include -#include "mof/VertexBuffer.hpp" -#include "mof/AmbientLight.hpp" -#include "mof/MaterialBuilder.hpp" -#include "mof/Material.hpp" -#include "mof/Camera.hpp" -#include "mof/Texture.hpp" -#include "mof/MeshBuilder.hpp" -#include "mof/Graphics3D.hpp" -#include "mof/mofAnimations.hpp" -#include "mof/EventScheduler.hpp" -#include "mof/EventCondition.hpp" -#include "mof/Board.hpp" -#include "mof/Font.hpp" -#include "CharacterBoard.hpp" -#include -#include -#include -#include -#include "mof/Finalizer.hpp" - -namespace -{ - - mof::AmbientLight* m_pLight; - mof::Camera* m_pCamera; - boost::shared_ptr m_pTexture; - std::vector<::CharacterBoard*> m_modelList; - mof::Graphics3D* m_pBox; - mof::EventScheduler* m_pScheduler; - mof::Animation::Handler m_backgroundColor; - mof::FrameNumber m_backgroundColorFrame; - mof::tstring m_part; -}; - - - - -namespace TestScene -{ - - void begin(){ - std::vector::Handler> handlerList; - - { - std::pair keyFrames[4]; - keyFrames[0] = std::pair( 25 , mof::Vector3D( mof::deg2rad(-90) , 0 , 0)); - keyFrames[1] = std::pair( 50 , mof::Vector3D( mof::deg2rad(-80) , 0 , 0)); - keyFrames[2] = std::pair( 75 , mof::Vector3D( mof::deg2rad(-25) , 0 , 0)); - keyFrames[3] = std::pair( 100 , mof::Vector3D( mof::deg2rad(0) , 0 , 0)); - mof::Animation::Handler handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[3])); - handlerList.push_back(handler); - } - { - mof::Animation::Handler handler( - mof::constantHandler(mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0 , -4.5f))) - ); - handlerList.push_back(handler); - } - { - std::pair keyFrames[3]; - keyFrames[0] = std::pair( 0 , mof::Vector3D( 0 , mof::deg2rad(70) , 0)); - keyFrames[1] = std::pair( 130 , mof::Vector3D( 0 , mof::deg2rad(360) , 0)); - mof::Animation::Handler handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); - handler = mof::Animation::Handler(new mof::LoopAnimation(handler , 200)); - handlerList.push_back(handler); - } - - int size = handlerList.size(); - handlerList.resize(size + 1); - - mof::tstring title[] = { _T("‚R") , _T("”N") , _T("‘O") , _T("‚É") , _T("Á") , _T("Ü") , _T("‚µ") , - _T("‚½") , _T("‚q") , _T("‚o") , _T("‚f") , _T("ŠJ") , _T("”­") , _T("‚ð") , _T("Ä") , _T("ŠJ") , - _T("‚µ") , _T("‚Ä") , _T("‚Ý") , _T("‚é") }; - - for(int i = 0 ; i < 20 ; i++) - { - m_modelList.push_back(new ::CharacterBoard( title[i])); - { - mof::Animation::Handler handler( - mof::constantHandler(mof::Matrix3D::createRotation(mof::Vector3D(0 , mof::deg2rad(-360.0f/20 * i) , 0))) - ); - handlerList.at(size) = handler; - } - mof::Animation::Handler handler(new mof::CascadingAnimation(handlerList.front() , handlerList.back())); - m_modelList.at(i)->setWorldMatrix(handler); - } - - - { - mof::MeshBuilder meshBuilder( "model/demo/box.x"); - m_pBox = meshBuilder.construct(); - handlerList.clear(); - - { - std::pair keyFrames[2]; - keyFrames[0] = std::pair( 0 , mof::Vector3D( 0 , 0 , 0)); - keyFrames[1] = std::pair( 130 , mof::Vector3D( mof::deg2rad(360) , mof::deg2rad(360) , mof::deg2rad(360))); - mof::Animation::Handler handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); - handler = mof::Animation::Handler(new mof::LoopAnimation(handler , 130)); - handlerList.push_back(handler); - } - mof::Animation::Handler handler(new mof::CascadingAnimation(handlerList.front() , handlerList.back())); - m_pBox->setWorldMatrix(handler); - } - - { - std::pair keyFrames[2]; - keyFrames[0] = std::pair( 0 , mof::Vector3D(0 , 10.5f , -5)); - keyFrames[1] = std::pair( 130 , mof::Vector3D(0 , 1.5f , -10 )); - mof::Animation::Handler handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])); - m_pCamera->setEye(handler); - } - - } - - void showTitle(){ - std::vector::Handler> handlerList; - mof::Animation::Handler handler; - for(unsigned int i = 0 ; i < m_modelList.size() ; ++i){ - handlerList.clear(); - mof::Matrix3D matrix = m_modelList.at(i)->getWorldMatrix(); - - { - mof::Vector3D a = mof::Vector3D(1 , 0 , 0) * matrix; - float rad = static_cast(atan2( -a.x , -a.z)); - std::pair keyFrames[] = { - std::pair( 20 , mof::Vector3D(0 , 0 , 0) ) , - std::pair( 50 , mof::Vector3D(0 , -rad , 0)) - }; - handler = mof::Animation::Handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); - handlerList.push_back(handler); - } - - { - handler = mof::constantHandler(matrix); - handlerList.push_back(handler); - } - - - { - float y = (i > 7) ? -1.0f : 0; - float x = (i > 7) ? i - 8.0f : i; - mof::Vector3D position(1.0f * x - 20 , y , -5); - std::pair keyFrames[] = { - std::pair( 0 , mof::Vector3D(0 , 0 , 0) ) , - std::pair( 50 , position - m_modelList.at(i)->getPosition()) - }; - handler = mof::Animation::Handler(new mof::TranslationAnimation3D(keyFrames[0] , keyFrames[1])); - handlerList.push_back(handler); - } - handler = mof::Animation::Handler( - new mof::CascadingAnimation>(handlerList.front() , handlerList.back()) - ); - m_modelList.at(i)->setWorldMatrix(handler); - m_modelList.at(i)->setFinishColor(70 , 20); - m_modelList.at(i)->setFrameNumber(0); - } - - - - { - mof::Vector3D eye = m_pCamera->getEye(); - std::pair keyFrames[] = { - std::pair( 0 , eye) , - std::pair( 20 , eye) , - std::pair( 60 , mof::Vector3D(-16 , 1.0f , eye.z + 1)) , - std::pair( 70 , mof::Vector3D(-14 , -0.5f , eye.z - 8 )) - }; - mof::Animation::Handler handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[3])); - m_pCamera->setEye(handler); - } - - { - std::pair keyFrames[] = { - std::pair( 0 , mof::Vector3D(0 , 0 , 0)) , - std::pair( 20 , mof::Vector3D(0 , 0 , 0)) , - std::pair( 60 , mof::Vector3D(-14 , 0.0f , 0 )) - }; - mof::Animation::Handler handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[2])); - m_pCamera->setCenter(handler); - } - m_pCamera->setFrameNumber(0); - - { - std::pair keyFrames[] = { - std::pair( 70 , mof::Color4f(mof::createColor(0 , 20 , 55)) ) , - std::pair( 90 , mof::Color4f(mof::createColor(255 , 255 , 255)) ) - }; - m_backgroundColor = mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])); - m_backgroundColorFrame = 0; - } - } - - void addPart(){ - std::vector::Handler> handlerList; - mof::Animation::Handler handler; - { - - handlerList.clear(); - std::pair keyFrames[] = { - std::pair( 0 , mof::Vector3D(0 , mof::deg2rad(270) , 0) ) , - std::pair( 40 , mof::Vector3D(0 , mof::deg2rad(360) , 0)) - }; - handler = mof::Animation::Handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); - handlerList.push_back(handler); - - handler = mof::constantHandler(mof::Matrix3D::createScaling(mof::Vector3D(4 , 1 , 1))); - handlerList.push_back(handler); - handler = mof::constantHandler(mof::Matrix3D::createTranslation(mof::Vector3D(-10 , -2 , -5))); - handlerList.push_back(handler); - handler = mof::Animation::Handler( - new mof::CascadingAnimation>(handlerList.front() , handlerList.back()) - ); - ::CharacterBoard* pPartBoard = new ::CharacterBoard( m_part); - pPartBoard->setWorldMatrix(handler); - pPartBoard->setPartColor(0 , 1); - m_modelList.push_back(pPartBoard); - } - } - - - - - - -void initialize( ) -{ - m_pLight = NULL; - m_pCamera = NULL; - m_pBox = NULL; - m_pScheduler = NULL; - m_backgroundColorFrame = 0; - m_part = _T("part7"); - - - - mof::GraphicsDevice::lightEnable(true); - m_pLight = new mof::AmbientLight( mof::Color4f(mof::createColor(255 , 255 , 255))); - - m_pCamera = new mof::Camera(mof::Vector3D(0 , 0.5f , -10) , mof::Vector3D(0 , 0 , 0) , mof::Vector3D(0 , 1 , 0)); - m_backgroundColor = - mof::Animation::Handler(mof::constantHandler(mof::Color4f(mof::createColor(0 , 20 , 55)))); - - m_pScheduler = new mof::EventScheduler(); - m_pScheduler->addEvent( 125 , &::TestScene::showTitle ); - m_pScheduler->addEvent( 125+70 , &::TestScene::addPart ); - begin(); - - -} - - -void finalize(){ - for(std::vector<::CharacterBoard*>::iterator itr = m_modelList.begin() ; - itr != m_modelList.end() ; - ++itr ){ - delete *itr; - } - delete m_pCamera; - delete m_pBox; - delete m_pScheduler; - delete m_pLight; - } - - - - -void update(){ - for(std::vector<::CharacterBoard*>::iterator itr = m_modelList.begin() ; - itr != m_modelList.end() ; - ++itr ){ - (*itr)->update(); - } - m_pBox->update(); - m_pScheduler->update(); - m_pCamera->nextFrame(); - m_backgroundColorFrame++; -} - - - -void draw() -{ - mof::GraphicsDevice::lightEnable(true); - //m_pGraphics->setZBuffer(false); - mof::GraphicsDevice::setViewTransform(m_pCamera->getViewMatrix()); - mof::GraphicsDevice::clearRenderTarget(m_backgroundColor->getValue(m_backgroundColorFrame).toColorCode()); - mof::GraphicsDevice::clearZBuffer(); - mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); - - //m_pBox->draw(); - mof::GraphicsDevice::lightEnable(false); - std::list boardList; - - for(std::vector<::CharacterBoard*>::iterator itr = m_modelList.begin() ; - itr != m_modelList.end() ; - ++itr ){ - (*itr)->append(boardList); - } - - for(std::list::iterator itr = boardList.begin() ; - itr != boardList.end() ; - ++itr ){ - (*itr)->draw(); - } - - - -} - -} // namespace TestScene +#include "TestScene.hpp" +#include "mof/GraphicsDevice.hpp" +#include +#include "mof/VertexBuffer.hpp" +#include "mof/AmbientLight.hpp" +#include "mof/MaterialBuilder.hpp" +#include "mof/Material.hpp" +#include "mof/Camera.hpp" +#include "mof/Texture.hpp" +#include "mof/MeshBuilder.hpp" +#include "mof/Graphics3D.hpp" +#include "mof/mofAnimations.hpp" +#include "mof/EventScheduler.hpp" +#include "mof/EventCondition.hpp" +#include "mof/Board.hpp" +#include "mof/Font.hpp" +#include "CharacterBoard.hpp" +#include +#include +#include +#include +#include "mof/Finalizer.hpp" + +namespace +{ + + mof::AmbientLight* m_pLight; + mof::Camera* m_pCamera; + boost::shared_ptr m_pTexture; + std::vector<::CharacterBoard*> m_modelList; + mof::Graphics3D* m_pBox; + mof::EventScheduler* m_pScheduler; + mof::Animation::Handler m_backgroundColor; + mof::FrameNumber m_backgroundColorFrame; + mof::tstring m_part; +}; + + + + +namespace TestScene +{ + + void begin(){ + std::vector::Handler> handlerList; + + { + std::pair keyFrames[4]; + keyFrames[0] = std::pair( 25 , mof::Vector3D( mof::deg2rad(-90) , 0 , 0)); + keyFrames[1] = std::pair( 50 , mof::Vector3D( mof::deg2rad(-80) , 0 , 0)); + keyFrames[2] = std::pair( 75 , mof::Vector3D( mof::deg2rad(-25) , 0 , 0)); + keyFrames[3] = std::pair( 100 , mof::Vector3D( mof::deg2rad(0) , 0 , 0)); + mof::Animation::Handler handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[3])); + handlerList.push_back(handler); + } + { + mof::Animation::Handler handler( + mof::constantHandler(mof::Matrix3D::createTranslation(mof::Vector3D(0 , 0 , -4.5f))) + ); + handlerList.push_back(handler); + } + { + std::pair keyFrames[3]; + keyFrames[0] = std::pair( 0 , mof::Vector3D( 0 , mof::deg2rad(70) , 0)); + keyFrames[1] = std::pair( 130 , mof::Vector3D( 0 , mof::deg2rad(360) , 0)); + mof::Animation::Handler handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); + handler = mof::Animation::Handler(new mof::LoopAnimation(handler , 200)); + handlerList.push_back(handler); + } + + int size = handlerList.size(); + handlerList.resize(size + 1); + + mof::tstring title[] = { _T("‚R") , _T("”N") , _T("‘O") , _T("‚É") , _T("Á") , _T("Ü") , _T("‚µ") , + _T("‚½") , _T("‚q") , _T("‚o") , _T("‚f") , _T("ŠJ") , _T("”­") , _T("‚ð") , _T("Ä") , _T("ŠJ") , + _T("‚µ") , _T("‚Ä") , _T("‚Ý") , _T("‚é") }; + + for(int i = 0 ; i < 20 ; i++) + { + m_modelList.push_back(new ::CharacterBoard( title[i])); + { + mof::Animation::Handler handler( + mof::constantHandler(mof::Matrix3D::createRotation(mof::Vector3D(0 , mof::deg2rad(-360.0f/20 * i) , 0))) + ); + handlerList.at(size) = handler; + } + mof::Animation::Handler handler(new mof::CascadingAnimation(handlerList.front() , handlerList.back())); + m_modelList.at(i)->setWorldMatrix(handler); + } + + + { + mof::MeshBuilder meshBuilder( "model/demo/box.x"); + m_pBox = meshBuilder.construct(); + handlerList.clear(); + + { + std::pair keyFrames[2]; + keyFrames[0] = std::pair( 0 , mof::Vector3D( 0 , 0 , 0)); + keyFrames[1] = std::pair( 130 , mof::Vector3D( mof::deg2rad(360) , mof::deg2rad(360) , mof::deg2rad(360))); + mof::Animation::Handler handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); + handler = mof::Animation::Handler(new mof::LoopAnimation(handler , 130)); + handlerList.push_back(handler); + } + mof::Animation::Handler handler(new mof::CascadingAnimation(handlerList.front() , handlerList.back())); + m_pBox->setWorldMatrix(handler); + } + + { + std::pair keyFrames[2]; + keyFrames[0] = std::pair( 0 , mof::Vector3D(0 , 10.5f , -5)); + keyFrames[1] = std::pair( 130 , mof::Vector3D(0 , 1.5f , -10 )); + mof::Animation::Handler handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])); + m_pCamera->setEye(handler); + } + + } + + void showTitle(){ + std::vector::Handler> handlerList; + mof::Animation::Handler handler; + for(unsigned int i = 0 ; i < m_modelList.size() ; ++i){ + handlerList.clear(); + mof::Matrix3D matrix = m_modelList.at(i)->getWorldMatrix(); + + { + mof::Vector3D a = mof::Vector3D(1 , 0 , 0) * matrix; + float rad = static_cast(atan2( -a.x , -a.z)); + std::pair keyFrames[] = { + std::pair( 20 , mof::Vector3D(0 , 0 , 0) ) , + std::pair( 50 , mof::Vector3D(0 , -rad , 0)) + }; + handler = mof::Animation::Handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); + handlerList.push_back(handler); + } + + { + handler = mof::constantHandler(matrix); + handlerList.push_back(handler); + } + + + { + float y = (i > 7) ? -1.0f : 0; + float x = (i > 7) ? i - 8.0f : i; + mof::Vector3D position(1.0f * x - 20 , y , -5); + std::pair keyFrames[] = { + std::pair( 0 , mof::Vector3D(0 , 0 , 0) ) , + std::pair( 50 , position - m_modelList.at(i)->getPosition()) + }; + handler = mof::Animation::Handler(new mof::TranslationAnimation3D(keyFrames[0] , keyFrames[1])); + handlerList.push_back(handler); + } + handler = mof::Animation::Handler( + new mof::CascadingAnimation>(handlerList.front() , handlerList.back()) + ); + m_modelList.at(i)->setWorldMatrix(handler); + m_modelList.at(i)->setFinishColor(70 , 20); + m_modelList.at(i)->setFrameNumber(0); + } + + + + { + mof::Vector3D eye = m_pCamera->getEye(); + std::pair keyFrames[] = { + std::pair( 0 , eye) , + std::pair( 20 , eye) , + std::pair( 60 , mof::Vector3D(-16 , 1.0f , eye.z + 1)) , + std::pair( 70 , mof::Vector3D(-14 , -0.5f , eye.z - 8 )) + }; + mof::Animation::Handler handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[3])); + m_pCamera->setEye(handler); + } + + { + std::pair keyFrames[] = { + std::pair( 0 , mof::Vector3D(0 , 0 , 0)) , + std::pair( 20 , mof::Vector3D(0 , 0 , 0)) , + std::pair( 60 , mof::Vector3D(-14 , 0.0f , 0 )) + }; + mof::Animation::Handler handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[2])); + m_pCamera->setCenter(handler); + } + m_pCamera->setFrameNumber(0); + + { + std::pair keyFrames[] = { + std::pair( 70 , mof::Color4f(mof::createColor(0 , 20 , 55)) ) , + std::pair( 90 , mof::Color4f(mof::createColor(255 , 255 , 255)) ) + }; + m_backgroundColor = mof::Animation::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[1])); + m_backgroundColorFrame = 0; + } + } + + void addPart(){ + std::vector::Handler> handlerList; + mof::Animation::Handler handler; + { + + handlerList.clear(); + std::pair keyFrames[] = { + std::pair( 0 , mof::Vector3D(0 , mof::deg2rad(270) , 0) ) , + std::pair( 40 , mof::Vector3D(0 , mof::deg2rad(360) , 0)) + }; + handler = mof::Animation::Handler(new mof::RotationAnimation3D(keyFrames[0] , keyFrames[1])); + handlerList.push_back(handler); + + handler = mof::constantHandler(mof::Matrix3D::createScaling(mof::Vector3D(4 , 1 , 1))); + handlerList.push_back(handler); + handler = mof::constantHandler(mof::Matrix3D::createTranslation(mof::Vector3D(-10 , -2 , -5))); + handlerList.push_back(handler); + handler = mof::Animation::Handler( + new mof::CascadingAnimation>(handlerList.front() , handlerList.back()) + ); + ::CharacterBoard* pPartBoard = new ::CharacterBoard( m_part); + pPartBoard->setWorldMatrix(handler); + pPartBoard->setPartColor(0 , 1); + m_modelList.push_back(pPartBoard); + } + } + + + + + + +void initialize( ) +{ + m_pLight = NULL; + m_pCamera = NULL; + m_pBox = NULL; + m_pScheduler = NULL; + m_backgroundColorFrame = 0; + m_part = _T("part7"); + + + + mof::GraphicsDevice::lightEnable(true); + m_pLight = new mof::AmbientLight( mof::Color4f(mof::createColor(255 , 255 , 255))); + + m_pCamera = new mof::Camera(mof::Vector3D(0 , 0.5f , -10) , mof::Vector3D(0 , 0 , 0) , mof::Vector3D(0 , 1 , 0)); + m_backgroundColor = + mof::Animation::Handler(mof::constantHandler(mof::Color4f(mof::createColor(0 , 20 , 55)))); + + m_pScheduler = new mof::EventScheduler(); + m_pScheduler->addEvent( 125 , &::TestScene::showTitle ); + m_pScheduler->addEvent( 125+70 , &::TestScene::addPart ); + begin(); + + +} + + +void finalize(){ + for(std::vector<::CharacterBoard*>::iterator itr = m_modelList.begin() ; + itr != m_modelList.end() ; + ++itr ){ + delete *itr; + } + delete m_pCamera; + delete m_pBox; + delete m_pScheduler; + delete m_pLight; + } + + + + +void update(){ + for(std::vector<::CharacterBoard*>::iterator itr = m_modelList.begin() ; + itr != m_modelList.end() ; + ++itr ){ + (*itr)->update(); + } + m_pBox->update(); + m_pScheduler->update(); + m_pCamera->nextFrame(); + m_backgroundColorFrame++; +} + + + +void draw() +{ + mof::GraphicsDevice::lightEnable(true); + //m_pGraphics->setZBuffer(false); + mof::GraphicsDevice::setViewTransform(m_pCamera->getViewMatrix()); + mof::GraphicsDevice::clearRenderTarget(m_backgroundColor->getValue(m_backgroundColorFrame).toColorCode()); + mof::GraphicsDevice::clearZBuffer(); + mof::GraphicsDevice::setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); + + //m_pBox->draw(); + mof::GraphicsDevice::lightEnable(false); + std::list boardList; + + for(std::vector<::CharacterBoard*>::iterator itr = m_modelList.begin() ; + itr != m_modelList.end() ; + ++itr ){ + (*itr)->append(boardList); + } + + for(std::list::iterator itr = boardList.begin() ; + itr != boardList.end() ; + ++itr ){ + (*itr)->draw(); + } + + + +} + +} // namespace TestScene diff --git a/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.cpp b/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.cpp index fa95271..ed938c7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.cpp @@ -1,84 +1,84 @@ -#include "UsingBattleItemMenu.h" -#include "mof/KeyFrameAnimation.h" -#include "MyWindow.h" -#include "TargetMenu.h" -#include "BattleData.h" -#include "BattlerGroup.h" -#include "BattlerFacade.h" - -mof::Window* et::UsingBattleItemMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ - mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); - pOwner->add(pSelectable); - selectables.push_back(pSelectable); - return pSelectable; -} - -et::UsingBattleItemMenu::UsingBattleItemMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) -: et::ItemOperationMenu(pTextureManager->getResource(_T("image/frame0.png")) ) -{ - m_pBattleData = pBattleData; - - m_pSelector = NULL; - m_pTextureManager = pTextureManager; - std::vector selectables; - - mof::Window* pSelectable = NULL; - addSelectableTextItem(this , selectables , _T("‚‚©‚¤") , 16); - - m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); - setVisible(true); -} - -et::UsingBattleItemMenu::~UsingBattleItemMenu(void) -{ - delete m_pSelector; -} - - - - - -void et::UsingBattleItemMenu::setVisible(bool visible){ - et::MyFrame::setVisible(visible); - if(visible){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(160 ,500)); - pAnimation->setPosition(10 , mof::Vector2D(160 , 370)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(160 , 370)); - pAnimation->setPosition(10 , mof::Vector2D(160 , 500)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } -} - -et::MyFrame* et::UsingBattleItemMenu::performAction(){ - et::BattleAction action; - action.type = et::BattleAction::USE_ITEM; - action.pTargetItem = m_pItemData; - action.pTarget = m_pBattleData->getBattlerGroup()->getHeroBattler(); - m_pBattleData->setBattleAction(action); - return this; -} - - - - -et::UsingBattleItemMenuFactory::UsingBattleItemMenuFactory(mof::TextureManager* pTextureManager , et::BattleData* pBattleData){ - m_pTextureManager = pTextureManager; - m_pBattleData = pBattleData; -} - -et::UsingBattleItemMenuFactory::~UsingBattleItemMenuFactory(){ - -} - -et::ItemOperationMenu* et::UsingBattleItemMenuFactory::create(){ - return new UsingBattleItemMenu(m_pTextureManager , m_pBattleData); +#include "UsingBattleItemMenu.h" +#include "mof/KeyFrameAnimation.h" +#include "MyWindow.h" +#include "TargetMenu.h" +#include "BattleData.h" +#include "BattlerGroup.h" +#include "BattlerFacade.h" + +mof::Window* et::UsingBattleItemMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ + mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); + pOwner->add(pSelectable); + selectables.push_back(pSelectable); + return pSelectable; +} + +et::UsingBattleItemMenu::UsingBattleItemMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData ) +: et::ItemOperationMenu(pTextureManager->getResource(_T("image/frame0.png")) ) +{ + m_pBattleData = pBattleData; + + m_pSelector = NULL; + m_pTextureManager = pTextureManager; + std::vector selectables; + + mof::Window* pSelectable = NULL; + addSelectableTextItem(this , selectables , _T("‚‚©‚¤") , 16); + + m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); + setVisible(true); +} + +et::UsingBattleItemMenu::~UsingBattleItemMenu(void) +{ + delete m_pSelector; +} + + + + + +void et::UsingBattleItemMenu::setVisible(bool visible){ + et::MyFrame::setVisible(visible); + if(visible){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(160 ,500)); + pAnimation->setPosition(10 , mof::Vector2D(160 , 370)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(160 , 370)); + pAnimation->setPosition(10 , mof::Vector2D(160 , 500)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } +} + +et::MyFrame* et::UsingBattleItemMenu::performAction(){ + et::BattleAction action; + action.type = et::BattleAction::USE_ITEM; + action.pTargetItem = m_pItemData; + action.pTarget = m_pBattleData->getBattlerGroup()->getHeroBattler(); + m_pBattleData->setBattleAction(action); + return this; +} + + + + +et::UsingBattleItemMenuFactory::UsingBattleItemMenuFactory(mof::TextureManager* pTextureManager , et::BattleData* pBattleData){ + m_pTextureManager = pTextureManager; + m_pBattleData = pBattleData; +} + +et::UsingBattleItemMenuFactory::~UsingBattleItemMenuFactory(){ + +} + +et::ItemOperationMenu* et::UsingBattleItemMenuFactory::create(){ + return new UsingBattleItemMenu(m_pTextureManager , m_pBattleData); } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.h b/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.h index cdbb23a..73dd616 100644 --- a/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/UsingBattleItemMenu.h @@ -1,38 +1,38 @@ -#pragma once -#include "MyFrame.h" -#include "mof/Texture.h" -#include "ItemOperationMenu.h" - - -namespace et{ - class BattleData; - - class UsingBattleItemMenu : public ItemOperationMenu - { - mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); - - mof::SelectionModel* m_pSelector; - mof::TextureManager* m_pTextureManager; - - et::BattleData* m_pBattleData; - - public: - UsingBattleItemMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); - virtual ~UsingBattleItemMenu(void); - virtual void setVisible(bool visible); - virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} - virtual MyFrame* performAction(); - }; - - class UsingBattleItemMenuFactory : public ItemOperatorFactory{ - mof::TextureManager* m_pTextureManager; - et::BattleData* m_pBattleData; - public: - UsingBattleItemMenuFactory(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); - virtual ~UsingBattleItemMenuFactory(); - virtual ItemOperationMenu* create(); - - }; - - +#pragma once +#include "MyFrame.h" +#include "mof/Texture.h" +#include "ItemOperationMenu.h" + + +namespace et{ + class BattleData; + + class UsingBattleItemMenu : public ItemOperationMenu + { + mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); + + mof::SelectionModel* m_pSelector; + mof::TextureManager* m_pTextureManager; + + et::BattleData* m_pBattleData; + + public: + UsingBattleItemMenu(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); + virtual ~UsingBattleItemMenu(void); + virtual void setVisible(bool visible); + virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} + virtual MyFrame* performAction(); + }; + + class UsingBattleItemMenuFactory : public ItemOperatorFactory{ + mof::TextureManager* m_pTextureManager; + et::BattleData* m_pBattleData; + public: + UsingBattleItemMenuFactory(mof::TextureManager* pTextureManager , et::BattleData* pBattleData); + virtual ~UsingBattleItemMenuFactory(); + virtual ItemOperationMenu* create(); + + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/World.cpp b/saisei-1_0/rpg/rpg/oldcode/World.cpp index 57dcacf..e1ef418 100644 --- a/saisei-1_0/rpg/rpg/oldcode/World.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/World.cpp @@ -1,83 +1,83 @@ -#include "World.h" -#include "mof/ConsoleIO.h" - - - - -et::World::World(std::vector& regenerationHistory) -{ - m_regenerationLevel = 0; - m_term = 0; - int regenePoint = 0; - - std::vector stock; - - m_pAreaMap = new et::AreaMap(10 , 10); - for(int i = 0 ; i < regenerationHistory.size() ; i++){ - et::RegenerationEvent event = regenerationHistory.at(i); - if(event.isSleepEvent()){ - m_term++; - for(int j = 0 ; j < stock.size() ; j++){ - regenePoint += updateAreaPowerLevel(stock.at(j).position , stock.at(j)); - } - stock.clear(); - } - else stock.push_back(event); - } - - for(int i = 0 ; i < stock.size() ; i++){ - //”z’uÏ‚݃GƒŒƒƒ“ƒg‚Æ‚µ‚ďˆ— - et::Area area = m_pAreaMap->get(stock.at(i).position.x , stock.at(i).position.y); - if(stock.at(i).forest)area.forestGen = true; - } - m_regenerationLevel = regenePoint / 10; -} - -et::World::~World(void) -{ - delete m_pAreaMap; -} - - -int et::World::updateAreaPowerLevel(mof::Vector2D& position , et::RegenerationEvent& event){ - int regenePoint = 0; - static int tableX[] = { -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1}; - static int tableY[] = { -1 , -1 , -1 , 0 , 0 , 0 , 1 , 1 , 1}; - static int tableEffect[] = { 1 , 3 , 1 , 3 , 5 , 3 , 1 , 3 , 1}; - for(int i = 0 ; i < 9 ; i++){ - mof::Vector2D target = position; - target.x += tableX[i]; - target.y += tableY[i]; - if(0 <= target.x && target.x < m_pAreaMap->getWidth() && 0 <= target.y && target.y < m_pAreaMap->getHeight() ){ - et::Area area = m_pAreaMap->get(target.x , target.y); - if(event.forest){ - int tmp = area.powerLevel.forest; - area.powerLevel.forest += tableEffect[i]; - if(area.powerLevel.forest > 9)area.powerLevel.forest = 9; - regenePoint += area.powerLevel.forest - tmp; - } - m_pAreaMap->set(target.x , target.y , area); - } - - } - return regenePoint; - -} - -et::Area& et::World::getArea(int x , int y){ - return m_pAreaMap->get(x , y); -} - -void et::World::setArea(int x , int y , et::Area& area){ - m_pAreaMap->set(x , y , area); -} - - - -et::AreaPowerLevelMap et::World::getAreaPowerLevelMap(){ - et::AreaPowerLevelMap powerLevelMap(m_pAreaMap->getWidth() , m_pAreaMap->getHeight()); - for(int x = 0 ; x < powerLevelMap.getWidth() ; x++){ - for(int y = 0 ; y < powerLevelMap.getHeight() ; y++)powerLevelMap.set(x , y , m_pAreaMap->get(x , y).powerLevel); - } - return powerLevelMap; -} +#include "World.h" +#include "mof/ConsoleIO.h" + + + + +et::World::World(std::vector& regenerationHistory) +{ + m_regenerationLevel = 0; + m_term = 0; + int regenePoint = 0; + + std::vector stock; + + m_pAreaMap = new et::AreaMap(10 , 10); + for(int i = 0 ; i < regenerationHistory.size() ; i++){ + et::RegenerationEvent event = regenerationHistory.at(i); + if(event.isSleepEvent()){ + m_term++; + for(int j = 0 ; j < stock.size() ; j++){ + regenePoint += updateAreaPowerLevel(stock.at(j).position , stock.at(j)); + } + stock.clear(); + } + else stock.push_back(event); + } + + for(int i = 0 ; i < stock.size() ; i++){ + //”z’uÏ‚݃GƒŒƒƒ“ƒg‚Æ‚µ‚ďˆ— + et::Area area = m_pAreaMap->get(stock.at(i).position.x , stock.at(i).position.y); + if(stock.at(i).forest)area.forestGen = true; + } + m_regenerationLevel = regenePoint / 10; +} + +et::World::~World(void) +{ + delete m_pAreaMap; +} + + +int et::World::updateAreaPowerLevel(mof::Vector2D& position , et::RegenerationEvent& event){ + int regenePoint = 0; + static int tableX[] = { -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1}; + static int tableY[] = { -1 , -1 , -1 , 0 , 0 , 0 , 1 , 1 , 1}; + static int tableEffect[] = { 1 , 3 , 1 , 3 , 5 , 3 , 1 , 3 , 1}; + for(int i = 0 ; i < 9 ; i++){ + mof::Vector2D target = position; + target.x += tableX[i]; + target.y += tableY[i]; + if(0 <= target.x && target.x < m_pAreaMap->getWidth() && 0 <= target.y && target.y < m_pAreaMap->getHeight() ){ + et::Area area = m_pAreaMap->get(target.x , target.y); + if(event.forest){ + int tmp = area.powerLevel.forest; + area.powerLevel.forest += tableEffect[i]; + if(area.powerLevel.forest > 9)area.powerLevel.forest = 9; + regenePoint += area.powerLevel.forest - tmp; + } + m_pAreaMap->set(target.x , target.y , area); + } + + } + return regenePoint; + +} + +et::Area& et::World::getArea(int x , int y){ + return m_pAreaMap->get(x , y); +} + +void et::World::setArea(int x , int y , et::Area& area){ + m_pAreaMap->set(x , y , area); +} + + + +et::AreaPowerLevelMap et::World::getAreaPowerLevelMap(){ + et::AreaPowerLevelMap powerLevelMap(m_pAreaMap->getWidth() , m_pAreaMap->getHeight()); + for(int x = 0 ; x < powerLevelMap.getWidth() ; x++){ + for(int y = 0 ; y < powerLevelMap.getHeight() ; y++)powerLevelMap.set(x , y , m_pAreaMap->get(x , y).powerLevel); + } + return powerLevelMap; +} diff --git a/saisei-1_0/rpg/rpg/oldcode/World.h b/saisei-1_0/rpg/rpg/oldcode/World.h index dd00762..2444143 100644 --- a/saisei-1_0/rpg/rpg/oldcode/World.h +++ b/saisei-1_0/rpg/rpg/oldcode/World.h @@ -1,60 +1,60 @@ -#pragma once -#include "Area.h" -#include "mof/Vector2D.h" -#include - -namespace et{ - struct RegenerationEvent{ - int term; - mof::Vector2D position; - bool forest; - bool earth; - - static RegenerationEvent createSleepEvent(int currentTerm ){ - RegenerationEvent event; - event.term = currentTerm; - event.forest = event.earth = false; - return event; - } - - static RegenerationEvent createForestGenEvent(int currentTerm , mof::Vector2D _position){ - RegenerationEvent event; - event.position = _position; - event.forest = true; - event.earth = false; - event.term = currentTerm; - return event; - } - - bool isSleepEvent(){ - return (!forest && !earth); - } - }; - - - - class World - { - et::AreaMap* m_pAreaMap; - int m_regenerationLevel; - int m_term; - - int updateAreaPowerLevel(mof::Vector2D& position , et::RegenerationEvent& event); - public: - World(std::vector& regenerationHistory); - ~World(void); - - - et::Area& getArea(int x , int y); - void setArea(int x , int y , et::Area& area); - et::AreaPowerLevelMap getAreaPowerLevelMap(); - int getRegenerationLevel(){return m_regenerationLevel;} - int getTerm(){return m_term;} - - int getAreaWidth(){return m_pAreaMap->getWidth();} - int getAreaHeight(){return m_pAreaMap->getHeight();} - }; - - - +#pragma once +#include "Area.h" +#include "mof/Vector2D.h" +#include + +namespace et{ + struct RegenerationEvent{ + int term; + mof::Vector2D position; + bool forest; + bool earth; + + static RegenerationEvent createSleepEvent(int currentTerm ){ + RegenerationEvent event; + event.term = currentTerm; + event.forest = event.earth = false; + return event; + } + + static RegenerationEvent createForestGenEvent(int currentTerm , mof::Vector2D _position){ + RegenerationEvent event; + event.position = _position; + event.forest = true; + event.earth = false; + event.term = currentTerm; + return event; + } + + bool isSleepEvent(){ + return (!forest && !earth); + } + }; + + + + class World + { + et::AreaMap* m_pAreaMap; + int m_regenerationLevel; + int m_term; + + int updateAreaPowerLevel(mof::Vector2D& position , et::RegenerationEvent& event); + public: + World(std::vector& regenerationHistory); + ~World(void); + + + et::Area& getArea(int x , int y); + void setArea(int x , int y , et::Area& area); + et::AreaPowerLevelMap getAreaPowerLevelMap(); + int getRegenerationLevel(){return m_regenerationLevel;} + int getTerm(){return m_term;} + + int getAreaWidth(){return m_pAreaMap->getWidth();} + int getAreaHeight(){return m_pAreaMap->getHeight();} + }; + + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.cpp b/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.cpp index aa03a31..15fad03 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.cpp @@ -1,42 +1,42 @@ -#include "WorldMapBuilder.h" -#include "MapImageColor.h" -#include "mof/ConsoleIO.h" - - -et::WorldMapBuilder::WorldMapBuilder(et::AreaPowerLevelMap &map , mof::TextureManager* pTextureManager , float scale) -: et::MapBuilder( pTextureManager , scale , map.getWidth() , map.getHeight()) , m_map(map) -{ - m_pTexture = m_pTextureManager->getResource(_T("image/worldtip.png")); -} - -et::WorldMapBuilder::~WorldMapBuilder(void) -{ -} - -void et::WorldMapBuilder::addParts(std::vector& vertices , int x , int y){ - - const float SCALE = getScale(); - et::VertexTypeDungeon vertex; - vertex.y = 0.0f; - float t = 0.0001f;//ƒeƒNƒXƒ`ƒƒ‹«ŠE•â³ - const float tmpTexel = 32.0f / (float)m_pTexture->getWidth(); - vertex.color = mof::createColor(255 , 255 , 255); - float tableX[]={ 0.0f , SCALE , SCALE , SCALE , 0.0f , 0.0f}; - float tableZ[]={ 0.0f , 0.0f , -SCALE , -SCALE , -SCALE , 0.0f}; - float tableTU[]={ 0.0f+t , tmpTexel-t , tmpTexel-t , tmpTexel-t , 0.0f+t , 0.0f+t}; - float tableTV[]={ 0.0f+t, 0.0f+t , tmpTexel-t , tmpTexel-t , tmpTexel-t , 0.0f+t}; - - - float toForestLevelTable[] = {0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 , 4 , 5 }; - for(int i = 0 ; i < 6 ; i++){ - vertex.x = tableX[i] + SCALE * x; - vertex.z = tableZ[i] - SCALE * y; - vertex.tu = tableTU[i] + toForestLevelTable[getMap().get(x , y).forest] * tmpTexel; - vertex.tv = tableTV[i]; - vertices.push_back(vertex); - - } - return; - - +#include "WorldMapBuilder.h" +#include "MapImageColor.h" +#include "mof/ConsoleIO.h" + + +et::WorldMapBuilder::WorldMapBuilder(et::AreaPowerLevelMap &map , mof::TextureManager* pTextureManager , float scale) +: et::MapBuilder( pTextureManager , scale , map.getWidth() , map.getHeight()) , m_map(map) +{ + m_pTexture = m_pTextureManager->getResource(_T("image/worldtip.png")); +} + +et::WorldMapBuilder::~WorldMapBuilder(void) +{ +} + +void et::WorldMapBuilder::addParts(std::vector& vertices , int x , int y){ + + const float SCALE = getScale(); + et::VertexTypeDungeon vertex; + vertex.y = 0.0f; + float t = 0.0001f;//ƒeƒNƒXƒ`ƒƒ‹«ŠE•â³ + const float tmpTexel = 32.0f / (float)m_pTexture->getWidth(); + vertex.color = mof::createColor(255 , 255 , 255); + float tableX[]={ 0.0f , SCALE , SCALE , SCALE , 0.0f , 0.0f}; + float tableZ[]={ 0.0f , 0.0f , -SCALE , -SCALE , -SCALE , 0.0f}; + float tableTU[]={ 0.0f+t , tmpTexel-t , tmpTexel-t , tmpTexel-t , 0.0f+t , 0.0f+t}; + float tableTV[]={ 0.0f+t, 0.0f+t , tmpTexel-t , tmpTexel-t , tmpTexel-t , 0.0f+t}; + + + float toForestLevelTable[] = {0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 , 4 , 5 }; + for(int i = 0 ; i < 6 ; i++){ + vertex.x = tableX[i] + SCALE * x; + vertex.z = tableZ[i] - SCALE * y; + vertex.tu = tableTU[i] + toForestLevelTable[getMap().get(x , y).forest] * tmpTexel; + vertex.tv = tableTV[i]; + vertices.push_back(vertex); + + } + return; + + } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.h b/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.h index 2331b45..a8d6fe3 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.h +++ b/saisei-1_0/rpg/rpg/oldcode/WorldMapBuilder.h @@ -1,23 +1,23 @@ -#pragma once -#include "DungeonBuilder.h" -#include "mof/GeneralMap.h" -#include "Area.h" - -namespace et{ - - - class WorldMapBuilder : public MapBuilder - { - et::AreaPowerLevelMap m_map; - mof::TextureResource m_pTexture; - protected: - et::AreaPowerLevelMap& getMap(){return m_map;} - virtual void addParts(std::vector& vertices , int x , int y); - - public: - WorldMapBuilder(et::AreaPowerLevelMap &map , mof::TextureManager* pTextureManager , float scale); - virtual ~WorldMapBuilder(void); - }; - - -}; +#pragma once +#include "DungeonBuilder.h" +#include "mof/GeneralMap.h" +#include "Area.h" + +namespace et{ + + + class WorldMapBuilder : public MapBuilder + { + et::AreaPowerLevelMap m_map; + mof::TextureResource m_pTexture; + protected: + et::AreaPowerLevelMap& getMap(){return m_map;} + virtual void addParts(std::vector& vertices , int x , int y); + + public: + WorldMapBuilder(et::AreaPowerLevelMap &map , mof::TextureManager* pTextureManager , float scale); + virtual ~WorldMapBuilder(void); + }; + + +}; diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.cpp b/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.cpp index 4f2f1f1..b3f9490 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.cpp @@ -1,40 +1,40 @@ -#include "WorldMapCursor.h" -#include "mof/KeyFrameAnimation.h" -#include "mof/ConsoleIO.h" - - -et::WorldMapCursor::WorldMapCursor(mof::Component3D* pBody) -: Symbol(pBody , 0.05f) -{ - mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(true); - for(int i = 0 ; i < 120 ; i++){ - float angle = 2 * 3.14f / (float)120 * (float)i; - pKeyFrameAnimation->setRotation(i , mof::Vector3D(0.0f , angle , 0.0f)); - } - setAnimation( 1 , mof::AnimationResource(pKeyFrameAnimation)); -} - -et::WorldMapCursor::~WorldMapCursor(void) -{ -} - - -void et::WorldMapCursor::move(Direction direction , mof::Vector3D& position , int length) -{ - m_direction = direction; - mof::AnimationResource pAnimation = getAnimation(3); - if(pAnimation.get() != NULL && !pAnimation->isFinalized())return; - - mof::Vector3D current = getPosition(); - mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); - pKeyFrameAnimation->setPosition(0 , current); - pKeyFrameAnimation->setPosition(length , position); - - setAnimation( 3 , mof::AnimationResource(pKeyFrameAnimation)); - -} - - -bool et::WorldMapCursor::isTraveling(){ - return (getAnimationSet()->getElement(3).get() != NULL && !getAnimationSet()->getElement(3)->isFinalized()); +#include "WorldMapCursor.h" +#include "mof/KeyFrameAnimation.h" +#include "mof/ConsoleIO.h" + + +et::WorldMapCursor::WorldMapCursor(mof::Component3D* pBody) +: Symbol(pBody , 0.05f) +{ + mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(true); + for(int i = 0 ; i < 120 ; i++){ + float angle = 2 * 3.14f / (float)120 * (float)i; + pKeyFrameAnimation->setRotation(i , mof::Vector3D(0.0f , angle , 0.0f)); + } + setAnimation( 1 , mof::AnimationResource(pKeyFrameAnimation)); +} + +et::WorldMapCursor::~WorldMapCursor(void) +{ +} + + +void et::WorldMapCursor::move(Direction direction , mof::Vector3D& position , int length) +{ + m_direction = direction; + mof::AnimationResource pAnimation = getAnimation(3); + if(pAnimation.get() != NULL && !pAnimation->isFinalized())return; + + mof::Vector3D current = getPosition(); + mof::KeyFrameAnimation* pKeyFrameAnimation = new mof::KeyFrameAnimation(); + pKeyFrameAnimation->setPosition(0 , current); + pKeyFrameAnimation->setPosition(length , position); + + setAnimation( 3 , mof::AnimationResource(pKeyFrameAnimation)); + +} + + +bool et::WorldMapCursor::isTraveling(){ + return (getAnimationSet()->getElement(3).get() != NULL && !getAnimationSet()->getElement(3)->isFinalized()); } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.h b/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.h index c223a2b..a1397c7 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.h +++ b/saisei-1_0/rpg/rpg/oldcode/WorldMapCursor.h @@ -1,18 +1,18 @@ -#pragma once -#include "Symbol.h" - -namespace et{ - - - class WorldMapCursor : public Symbol - { - public: - WorldMapCursor(mof::Component3D* pBody); - virtual ~WorldMapCursor(void); - void move(Direction direction , mof::Vector3D& position , int length); - bool isTraveling(); - //void setAnimation(mof::AnimationResource& pAnime); - }; - - +#pragma once +#include "Symbol.h" + +namespace et{ + + + class WorldMapCursor : public Symbol + { + public: + WorldMapCursor(mof::Component3D* pBody); + virtual ~WorldMapCursor(void); + void move(Direction direction , mof::Vector3D& position , int length); + bool isTraveling(); + //void setAnimation(mof::AnimationResource& pAnime); + }; + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldMenu.cpp b/saisei-1_0/rpg/rpg/oldcode/WorldMenu.cpp index 70b370c..cd1733b 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldMenu.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/WorldMenu.cpp @@ -1,88 +1,88 @@ -#include "WorldMenu.h" -#include "mof/KeyFrameAnimation.h" -#include "MyWindow.h" - - -et::WorldMenu::WorldMenu( mof::TextureManager* pTextureManager , et::World* pWorld , et::GameData* pGameData) -: et::MyFrame(mof::Line2D( 650 , 50 , 800 , 200) , true , pTextureManager->getResource(_T("image/frame0.png")) ) -{ - m_pTextureManager = pTextureManager; - m_pWorld = pWorld; - m_pGameData = pGameData; - m_pSelector = NULL; - std::vector selectables; - - mof::Window* pSelectable = NULL; - add(mof::Sprite::createSpriteFromText(_T("ƒ[ƒ‹ƒhƒƒjƒ…[") , 16) ); - pSelectable = addSelectableTextItem(this , selectables , _T("ƒ_ƒ“ƒWƒ‡ƒ“’Tõ") , 16); - pSelectable->setAvailable(false); - addSelectableTextItem(this , selectables , _T("ƒGƒŠƒAƒƒjƒ…[") , 16); - addSelectableTextItem(this , selectables , _T("ƒXƒŠ[ƒv") , 16); - pSelectable = addSelectableTextItem(this , selectables , _T("ƒ[ƒ‹ƒh‰ðÍ") , 16); - pSelectable->setAvailable(false); - m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); - setVisible(true); -} - - - - -et::WorldMenu::~WorldMenu(void) -{ - delete m_pSelector; -} - - - - -void et::WorldMenu::setVisible(bool visible){ - et::MyFrame::setVisible(visible); - if(visible){ - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(650 , 50)); - pAnimation->setPosition(7 , mof::Vector2D(440 , 50)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } - else { - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition(0 , mof::Vector2D(440 , 50)); - pAnimation->setPosition(7 , mof::Vector2D(650 , 50)); - mof::AnimationResource resource(pAnimation); - m_pSelector->setMenuAnimation(resource); - setAnimation(0 , resource); - } -} - -et::MyFrame* et::WorldMenu::performAction(){ - - switch(getSelectionModel()->getSelectingIndex()){ - case 0 : //ƒ_ƒ“ƒWƒ‡ƒ“’Tõ - return this; - case 1 : //ƒGƒŠƒAƒƒjƒ…[ - { - //ƒ[ƒ‹ƒhƒƒjƒ…[¨ƒGƒŠƒAƒƒjƒ…[‚Ì‘JˆÚƒAƒjƒ‚ðƒZƒbƒg - setVisible(false); - return NULL; - } - case 2 : //ƒXƒŠ[ƒv - { - m_pGameData->addRegenerationEvent(et::RegenerationEvent::createSleepEvent(m_pWorld->getTerm())); - setVisible(false); - return NULL; - } - default : - DEBUG_PRINT("–¢’è‹`‚̃AƒNƒVƒ‡ƒ“‚ª—v‹‚³‚ê‚Ü‚µ‚½"); - return NULL; - } -} - - - -mof::Window* et::WorldMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ - mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); - pOwner->add(pSelectable); - selectables.push_back(pSelectable); - return pSelectable; +#include "WorldMenu.h" +#include "mof/KeyFrameAnimation.h" +#include "MyWindow.h" + + +et::WorldMenu::WorldMenu( mof::TextureManager* pTextureManager , et::World* pWorld , et::GameData* pGameData) +: et::MyFrame(mof::Line2D( 650 , 50 , 800 , 200) , true , pTextureManager->getResource(_T("image/frame0.png")) ) +{ + m_pTextureManager = pTextureManager; + m_pWorld = pWorld; + m_pGameData = pGameData; + m_pSelector = NULL; + std::vector selectables; + + mof::Window* pSelectable = NULL; + add(mof::Sprite::createSpriteFromText(_T("ƒ[ƒ‹ƒhƒƒjƒ…[") , 16) ); + pSelectable = addSelectableTextItem(this , selectables , _T("ƒ_ƒ“ƒWƒ‡ƒ“’Tõ") , 16); + pSelectable->setAvailable(false); + addSelectableTextItem(this , selectables , _T("ƒGƒŠƒAƒƒjƒ…[") , 16); + addSelectableTextItem(this , selectables , _T("ƒXƒŠ[ƒv") , 16); + pSelectable = addSelectableTextItem(this , selectables , _T("ƒ[ƒ‹ƒh‰ðÍ") , 16); + pSelectable->setAvailable(false); + m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource()); + setVisible(true); +} + + + + +et::WorldMenu::~WorldMenu(void) +{ + delete m_pSelector; +} + + + + +void et::WorldMenu::setVisible(bool visible){ + et::MyFrame::setVisible(visible); + if(visible){ + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(650 , 50)); + pAnimation->setPosition(7 , mof::Vector2D(440 , 50)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } + else { + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition(0 , mof::Vector2D(440 , 50)); + pAnimation->setPosition(7 , mof::Vector2D(650 , 50)); + mof::AnimationResource resource(pAnimation); + m_pSelector->setMenuAnimation(resource); + setAnimation(0 , resource); + } +} + +et::MyFrame* et::WorldMenu::performAction(){ + + switch(getSelectionModel()->getSelectingIndex()){ + case 0 : //ƒ_ƒ“ƒWƒ‡ƒ“’Tõ + return this; + case 1 : //ƒGƒŠƒAƒƒjƒ…[ + { + //ƒ[ƒ‹ƒhƒƒjƒ…[¨ƒGƒŠƒAƒƒjƒ…[‚Ì‘JˆÚƒAƒjƒ‚ðƒZƒbƒg + setVisible(false); + return NULL; + } + case 2 : //ƒXƒŠ[ƒv + { + m_pGameData->addRegenerationEvent(et::RegenerationEvent::createSleepEvent(m_pWorld->getTerm())); + setVisible(false); + return NULL; + } + default : + DEBUG_PRINT("–¢’è‹`‚̃AƒNƒVƒ‡ƒ“‚ª—v‹‚³‚ê‚Ü‚µ‚½"); + return NULL; + } +} + + + +mof::Window* et::WorldMenu::addSelectableTextItem(mof::Window* pOwner, std::vector& selectables , TCHAR* text , int size){ + mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager); + pOwner->add(pSelectable); + selectables.push_back(pSelectable); + return pSelectable; } \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldMenu.h b/saisei-1_0/rpg/rpg/oldcode/WorldMenu.h index 2a11bba..1c13fb1 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldMenu.h +++ b/saisei-1_0/rpg/rpg/oldcode/WorldMenu.h @@ -1,29 +1,29 @@ -#pragma once -#include "mof/SelectionModel.h" -#include "MyFrame.h" -#include "World.h" -#include "GameData.h" - - -namespace et{ - - class WorldMenu : public MyFrame{ - mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); - - mof::SelectionModel* m_pSelector; - mof::TextureManager* m_pTextureManager; - et::World* m_pWorld; - et::GameData* m_pGameData; - public: - WorldMenu( mof::TextureManager* pTextureManager , et::World* pWorld , et::GameData* pGameData); - virtual ~WorldMenu(); - virtual void setVisible(bool visible); - - virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} - virtual MyFrame* performAction(); - - }; - - - +#pragma once +#include "mof/SelectionModel.h" +#include "MyFrame.h" +#include "World.h" +#include "GameData.h" + + +namespace et{ + + class WorldMenu : public MyFrame{ + mof::Window* addSelectableTextItem(mof::Window* pOwner , std::vector& selectables , TCHAR* text , int size); + + mof::SelectionModel* m_pSelector; + mof::TextureManager* m_pTextureManager; + et::World* m_pWorld; + et::GameData* m_pGameData; + public: + WorldMenu( mof::TextureManager* pTextureManager , et::World* pWorld , et::GameData* pGameData); + virtual ~WorldMenu(); + virtual void setVisible(bool visible); + + virtual mof::SelectionModel* getSelectionModel(){return m_pSelector;} + virtual MyFrame* performAction(); + + }; + + + }; \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldScene.cpp b/saisei-1_0/rpg/rpg/oldcode/WorldScene.cpp index 893b777..1a27e39 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldScene.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/WorldScene.cpp @@ -1,361 +1,361 @@ -#include "WorldScene.h" -#include "mof/GraphicsDevice.h" -#include "mof/AmbientLight.h" -#include "mof/InputDevice.h" -#include "mof/ConsoleIO.h" -#include -#include "mof/System.h" -#include "Area.h" -#include "DungeonBuilderA.h" -#include "mof/AmbientLight.h" -#include "mof/DirectionalLight.h" -#include "mof/ConsoleIO.h" -#include "mof/SoftVertexBufferImpl.h" -#include "mof/KeyFrameAnimation.h" -#include - -mof::Vector2D toAreaCoord(mof::Vector3D position){ - return mof::Vector2D(position.x / 0.03f , -position.z / 0.03f); -} - -mof::Vector3D toWorldCoord(mof::Vector2D position){ - return mof::Vector3D((float)position.x * 0.03f + 0.015f , 0.015f , (float)position.y * -0.03f - 0.015f); -} - -et::WorldScene::WorldScene() -: et::GameScene() -{ - - m_pWindow = NULL; - m_pBuilder = NULL; - m_pWorldMap = NULL; - m_pCamera = NULL; - m_pGrid = NULL; - m_pPoint = NULL; - //m_state = et::WorldScene::OPENING; - m_pCurrentFrame = NULL; - m_pAreaMenu = NULL; - m_pWorldMenu = NULL; - m_pWorld = NULL; - m_pFeedEffect = NULL; -} - -et::WorldScene::~WorldScene(void) -{ - //delete m_pAreaMenu; - delete m_pWorld; - delete m_pAreaMenu; - delete m_pWorldMenu; - delete m_pWindow; - delete m_pBuilder; - delete m_pWorldMap; - delete m_pCamera; - delete m_pCursor; - delete m_pGrid; - delete m_pPoint; - delete m_pFeedEffect; -} - - -bool et::WorldScene::initialize(){ - - m_pWorld = m_pGameData->createWorld(); - - //Ä¶“x•\Ž¦ƒtƒŒ[ƒ€‚̍쐬 - m_pWindow = new et::MyFrame(mof::Line2D( 370 , 400 , 600 , 450) , false , m_pTextureManager->getResource(_T("image/frame0.png"))); - std::stringstream os; - os << _T("Ä¶“x") << m_pWorld->getRegenerationLevel() << _T("/Term") << m_pWorld->getTerm(); - m_pWindow->add(mof::Sprite::createSpriteFromText((TCHAR*)os.str().c_str() , 24)); - m_pWindow->setLayout(); - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - //ƒAƒjƒ‚̐ݒè - pAnimation->setPosition( 1 , mof::Vector2D( 220 , 200 )); - pAnimation->setPosition(180 , mof::Vector2D(400 , 380)); - m_pWindow->setAnimation(0 , mof::AnimationResource(pAnimation)); - - //ƒ[ƒ‹ƒhƒƒjƒ…‚̍쐬 - m_pWorldMenu = new et::WorldMenu(m_pTextureManager , m_pWorld , m_pGameData); - m_pCurrentFrame = m_pWorldMenu; - - //ƒtƒF[ƒhƒGƒtƒFƒNƒg - mof::RectangleModel rect = mof::System::getInstance()->getBounds(); - m_pFeedEffect = new mof::Sprite(mof::Line2D(rect.getPosition() , rect.getWidth() , rect.getHeight()) , - mof::Line2D() , m_pTextureManager->getResource(_T("null"))); - pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setColor(0 , mof::createColor(255 , 0 , 0 , 0)); - pAnimation->setColor(180 , mof::createColor(255 , 0 , 0 , 0)); - pAnimation->setColor(210 , mof::createColor(0 , 0 , 0 , 0)); - m_pFeedEffect->setAnimation(0 , mof::AnimationResource(pAnimation)); - - m_translationScheduler.add(0 , m_pWindow->getAnimationSet()); - m_translationScheduler.add(180 , m_pWorldMenu->getAnimationSet()); - m_translationScheduler.add(0 , m_pFeedEffect->getAnimationSet()); - - - - //ƒ[ƒ‹ƒhƒ}ƒbƒv‚̍쐬 - m_pBuilder = new et::WorldMapBuilder(m_pWorld->getAreaPowerLevelMap() , m_pTextureManager , 0.03f); - m_pWorldMap = m_pBuilder->create(); - m_pTexture = m_pTextureManager->getResource(_T("image/worldtip.png")); - - - //ƒJ[ƒ\ƒ‹‚̐ݒè - m_pCursor = new et::WorldMapCursor(new mof::Mesh(mof::tstring(_T("model/cursor.x")))); - m_pCursor->move(et::Symbol::UP , toWorldCoord(mof::Vector2D(0 , 0 )) , 1); - - - - //ƒ‰ƒCƒg‚̐ݒè - mof::AmbientLight light(mof::createColor(255 , 255 , 255)); - light.reflect(); - mof::GraphicsDevice::getInstance()->setLight(true); - - //ƒOƒŠƒbƒh‚̍쐬 - m_pGrid = new mof::SoftVertexBuffer(mof::VertexBuffer::PRIMITIVE_TYPE_LINELIST); - mof::VertexXYZC vertex; - vertex.color = mof::createColor(155 , 155 , 155); - vertex.y = 0.001f; - //cü - for(int x = 0 ; x < 10+1 ; x++){ - vertex.x = (float)x * 0.03f; - vertex.z = 0.0f; - m_pGrid->add(vertex); - vertex.x = (float)x * 0.03f; - vertex.z = -0.03f * 10; - m_pGrid->add(vertex); - } - //‰¡ü - for(int y = 0 ; y < 10+1 ; y++){ - vertex.x = 0.0f; - vertex.z = -(float)y * 0.03f; - m_pGrid->add(vertex); - vertex.x = 0.03f * 10; - vertex.z = -(float)y * 0.03f; - m_pGrid->add(vertex); - } - - //ƒJ[ƒ\ƒ‹ƒ|ƒCƒ“ƒg‚ðì¬ - m_pPoint = new mof::SoftVertexBuffer(mof::VertexBuffer::PRIMITIVE_TYPE_LINELIST); - mof::Color color = mof::createColor(255 , 255 , 0); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f , 0.002f , 0.0f) , color)); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f ,0.002f , -0.03f) , color)); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f , 0.002f , -0.03f) , color)); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f , -0.03f) , color)); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f , -0.03f) , color)); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f, 0.0f) , color)); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f , 0.0f) , color)); - m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f , 0.002f , 0.0f) , color)); - - - //3DŠÂ‹«‚̏€”õ1 - m_pCamera = new mof::Camera(mof::Vector3D(/*0.25f*/ 0.03f * 5 , 0.5f , -0.35f) , mof::Vector3D( 0.03f * 5 , 0.0f , -0.17f) , mof::Vector3D(0.0f , 0.0f , 0.90f)); - m_pCamera->reflect(); - mof::GraphicsDevice::getInstance()->setProjectionTransform(0.01f , 50.0f); - - - - return true; -} - -bool et::WorldScene::draw(){ - //m_pCapturer->capture(); - mof::GraphicsDevice* pDevice = mof::GraphicsDevice::getInstance(); - pDevice->clearRenderTarget(mof::createColor(27 , 37 , 67));//27 - pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_BASIC); - - if(m_pWindow != NULL && m_pWindow->getAnimationSet()->isFinalized()){ - pDevice->setZBuffer(true); - pDevice->clearZBuffer(); - pDevice->setLight(false); - mof::Material().reflect(); - m_pTexture->setTextureToDevice(); - m_pWorldMap->draw(mof::Matrix3D()); - } - - if(m_pAreaMenu != NULL || (m_pCurrentFrame == NULL || (m_menuChangeAnimation.get() != NULL && !m_menuChangeAnimation->isFinalized()))){ - //ƒGƒŠƒAƒOƒŠƒbƒh‚Ì•`‰æ - pDevice->setLight(false); - m_pTextureManager->getResource(_T("null"))->setTextureToDevice(); - m_pGrid->draw(m_menuChangeAnimation->getWorldTransform(mof::Matrix3D())); - } - - if(m_pAreaMenu != NULL || (m_pCurrentFrame == NULL && m_translationScheduler.isFinalized())){ - - //ƒJ[ƒ\ƒ‹ƒ|ƒCƒ“ƒg‚Ì•`‰æ - mof::Vector3D pointPosition = m_pCursor->getPosition(); - pointPosition.x = (float)(int)(pointPosition.x / 0.03f) * 0.03f; - pointPosition.z = (float)(int)(pointPosition.z / 0.03f) * 0.03f; - //DEBUG_PRINT(pointPosition.y); - m_pPoint->draw(mof::Matrix3D::createTranslation(pointPosition)); - - //ƒGƒŠƒAƒAƒCƒRƒ“‚Ì•`‰æ - mof::Billboard icon(mof::Billboard::XYZ_FIXED , m_pTexture); - mof::Matrix3D scaling = mof::Matrix3D::createScaling(0.03f , 0.03f , 0.03f); - for(int y = 0 ; y < m_pWorld->getAreaHeight() ; y++){ - for(int x = 0 ; x < m_pWorld->getAreaWidth() ; x++){ - if(m_pWorld->getArea(x , y).forestGen)icon.setTextureRectangle(mof::Line2D(32 * 4 , 32 * 6 , 32 * 5 , 32 * 7)); - else continue; - icon.setWorldTransform(scaling * mof::Matrix3D::createTranslation(mof::Vector3D(0.015f + 0.03*x , pointPosition.y , -0.015f - 0.03*y))); - icon.draw(); - } - } - pDevice->setZBuffer(false); - pDevice->setLight(true); - //ƒGƒŠƒAƒJ[ƒ\ƒ‹‚Ì•`‰æ - mof::DirectionalLight(mof::createColor(255 , 255 , 0) , mof::createColor(55 , 55 , 155) , mof::Vector3D(1.0f , -1.0f , -1.0f)).reflect(); - m_pCursor->draw(); - - - }else pDevice->setZBuffer(false); - - if(m_pAreaMenu != NULL)m_pAreaMenu->draw(); - if(m_pWorldMenu != NULL)m_pWorldMenu->draw(); - - mof::Color color = m_pFeedEffect->getCornerColor(mof::Sprite::C_RIGHT_BOTTOM); - //DEBUG_PRINT("color:" << (int)mof::getRed(color)); - if(mof::getAlpha(color) != 0){//“§–¾‚ÅŒ©‚¦‚È‚¢‚Æ‚«‚Í•`‰æ‚µ‚È‚¢ - pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); - m_pFeedEffect->draw(); - pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_BASIC); - } - m_pWindow->draw(); - - return true; -} - - -bool et::WorldScene::update(){ - //ƒJ[ƒ\ƒ‹‚̈ړ® - mof::Vector2D areaPosition = toAreaCoord(m_pCursor->getPosition()); - if(m_pCurrentFrame == NULL && m_translationScheduler.isFinalized()){ - mof::Vector2D nextPosition = areaPosition; - if(m_pInputReceiver->checkKeyState(mof::InputReceiver::UP) && areaPosition.y > 0){ - nextPosition.y--; - m_pCursor->move(et::Symbol::UP , toWorldCoord(nextPosition) , 10); - } - else if(m_pInputReceiver->checkKeyState(mof::InputReceiver::DOWN) && areaPosition.y < 10-1){ - nextPosition.y++; - m_pCursor->move(et::Symbol::DOWN , toWorldCoord(nextPosition) , 10); - } - else if(m_pInputReceiver->checkKeyState(mof::InputReceiver::LEFT) && areaPosition.x > 0){ - nextPosition.x--; - m_pCursor->move(et::Symbol::LEFT , toWorldCoord(nextPosition) , 10); - } - else if(m_pInputReceiver->checkKeyState(mof::InputReceiver::RIGHT) && areaPosition.x < 10-1){ - nextPosition.x++; - m_pCursor->move(et::Symbol::RIGHT , toWorldCoord(nextPosition) , 10); - } - else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::Z)){ - if(!m_pCursor->isTraveling()){ - //ƒGƒŠƒAƒƒjƒ…[Ý’è - m_pAreaMenu = new et::AreaMenu( m_pWorld->getArea(areaPosition.x , areaPosition.y) , m_pTextureManager - , m_pWorld , m_pGameData , areaPosition); - m_pCurrentFrame = m_pAreaMenu; - - m_translationScheduler.clear(); - m_translationScheduler.add(0 , m_pAreaMenu->getAnimationSet()); - } - - } - else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::X)){ - //ƒGƒŠƒAƒƒjƒ…[¨ƒ[ƒ‹ƒhƒƒjƒ…[‚Ì‘JˆÚƒAƒjƒ‚ðƒZƒbƒg - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition( 0 , mof::Vector3D(0.0f , 0.015f , 0.0f)); - pAnimation->setPosition(30 , mof::Vector3D(0 , 0.0001 , 0)); - m_menuChangeAnimation = mof::AnimationResource(pAnimation); - - m_pWorldMenu = new et::WorldMenu(m_pTextureManager , m_pWorld , m_pGameData); - m_pCurrentFrame = m_pWorldMenu; - - m_translationScheduler.clear(); - m_translationScheduler.add(0 , m_pWorldMenu->getAnimationSet()); - m_translationScheduler.add(0 , m_menuChangeAnimation); - - } - } - else if(m_pCurrentFrame != NULL && m_translationScheduler.isFinalized()){ - - //ƒEƒBƒ“ƒhƒE‚ɑ΂·‚éƒL[ - if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::UP))m_pCurrentFrame->getSelectionModel()->previous(); - else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::DOWN))m_pCurrentFrame->getSelectionModel()->next(); - else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::Z) && - m_pCurrentFrame->getSelectionModel()->getSelectingItem()->isAvailable()){ - - int selectedIndex = m_pCurrentFrame->getSelectionModel()->getSelectingIndex(); - MyFrame* tmpFrame = m_pCurrentFrame; - MyFrame* pFrame = m_pCurrentFrame->performAction(); - if(pFrame != m_pCurrentFrame){ - //ƒEƒBƒ“ƒhƒE‚Ì‘JˆÚ - m_translationScheduler.clear(); - if(!m_pCurrentFrame->isVisible())m_translationScheduler.add(0 , m_pCurrentFrame->getAnimationSet()); - m_pCurrentFrame = pFrame; - if(m_pCurrentFrame != NULL)m_translationScheduler.add(0 , m_pCurrentFrame->getAnimationSet()); - - } - if(tmpFrame == m_pWorldMenu && selectedIndex == 1){ - //ƒ[ƒ‹ƒhƒƒjƒ…[¨ƒGƒŠƒAƒƒjƒ…[‚Ì‘JˆÚƒAƒjƒ‚ðƒZƒbƒg - mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); - pAnimation->setPosition( 0 , mof::Vector3D(0.0f , 0.0001f , 0.0f)); - pAnimation->setPosition(30 , mof::Vector3D(0 , 0.015 , 0)); - m_menuChangeAnimation = mof::AnimationResource(pAnimation); - m_translationScheduler.add(0 , m_menuChangeAnimation); - - } - else if(tmpFrame == m_pWorldMenu && selectedIndex == 2){ - //ƒ[ƒ‹ƒhƒV[ƒ“‚̏I—¹ - end(0); - } - } - else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::X)){ - if(m_pCurrentFrame == m_pAreaMenu){ - m_pAreaMenu->setVisible(false); - m_pCurrentFrame = NULL; - } - } - - } - - - - //ƒtƒŒ[ƒ€‚̍XVˆ— - /*et::MyFrame** targets[] = {&m_pAreaMenu , &m_pWorldMenu}; - int length = sizeof(targets) / sizeof(targets[0]); - for(int i = 0 ; i < length ; i++){ - if(*(targets[i]) != NULL){ - (*(targets[i]))->update(); - if(!(*(targets[i]))->isVisible() && (*(targets[i]))->getAnimation(0)->isFinalized()){ - delete *(targets[i]); - *(targets[i]) = NULL; - } - } - }*/ - if(m_pAreaMenu != NULL){ - m_pAreaMenu->update(); - if(!m_pAreaMenu->isVisible() && m_pAreaMenu->getAnimation(0)->isFinalized()){ - delete m_pAreaMenu; - m_pAreaMenu = NULL; - } - } - if(m_pWorldMenu != NULL){ - m_pWorldMenu->update(); - if(!m_pWorldMenu->isVisible() && m_pWorldMenu->getAnimation(0)->isFinalized()){ - delete m_pWorldMenu; - m_pWorldMenu = NULL; - } - } - if(m_pWindow != NULL){ - m_pWindow->update(); - } - - if(m_menuChangeAnimation.get() != NULL)m_menuChangeAnimation->update(); - m_pCamera->setWorldTransform(mof::Matrix3D::createTranslation(mof::Vector3D(0.0f , 0.0f, 0.0f))); - m_pCamera->reflect(); - m_pCursor->update(); - m_pFeedEffect->update(); - - mof::Billboard::updateBillboardDirection(m_pCamera); - m_translationScheduler.update(); - - return true; -} - +#include "WorldScene.h" +#include "mof/GraphicsDevice.h" +#include "mof/AmbientLight.h" +#include "mof/InputDevice.h" +#include "mof/ConsoleIO.h" +#include +#include "mof/System.h" +#include "Area.h" +#include "DungeonBuilderA.h" +#include "mof/AmbientLight.h" +#include "mof/DirectionalLight.h" +#include "mof/ConsoleIO.h" +#include "mof/SoftVertexBufferImpl.h" +#include "mof/KeyFrameAnimation.h" +#include + +mof::Vector2D toAreaCoord(mof::Vector3D position){ + return mof::Vector2D(position.x / 0.03f , -position.z / 0.03f); +} + +mof::Vector3D toWorldCoord(mof::Vector2D position){ + return mof::Vector3D((float)position.x * 0.03f + 0.015f , 0.015f , (float)position.y * -0.03f - 0.015f); +} + +et::WorldScene::WorldScene() +: et::GameScene() +{ + + m_pWindow = NULL; + m_pBuilder = NULL; + m_pWorldMap = NULL; + m_pCamera = NULL; + m_pGrid = NULL; + m_pPoint = NULL; + //m_state = et::WorldScene::OPENING; + m_pCurrentFrame = NULL; + m_pAreaMenu = NULL; + m_pWorldMenu = NULL; + m_pWorld = NULL; + m_pFeedEffect = NULL; +} + +et::WorldScene::~WorldScene(void) +{ + //delete m_pAreaMenu; + delete m_pWorld; + delete m_pAreaMenu; + delete m_pWorldMenu; + delete m_pWindow; + delete m_pBuilder; + delete m_pWorldMap; + delete m_pCamera; + delete m_pCursor; + delete m_pGrid; + delete m_pPoint; + delete m_pFeedEffect; +} + + +bool et::WorldScene::initialize(){ + + m_pWorld = m_pGameData->createWorld(); + + //Ä¶“x•\Ž¦ƒtƒŒ[ƒ€‚̍쐬 + m_pWindow = new et::MyFrame(mof::Line2D( 370 , 400 , 600 , 450) , false , m_pTextureManager->getResource(_T("image/frame0.png"))); + std::stringstream os; + os << _T("Ä¶“x") << m_pWorld->getRegenerationLevel() << _T("/Term") << m_pWorld->getTerm(); + m_pWindow->add(mof::Sprite::createSpriteFromText((TCHAR*)os.str().c_str() , 24)); + m_pWindow->setLayout(); + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + //ƒAƒjƒ‚̐ݒè + pAnimation->setPosition( 1 , mof::Vector2D( 220 , 200 )); + pAnimation->setPosition(180 , mof::Vector2D(400 , 380)); + m_pWindow->setAnimation(0 , mof::AnimationResource(pAnimation)); + + //ƒ[ƒ‹ƒhƒƒjƒ…‚̍쐬 + m_pWorldMenu = new et::WorldMenu(m_pTextureManager , m_pWorld , m_pGameData); + m_pCurrentFrame = m_pWorldMenu; + + //ƒtƒF[ƒhƒGƒtƒFƒNƒg + mof::RectangleModel rect = mof::System::getInstance()->getBounds(); + m_pFeedEffect = new mof::Sprite(mof::Line2D(rect.getPosition() , rect.getWidth() , rect.getHeight()) , + mof::Line2D() , m_pTextureManager->getResource(_T("null"))); + pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setColor(0 , mof::createColor(255 , 0 , 0 , 0)); + pAnimation->setColor(180 , mof::createColor(255 , 0 , 0 , 0)); + pAnimation->setColor(210 , mof::createColor(0 , 0 , 0 , 0)); + m_pFeedEffect->setAnimation(0 , mof::AnimationResource(pAnimation)); + + m_translationScheduler.add(0 , m_pWindow->getAnimationSet()); + m_translationScheduler.add(180 , m_pWorldMenu->getAnimationSet()); + m_translationScheduler.add(0 , m_pFeedEffect->getAnimationSet()); + + + + //ƒ[ƒ‹ƒhƒ}ƒbƒv‚̍쐬 + m_pBuilder = new et::WorldMapBuilder(m_pWorld->getAreaPowerLevelMap() , m_pTextureManager , 0.03f); + m_pWorldMap = m_pBuilder->create(); + m_pTexture = m_pTextureManager->getResource(_T("image/worldtip.png")); + + + //ƒJ[ƒ\ƒ‹‚̐ݒè + m_pCursor = new et::WorldMapCursor(new mof::Mesh(mof::tstring(_T("model/cursor.x")))); + m_pCursor->move(et::Symbol::UP , toWorldCoord(mof::Vector2D(0 , 0 )) , 1); + + + + //ƒ‰ƒCƒg‚̐ݒè + mof::AmbientLight light(mof::createColor(255 , 255 , 255)); + light.reflect(); + mof::GraphicsDevice::getInstance()->setLight(true); + + //ƒOƒŠƒbƒh‚̍쐬 + m_pGrid = new mof::SoftVertexBuffer(mof::VertexBuffer::PRIMITIVE_TYPE_LINELIST); + mof::VertexXYZC vertex; + vertex.color = mof::createColor(155 , 155 , 155); + vertex.y = 0.001f; + //cü + for(int x = 0 ; x < 10+1 ; x++){ + vertex.x = (float)x * 0.03f; + vertex.z = 0.0f; + m_pGrid->add(vertex); + vertex.x = (float)x * 0.03f; + vertex.z = -0.03f * 10; + m_pGrid->add(vertex); + } + //‰¡ü + for(int y = 0 ; y < 10+1 ; y++){ + vertex.x = 0.0f; + vertex.z = -(float)y * 0.03f; + m_pGrid->add(vertex); + vertex.x = 0.03f * 10; + vertex.z = -(float)y * 0.03f; + m_pGrid->add(vertex); + } + + //ƒJ[ƒ\ƒ‹ƒ|ƒCƒ“ƒg‚ðì¬ + m_pPoint = new mof::SoftVertexBuffer(mof::VertexBuffer::PRIMITIVE_TYPE_LINELIST); + mof::Color color = mof::createColor(255 , 255 , 0); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f , 0.002f , 0.0f) , color)); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f ,0.002f , -0.03f) , color)); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f , 0.002f , -0.03f) , color)); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f , -0.03f) , color)); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f , -0.03f) , color)); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f, 0.0f) , color)); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.03f , 0.002f , 0.0f) , color)); + m_pPoint->add(mof::VertexXYZC(mof::Vector3D(0.0f , 0.002f , 0.0f) , color)); + + + //3DŠÂ‹«‚̏€”õ1 + m_pCamera = new mof::Camera(mof::Vector3D(/*0.25f*/ 0.03f * 5 , 0.5f , -0.35f) , mof::Vector3D( 0.03f * 5 , 0.0f , -0.17f) , mof::Vector3D(0.0f , 0.0f , 0.90f)); + m_pCamera->reflect(); + mof::GraphicsDevice::getInstance()->setProjectionTransform(0.01f , 50.0f); + + + + return true; +} + +bool et::WorldScene::draw(){ + //m_pCapturer->capture(); + mof::GraphicsDevice* pDevice = mof::GraphicsDevice::getInstance(); + pDevice->clearRenderTarget(mof::createColor(27 , 37 , 67));//27 + pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_BASIC); + + if(m_pWindow != NULL && m_pWindow->getAnimationSet()->isFinalized()){ + pDevice->setZBuffer(true); + pDevice->clearZBuffer(); + pDevice->setLight(false); + mof::Material().reflect(); + m_pTexture->setTextureToDevice(); + m_pWorldMap->draw(mof::Matrix3D()); + } + + if(m_pAreaMenu != NULL || (m_pCurrentFrame == NULL || (m_menuChangeAnimation.get() != NULL && !m_menuChangeAnimation->isFinalized()))){ + //ƒGƒŠƒAƒOƒŠƒbƒh‚Ì•`‰æ + pDevice->setLight(false); + m_pTextureManager->getResource(_T("null"))->setTextureToDevice(); + m_pGrid->draw(m_menuChangeAnimation->getWorldTransform(mof::Matrix3D())); + } + + if(m_pAreaMenu != NULL || (m_pCurrentFrame == NULL && m_translationScheduler.isFinalized())){ + + //ƒJ[ƒ\ƒ‹ƒ|ƒCƒ“ƒg‚Ì•`‰æ + mof::Vector3D pointPosition = m_pCursor->getPosition(); + pointPosition.x = (float)(int)(pointPosition.x / 0.03f) * 0.03f; + pointPosition.z = (float)(int)(pointPosition.z / 0.03f) * 0.03f; + //DEBUG_PRINT(pointPosition.y); + m_pPoint->draw(mof::Matrix3D::createTranslation(pointPosition)); + + //ƒGƒŠƒAƒAƒCƒRƒ“‚Ì•`‰æ + mof::Billboard icon(mof::Billboard::XYZ_FIXED , m_pTexture); + mof::Matrix3D scaling = mof::Matrix3D::createScaling(0.03f , 0.03f , 0.03f); + for(int y = 0 ; y < m_pWorld->getAreaHeight() ; y++){ + for(int x = 0 ; x < m_pWorld->getAreaWidth() ; x++){ + if(m_pWorld->getArea(x , y).forestGen)icon.setTextureRectangle(mof::Line2D(32 * 4 , 32 * 6 , 32 * 5 , 32 * 7)); + else continue; + icon.setWorldTransform(scaling * mof::Matrix3D::createTranslation(mof::Vector3D(0.015f + 0.03*x , pointPosition.y , -0.015f - 0.03*y))); + icon.draw(); + } + } + pDevice->setZBuffer(false); + pDevice->setLight(true); + //ƒGƒŠƒAƒJ[ƒ\ƒ‹‚Ì•`‰æ + mof::DirectionalLight(mof::createColor(255 , 255 , 0) , mof::createColor(55 , 55 , 155) , mof::Vector3D(1.0f , -1.0f , -1.0f)).reflect(); + m_pCursor->draw(); + + + }else pDevice->setZBuffer(false); + + if(m_pAreaMenu != NULL)m_pAreaMenu->draw(); + if(m_pWorldMenu != NULL)m_pWorldMenu->draw(); + + mof::Color color = m_pFeedEffect->getCornerColor(mof::Sprite::C_RIGHT_BOTTOM); + //DEBUG_PRINT("color:" << (int)mof::getRed(color)); + if(mof::getAlpha(color) != 0){//“§–¾‚ÅŒ©‚¦‚È‚¢‚Æ‚«‚Í•`‰æ‚µ‚È‚¢ + pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_ALPHA); + m_pFeedEffect->draw(); + pDevice->setAlphaBlendingMode(mof::GraphicsDevice::BLENDING_MODE_BASIC); + } + m_pWindow->draw(); + + return true; +} + + +bool et::WorldScene::update(){ + //ƒJ[ƒ\ƒ‹‚̈ړ® + mof::Vector2D areaPosition = toAreaCoord(m_pCursor->getPosition()); + if(m_pCurrentFrame == NULL && m_translationScheduler.isFinalized()){ + mof::Vector2D nextPosition = areaPosition; + if(m_pInputReceiver->checkKeyState(mof::InputReceiver::UP) && areaPosition.y > 0){ + nextPosition.y--; + m_pCursor->move(et::Symbol::UP , toWorldCoord(nextPosition) , 10); + } + else if(m_pInputReceiver->checkKeyState(mof::InputReceiver::DOWN) && areaPosition.y < 10-1){ + nextPosition.y++; + m_pCursor->move(et::Symbol::DOWN , toWorldCoord(nextPosition) , 10); + } + else if(m_pInputReceiver->checkKeyState(mof::InputReceiver::LEFT) && areaPosition.x > 0){ + nextPosition.x--; + m_pCursor->move(et::Symbol::LEFT , toWorldCoord(nextPosition) , 10); + } + else if(m_pInputReceiver->checkKeyState(mof::InputReceiver::RIGHT) && areaPosition.x < 10-1){ + nextPosition.x++; + m_pCursor->move(et::Symbol::RIGHT , toWorldCoord(nextPosition) , 10); + } + else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::Z)){ + if(!m_pCursor->isTraveling()){ + //ƒGƒŠƒAƒƒjƒ…[Ý’è + m_pAreaMenu = new et::AreaMenu( m_pWorld->getArea(areaPosition.x , areaPosition.y) , m_pTextureManager + , m_pWorld , m_pGameData , areaPosition); + m_pCurrentFrame = m_pAreaMenu; + + m_translationScheduler.clear(); + m_translationScheduler.add(0 , m_pAreaMenu->getAnimationSet()); + } + + } + else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::X)){ + //ƒGƒŠƒAƒƒjƒ…[¨ƒ[ƒ‹ƒhƒƒjƒ…[‚Ì‘JˆÚƒAƒjƒ‚ðƒZƒbƒg + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition( 0 , mof::Vector3D(0.0f , 0.015f , 0.0f)); + pAnimation->setPosition(30 , mof::Vector3D(0 , 0.0001 , 0)); + m_menuChangeAnimation = mof::AnimationResource(pAnimation); + + m_pWorldMenu = new et::WorldMenu(m_pTextureManager , m_pWorld , m_pGameData); + m_pCurrentFrame = m_pWorldMenu; + + m_translationScheduler.clear(); + m_translationScheduler.add(0 , m_pWorldMenu->getAnimationSet()); + m_translationScheduler.add(0 , m_menuChangeAnimation); + + } + } + else if(m_pCurrentFrame != NULL && m_translationScheduler.isFinalized()){ + + //ƒEƒBƒ“ƒhƒE‚ɑ΂·‚éƒL[ + if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::UP))m_pCurrentFrame->getSelectionModel()->previous(); + else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::DOWN))m_pCurrentFrame->getSelectionModel()->next(); + else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::Z) && + m_pCurrentFrame->getSelectionModel()->getSelectingItem()->isAvailable()){ + + int selectedIndex = m_pCurrentFrame->getSelectionModel()->getSelectingIndex(); + MyFrame* tmpFrame = m_pCurrentFrame; + MyFrame* pFrame = m_pCurrentFrame->performAction(); + if(pFrame != m_pCurrentFrame){ + //ƒEƒBƒ“ƒhƒE‚Ì‘JˆÚ + m_translationScheduler.clear(); + if(!m_pCurrentFrame->isVisible())m_translationScheduler.add(0 , m_pCurrentFrame->getAnimationSet()); + m_pCurrentFrame = pFrame; + if(m_pCurrentFrame != NULL)m_translationScheduler.add(0 , m_pCurrentFrame->getAnimationSet()); + + } + if(tmpFrame == m_pWorldMenu && selectedIndex == 1){ + //ƒ[ƒ‹ƒhƒƒjƒ…[¨ƒGƒŠƒAƒƒjƒ…[‚Ì‘JˆÚƒAƒjƒ‚ðƒZƒbƒg + mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation(); + pAnimation->setPosition( 0 , mof::Vector3D(0.0f , 0.0001f , 0.0f)); + pAnimation->setPosition(30 , mof::Vector3D(0 , 0.015 , 0)); + m_menuChangeAnimation = mof::AnimationResource(pAnimation); + m_translationScheduler.add(0 , m_menuChangeAnimation); + + } + else if(tmpFrame == m_pWorldMenu && selectedIndex == 2){ + //ƒ[ƒ‹ƒhƒV[ƒ“‚̏I—¹ + end(0); + } + } + else if(m_pInputReceiver->checkKeyPressed(mof::InputReceiver::X)){ + if(m_pCurrentFrame == m_pAreaMenu){ + m_pAreaMenu->setVisible(false); + m_pCurrentFrame = NULL; + } + } + + } + + + + //ƒtƒŒ[ƒ€‚̍XVˆ— + /*et::MyFrame** targets[] = {&m_pAreaMenu , &m_pWorldMenu}; + int length = sizeof(targets) / sizeof(targets[0]); + for(int i = 0 ; i < length ; i++){ + if(*(targets[i]) != NULL){ + (*(targets[i]))->update(); + if(!(*(targets[i]))->isVisible() && (*(targets[i]))->getAnimation(0)->isFinalized()){ + delete *(targets[i]); + *(targets[i]) = NULL; + } + } + }*/ + if(m_pAreaMenu != NULL){ + m_pAreaMenu->update(); + if(!m_pAreaMenu->isVisible() && m_pAreaMenu->getAnimation(0)->isFinalized()){ + delete m_pAreaMenu; + m_pAreaMenu = NULL; + } + } + if(m_pWorldMenu != NULL){ + m_pWorldMenu->update(); + if(!m_pWorldMenu->isVisible() && m_pWorldMenu->getAnimation(0)->isFinalized()){ + delete m_pWorldMenu; + m_pWorldMenu = NULL; + } + } + if(m_pWindow != NULL){ + m_pWindow->update(); + } + + if(m_menuChangeAnimation.get() != NULL)m_menuChangeAnimation->update(); + m_pCamera->setWorldTransform(mof::Matrix3D::createTranslation(mof::Vector3D(0.0f , 0.0f, 0.0f))); + m_pCamera->reflect(); + m_pCursor->update(); + m_pFeedEffect->update(); + + mof::Billboard::updateBillboardDirection(m_pCamera); + m_translationScheduler.update(); + + return true; +} + diff --git a/saisei-1_0/rpg/rpg/oldcode/WorldScene.h b/saisei-1_0/rpg/rpg/oldcode/WorldScene.h index 126544b..e4c5c8a 100644 --- a/saisei-1_0/rpg/rpg/oldcode/WorldScene.h +++ b/saisei-1_0/rpg/rpg/oldcode/WorldScene.h @@ -1,66 +1,66 @@ -#pragma once -#include "GameScene.h" -#include "mof/Graphics.h" -#include "mof/Camera.h" -#include "mof/VertexBuffer.h" -#include "mof/VertexTypes.h" -#include "mof/Billboard.h" -#include "MyWindow.h" -#include "mof/InputReceiver.h" -#include "WorldMapBuilder.h" -#include "mof/Capturer.h" -#include "WorldMapCursor.h" -#include "GameData.h" -#include "mof/SelectionModel.h" -#include "MyFrame.h" -#include "AreaMenu.h" -#include "WorldMenu.h" -#include "World.h" - -#include "mof/AnimationScheduler.h" - -namespace et{ - - class WorldScene - : public et::GameScene - { - - - //‹¤’Ê - mof::Window* m_pWindow; - mof::Camera* m_pCamera; - mof::TextureResource m_pTexture; - MyFrame* m_pCurrentFrame; - et::World* m_pWorld; - mof::AnimationResource m_menuChangeAnimation; - - //ƒ[ƒ‹ƒhƒrƒ…[ - et::WorldMapBuilder* m_pBuilder; - et::MapBuffer* m_pWorldMap; - et::WorldMenu* m_pWorldMenu; - - //ƒGƒŠƒAƒrƒ…[ - et::WorldMapCursor* m_pCursor; - mof::SoftVertexBuffer* m_pGrid; - mof::SoftVertexBuffer* m_pPoint; - et::AreaMenu* m_pAreaMenu; - - mof::AnimationScheduler m_translationScheduler; - - - mof::Sprite* m_pFeedEffect; - - public: - WorldScene(); - virtual ~WorldScene(void); - - - - virtual bool initialize(); - virtual bool draw(); - virtual bool update(); - - - }; - -}; +#pragma once +#include "GameScene.h" +#include "mof/Graphics.h" +#include "mof/Camera.h" +#include "mof/VertexBuffer.h" +#include "mof/VertexTypes.h" +#include "mof/Billboard.h" +#include "MyWindow.h" +#include "mof/InputReceiver.h" +#include "WorldMapBuilder.h" +#include "mof/Capturer.h" +#include "WorldMapCursor.h" +#include "GameData.h" +#include "mof/SelectionModel.h" +#include "MyFrame.h" +#include "AreaMenu.h" +#include "WorldMenu.h" +#include "World.h" + +#include "mof/AnimationScheduler.h" + +namespace et{ + + class WorldScene + : public et::GameScene + { + + + //‹¤’Ê + mof::Window* m_pWindow; + mof::Camera* m_pCamera; + mof::TextureResource m_pTexture; + MyFrame* m_pCurrentFrame; + et::World* m_pWorld; + mof::AnimationResource m_menuChangeAnimation; + + //ƒ[ƒ‹ƒhƒrƒ…[ + et::WorldMapBuilder* m_pBuilder; + et::MapBuffer* m_pWorldMap; + et::WorldMenu* m_pWorldMenu; + + //ƒGƒŠƒAƒrƒ…[ + et::WorldMapCursor* m_pCursor; + mof::SoftVertexBuffer* m_pGrid; + mof::SoftVertexBuffer* m_pPoint; + et::AreaMenu* m_pAreaMenu; + + mof::AnimationScheduler m_translationScheduler; + + + mof::Sprite* m_pFeedEffect; + + public: + WorldScene(); + virtual ~WorldScene(void); + + + + virtual bool initialize(); + virtual bool draw(); + virtual bool update(); + + + }; + +}; diff --git a/saisei-1_0/rpg/rpg/oldcode/configure.hpp~ b/saisei-1_0/rpg/rpg/oldcode/configure.hpp~ index a225142..cb71d89 100644 --- a/saisei-1_0/rpg/rpg/oldcode/configure.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/configure.hpp~ @@ -1,7 +1,7 @@ -#pragma once - -#define FONT_SIZE_STANDARD 24 -#define FONT_SIZE_LARGE 36 -#define FONT_PATH_UME _T("font/ume-ugo4.ttf") -//#define FONT_NAME_UME mof::Font::MS_GOTHIC -#define FONT_NAME_UME _T("”~UIƒSƒVƒbƒN") +#pragma once + +#define FONT_SIZE_STANDARD 24 +#define FONT_SIZE_LARGE 36 +#define FONT_PATH_UME _T("font/ume-ugo4.ttf") +//#define FONT_NAME_UME mof::Font::MS_GOTHIC +#define FONT_NAME_UME _T("”~UIƒSƒVƒbƒN") diff --git a/saisei-1_0/rpg/rpg/oldcode/main.cpp~ b/saisei-1_0/rpg/rpg/oldcode/main.cpp~ index 60d4216..a407d70 100644 --- a/saisei-1_0/rpg/rpg/oldcode/main.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/main.cpp~ @@ -1,51 +1,51 @@ -#include "configure.hpp" -#include "mof/Application.hpp" -#include "mof/streams.hpp" -#include "mof/Color.hpp" -#include -#include "mof/utilities.hpp" -#include "mof/ConsoleIO.hpp" -#include -#include "mof/Finalizer.hpp" -#include "mof/Font.hpp" - -#include "Demo1.hpp" -#include "Demo2.hpp" -#include "Demo3.hpp" - - -int main(int , char**) -{ - mof::Font::addFontResource( FONT_PATH_UME ); - mof::Finalizer application; - try - { - { // ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚̏‰Šú‰» - mof::Application::initialize - ( - _T("MyApplication") , - 640 , 480 , false , // fullscreen - 32 , 2 // 30FPS - //16 , 1 // 60FPS - ); - application = mof::Finalizer( mof::Application::finalize ); - } - - { // ƒV[ƒ“‚̃Zƒbƒg‚ÆŠJŽn - mof::Scene scene; - #define FIRST_SCENE ::Demo3 - scene.initialize = FIRST_SCENE::initialize; - scene.finalize = FIRST_SCENE::finalize; - scene.update = FIRST_SCENE::update; - scene.draw = FIRST_SCENE::draw; - mof::Application::run( scene ); - } - } - catch(std::exception& e) - { - DEBUG_PRINT( e.what() ); - getch(); - } - - return 0; -} +#include "configure.hpp" +#include "mof/Application.hpp" +#include "mof/streams.hpp" +#include "mof/Color.hpp" +#include +#include "mof/utilities.hpp" +#include "mof/ConsoleIO.hpp" +#include +#include "mof/Finalizer.hpp" +#include "mof/Font.hpp" + +#include "Demo1.hpp" +#include "Demo2.hpp" +#include "Demo3.hpp" + + +int main(int , char**) +{ + mof::Font::addFontResource( FONT_PATH_UME ); + mof::Finalizer application; + try + { + { // ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚̏‰Šú‰» + mof::Application::initialize + ( + _T("MyApplication") , + 640 , 480 , false , // fullscreen + 32 , 2 // 30FPS + //16 , 1 // 60FPS + ); + application = mof::Finalizer( mof::Application::finalize ); + } + + { // ƒV[ƒ“‚̃Zƒbƒg‚ÆŠJŽn + mof::Scene scene; + #define FIRST_SCENE ::Demo3 + scene.initialize = FIRST_SCENE::initialize; + scene.finalize = FIRST_SCENE::finalize; + scene.update = FIRST_SCENE::update; + scene.draw = FIRST_SCENE::draw; + mof::Application::run( scene ); + } + } + catch(std::exception& e) + { + DEBUG_PRINT( e.what() ); + getch(); + } + + return 0; +} diff --git a/saisei-1_0/rpg/rpg/oldcode/resource.cpp~ b/saisei-1_0/rpg/rpg/oldcode/resource.cpp~ index 84f02ca..d488bd8 100644 --- a/saisei-1_0/rpg/rpg/oldcode/resource.cpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/resource.cpp~ @@ -1,26 +1,26 @@ -#include "resource.hpp" -#include - -namespace -{ - mof::TextureManagerHandler m_systemTextureManager; - bool m_initialized = false; - - void initialize( ) - { - m_systemTextureManager = mof::TextureManagerHandler( new mof::TextureManager ); - } -} - -TextureManagerHandler -getTextureResourceManager( ResourceGroup rg ) -{ - if( !m_initialized )initialize(); - switch( rg ) - { - case SYSTEM : - return m_systemTextureManager; - default : - std::runtime_error("invalid resource group"); - } -} +#include "resource.hpp" +#include + +namespace +{ + mof::TextureManagerHandler m_systemTextureManager; + bool m_initialized = false; + + void initialize( ) + { + m_systemTextureManager = mof::TextureManagerHandler( new mof::TextureManager ); + } +} + +TextureManagerHandler +getTextureResourceManager( ResourceGroup rg ) +{ + if( !m_initialized )initialize(); + switch( rg ) + { + case SYSTEM : + return m_systemTextureManager; + default : + std::runtime_error("invalid resource group"); + } +} diff --git a/saisei-1_0/rpg/rpg/oldcode/resource.hpp~ b/saisei-1_0/rpg/rpg/oldcode/resource.hpp~ index c7878a2..1968d35 100644 --- a/saisei-1_0/rpg/rpg/oldcode/resource.hpp~ +++ b/saisei-1_0/rpg/rpg/oldcode/resource.hpp~ @@ -1,9 +1,9 @@ -#pragma once -#include - -enum ResourceGroup -{ - /** アプリケーション全体共通のリソース */ SYSTEM -}; - -TextureManagerHandler getTextureResourceManager( ResourceGroup rg ); +#pragma once +#include + +enum ResourceGroup +{ + /** アプリケーション全体共通のリソース */ SYSTEM +}; + +TextureManagerHandler getTextureResourceManager( ResourceGroup rg ); diff --git a/saisei-1_0/rpg/rpg/oldcode/tmp.cpp b/saisei-1_0/rpg/rpg/oldcode/tmp.cpp index 42ad711..486dc29 100644 --- a/saisei-1_0/rpg/rpg/oldcode/tmp.cpp +++ b/saisei-1_0/rpg/rpg/oldcode/tmp.cpp @@ -1,171 +1,171 @@ -#include "mof/Menu.hpp" -#include "mof/Effect.hpp" -#include "mof/utilities.hpp" -#include "mof/LayoutManager.hpp" -#include -#include "mof/ConsoleIO.hpp" -#include "mof/WidgetView.hpp" -#include "mof/GraphicsDevice.hpp" -#include "mof/mofAnimations.hpp" - - -struct mof::Menu::Impl{ - mof::WidgetView* pBackgroundView; - mof::LayoutManager* pLayout; - std::shared_ptr pTranslation; - int width; - int height; - - MenuItem* items; - int size; - int indicator; - - Impl( const mof::Rectangle& _bounds) - : pBackgroundView(NULL) , - width(_bounds.endX - _bounds.beginX) , height(_bounds.endY - _bounds.beginY) , - items(NULL) , size(0) , indicator(0) , pLayout(NULL) { - pTranslation = std::shared_ptr( - new mof::Matrix2D( - mof::Matrix2D::createTranslation( - mof::Vector2D(_bounds.beginX , _bounds.beginY ) - ) - ) - ); - } - - ~Impl(){ - for(int i = 0 ; i < size ; ++i){ - delete items[i].pView; - } - delete[] items; - delete pLayout; - delete pBackgroundView; - } - - - -}; - - -mof::Menu::Menu -( - mof::WidgetView* pBackgroundView , - const mof::Menu::MenuItem & front , - const mof::Menu::MenuItem& back , - const mof::Rectangle& bounds , - mof::LayoutManager* pLayout -) -: m_pImpl(new Impl(bounds)) -{ - m_pImpl->pLayout = pLayout; - m_pImpl->pBackgroundView = pBackgroundView; - - m_pImpl->size = &back - &front + 1; - if(m_pImpl->size <= 0)throw std::invalid_argument("the length of front-back is less than zero"); - - m_pImpl->items = new MenuItem[m_pImpl->size]; - boost::scoped_array > boundList(new mof::Rectangle[m_pImpl->size]); - - for(int i = 0 ; i < m_pImpl->size ; ++i){ - m_pImpl->items[i] = (&front)[i]; - mof::Rectangle bounds = m_pImpl->items[i].pView->initialize(); - boundList[i] = bounds; - } - - m_pImpl->pLayout->replace(m_pImpl->width , m_pImpl->height , boundList[0] , boundList[m_pImpl->size-1]); - - //TODO: LayoutAnimation‚ð‚‚­‚é - for(int i = 0 ; i < m_pImpl->size ; ++i){ - const mof::Animation::Handler children[] = - { - mof::makeParametricHandler(m_pImpl->pTranslation) , - mof::makeConstantHandler - ( - mof::Matrix2D::createTranslation( m_pImpl->pLayout->getPosition(i)) - ) - }; - - m_pImpl->items[i].pView->setPosition - ( - mof::Animation::Handler - ( - new mof::CascadingAnimation(children[0] , children[1]) - ) - ); - } - m_pImpl->pBackgroundView->setBounds(bounds); - -} - - -mof::Menu::~Menu(){ - -} - -void mof::Menu::show(){ - m_pImpl->pBackgroundView->show(); - for(int i = 0 ; i < m_pImpl->size ; ++i){ - m_pImpl->items[i].pView->show(); - } -} - -void mof::Menu::close(){ - m_pImpl->pBackgroundView->close(); - for(int i = 0 ; i < m_pImpl->size ; ++i){ - m_pImpl->items[i].pView->close(); - } -} - -void mof::Menu::up(){ - mof::Menu::MenuItem* pItem = &m_pImpl->items[m_pImpl->indicator]; - pItem->pView->blur(); - - m_pImpl->indicator--; - if(m_pImpl->indicator == -1)m_pImpl->indicator = m_pImpl->size -1; - - pItem = &m_pImpl->items[m_pImpl->indicator]; - pItem->pView->focus(); -} - -void mof::Menu::down(){ - mof::Menu::MenuItem* pItem = &m_pImpl->items[m_pImpl->indicator]; - pItem->pView->blur(); - - m_pImpl->indicator++; - if(m_pImpl->indicator == m_pImpl->size)m_pImpl->indicator = 0; - - pItem = &m_pImpl->items[m_pImpl->indicator]; - pItem->pView->focus(); -} - - - -void mof::Menu::left() { - -} - -void mof::Menu::right(){ - -} - -void mof::Menu::performAction() const{ - if(!m_pImpl->items[m_pImpl->indicator].action)return; - m_pImpl->items[m_pImpl->indicator].action(); -} - -void mof::Menu::draw() const{ - m_pImpl->pBackgroundView->draw(); - mof::GraphicsDevice::setViewport(m_pImpl->pBackgroundView->getBounds()); - for(int i = 0 ; i < m_pImpl->size ; ++i){ - m_pImpl->items[i].pView->getEffect()->draw(); - } - mof::GraphicsDevice::setViewport(mof::Rectangle(0 , 0 , 640 , 480));//TODO -} - - -void mof::Menu::update() { - m_pImpl->pBackgroundView->update(); - for(int i = 0 ; i < m_pImpl->size ; ++i){ - m_pImpl->items[i].pView->update(); - } -} +#include "mof/Menu.hpp" +#include "mof/Effect.hpp" +#include "mof/utilities.hpp" +#include "mof/LayoutManager.hpp" +#include +#include "mof/ConsoleIO.hpp" +#include "mof/WidgetView.hpp" +#include "mof/GraphicsDevice.hpp" +#include "mof/mofAnimations.hpp" + + +struct mof::Menu::Impl{ + mof::WidgetView* pBackgroundView; + mof::LayoutManager* pLayout; + std::shared_ptr pTranslation; + int width; + int height; + + MenuItem* items; + int size; + int indicator; + + Impl( const mof::Rectangle& _bounds) + : pBackgroundView(NULL) , + width(_bounds.endX - _bounds.beginX) , height(_bounds.endY - _bounds.beginY) , + items(NULL) , size(0) , indicator(0) , pLayout(NULL) { + pTranslation = std::shared_ptr( + new mof::Matrix2D( + mof::Matrix2D::createTranslation( + mof::Vector2D(_bounds.beginX , _bounds.beginY ) + ) + ) + ); + } + + ~Impl(){ + for(int i = 0 ; i < size ; ++i){ + delete items[i].pView; + } + delete[] items; + delete pLayout; + delete pBackgroundView; + } + + + +}; + + +mof::Menu::Menu +( + mof::WidgetView* pBackgroundView , + const mof::Menu::MenuItem & front , + const mof::Menu::MenuItem& back , + const mof::Rectangle& bounds , + mof::LayoutManager* pLayout +) +: m_pImpl(new Impl(bounds)) +{ + m_pImpl->pLayout = pLayout; + m_pImpl->pBackgroundView = pBackgroundView; + + m_pImpl->size = &back - &front + 1; + if(m_pImpl->size <= 0)throw std::invalid_argument("the length of front-back is less than zero"); + + m_pImpl->items = new MenuItem[m_pImpl->size]; + boost::scoped_array > boundList(new mof::Rectangle[m_pImpl->size]); + + for(int i = 0 ; i < m_pImpl->size ; ++i){ + m_pImpl->items[i] = (&front)[i]; + mof::Rectangle bounds = m_pImpl->items[i].pView->initialize(); + boundList[i] = bounds; + } + + m_pImpl->pLayout->replace(m_pImpl->width , m_pImpl->height , boundList[0] , boundList[m_pImpl->size-1]); + + //TODO: LayoutAnimation‚ð‚‚­‚é + for(int i = 0 ; i < m_pImpl->size ; ++i){ + const mof::Animation::Handler children[] = + { + mof::makeParametricHandler(m_pImpl->pTranslation) , + mof::makeConstantHandler + ( + mof::Matrix2D::createTranslation( m_pImpl->pLayout->getPosition(i)) + ) + }; + + m_pImpl->items[i].pView->setPosition + ( + mof::Animation::Handler + ( + new mof::CascadingAnimation(children[0] , children[1]) + ) + ); + } + m_pImpl->pBackgroundView->setBounds(bounds); + +} + + +mof::Menu::~Menu(){ + +} + +void mof::Menu::show(){ + m_pImpl->pBackgroundView->show(); + for(int i = 0 ; i < m_pImpl->size ; ++i){ + m_pImpl->items[i].pView->show(); + } +} + +void mof::Menu::close(){ + m_pImpl->pBackgroundView->close(); + for(int i = 0 ; i < m_pImpl->size ; ++i){ + m_pImpl->items[i].pView->close(); + } +} + +void mof::Menu::up(){ + mof::Menu::MenuItem* pItem = &m_pImpl->items[m_pImpl->indicator]; + pItem->pView->blur(); + + m_pImpl->indicator--; + if(m_pImpl->indicator == -1)m_pImpl->indicator = m_pImpl->size -1; + + pItem = &m_pImpl->items[m_pImpl->indicator]; + pItem->pView->focus(); +} + +void mof::Menu::down(){ + mof::Menu::MenuItem* pItem = &m_pImpl->items[m_pImpl->indicator]; + pItem->pView->blur(); + + m_pImpl->indicator++; + if(m_pImpl->indicator == m_pImpl->size)m_pImpl->indicator = 0; + + pItem = &m_pImpl->items[m_pImpl->indicator]; + pItem->pView->focus(); +} + + + +void mof::Menu::left() { + +} + +void mof::Menu::right(){ + +} + +void mof::Menu::performAction() const{ + if(!m_pImpl->items[m_pImpl->indicator].action)return; + m_pImpl->items[m_pImpl->indicator].action(); +} + +void mof::Menu::draw() const{ + m_pImpl->pBackgroundView->draw(); + mof::GraphicsDevice::setViewport(m_pImpl->pBackgroundView->getBounds()); + for(int i = 0 ; i < m_pImpl->size ; ++i){ + m_pImpl->items[i].pView->getEffect()->draw(); + } + mof::GraphicsDevice::setViewport(mof::Rectangle(0 , 0 , 640 , 480));//TODO +} + + +void mof::Menu::update() { + m_pImpl->pBackgroundView->update(); + for(int i = 0 ; i < m_pImpl->size ; ++i){ + m_pImpl->items[i].pView->update(); + } +} diff --git a/saisei-1_0/rpg/rpg/resource.cpp b/saisei-1_0/rpg/rpg/resource.cpp index 76bf8f7..c3d6691 100644 --- a/saisei-1_0/rpg/rpg/resource.cpp +++ b/saisei-1_0/rpg/rpg/resource.cpp @@ -1,26 +1,26 @@ -#include "resource.hpp" -#include - -namespace -{ - mof::TextureManagerHandler m_systemTextureManager; - bool m_initialized = false; - - void initialize( ) - { - m_systemTextureManager = mof::TextureManagerHandler( new mof::TextureManager ); - } -} - -mof::TextureManagerHandler -getTextureResourceManager( ResourceGroup rg ) -{ - if( !m_initialized )initialize(); - switch( rg ) - { - case SYSTEM : - return m_systemTextureManager; - default : - std::runtime_error("invalid resource group"); - } -} +#include "resource.hpp" +#include + +namespace +{ + mof::TextureManagerHandler m_systemTextureManager; + bool m_initialized = false; + + void initialize( ) + { + m_systemTextureManager = mof::TextureManagerHandler( new mof::TextureManager ); + } +} + +mof::TextureManagerHandler +getTextureResourceManager( ResourceGroup rg ) +{ + if( !m_initialized )initialize(); + switch( rg ) + { + case SYSTEM : + return m_systemTextureManager; + default : + std::runtime_error("invalid resource group"); + } +} diff --git a/saisei-1_0/rpg/rpg/resource.hpp b/saisei-1_0/rpg/rpg/resource.hpp index 16bd420..d218768 100644 --- a/saisei-1_0/rpg/rpg/resource.hpp +++ b/saisei-1_0/rpg/rpg/resource.hpp @@ -1,9 +1,9 @@ -#pragma once -#include - -enum ResourceGroup -{ - /** アプリケーション全体共通のリソース */ SYSTEM -}; - -mof::TextureManagerHandler getTextureResourceManager( ResourceGroup rg ); +#pragma once +#include + +enum ResourceGroup +{ + /** アプリケーション全体共通のリソース */ SYSTEM +}; + +mof::TextureManagerHandler getTextureResourceManager( ResourceGroup rg ); diff --git a/saisei-1_0/rpg/rpg/rpg.vcproj b/saisei-1_0/rpg/rpg/rpg.vcproj index 6d7a4ec..d631f3a 100644 --- a/saisei-1_0/rpg/rpg/rpg.vcproj +++ b/saisei-1_0/rpg/rpg/rpg.vcproj @@ -1,261 +1,261 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/saisei-1_0/rpg/rpg/rpg.vcproj.TOMOHIRO.TomohiroYasuda.user b/saisei-1_0/rpg/rpg/rpg.vcproj.TOMOHIRO.TomohiroYasuda.user index aa35822..b23a0e5 100644 --- a/saisei-1_0/rpg/rpg/rpg.vcproj.TOMOHIRO.TomohiroYasuda.user +++ b/saisei-1_0/rpg/rpg/rpg.vcproj.TOMOHIRO.TomohiroYasuda.user @@ -1,65 +1,65 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/saisei-1_0/rpg/rpg/rpg.vcxproj b/saisei-1_0/rpg/rpg/rpg.vcxproj index 557fa7e..9341d55 100644 --- a/saisei-1_0/rpg/rpg/rpg.vcxproj +++ b/saisei-1_0/rpg/rpg/rpg.vcxproj @@ -1,108 +1,108 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {0F6EAEBE-4F7B-485F-99CE-5D9918CBC304} - - - - Application - - - Application - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib;C:\Program Files\Microsoft DirectX SDK %28February 2010%29\Lib\x86;C:\Program Files\boost\boost_1_40_0\stage\lib;$(LibraryPath) - - - - Disabled - C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\rpg;C:\Program Files\Lua\5.1\include;C:\Program Files\boost\boost_1_40_0;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\rpg\extlib;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib\extlib\expat\include - Level4 - true - MultiThreadedDebug - - - moflib.lib;sqlite3.lib - C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\debug;C:\Program Files\Lua\5.1\lib;%(AdditionalLibraryDirectories) - true - - - - - C:\Program Files\Lua\5.1\include;C:\Program Files\luabind-0.8;C:\Program Files\Lua\5.1\include\cppunit;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib;%(AdditionalIncludeDirectories) - - - /NODEFAULTLIB:library /LTCG %(AdditionalOptions) - moflib.lib;%(AdditionalDependencies) - C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\release;%(AdditionalLibraryDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {04cd4817-1559-4830-bcb0-c5ae997cd904} - false - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {0F6EAEBE-4F7B-485F-99CE-5D9918CBC304} + + + + Application + + + Application + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib;C:\Program Files\Microsoft DirectX SDK %28February 2010%29\Lib\x86;C:\Program Files\boost\boost_1_40_0\stage\lib;$(LibraryPath) + + + + Disabled + C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\rpg;C:\Program Files\Lua\5.1\include;C:\Program Files\boost\boost_1_40_0;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\rpg\extlib;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib\extlib\expat\include + Level4 + true + MultiThreadedDebug + + + moflib.lib;sqlite3.lib + C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\debug;C:\Program Files\Lua\5.1\lib;%(AdditionalLibraryDirectories) + true + + + + + C:\Program Files\Lua\5.1\include;C:\Program Files\luabind-0.8;C:\Program Files\Lua\5.1\include\cppunit;C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\moflib\moflib;%(AdditionalIncludeDirectories) + + + /NODEFAULTLIB:library /LTCG %(AdditionalOptions) + moflib.lib;%(AdditionalDependencies) + C:\Documents and Settings\TomohiroYasuda\My Documents\Visual Studio 2005\Projects\rpg\release;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {04cd4817-1559-4830-bcb0-c5ae997cd904} + false + + + + + \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/rpg.vcxproj.filters b/saisei-1_0/rpg/rpg/rpg.vcxproj.filters index 6f4c976..ff954ac 100644 --- a/saisei-1_0/rpg/rpg/rpg.vcxproj.filters +++ b/saisei-1_0/rpg/rpg/rpg.vcxproj.filters @@ -1,129 +1,129 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {add1e201-f39b-4bbe-a2c2-94e94303e6fa} - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {3b7a5d19-fdb1-41de-a6eb-0b0264cdfde1} - - - {1f07a6e6-4368-41c1-98c4-3904c828a74e} - - - {16614efb-9490-4228-977d-e2a13c3f6179} - - - {9eac29d6-8d45-4ddb-9a0f-e291ab144ab5} - - - {375d9b3c-d9d6-4ae1-9518-a717ba580359} - - - - - ソース ファイル - - - ソース ファイル - - - ソース ファイル - - - ソース ファイル - - - ソース ファイル - - - ソース ファイル\widget - - - ソース ファイル\widget - - - ソース ファイル\widget - - - ソース ファイル\widget - - - ソース ファイル\widget - - - ソース ファイル\script - - - ソース ファイル - - - ソース ファイル\other - - - ソース ファイル - - - ソース ファイル - - - - - ヘッダー ファイル - - - ヘッダー ファイル - - - ヘッダー ファイル - - - ヘッダー ファイル - - - ヘッダー ファイル - - - ヘッダー ファイル\widget - - - ヘッダー ファイル\widget - - - ヘッダー ファイル\widget - - - ヘッダー ファイル\widget - - - ヘッダー ファイル\widget - - - ヘッダー ファイル\script - - - ヘッダー ファイル - - - ヘッダー ファイル\other - - - ヘッダー ファイル - - - ヘッダー ファイル - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {add1e201-f39b-4bbe-a2c2-94e94303e6fa} + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {3b7a5d19-fdb1-41de-a6eb-0b0264cdfde1} + + + {1f07a6e6-4368-41c1-98c4-3904c828a74e} + + + {16614efb-9490-4228-977d-e2a13c3f6179} + + + {9eac29d6-8d45-4ddb-9a0f-e291ab144ab5} + + + {375d9b3c-d9d6-4ae1-9518-a717ba580359} + + + + + ソース ファイル + + + ソース ファイル + + + ソース ファイル + + + ソース ファイル + + + ソース ファイル + + + ソース ファイル\widget + + + ソース ファイル\widget + + + ソース ファイル\widget + + + ソース ファイル\widget + + + ソース ファイル\widget + + + ソース ファイル\script + + + ソース ファイル + + + ソース ファイル\other + + + ソース ファイル + + + ソース ファイル + + + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル + + + ヘッダー ファイル\widget + + + ヘッダー ファイル\widget + + + ヘッダー ファイル\widget + + + ヘッダー ファイル\widget + + + ヘッダー ファイル\widget + + + ヘッダー ファイル\script + + + ヘッダー ファイル + + + ヘッダー ファイル\other + + + ヘッダー ファイル + + + ヘッダー ファイル + + \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/rpg.vcxproj.user b/saisei-1_0/rpg/rpg/rpg.vcxproj.user index adddae4..8173198 100644 --- a/saisei-1_0/rpg/rpg/rpg.vcxproj.user +++ b/saisei-1_0/rpg/rpg/rpg.vcxproj.user @@ -1,7 +1,7 @@ - - - - $(SolutionDir)$(Configuration)\ - WindowsLocalDebugger - + + + + $(SolutionDir)$(Configuration)\ + WindowsLocalDebugger + \ No newline at end of file diff --git a/saisei-1_0/rpg/rpg/widget/HighlightButtonView.cpp b/saisei-1_0/rpg/rpg/widget/HighlightButtonView.cpp index 6869c10..6b38e0e 100644 --- a/saisei-1_0/rpg/rpg/widget/HighlightButtonView.cpp +++ b/saisei-1_0/rpg/rpg/widget/HighlightButtonView.cpp @@ -1,277 +1,277 @@ -#include "widget/HighlightButtonView.hpp" -#include "mof/mofGraphics.hpp" -#include "mof/Sprite.hpp" -#include "mof/widget/Effect.hpp" -#include "mof/utilities.hpp" -#include "mof/widgets.hpp" -#include "mof/streams.hpp" -#include "resource.hpp" - -using mof::widget::WidgetView; - -namespace -{ - const mof::Color4f HIGHLIGHT_COLOR( 0.8f , 0.4f , 0.6f , 1 ); - const mof::Color4f HIGHLIGHT_COLOR2( 1 , 0.6f , 0.8f , 1 ); - const mof::Color4f NORMAL_COLOR( 0 , 0.4f , 0.6f , 1 ); - const mof::Color4f HIGHLIGHT_TEXT_COLOR_FASE1( 1 , 1 , 1 , 0.5f ); - const mof::Color4f HIGHLIGHT_TEXT_COLOR_FASE2( 1 , 0.5f , 1 , 0.7f ); - const mof::Color4f HIGHLIGHT_TEXT_COLOR_FASE3( 1 , 0.8f , 1 , 0.9f ); - const mof::Color4f NORMAL_TEXT_COLOR( 1 , 1 , 1 , 1 ); -} -//{{{ struct Impl -struct HighlightButtonView::Impl -{ - mof::Effect* pEffect; - WidgetView* pView; - mof::Vector2D preferredSize; - mof::ReferenceWrapper imageColorWrapper; - mof::ReferenceWrapper bgColorWrapper; - bool visible_; - bool is_disable_; - - Impl( WidgetView* pView_, bool is_disable ) - : visible_(true), pEffect( NULL ) , pView( pView_ ), is_disable_(is_disable) - { - } - - ~Impl() - { - delete pEffect; - delete pView; - } - -}; -//}}} -//{{{ constructor -HighlightButtonView::HighlightButtonView -( - const boost::function& viewFactory, - bool is_disable -) -: m_pImpl( new Impl( viewFactory(), is_disable ) ) -{ - m_pImpl->pEffect = new mof::Effect( ); - { - m_pImpl->pView->getPositionStream() - << getPositionStream() - << mof::Vector2D( 0 , 0 ) - << mof::Vector2D( 0 , 0 ); - m_pImpl->pView->getColorStream() - << getColorStream() - << m_pImpl->imageColorWrapper.makeRef(mof::Color4f(1 , 1 , 1 , 1)) - << m_pImpl->imageColorWrapper.makeRef(NORMAL_TEXT_COLOR); - m_pImpl->preferredSize = m_pImpl->pView->getSizeStream().value(); - m_sizeStream << m_pImpl->preferredSize; - } - { // 背景の生成 - mof::Sprite* pSprite = new mof::Sprite - ( - ::getTextureResourceManager( SYSTEM )->getResource( "image/fill.png" ) , - mof::Rectangle( 0 , 0 , 1 , 1 ) - ); - m_pImpl->pEffect->addSprite(_T("bg") , pSprite); - - pSprite->getPositionStream() << getPositionStream( ) << mof::Vector2D( 0 , 0 ) << mof::Vector2D( 0 , 0 ); - pSprite->getColorStream() - << getColorStream() - << m_pImpl->bgColorWrapper.makeRef(mof::Color4f(0 , 1 , 1 , 1)) - << m_pImpl->bgColorWrapper.makeRef(NORMAL_COLOR); - pSprite->setSizeStream( m_sizeStream );//背景のサイズはビューのサイズに依存 - } - - -} -//}}} -//{{{ destructor -HighlightButtonView::~HighlightButtonView() -{ -} -//}}} -//{{{ update -void HighlightButtonView::update( ) -{ - m_positionStream.update( ); - m_sizeStream.update( ); - m_colorStream.update( ); - m_pImpl->pEffect->update( ); - m_pImpl->pView->update( ); -} -//}}} -//{{{ draw -void HighlightButtonView::draw( ) const -{ - if (!m_pImpl->visible_) return; - m_pImpl->pEffect->draw( ); - m_pImpl->pView->draw( ); -} -//}}} -//{{{ setVisible -void HighlightButtonView::setVisible(bool visible) -{ - m_pImpl->visible_ = visible; -} -//}}} -//{{{ show -mof::FrameNumber HighlightButtonView::show( bool imidiately ) -{ - m_pImpl->pView->show( imidiately ); - if( imidiately ) - { - m_pImpl->imageColorWrapper.replace(0 , mof::Color4f(1 , 1 , 1 , 1)); - m_pImpl->bgColorWrapper.replace(0 , mof::Color4f(1 , 1 , 1 , 1)); - return 0; - } - - { //Text更新 - m_pImpl->imageColorWrapper.replace - ( - 0 , m_colorStream , - mof::makeKeyFrameAnimationHandler - ( - 0 , mof::Color4f(0 , 1, 1 , 1) , - 30 , mof::Color4f(1 , 1, 1 , 1) - ) - ); - } - { //背景更新(透明度) - m_pImpl->bgColorWrapper.replace - ( - 0 , m_colorStream , - mof::makeKeyFrameAnimationHandler - ( - 0 , mof::Color4f(0 , 1, 1 , 1) , - 30 , mof::Color4f(1 , 1, 1 , 1) - ) - ); - } - - return 30; -} -//}}} -//{{{ hide -mof::FrameNumber HighlightButtonView::hide( bool imidiately ) -{ - m_pImpl->pView->hide( imidiately ); - if( imidiately ) - { - m_pImpl->imageColorWrapper.replace(0 , mof::Color4f( 0 , 1 , 1 , 1)); - m_pImpl->bgColorWrapper.replace(0 , mof::makeConstantHandler( mof::Color4f( 0 , 1 , 1 , 1 ) )); - return 0; - } - - { //Text更新 - m_pImpl->imageColorWrapper.replace - ( - 0 , m_colorStream , - mof::makeKeyFrameAnimationHandler - ( - 0 , mof::Color4f(1 , 1, 1 , 1) , - 30 , mof::Color4f(0 , 1, 1 , 1) - ) - ); - } - { //背景更新 - m_pImpl->bgColorWrapper.replace - ( - 0 , m_colorStream , - mof::makeKeyFrameAnimationHandler - ( - 0 , mof::Color4f(1 , 1, 1 , 1) , - 30 , mof::Color4f(0 , 1, 1 , 1) - ) - ); - } - - return 30; -} -//}}} -//{{{ focus -mof::FrameNumber HighlightButtonView::focus( bool imidiately ) -{ - m_pImpl->pView->focus( imidiately ); - - //TODO imidiately , shared - static mof::Manipulator::Handler manip; - static bool isInitialized = false; - if(!isInitialized) - { - mof::KeyFrameAnimation::KeyFrame keyFrames[] = { - mof::KeyFrameAnimation::KeyFrame(0 , HIGHLIGHT_TEXT_COLOR_FASE2) , - mof::KeyFrameAnimation::KeyFrame(30 , HIGHLIGHT_TEXT_COLOR_FASE2) , - mof::KeyFrameAnimation::KeyFrame(50 , HIGHLIGHT_TEXT_COLOR_FASE1) , - mof::KeyFrameAnimation::KeyFrame(70 , HIGHLIGHT_TEXT_COLOR_FASE1) , - mof::KeyFrameAnimation::KeyFrame(120 , HIGHLIGHT_TEXT_COLOR_FASE2) , - mof::KeyFrameAnimation::KeyFrame(170 , HIGHLIGHT_TEXT_COLOR_FASE2) , - mof::KeyFrameAnimation::KeyFrame(220 , HIGHLIGHT_TEXT_COLOR_FASE3) , - mof::KeyFrameAnimation::KeyFrame(270 , HIGHLIGHT_TEXT_COLOR_FASE2) , - }; - manip = mof::makeKeyFrameAnimationHandler - ( - keyFrames[0] , mof::lastOf(keyFrames) - ); - isInitialized = true; - } - { - if (!m_pImpl->is_disable_) m_pImpl->imageColorWrapper.replace(1 , m_colorStream , manip); - m_pImpl->bgColorWrapper.replace(1 , HIGHLIGHT_COLOR); - return 30; - } - -} -//}}} -//{{{ blur -mof::FrameNumber HighlightButtonView::blur( bool imidiately ) -{ - m_pImpl->pView->blur( imidiately ); - { - if (!m_pImpl->is_disable_) m_pImpl->imageColorWrapper.replace(1 , NORMAL_TEXT_COLOR); - m_pImpl->bgColorWrapper.replace(1 , NORMAL_COLOR); - return 0; - } - -} -//}}} -//{{{ click -mof::FrameNumber HighlightButtonView::click(bool) -{ - static mof::Manipulator::Handler manip1; - static mof::Manipulator::Handler manip2; - static bool isInitialized = false; - if(!isInitialized) - { - mof::KeyFrameAnimation::KeyFrame keyFrames1[] = { - mof::KeyFrameAnimation::KeyFrame(0 , HIGHLIGHT_TEXT_COLOR_FASE2) , - }; - manip1 = mof::makeKeyFrameAnimationHandler - ( - keyFrames1[0] , mof::lastOf(keyFrames1) - ); - - mof::KeyFrameAnimation::KeyFrame keyFrames2[] = { - mof::KeyFrameAnimation::KeyFrame(0 , HIGHLIGHT_COLOR) , - mof::KeyFrameAnimation::KeyFrame(5 , HIGHLIGHT_COLOR2) , - mof::KeyFrameAnimation::KeyFrame(10 , HIGHLIGHT_COLOR) , - mof::KeyFrameAnimation::KeyFrame(15 , HIGHLIGHT_COLOR2) , - mof::KeyFrameAnimation::KeyFrame(20 , HIGHLIGHT_COLOR) , - }; - manip2 = mof::makeKeyFrameAnimationHandler - ( - keyFrames2[0] , mof::lastOf(keyFrames2) - ); - isInitialized = true; - } - { - m_pImpl->imageColorWrapper.replace(1 , m_colorStream , manip1); - m_pImpl->bgColorWrapper.replace(1, m_colorStream, manip2); - return 10; - } -} -//}}} -//{{{ getPreferredSize -mof::Vector2D HighlightButtonView::getPreferredSize() const -{ - return m_pImpl->preferredSize; -} -//}}} - +#include "widget/HighlightButtonView.hpp" +#include "mof/mofGraphics.hpp" +#include "mof/Sprite.hpp" +#include "mof/widget/Effect.hpp" +#include "mof/utilities.hpp" +#include "mof/widgets.hpp" +#include "mof/streams.hpp" +#include "resource.hpp" + +using mof::widget::WidgetView; + +namespace +{ + const mof::Color4f HIGHLIGHT_COLOR( 0.8f , 0.4f , 0.6f , 1 ); + const mof::Color4f HIGHLIGHT_COLOR2( 1 , 0.6f , 0.8f , 1 ); + const mof::Color4f NORMAL_COLOR( 0 , 0.4f , 0.6f , 1 ); + const mof::Color4f HIGHLIGHT_TEXT_COLOR_FASE1( 1 , 1 , 1 , 0.5f ); + const mof::Color4f HIGHLIGHT_TEXT_COLOR_FASE2( 1 , 0.5f , 1 , 0.7f ); + const mof::Color4f HIGHLIGHT_TEXT_COLOR_FASE3( 1 , 0.8f , 1 , 0.9f ); + const mof::Color4f NORMAL_TEXT_COLOR( 1 , 1 , 1 , 1 ); +} +//{{{ struct Impl +struct HighlightButtonView::Impl +{ + mof::Effect* pEffect; + WidgetView* pView; + mof::Vector2D preferredSize; + mof::ReferenceWrapper imageColorWrapper; + mof::ReferenceWrapper bgColorWrapper; + bool visible_; + bool is_disable_; + + Impl( WidgetView* pView_, bool is_disable ) + : visible_(true), pEffect( NULL ) , pView( pView_ ), is_disable_(is_disable) + { + } + + ~Impl() + { + delete pEffect; + delete pView; + } + +}; +//}}} +//{{{ constructor +HighlightButtonView::HighlightButtonView +( + const boost::function& viewFactory, + bool is_disable +) +: m_pImpl( new Impl( viewFactory(), is_disable ) ) +{ + m_pImpl->pEffect = new mof::Effect( ); + { + m_pImpl->pView->getPositionStream() + << getPositionStream() + << mof::Vector2D( 0 , 0 ) + << mof::Vector2D( 0 , 0 ); + m_pImpl->pView->getColorStream() + << getColorStream() + << m_pImpl->imageColorWrapper.makeRef(mof::Color4f(1 , 1 , 1 , 1)) + << m_pImpl->imageColorWrapper.makeRef(NORMAL_TEXT_COLOR); + m_pImpl->preferredSize = m_pImpl->pView->getSizeStream().value(); + m_sizeStream << m_pImpl->preferredSize; + } + { // 背景の生成 + mof::Sprite* pSprite = new mof::Sprite + ( + ::getTextureResourceManager( SYSTEM )->getResource( "image/fill.png" ) , + mof::Rectangle( 0 , 0 , 1 , 1 ) + ); + m_pImpl->pEffect->addSprite(_T("bg") , pSprite); + + pSprite->getPositionStream() << getPositionStream( ) << mof::Vector2D( 0 , 0 ) << mof::Vector2D( 0 , 0 ); + pSprite->getColorStream() + << getColorStream() + << m_pImpl->bgColorWrapper.makeRef(mof::Color4f(0 , 1 , 1 , 1)) + << m_pImpl->bgColorWrapper.makeRef(NORMAL_COLOR); + pSprite->setSizeStream( m_sizeStream );//背景のサイズはビューのサイズに依存 + } + + +} +//}}} +//{{{ destructor +HighlightButtonView::~HighlightButtonView() +{ +} +//}}} +//{{{ update +void HighlightButtonView::update( ) +{ + m_positionStream.update( ); + m_sizeStream.update( ); + m_colorStream.update( ); + m_pImpl->pEffect->update( ); + m_pImpl->pView->update( ); +} +//}}} +//{{{ draw +void HighlightButtonView::draw( ) const +{ + if (!m_pImpl->visible_) return; + m_pImpl->pEffect->draw( ); + m_pImpl->pView->draw( ); +} +//}}} +//{{{ setVisible +void HighlightButtonView::setVisible(bool visible) +{ + m_pImpl->visible_ = visible; +} +//}}} +//{{{ show +mof::FrameNumber HighlightButtonView::show( bool imidiately ) +{ + m_pImpl->pView->show( imidiately ); + if( imidiately ) + { + m_pImpl->imageColorWrapper.replace(0 , mof::Color4f(1 , 1 , 1 , 1)); + m_pImpl->bgColorWrapper.replace(0 , mof::Color4f(1 , 1 , 1 , 1)); + return 0; + } + + { //Text更新 + m_pImpl->imageColorWrapper.replace + ( + 0 , m_colorStream , + mof::makeKeyFrameAnimationHandler + ( + 0 , mof::Color4f(0 , 1, 1 , 1) , + 30 , mof::Color4f(1 , 1, 1 , 1) + ) + ); + } + { //背景更新(透明度) + m_pImpl->bgColorWrapper.replace + ( + 0 , m_colorStream , + mof::makeKeyFrameAnimationHandler + ( + 0 , mof::Color4f(0 , 1, 1 , 1) , + 30 , mof::Color4f(1 , 1, 1 , 1) + ) + ); + } + + return 30; +} +//}}} +//{{{ hide +mof::FrameNumber HighlightButtonView::hide( bool imidiately ) +{ + m_pImpl->pView->hide( imidiately ); + if( imidiately ) + { + m_pImpl->imageColorWrapper.replace(0 , mof::Color4f( 0 , 1 , 1 , 1)); + m_pImpl->bgColorWrapper.replace(0 , mof::makeConstantHandler( mof::Color4f( 0 , 1 , 1 , 1 ) )); + return 0; + } + + { //Text更新 + m_pImpl->imageColorWrapper.replace + ( + 0 , m_colorStream , + mof::makeKeyFrameAnimationHandler + ( + 0 , mof::Color4f(1 , 1, 1 , 1) , + 30 , mof::Color4f(0 , 1, 1 , 1) + ) + ); + } + { //背景更新 + m_pImpl->bgColorWrapper.replace + ( + 0 , m_colorStream , + mof::makeKeyFrameAnimationHandler + ( + 0 , mof::Color4f(1 , 1, 1 , 1) , + 30 , mof::Color4f(0 , 1, 1 , 1) + ) + ); + } + + return 30; +} +//}}} +//{{{ focus +mof::FrameNumber HighlightButtonView::focus( bool imidiately ) +{ + m_pImpl->pView->focus( imidiately ); + + //TODO imidiately , shared + static mof::Manipulator::Handler manip; + static bool isInitialized = false; + if(!isInitialized) + { + mof::KeyFrameAnimation::KeyFrame keyFrames[] = { + mof::KeyFrameAnimation::KeyFrame(0 , HIGHLIGHT_TEXT_COLOR_FASE2) , + mof::KeyFrameAnimation::KeyFrame(30 , HIGHLIGHT_TEXT_COLOR_FASE2) , + mof::KeyFrameAnimation::KeyFrame(50 , HIGHLIGHT_TEXT_COLOR_FASE1) , + mof::KeyFrameAnimation::KeyFrame(70 , HIGHLIGHT_TEXT_COLOR_FASE1) , + mof::KeyFrameAnimation::KeyFrame(120 , HIGHLIGHT_TEXT_COLOR_FASE2) , + mof::KeyFrameAnimation::KeyFrame(170 , HIGHLIGHT_TEXT_COLOR_FASE2) , + mof::KeyFrameAnimation::KeyFrame(220 , HIGHLIGHT_TEXT_COLOR_FASE3) , + mof::KeyFrameAnimation::KeyFrame(270 , HIGHLIGHT_TEXT_COLOR_FASE2) , + }; + manip = mof::makeKeyFrameAnimationHandler + ( + keyFrames[0] , mof::lastOf(keyFrames) + ); + isInitialized = true; + } + { + if (!m_pImpl->is_disable_) m_pImpl->imageColorWrapper.replace(1 , m_colorStream , manip); + m_pImpl->bgColorWrapper.replace(1 , HIGHLIGHT_COLOR); + return 30; + } + +} +//}}} +//{{{ blur +mof::FrameNumber HighlightButtonView::blur( bool imidiately ) +{ + m_pImpl->pView->blur( imidiately ); + { + if (!m_pImpl->is_disable_) m_pImpl->imageColorWrapper.replace(1 , NORMAL_TEXT_COLOR); + m_pImpl->bgColorWrapper.replace(1 , NORMAL_COLOR); + return 0; + } + +} +//}}} +//{{{ click +mof::FrameNumber HighlightButtonView::click(bool) +{ + static mof::Manipulator::Handler manip1; + static mof::Manipulator::Handler manip2; + static bool isInitialized = false; + if(!isInitialized) + { + mof::KeyFrameAnimation::KeyFrame keyFrames1[] = { + mof::KeyFrameAnimation::KeyFrame(0 , HIGHLIGHT_TEXT_COLOR_FASE2) , + }; + manip1 = mof::makeKeyFrameAnimationHandler + ( + keyFrames1[0] , mof::lastOf(keyFrames1) + ); + + mof::KeyFrameAnimation::KeyFrame keyFrames2[] = { + mof::KeyFrameAnimation::KeyFrame(0 , HIGHLIGHT_COLOR) , + mof::KeyFrameAnimation::KeyFrame(5 , HIGHLIGHT_COLOR2) , + mof::KeyFrameAnimation::KeyFrame(10 , HIGHLIGHT_COLOR) , + mof::KeyFrameAnimation::KeyFrame(15 , HIGHLIGHT_COLOR2) , + mof::KeyFrameAnimation::KeyFrame(20 , HIGHLIGHT_COLOR) , + }; + manip2 = mof::makeKeyFrameAnimationHandler + ( + keyFrames2[0] , mof::lastOf(keyFrames2) + ); + isInitialized = true; + } + { + m_pImpl->imageColorWrapper.replace(1 , m_colorStream , manip1); + m_pImpl->bgColorWrapper.replace(1, m_colorStream, manip2); + return 10; + } +} +//}}} +//{{{ getPreferredSize +mof::Vector2D HighlightButtonView::getPreferredSize() const +{ + return m_pImpl->preferredSize; +} +//}}} + diff --git a/saisei-1_0/rpg/rpg/widget/HighlightButtonView.hpp b/saisei-1_0/rpg/rpg/widget/HighlightButtonView.hpp index db03e34..8c0345b 100644 --- a/saisei-1_0/rpg/rpg/widget/HighlightButtonView.hpp +++ b/saisei-1_0/rpg/rpg/widget/HighlightButtonView.hpp @@ -1,34 +1,34 @@ -#pragma once -#include "mof/widget/WidgetView.hpp" -#include "mof/FactoryMethod.hpp" -#include "mof/graphics/utilities.hpp" -#include "mof/widget/utilities.hpp" -#include -#include - -using mof::widget::WidgetView; - -class HighlightButtonView -: - public WidgetView -{ -public: - HighlightButtonView(const boost::function& child, bool is_disable_item); - virtual ~HighlightButtonView( ); - - virtual mof::FrameNumber show( bool imidiately = false ); - virtual mof::FrameNumber hide( bool imidiately = false ); - virtual mof::FrameNumber focus( bool imidiately = false ); - virtual mof::FrameNumber blur( bool imidiately = false ); - virtual mof::FrameNumber click( bool imidiately = false ); - virtual mof::Vector2D getPreferredSize() const; - virtual void update( ); - virtual void draw( ) const; - virtual void setVisible(bool visible); - -private: - struct Impl; - boost::scoped_ptr m_pImpl; - -}; - +#pragma once +#include "mof/widget/WidgetView.hpp" +#include "mof/FactoryMethod.hpp" +#include "mof/graphics/utilities.hpp" +#include "mof/widget/utilities.hpp" +#include +#include + +using mof::widget::WidgetView; + +class HighlightButtonView +: + public WidgetView +{ +public: + HighlightButtonView(const boost::function& child, bool is_disable_item); + virtual ~HighlightButtonView( ); + + virtual mof::FrameNumber show( bool imidiately = false ); + virtual mof::FrameNumber hide( bool imidiately = false ); + virtual mof::FrameNumber focus( bool imidiately = false ); + virtual mof::FrameNumber blur( bool imidiately = false ); + virtual mof::FrameNumber click( bool imidiately = false ); + virtual mof::Vector2D getPreferredSize() const; + virtual void update( ); + virtual void draw( ) const; + virtual void setVisible(bool visible); + +private: + struct Impl; + boost::scoped_ptr m_pImpl; + +}; + diff --git a/saisei-1_0/rpg/rpg/widget/ImageTileView.cpp b/saisei-1_0/rpg/rpg/widget/ImageTileView.cpp index ab8f38d..a9054de 100644 --- a/saisei-1_0/rpg/rpg/widget/ImageTileView.cpp +++ b/saisei-1_0/rpg/rpg/widget/ImageTileView.cpp @@ -1,101 +1,101 @@ -#include "widget/ImageTileView.hpp" -#include "widget/ImageTiler.hpp" -#include -#include -#include - -using std::shared_ptr; -using std::make_shared; -using mof::FrameNumber; -using mof::Texture; -using namespace mof::widget; - -//{{{ struct Impl -struct ImageTileView::Impl -{ - ImageTiler tiler; - - Impl( const shared_ptr& pTexture ) - : tiler( pTexture ) - { - } -}; -//}}} -//{{{ constructor -ImageTileView::ImageTileView( const shared_ptr& pTexture ) -: m_pImpl( new Impl (pTexture ) ) -{ -} -//}}} -//{{{ destructor -ImageTileView::~ImageTileView() -{ -} -//}}} -//{{{ show -FrameNumber ImageTileView::show( bool ) -{ - return 0; -} -//}}} -//{{{ hide -FrameNumber ImageTileView::hide( bool ) -{ - return 0; -} -//}}} -//{{{ focus -FrameNumber ImageTileView::focus( bool ) -{ - return 0; -} -//}}} -//{{{ blur -FrameNumber ImageTileView::blur( bool ) -{ - return 0; -} -//}}} -//{{{ click -FrameNumber ImageTileView::click( bool ) -{ - return 0; -} -//}}} -//{{{ getPreferredSize -mof::Vector2D ImageTileView::getPreferredSize() const -{ - return mof::Vector2D(0, 0); -} -//}}} -//{{{ update -void ImageTileView::update( ) -{ - m_positionStream.update( ); - m_sizeStream.update( ); - m_colorStream.update(); - - mof::Rectangle region; - mof::Vector2D position = m_positionStream.value(); - mof::Vector2D size = m_sizeStream.value(); - region.beginX = position.x; - region.beginY = position.y; - region.endX = region.beginX + size.x; - region.endY = region.beginY + size.y; - m_pImpl->tiler.setRegion( region ); - m_pImpl->tiler.setColor(m_colorStream.value().toColorCode()); - -} -//}}} -//{{{ draw -void ImageTileView::draw( ) const -{ - m_pImpl->tiler.draw( ); -} -//}}} -//{{{ setVisible -void ImageTileView::setVisible(bool visible) -{ - m_pImpl->tiler.setVisible(visible); -} -//}}} +#include "widget/ImageTileView.hpp" +#include "widget/ImageTiler.hpp" +#include +#include +#include + +using std::shared_ptr; +using std::make_shared; +using mof::FrameNumber; +using mof::Texture; +using namespace mof::widget; + +//{{{ struct Impl +struct ImageTileView::Impl +{ + ImageTiler tiler; + + Impl( const shared_ptr& pTexture ) + : tiler( pTexture ) + { + } +}; +//}}} +//{{{ constructor +ImageTileView::ImageTileView( const shared_ptr& pTexture ) +: m_pImpl( new Impl (pTexture ) ) +{ +} +//}}} +//{{{ destructor +ImageTileView::~ImageTileView() +{ +} +//}}} +//{{{ show +FrameNumber ImageTileView::show( bool ) +{ + return 0; +} +//}}} +//{{{ hide +FrameNumber ImageTileView::hide( bool ) +{ + return 0; +} +//}}} +//{{{ focus +FrameNumber ImageTileView::focus( bool ) +{ + return 0; +} +//}}} +//{{{ blur +FrameNumber ImageTileView::blur( bool ) +{ + return 0; +} +//}}} +//{{{ click +FrameNumber ImageTileView::click( bool ) +{ + return 0; +} +//}}} +//{{{ getPreferredSize +mof::Vector2D ImageTileView::getPreferredSize() const +{ + return mof::Vector2D(0, 0); +} +//}}} +//{{{ update +void ImageTileView::update( ) +{ + m_positionStream.update( ); + m_sizeStream.update( ); + m_colorStream.update(); + + mof::Rectangle region; + mof::Vector2D position = m_positionStream.value(); + mof::Vector2D size = m_sizeStream.value(); + region.beginX = position.x; + region.beginY = position.y; + region.endX = region.beginX + size.x; + region.endY = region.beginY + size.y; + m_pImpl->tiler.setRegion( region ); + m_pImpl->tiler.setColor(m_colorStream.value().toColorCode()); + +} +//}}} +//{{{ draw +void ImageTileView::draw( ) const +{ + m_pImpl->tiler.draw( ); +} +//}}} +//{{{ setVisible +void ImageTileView::setVisible(bool visible) +{ + m_pImpl->tiler.setVisible(visible); +} +//}}} diff --git a/saisei-1_0/rpg/rpg/widget/ImageTileView.hpp b/saisei-1_0/rpg/rpg/widget/ImageTileView.hpp index 554b55d..28e4f4f 100644 --- a/saisei-1_0/rpg/rpg/widget/ImageTileView.hpp +++ b/saisei-1_0/rpg/rpg/widget/ImageTileView.hpp @@ -1,30 +1,30 @@ -#pragma once -#include "mof/widget/WidgetView.hpp" -#include "mof/FactoryMethod.hpp" -#include "mof/graphics/utilities.hpp" -#include "mof/widget/utilities.hpp" -#include - - -class ImageTileView : public mof::widget::WidgetView -{ -public: - ImageTileView( const std::shared_ptr& pTexture ); - virtual ~ImageTileView( ); - - virtual mof::FrameNumber show( bool imidiately = false ); - virtual mof::FrameNumber hide( bool imidiately = false ); - virtual mof::FrameNumber focus( bool imidiately = false ); - virtual mof::FrameNumber blur( bool imidiately = false ); - virtual mof::FrameNumber click( bool imidiately = false ); - virtual mof::Vector2D getPreferredSize() const; - virtual void update( ); - virtual void draw( ) const; - virtual void setVisible(bool visible); - -private: - struct Impl; - std::unique_ptr m_pImpl; - -}; - +#pragma once +#include "mof/widget/WidgetView.hpp" +#include "mof/FactoryMethod.hpp" +#include "mof/graphics/utilities.hpp" +#include "mof/widget/utilities.hpp" +#include + + +class ImageTileView : public mof::widget::WidgetView +{ +public: + ImageTileView( const std::shared_ptr& pTexture ); + virtual ~ImageTileView( ); + + virtual mof::FrameNumber show( bool imidiately = false ); + virtual mof::FrameNumber hide( bool imidiately = false ); + virtual mof::FrameNumber focus( bool imidiately = false ); + virtual mof::FrameNumber blur( bool imidiately = false ); + virtual mof::FrameNumber click( bool imidiately = false ); + virtual mof::Vector2D getPreferredSize() const; + virtual void update( ); + virtual void draw( ) const; + virtual void setVisible(bool visible); + +private: + struct Impl; + std::unique_ptr m_pImpl; + +}; + diff --git a/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.cpp b/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.cpp index 4b8be7a..003e064 100644 --- a/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.cpp +++ b/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.cpp @@ -1,281 +1,281 @@ -#include "widget/ImageTileWidgetView.hpp" -#include "mof/GraphicsDevice.hpp" -#include "mof/Sprite.hpp" -#include "widget/Frame.hpp" -#include "mof/streams.hpp" -#include "mof/Font.hpp" - - - -struct ImageTileWidgetView::Impl{ - - Frame* pFrame; - mof::Manipulator::Handler visible; - mof::FrameNumber frame; - mof::Rectangle bounds; - //mof::Sprite* pCaption; - - - Impl( ) - : pFrame(NULL) , frame(0) - { - } - - ~Impl(){ - delete pFrame; - } -}; - - -ImageTileWidgetView::ImageTileWidgetView -( - const mof::tstring& filepath -) -: m_pImpl( new Impl( ) ) -{ - - std::shared_ptr pTexture(new mof::Texture( filepath)); - m_pImpl->pFrame = new Frame( pTexture ); - //mof::Manipulator::Handler t = mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ; - //m_pImpl->transform = mof::makeJointHandler( t ); - //m_pImpl->transform = mof::makeJointHandler< mof::Matrix2D >( mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ); - - { //visible‚̐ݒè - //m_pImpl->visible = mof::makeConstantHandler(false); - } - - //m_pImpl->pCaption = mof::Sprite::createTextSprite( mof::Font(mof::Font::MS_P_GOTHIC , 25) , title ); -} - -ImageTileWidgetView::~ImageTileWidgetView() -{ - -} - - - - -void ImageTileWidgetView::update( ) -{ - m_pImpl->frame++; - //m_pImpl->pCaption->update(); - /*mof::Matrix2D transformMatrix = m_pImpl->transform->getValue(m_pImpl->frame); - mof::Vector2D begin = mof::Vector2D(0 , 0) * transformMatrix; - mof::Vector2D end = mof::Vector2D(1 , 1) * transformMatrix; - m_pImpl->pFrame->setRegion(mof::Rectangle(begin.x , begin. y , end.x , end.y)); - */ -} - -void ImageTileWidgetView::draw() const -{ - if(m_pImpl->visible->value(m_pImpl->frame)) - { - m_pImpl->pFrame->draw(); - //m_pImpl->pCaption->draw(); - } -} - - - -/* -#include "mof/ImageTileWidgetView.hpp" -#include "mof/GraphicsDevice.hpp" -#include "mof/Sprite.hpp" -#include "mof/Frame.hpp" -#include "mof/mofManipulators.hpp" -#include "mof/Font.hpp" - -struct mof::ImageTileWidgetView::Impl{ - - mof::Frame* pFrame; - mof::Joint< mof::Matrix2D , mof::Matrix2D >::Handler transform; - mof::Manipulator::Handler visible; - mof::FrameNumber frame; - mof::Rectangle bounds; - //mof::Sprite* pCaption; - - - Impl( ) - : pFrame(NULL) , frame(0) - { - } - - ~Impl(){ - delete pFrame; - } -}; - - -mof::ImageTileWidgetView::ImageTileWidgetView( - const mof::tstring& filepath - ) - : m_pImpl( new Impl( ) ){ - - std::shared_ptr pTexture(new mof::Texture( filepath)); - m_pImpl->pFrame = new mof::Frame( pTexture); - //mof::Manipulator::Handler t = mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ; - //m_pImpl->transform = mof::makeJointHandler( t ); - m_pImpl->transform = mof::makeJointHandler< mof::Matrix2D >( mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ); - { - //visible‚̐ݒè - m_pImpl->visible = mof::makeConstantHandler(false); - } - - //m_pImpl->pCaption = mof::Sprite::createTextSprite( mof::Font(mof::Font::MS_P_GOTHIC , 25) , title ); -} - -mof::ImageTileWidgetView::~ImageTileWidgetView(){ - -} - - -void mof::ImageTileWidgetView::focus(){ - -} - -void mof::ImageTileWidgetView::blur(){ - -} - -//{{{ show -void mof::ImageTileWidgetView::show(){ - const int endWidth = m_pImpl->bounds.endX - m_pImpl->bounds.beginX; - const int beginWidth = static_cast( static_cast(endWidth ) / 10.0f ); - const int endHeight = m_pImpl->bounds.endY - m_pImpl->bounds.beginY; - const int beginHeight = static_cast( static_cast(endHeight ) / 10.0f); - mof::KeyFrameManipulator::KeyFrame keyFrames1[] = { - mof::makeKeyFrame(0 , mof::Vector2D(beginWidth , beginHeight )) , - mof::makeKeyFrame(10 , mof::Vector2D(endWidth , beginHeight )) , - mof::makeKeyFrame(20 , mof::Vector2D(endWidth , endHeight)) - }; - - const int beginCX = (m_pImpl->bounds.beginX + m_pImpl->bounds.endX - beginWidth) / 2; - const int beginCY = (m_pImpl->bounds.beginY + m_pImpl->bounds.endY - beginHeight) / 2; - mof::KeyFrameManipulator::KeyFrame keyFrames2[] = { - mof::makeKeyFrame(0 , mof::Vector2D(beginCX , beginCY )) , - mof::makeKeyFrame(10 , mof::Vector2D(m_pImpl->bounds.beginX , beginCY )) , - mof::makeKeyFrame(20 , mof::Vector2D(m_pImpl->bounds.beginX , m_pImpl->bounds.beginY)) - }; - mof::Manipulator::Handler list[] = { - mof::Manipulator::Handler(new mof::ScalingAnimation2D(keyFrames1[0] , keyFrames1[2])) , - mof::Manipulator::Handler(new mof::TranslationAnimation2D(keyFrames2[0] , keyFrames2[2])) , - }; - m_pImpl->transform->set( mof::Manipulator::Handler(new mof::CascadingAnimation(list[0] , list[1])) ); - - { - //titleŠÖŒW‚̐ݒè - { - //world transform - mof::KeyFrameManipulator::KeyFrame keyFrames[] = { - mof::makeKeyFrame(0 , mof::Vector2D(-10 , 0 ) ) , - mof::makeKeyFrame(20 , mof::Vector2D(-10 , 0 ) ) , - mof::makeKeyFrame(30 , mof::Vector2D(0 , 0 ) ) - }; - mof::Manipulator::Handler tmp(new mof::TranslationAnimation2D(keyFrames[0] , keyFrames[2])); - - mof::Manipulator::Handler list[]= { - mof::makeConstantHandler( mof::Matrix2D::createScaling( m_pImpl->pCaption->getWorldTransform().getDiagonal())) , - mof::makeConstantHandler( mof::Matrix2D::createTranslation(mof::Vector2D(m_pImpl->bounds.beginX + 20 , m_pImpl->bounds.beginY + 5 )) ) , - tmp - }; - m_pImpl->pCaption->setWorldTransform(mof::Manipulator::Handler(new mof::CascadingAnimation(list[0] , list[2]))); - - } - mof::KeyFrameManipulator::KeyFrame keyFrames[] = { - mof::makeKeyFrame(0 , mof::Color4f(0 , 1 , 1 , 1) ) , - mof::makeKeyFrame(20 , mof::Color4f(0 , 1 , 1 , 1) ) , - mof::makeKeyFrame(30 , mof::Color4f(1 , 1 , 1 , 1) ) - }; - m_pImpl->pCaption->setColor(mof::Manipulator::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[2]))); - m_pImpl->pCaption->setFrameNumber(0); - } - { - //visible‚̐ݒè - m_pImpl->visible = mof::makeConstantHandler(true); - } - m_pImpl->frame = 0; - -} -//}}} -//{{{ close -void mof::ImageTileWidgetView::close(){ - const int beginWidth = m_pImpl->bounds.endX - m_pImpl->bounds.beginX; - const int endWidth = static_cast( static_cast(beginWidth ) / 10.0f ); - const int beginHeight = m_pImpl->bounds.endY - m_pImpl->bounds.beginY; - const int endHeight = static_cast( static_cast(beginHeight ) / 10.0f); - mof::KeyFrameManipulator::KeyFrame keyFrames1[] = { - mof::makeKeyFrame(0 , mof::Vector2D(beginWidth , beginHeight )) , - mof::makeKeyFrame(10 , mof::Vector2D(beginWidth , endHeight )) , - mof::makeKeyFrame(20 , mof::Vector2D(endWidth , endHeight)) - }; - - const int endCX = (m_pImpl->bounds.beginX + m_pImpl->bounds.endX - endWidth) / 2; - const int endCY = (m_pImpl->bounds.beginY + m_pImpl->bounds.endY - endHeight) / 2; - mof::KeyFrameManipulator::KeyFrame keyFrames2[] = { - mof::makeKeyFrame(0 , mof::Vector2D(m_pImpl->bounds.beginX , m_pImpl->bounds.beginY )) , - mof::makeKeyFrame(10 , mof::Vector2D(m_pImpl->bounds.beginX , endCY)) , - mof::makeKeyFrame(20 , mof::Vector2D(endCX , endCY )) - }; - mof::Manipulator::Handler list[] = { - mof::Manipulator::Handler(new mof::ScalingAnimation2D(keyFrames1[0] , keyFrames1[2])) , - mof::Manipulator::Handler(new mof::TranslationAnimation2D(keyFrames2[0] , keyFrames2[2])) , - }; - m_pImpl->transform->set( mof::Manipulator::Handler(new mof::CascadingAnimation(list[0] , list[1])) ); - - { - //titleŠÖŒW‚̐ݒè - //m_pImpl->pCaption->setColor(mof::Color4f(0 , 0 , 0 , 0)); - //m_pImpl->pCaption->setFrameNumber(0); - } - { - //visible‚̐ݒè - mof::KeyFrameManipulator::KeyFrame keyFrames[] = { - mof::makeKeyFrame(0 , true) , - mof::makeKeyFrame(20 , false) - }; - m_pImpl->visible = mof::Manipulator::Handler( - new mof::KeyFrameManipulator(keyFrames[0] , keyFrames[1] , &mof::stepInterpolate ) - ); - } - m_pImpl->frame = 0; -} -//}}} -mof::Manipulator::Handler mof::ImageTileWidgetView::getPosition( ) const -{ - return mof::dynamic::makeTranslation2DHandler( m_pImpl->transform ); -} - -mof::Manipulator::Handler mof::ImageTileWidgetView::getSize( ) const -{ - return mof::dynamic::makeScaling2DHandler( m_pImpl->transform ); -} - - -void mof::ImageTileWidgetView::setBounds(const mof::Rectangle& bounds) -{ - m_pImpl->bounds = bounds; -} - -mof::Rectangle mof::ImageTileWidgetView::getBounds() const -{ - return m_pImpl->bounds; -} - - -void mof::ImageTileWidgetView::update( ) -{ - m_pImpl->frame++; - //m_pImpl->pCaption->update(); - mof::Matrix2D transformMatrix = m_pImpl->transform->getValue(m_pImpl->frame); - mof::Vector2D begin = mof::Vector2D(0 , 0) * transformMatrix; - mof::Vector2D end = mof::Vector2D(1 , 1) * transformMatrix; - m_pImpl->pFrame->setRegion(mof::Rectangle(begin.x , begin. y , end.x , end.y)); -} - -void mof::ImageTileWidgetView::draw(){ - if(m_pImpl->visible->getValue(m_pImpl->frame)){ - m_pImpl->pFrame->draw(); - //m_pImpl->pCaption->draw(); - } -} -*/ +#include "widget/ImageTileWidgetView.hpp" +#include "mof/GraphicsDevice.hpp" +#include "mof/Sprite.hpp" +#include "widget/Frame.hpp" +#include "mof/streams.hpp" +#include "mof/Font.hpp" + + + +struct ImageTileWidgetView::Impl{ + + Frame* pFrame; + mof::Manipulator::Handler visible; + mof::FrameNumber frame; + mof::Rectangle bounds; + //mof::Sprite* pCaption; + + + Impl( ) + : pFrame(NULL) , frame(0) + { + } + + ~Impl(){ + delete pFrame; + } +}; + + +ImageTileWidgetView::ImageTileWidgetView +( + const mof::tstring& filepath +) +: m_pImpl( new Impl( ) ) +{ + + std::shared_ptr pTexture(new mof::Texture( filepath)); + m_pImpl->pFrame = new Frame( pTexture ); + //mof::Manipulator::Handler t = mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ; + //m_pImpl->transform = mof::makeJointHandler( t ); + //m_pImpl->transform = mof::makeJointHandler< mof::Matrix2D >( mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ); + + { //visible‚̐ݒè + //m_pImpl->visible = mof::makeConstantHandler(false); + } + + //m_pImpl->pCaption = mof::Sprite::createTextSprite( mof::Font(mof::Font::MS_P_GOTHIC , 25) , title ); +} + +ImageTileWidgetView::~ImageTileWidgetView() +{ + +} + + + + +void ImageTileWidgetView::update( ) +{ + m_pImpl->frame++; + //m_pImpl->pCaption->update(); + /*mof::Matrix2D transformMatrix = m_pImpl->transform->getValue(m_pImpl->frame); + mof::Vector2D begin = mof::Vector2D(0 , 0) * transformMatrix; + mof::Vector2D end = mof::Vector2D(1 , 1) * transformMatrix; + m_pImpl->pFrame->setRegion(mof::Rectangle(begin.x , begin. y , end.x , end.y)); + */ +} + +void ImageTileWidgetView::draw() const +{ + if(m_pImpl->visible->value(m_pImpl->frame)) + { + m_pImpl->pFrame->draw(); + //m_pImpl->pCaption->draw(); + } +} + + + +/* +#include "mof/ImageTileWidgetView.hpp" +#include "mof/GraphicsDevice.hpp" +#include "mof/Sprite.hpp" +#include "mof/Frame.hpp" +#include "mof/mofManipulators.hpp" +#include "mof/Font.hpp" + +struct mof::ImageTileWidgetView::Impl{ + + mof::Frame* pFrame; + mof::Joint< mof::Matrix2D , mof::Matrix2D >::Handler transform; + mof::Manipulator::Handler visible; + mof::FrameNumber frame; + mof::Rectangle bounds; + //mof::Sprite* pCaption; + + + Impl( ) + : pFrame(NULL) , frame(0) + { + } + + ~Impl(){ + delete pFrame; + } +}; + + +mof::ImageTileWidgetView::ImageTileWidgetView( + const mof::tstring& filepath + ) + : m_pImpl( new Impl( ) ){ + + std::shared_ptr pTexture(new mof::Texture( filepath)); + m_pImpl->pFrame = new mof::Frame( pTexture); + //mof::Manipulator::Handler t = mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ; + //m_pImpl->transform = mof::makeJointHandler( t ); + m_pImpl->transform = mof::makeJointHandler< mof::Matrix2D >( mof::makeConstantHandler( mof::Matrix2D::createIdentity() ) ); + { + //visible‚̐ݒè + m_pImpl->visible = mof::makeConstantHandler(false); + } + + //m_pImpl->pCaption = mof::Sprite::createTextSprite( mof::Font(mof::Font::MS_P_GOTHIC , 25) , title ); +} + +mof::ImageTileWidgetView::~ImageTileWidgetView(){ + +} + + +void mof::ImageTileWidgetView::focus(){ + +} + +void mof::ImageTileWidgetView::blur(){ + +} + +//{{{ show +void mof::ImageTileWidgetView::show(){ + const int endWidth = m_pImpl->bounds.endX - m_pImpl->bounds.beginX; + const int beginWidth = static_cast( static_cast(endWidth ) / 10.0f ); + const int endHeight = m_pImpl->bounds.endY - m_pImpl->bounds.beginY; + const int beginHeight = static_cast( static_cast(endHeight ) / 10.0f); + mof::KeyFrameManipulator::KeyFrame keyFrames1[] = { + mof::makeKeyFrame(0 , mof::Vector2D(beginWidth , beginHeight )) , + mof::makeKeyFrame(10 , mof::Vector2D(endWidth , beginHeight )) , + mof::makeKeyFrame(20 , mof::Vector2D(endWidth , endHeight)) + }; + + const int beginCX = (m_pImpl->bounds.beginX + m_pImpl->bounds.endX - beginWidth) / 2; + const int beginCY = (m_pImpl->bounds.beginY + m_pImpl->bounds.endY - beginHeight) / 2; + mof::KeyFrameManipulator::KeyFrame keyFrames2[] = { + mof::makeKeyFrame(0 , mof::Vector2D(beginCX , beginCY )) , + mof::makeKeyFrame(10 , mof::Vector2D(m_pImpl->bounds.beginX , beginCY )) , + mof::makeKeyFrame(20 , mof::Vector2D(m_pImpl->bounds.beginX , m_pImpl->bounds.beginY)) + }; + mof::Manipulator::Handler list[] = { + mof::Manipulator::Handler(new mof::ScalingAnimation2D(keyFrames1[0] , keyFrames1[2])) , + mof::Manipulator::Handler(new mof::TranslationAnimation2D(keyFrames2[0] , keyFrames2[2])) , + }; + m_pImpl->transform->set( mof::Manipulator::Handler(new mof::CascadingAnimation(list[0] , list[1])) ); + + { + //titleŠÖŒW‚̐ݒè + { + //world transform + mof::KeyFrameManipulator::KeyFrame keyFrames[] = { + mof::makeKeyFrame(0 , mof::Vector2D(-10 , 0 ) ) , + mof::makeKeyFrame(20 , mof::Vector2D(-10 , 0 ) ) , + mof::makeKeyFrame(30 , mof::Vector2D(0 , 0 ) ) + }; + mof::Manipulator::Handler tmp(new mof::TranslationAnimation2D(keyFrames[0] , keyFrames[2])); + + mof::Manipulator::Handler list[]= { + mof::makeConstantHandler( mof::Matrix2D::createScaling( m_pImpl->pCaption->getWorldTransform().getDiagonal())) , + mof::makeConstantHandler( mof::Matrix2D::createTranslation(mof::Vector2D(m_pImpl->bounds.beginX + 20 , m_pImpl->bounds.beginY + 5 )) ) , + tmp + }; + m_pImpl->pCaption->setWorldTransform(mof::Manipulator::Handler(new mof::CascadingAnimation(list[0] , list[2]))); + + } + mof::KeyFrameManipulator::KeyFrame keyFrames[] = { + mof::makeKeyFrame(0 , mof::Color4f(0 , 1 , 1 , 1) ) , + mof::makeKeyFrame(20 , mof::Color4f(0 , 1 , 1 , 1) ) , + mof::makeKeyFrame(30 , mof::Color4f(1 , 1 , 1 , 1) ) + }; + m_pImpl->pCaption->setColor(mof::Manipulator::Handler(new mof::KeyFrameAnimation(keyFrames[0] , keyFrames[2]))); + m_pImpl->pCaption->setFrameNumber(0); + } + { + //visible‚̐ݒè + m_pImpl->visible = mof::makeConstantHandler(true); + } + m_pImpl->frame = 0; + +} +//}}} +//{{{ close +void mof::ImageTileWidgetView::close(){ + const int beginWidth = m_pImpl->bounds.endX - m_pImpl->bounds.beginX; + const int endWidth = static_cast( static_cast(beginWidth ) / 10.0f ); + const int beginHeight = m_pImpl->bounds.endY - m_pImpl->bounds.beginY; + const int endHeight = static_cast( static_cast(beginHeight ) / 10.0f); + mof::KeyFrameManipulator::KeyFrame keyFrames1[] = { + mof::makeKeyFrame(0 , mof::Vector2D(beginWidth , beginHeight )) , + mof::makeKeyFrame(10 , mof::Vector2D(beginWidth , endHeight )) , + mof::makeKeyFrame(20 , mof::Vector2D(endWidth , endHeight)) + }; + + const int endCX = (m_pImpl->bounds.beginX + m_pImpl->bounds.endX - endWidth) / 2; + const int endCY = (m_pImpl->bounds.beginY + m_pImpl->bounds.endY - endHeight) / 2; + mof::KeyFrameManipulator::KeyFrame keyFrames2[] = { + mof::makeKeyFrame(0 , mof::Vector2D(m_pImpl->bounds.beginX , m_pImpl->bounds.beginY )) , + mof::makeKeyFrame(10 , mof::Vector2D(m_pImpl->bounds.beginX , endCY)) , + mof::makeKeyFrame(20 , mof::Vector2D(endCX , endCY )) + }; + mof::Manipulator::Handler list[] = { + mof::Manipulator::Handler(new mof::ScalingAnimation2D(keyFrames1[0] , keyFrames1[2])) , + mof::Manipulator::Handler(new mof::TranslationAnimation2D(keyFrames2[0] , keyFrames2[2])) , + }; + m_pImpl->transform->set( mof::Manipulator::Handler(new mof::CascadingAnimation(list[0] , list[1])) ); + + { + //titleŠÖŒW‚̐ݒè + //m_pImpl->pCaption->setColor(mof::Color4f(0 , 0 , 0 , 0)); + //m_pImpl->pCaption->setFrameNumber(0); + } + { + //visible‚̐ݒè + mof::KeyFrameManipulator::KeyFrame keyFrames[] = { + mof::makeKeyFrame(0 , true) , + mof::makeKeyFrame(20 , false) + }; + m_pImpl->visible = mof::Manipulator::Handler( + new mof::KeyFrameManipulator(keyFrames[0] , keyFrames[1] , &mof::stepInterpolate ) + ); + } + m_pImpl->frame = 0; +} +//}}} +mof::Manipulator::Handler mof::ImageTileWidgetView::getPosition( ) const +{ + return mof::dynamic::makeTranslation2DHandler( m_pImpl->transform ); +} + +mof::Manipulator::Handler mof::ImageTileWidgetView::getSize( ) const +{ + return mof::dynamic::makeScaling2DHandler( m_pImpl->transform ); +} + + +void mof::ImageTileWidgetView::setBounds(const mof::Rectangle& bounds) +{ + m_pImpl->bounds = bounds; +} + +mof::Rectangle mof::ImageTileWidgetView::getBounds() const +{ + return m_pImpl->bounds; +} + + +void mof::ImageTileWidgetView::update( ) +{ + m_pImpl->frame++; + //m_pImpl->pCaption->update(); + mof::Matrix2D transformMatrix = m_pImpl->transform->getValue(m_pImpl->frame); + mof::Vector2D begin = mof::Vector2D(0 , 0) * transformMatrix; + mof::Vector2D end = mof::Vector2D(1 , 1) * transformMatrix; + m_pImpl->pFrame->setRegion(mof::Rectangle(begin.x , begin. y , end.x , end.y)); +} + +void mof::ImageTileWidgetView::draw(){ + if(m_pImpl->visible->getValue(m_pImpl->frame)){ + m_pImpl->pFrame->draw(); + //m_pImpl->pCaption->draw(); + } +} +*/ diff --git a/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.hpp b/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.hpp index eb80820..45d3b37 100644 --- a/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.hpp +++ b/saisei-1_0/rpg/rpg/widget/ImageTileWidgetView.hpp @@ -1,27 +1,27 @@ -#pragma once -#include "mof/widget/WidgetView.hpp" -#include "mof/Font.hpp" -#include "mof/tstring.hpp" -#include - -class ImageTileWidgetView -: - public mof::WidgetView -{ -public: - ImageTileWidgetView( const mof::tstring& caption , const mof::Font& font ); - virtual ~ImageTileWidgetView( ); - - virtual mof::FrameNumber show( bool imidiately = false ); - virtual mof::FrameNumber hide( bool imidiately = false ); - virtual mof::FrameNumber focus( bool imidiately = false ); - virtual mof::FrameNumber blur( bool imidiately = false ); - virtual void update( ); - virtual void draw( ) const; - -private: - struct Impl; - boost::scoped_ptr m_pImpl; - -}; - +#pragma once +#include "mof/widget/WidgetView.hpp" +#include "mof/Font.hpp" +#include "mof/tstring.hpp" +#include + +class ImageTileWidgetView +: + public mof::WidgetView +{ +public: + ImageTileWidgetView( const mof::tstring& caption , const mof::Font& font ); + virtual ~ImageTileWidgetView( ); + + virtual mof::FrameNumber show( bool imidiately = false ); + virtual mof::FrameNumber hide( bool imidiately = false ); + virtual mof::FrameNumber focus( bool imidiately = false ); + virtual mof::FrameNumber blur( bool imidiately = false ); + virtual void update( ); + virtual void draw( ) const; + +private: + struct Impl; + boost::scoped_ptr m_pImpl; + +}; + diff --git a/saisei-1_0/rpg/rpg/widget/ImageTiler.cpp b/saisei-1_0/rpg/rpg/widget/ImageTiler.cpp index 0ce03a0..aeb7d0e 100644 --- a/saisei-1_0/rpg/rpg/widget/ImageTiler.cpp +++ b/saisei-1_0/rpg/rpg/widget/ImageTiler.cpp @@ -1,218 +1,218 @@ -#include "widget/ImageTiler.hpp" -#include "mof/GraphicsDevice.hpp" -#include "mof/ConsoleIO.hpp" -#include "mof/Sprite.hpp" -#include "mof/utilities.hpp" -#include -#include - -const int TIP_SIZE = 32; - -struct ImageTiler::Impl{ - std::shared_ptr pTexture; - std::vector vertices; - mof::Rectangle region; - mof::Color color_; - bool visible_; - bool update_; - - - Impl() - : region(0 , 0 , 0 , 0), visible_(true), color_(mof::createColor(255, 255, 255)), - update_(true) - {} - - ~Impl(){} - - //{{{ _addVerticesOfInternal - void _addVerticesOfInternal( ) - { - - const int tipMaxWidth = 32; - const int tipMaxHeight = 32; - - float sumY = region.beginY; - while( sumY < region.endY ) - { - // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv‚‚³‚ð’²ß - float tipHeight = tipMaxHeight; - float tipTextureHeight = 0.25f; - if( tipMaxHeight > region.endY - sumY ) - { - tipHeight = region.endY - sumY; - tipTextureHeight = tipTextureHeight * tipHeight / tipMaxHeight; - } - - float sumX = region.beginX; - while( sumX < region.endX ) - { - // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv•‚ð’²ß - float tipWidth = tipMaxWidth; - float tipTextureWidth = 0.25f; - if( tipMaxWidth > region.endX - sumX ) - { - tipWidth = region.endX - sumX; - tipTextureWidth = tipTextureWidth * tipWidth / tipMaxWidth; - } - - mof::Sprite::append( - vertices , - mof::Rectangle(sumX , sumY , sumX + tipWidth , sumY + tipHeight ) , - color_ , - mof::Rectangle( 0.25 , 0.25 , 0.25 + tipTextureWidth , 0.25 + tipTextureHeight ) - ); - - sumX += tipWidth; - } // while sumX - sumY += tipHeight; - } // while sumY - - } - //}}} - //{{{ _addVerticesOfExternal - void _addVerticesOfExternal( ) - { - const int tipMaxWidth = 32; - const int tipMaxHeight = 32; - - float sumY = region.beginY; - while( sumY < region.endY ) - { - // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv‚‚³‚ð’²ß - float tipHeight = tipMaxHeight; - float tipTextureHeight = 0.25f; - if( tipMaxHeight > region.endY - sumY ) - { - tipHeight = region.endY - sumY; - tipTextureHeight = tipTextureHeight * tipHeight / tipMaxHeight; - } - - mof::Sprite::append( - vertices , - mof::Rectangle( region.beginX - tipMaxWidth , sumY , region.beginX , sumY + tipHeight ) , - color_ , - mof::Rectangle( 0.0 , 0.25 , 0.25 , 0.25 + tipTextureHeight ) - ); - - mof::Sprite::append( - vertices , - mof::Rectangle( region.endX , sumY , region.endX + tipMaxWidth , sumY + tipHeight ) , - color_ , - mof::Rectangle( 0.5 , 0.25 , 0.75 , 0.25 + tipTextureHeight ) - ); - - sumY += tipHeight; - } // while sumY - - - float sumX = region.beginX; - while( sumX < region.endX ) - { - // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv•‚ð’²ß - float tipWidth = tipMaxWidth; - float tipTextureWidth = 0.25f; - if( tipMaxWidth > region.endX - sumX ) - { - tipWidth = region.endX - sumX; - tipTextureWidth = tipTextureWidth * tipWidth / tipMaxWidth; - } - - mof::Sprite::append( - vertices , - mof::Rectangle( sumX , region.beginY - tipMaxHeight , sumX + tipWidth , region.beginY ) , - color_ , - mof::Rectangle( 0.25 , 0.0 , 0.25 + tipTextureWidth , 0.25 ) - ); - - mof::Sprite::append( - vertices , - mof::Rectangle( sumX , region.endY , sumX + tipWidth , region.endY + tipMaxHeight ) , - color_ , - mof::Rectangle( 0.25 , 0.5 , 0.25 + tipTextureWidth , 0.75 ) - ); - - sumX += tipWidth; - } // while sumY - - mof::Sprite::append( - vertices , - mof::Rectangle( region.beginX - tipMaxWidth , region.beginY - tipMaxHeight , region.beginX , region.beginY ) , - color_ , - mof::Rectangle( 0.0 , 0.0 , 0.25 , 0.25 ) - ); - - mof::Sprite::append( - vertices , - mof::Rectangle( region.endX , region.beginY - tipMaxHeight , region.endX + tipMaxWidth , region.beginY ) , - color_ , - mof::Rectangle( 0.5 , 0.0 , 0.75 , 0.25 ) - ); - - mof::Sprite::append( - vertices , - mof::Rectangle( region.beginX - tipMaxWidth , region.endY , region.beginX , region.endY + tipMaxHeight ) , - color_ , - mof::Rectangle( 0.0 , 0.5 , 0.25 , 0.75 ) - ); - - mof::Sprite::append( - vertices , - mof::Rectangle( region.endX , region.endY , region.endX + tipMaxWidth , region.endY + tipMaxHeight ) , - color_ , - mof::Rectangle( 0.5 , 0.5 , 0.75 , 0.75 ) - ); - - - } - //}}} -}; - -ImageTiler::ImageTiler( const std::shared_ptr& pTexture) -: m_pImpl(new Impl) -{ - m_pImpl->pTexture = pTexture; -} - -ImageTiler::~ImageTiler(){} -//{{{ setRegion -void ImageTiler::setRegion( const mof::Rectangle& region ){ - - if(m_pImpl->region == region)return; - m_pImpl->region = region; - m_pImpl->update_ = true; -} -//}}} -//{{{ setColor -void ImageTiler::setColor(mof::Color color) -{ - if (m_pImpl->color_ == color) return; - m_pImpl->color_ = color; - m_pImpl->update_ = true; - -} -//}}} -//{{{ draw -void ImageTiler::draw() const{ - if (!m_pImpl->visible_) return; - if (m_pImpl->update_) { - m_pImpl->vertices.clear(); - m_pImpl->_addVerticesOfInternal(); - m_pImpl->_addVerticesOfExternal(); - m_pImpl->update_ = false; - } - if (m_pImpl->vertices.empty()) return; - - mof::GraphicsDevice::setTexture( m_pImpl->pTexture.get( ) ); - mof::GraphicsDevice::drawVertexArray( - m_pImpl->vertices.front() , - m_pImpl->vertices.back() , - mof::PRIMITIVE_TYPE_TRIANGLELIST - ); -} -//}}} -//{{{ setVisible -void ImageTiler::setVisible(bool visible) -{ - m_pImpl->visible_ = visible; -} -//}}} +#include "widget/ImageTiler.hpp" +#include "mof/GraphicsDevice.hpp" +#include "mof/ConsoleIO.hpp" +#include "mof/Sprite.hpp" +#include "mof/utilities.hpp" +#include +#include + +const int TIP_SIZE = 32; + +struct ImageTiler::Impl{ + std::shared_ptr pTexture; + std::vector vertices; + mof::Rectangle region; + mof::Color color_; + bool visible_; + bool update_; + + + Impl() + : region(0 , 0 , 0 , 0), visible_(true), color_(mof::createColor(255, 255, 255)), + update_(true) + {} + + ~Impl(){} + + //{{{ _addVerticesOfInternal + void _addVerticesOfInternal( ) + { + + const int tipMaxWidth = 32; + const int tipMaxHeight = 32; + + float sumY = region.beginY; + while( sumY < region.endY ) + { + // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv‚‚³‚ð’²ß + float tipHeight = tipMaxHeight; + float tipTextureHeight = 0.25f; + if( tipMaxHeight > region.endY - sumY ) + { + tipHeight = region.endY - sumY; + tipTextureHeight = tipTextureHeight * tipHeight / tipMaxHeight; + } + + float sumX = region.beginX; + while( sumX < region.endX ) + { + // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv•‚ð’²ß + float tipWidth = tipMaxWidth; + float tipTextureWidth = 0.25f; + if( tipMaxWidth > region.endX - sumX ) + { + tipWidth = region.endX - sumX; + tipTextureWidth = tipTextureWidth * tipWidth / tipMaxWidth; + } + + mof::Sprite::append( + vertices , + mof::Rectangle(sumX , sumY , sumX + tipWidth , sumY + tipHeight ) , + color_ , + mof::Rectangle( 0.25 , 0.25 , 0.25 + tipTextureWidth , 0.25 + tipTextureHeight ) + ); + + sumX += tipWidth; + } // while sumX + sumY += tipHeight; + } // while sumY + + } + //}}} + //{{{ _addVerticesOfExternal + void _addVerticesOfExternal( ) + { + const int tipMaxWidth = 32; + const int tipMaxHeight = 32; + + float sumY = region.beginY; + while( sumY < region.endY ) + { + // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv‚‚³‚ð’²ß + float tipHeight = tipMaxHeight; + float tipTextureHeight = 0.25f; + if( tipMaxHeight > region.endY - sumY ) + { + tipHeight = region.endY - sumY; + tipTextureHeight = tipTextureHeight * tipHeight / tipMaxHeight; + } + + mof::Sprite::append( + vertices , + mof::Rectangle( region.beginX - tipMaxWidth , sumY , region.beginX , sumY + tipHeight ) , + color_ , + mof::Rectangle( 0.0 , 0.25 , 0.25 , 0.25 + tipTextureHeight ) + ); + + mof::Sprite::append( + vertices , + mof::Rectangle( region.endX , sumY , region.endX + tipMaxWidth , sumY + tipHeight ) , + color_ , + mof::Rectangle( 0.5 , 0.25 , 0.75 , 0.25 + tipTextureHeight ) + ); + + sumY += tipHeight; + } // while sumY + + + float sumX = region.beginX; + while( sumX < region.endX ) + { + // region‚ðƒI[ƒo[‚µ‚È‚¢‚悤‚Ƀ`ƒbƒv•‚ð’²ß + float tipWidth = tipMaxWidth; + float tipTextureWidth = 0.25f; + if( tipMaxWidth > region.endX - sumX ) + { + tipWidth = region.endX - sumX; + tipTextureWidth = tipTextureWidth * tipWidth / tipMaxWidth; + } + + mof::Sprite::append( + vertices , + mof::Rectangle( sumX , region.beginY - tipMaxHeight , sumX + tipWidth , region.beginY ) , + color_ , + mof::Rectangle( 0.25 , 0.0 , 0.25 + tipTextureWidth , 0.25 ) + ); + + mof::Sprite::append( + vertices , + mof::Rectangle( sumX , region.endY , sumX + tipWidth , region.endY + tipMaxHeight ) , + color_ , + mof::Rectangle( 0.25 , 0.5 , 0.25 + tipTextureWidth , 0.75 ) + ); + + sumX += tipWidth; + } // while sumY + + mof::Sprite::append( + vertices , + mof::Rectangle( region.beginX - tipMaxWidth , region.beginY - tipMaxHeight , region.beginX , region.beginY ) , + color_ , + mof::Rectangle( 0.0 , 0.0 , 0.25 , 0.25 ) + ); + + mof::Sprite::append( + vertices , + mof::Rectangle( region.endX , region.beginY - tipMaxHeight , region.endX + tipMaxWidth , region.beginY ) , + color_ , + mof::Rectangle( 0.5 , 0.0 , 0.75 , 0.25 ) + ); + + mof::Sprite::append( + vertices , + mof::Rectangle( region.beginX - tipMaxWidth , region.endY , region.beginX , region.endY + tipMaxHeight ) , + color_ , + mof::Rectangle( 0.0 , 0.5 , 0.25 , 0.75 ) + ); + + mof::Sprite::append( + vertices , + mof::Rectangle( region.endX , region.endY , region.endX + tipMaxWidth , region.endY + tipMaxHeight ) , + color_ , + mof::Rectangle( 0.5 , 0.5 , 0.75 , 0.75 ) + ); + + + } + //}}} +}; + +ImageTiler::ImageTiler( const std::shared_ptr& pTexture) +: m_pImpl(new Impl) +{ + m_pImpl->pTexture = pTexture; +} + +ImageTiler::~ImageTiler(){} +//{{{ setRegion +void ImageTiler::setRegion( const mof::Rectangle& region ){ + + if(m_pImpl->region == region)return; + m_pImpl->region = region; + m_pImpl->update_ = true; +} +//}}} +//{{{ setColor +void ImageTiler::setColor(mof::Color color) +{ + if (m_pImpl->color_ == color) return; + m_pImpl->color_ = color; + m_pImpl->update_ = true; + +} +//}}} +//{{{ draw +void ImageTiler::draw() const{ + if (!m_pImpl->visible_) return; + if (m_pImpl->update_) { + m_pImpl->vertices.clear(); + m_pImpl->_addVerticesOfInternal(); + m_pImpl->_addVerticesOfExternal(); + m_pImpl->update_ = false; + } + if (m_pImpl->vertices.empty()) return; + + mof::GraphicsDevice::setTexture( m_pImpl->pTexture.get( ) ); + mof::GraphicsDevice::drawVertexArray( + m_pImpl->vertices.front() , + m_pImpl->vertices.back() , + mof::PRIMITIVE_TYPE_TRIANGLELIST + ); +} +//}}} +//{{{ setVisible +void ImageTiler::setVisible(bool visible) +{ + m_pImpl->visible_ = visible; +} +//}}} diff --git a/saisei-1_0/rpg/rpg/widget/ImageTiler.hpp b/saisei-1_0/rpg/rpg/widget/ImageTiler.hpp index 2763cfb..39abf99 100644 --- a/saisei-1_0/rpg/rpg/widget/ImageTiler.hpp +++ b/saisei-1_0/rpg/rpg/widget/ImageTiler.hpp @@ -1,24 +1,24 @@ -#pragma once -#include -#include "mof/SceneGraph.hpp" -#include "mof/Texture.hpp" -#include "mof/Drawable.hpp" -#include "mof/Color.hpp" -#include "mof/Rectangle.hpp" - -class ImageTiler : public mof::Drawable { - struct Impl; - boost::scoped_ptr m_pImpl; - -public: - ImageTiler( const std::shared_ptr& pTexture ); - virtual ~ImageTiler(); - - void setRegion(const mof::Rectangle& region); - void setColor(mof::Color color); - virtual void draw() const; - virtual void setVisible(bool visible); -}; - - - +#pragma once +#include +#include "mof/SceneGraph.hpp" +#include "mof/Texture.hpp" +#include "mof/Drawable.hpp" +#include "mof/Color.hpp" +#include "mof/Rectangle.hpp" + +class ImageTiler : public mof::Drawable { + struct Impl; + boost::scoped_ptr m_pImpl; + +public: + ImageTiler( const std::shared_ptr& pTexture ); + virtual ~ImageTiler(); + + void setRegion(const mof::Rectangle& region); + void setColor(mof::Color color); + virtual void draw() const; + virtual void setVisible(bool visible); +}; + + + diff --git a/saisei-1_0/rpg/rpg/widget/createFrame.cpp b/saisei-1_0/rpg/rpg/widget/createFrame.cpp index 9a6f419..b76f903 100644 --- a/saisei-1_0/rpg/rpg/widget/createFrame.cpp +++ b/saisei-1_0/rpg/rpg/widget/createFrame.cpp @@ -1,50 +1,50 @@ -#include "widget/createFrame.hpp" -#include "widget/ImageTileView.hpp" -#include -#include -#include -#include -#include -#include -#include "configure.hpp" -#include "resource.hpp" - -using mof::Texture; -using mof::Font; -using mof::makeFactoryMethod; -using mof::Rectangle; -using mof::widget::ImageView; -using std::shared_ptr; -using std::make_shared; -using namespace mof::widget; - -std::unique_ptr createFrame -( - const mof::tstring& caption , - const mof::tstring& contentImagePath , - const mof::tstring& titleImagePath , - shared_ptr pContentView -) -{ - std::unique_ptr pFrame - ( - - new Frame - ( - caption , - pContentView , - makeFactoryMethod( make_shared( contentImagePath ) ) , - makeFactoryMethod( make_shared( titleImagePath ) ), - makeFactoryMethod - ( - Font( FONT_NAME_UME, FONT_SIZE_LARGE ), - [] (const mof::tstring& path) { return ::getTextureResourceManager(::SYSTEM)->getResource(path);} - ) - ) - ); - return pFrame; - -} - - - +#include "widget/createFrame.hpp" +#include "widget/ImageTileView.hpp" +#include +#include +#include +#include +#include +#include +#include "configure.hpp" +#include "resource.hpp" + +using mof::Texture; +using mof::Font; +using mof::makeFactoryMethod; +using mof::Rectangle; +using mof::widget::ImageView; +using std::shared_ptr; +using std::make_shared; +using namespace mof::widget; + +std::unique_ptr createFrame +( + const mof::tstring& caption , + const mof::tstring& contentImagePath , + const mof::tstring& titleImagePath , + shared_ptr pContentView +) +{ + std::unique_ptr pFrame + ( + + new Frame + ( + caption , + pContentView , + makeFactoryMethod( make_shared( contentImagePath ) ) , + makeFactoryMethod( make_shared( titleImagePath ) ), + makeFactoryMethod + ( + Font( FONT_NAME_UME, FONT_SIZE_LARGE ), + [] (const mof::tstring& path) { return ::getTextureResourceManager(::SYSTEM)->getResource(path);} + ) + ) + ); + return pFrame; + +} + + + diff --git a/saisei-1_0/rpg/rpg/widget/createFrame.hpp b/saisei-1_0/rpg/rpg/widget/createFrame.hpp index 017e6b6..8d2ad52 100644 --- a/saisei-1_0/rpg/rpg/widget/createFrame.hpp +++ b/saisei-1_0/rpg/rpg/widget/createFrame.hpp @@ -1,22 +1,22 @@ -#pragma once -#include -#include -#include -#include -#include - - -std::unique_ptr createFrame -( - const mof::tstring& text , - const mof::tstring& contentImagePath , - const mof::tstring& titleImagePath , - std::shared_ptr pContentView -); - - - - - - - +#pragma once +#include +#include +#include +#include +#include + + +std::unique_ptr createFrame +( + const mof::tstring& text , + const mof::tstring& contentImagePath , + const mof::tstring& titleImagePath , + std::shared_ptr pContentView +); + + + + + + + diff --git a/saisei-1_0/rpg/rpg/widget/createMenuView.cpp b/saisei-1_0/rpg/rpg/widget/createMenuView.cpp index 26db12c..2fa9cbb 100644 --- a/saisei-1_0/rpg/rpg/widget/createMenuView.cpp +++ b/saisei-1_0/rpg/rpg/widget/createMenuView.cpp @@ -1,53 +1,53 @@ -#include "widget/createMenuView.hpp" -#include -#include "widget/HighlightButtonView.hpp" -#include -#include -#include -#include "configure.hpp" -#include "resource.hpp" -#include - -using mof::widget::WidgetView; -using mof::widget::ImageView; - -namespace -{ - std::shared_ptr text_compiler; -} - -mof::FactoryMethod createMenuView(const mof::tstring& text, bool is_disable_item) -{ - //using namespace mof::widget; - - if (text_compiler.get() == NULL) { - text_compiler = std::make_shared - ( - mof::Font(FONT_NAME_UME, FONT_SIZE_STANDARD), - [] (const mof::tstring& path) { return ::getTextureResourceManager(::SYSTEM)->getResource(path);} - ); - - text_compiler->setBehaviorOnColor - ( - mof::widget::AbstractTextCompiler::PAGE_OPEN, - mof::makeConstantHandler(mof::Color4f(1, 1, 1, 1)), - 0 - ); - - text_compiler->setBehaviorOnColor - ( - mof::widget::AbstractTextCompiler::PAGE_CLOSE, - mof::makeConstantHandler(mof::Color4f(1, 1, 1, 1)), - 0 - ); - } - - return mof::makeFactoryMethod - ( - [text]() {return text_compiler->compile_d(text).release();}, - is_disable_item - ); -} - - - +#include "widget/createMenuView.hpp" +#include +#include "widget/HighlightButtonView.hpp" +#include +#include +#include +#include "configure.hpp" +#include "resource.hpp" +#include + +using mof::widget::WidgetView; +using mof::widget::ImageView; + +namespace +{ + std::shared_ptr text_compiler; +} + +mof::FactoryMethod createMenuView(const mof::tstring& text, bool is_disable_item) +{ + //using namespace mof::widget; + + if (text_compiler.get() == NULL) { + text_compiler = std::make_shared + ( + mof::Font(FONT_NAME_UME, FONT_SIZE_STANDARD), + [] (const mof::tstring& path) { return ::getTextureResourceManager(::SYSTEM)->getResource(path);} + ); + + text_compiler->setBehaviorOnColor + ( + mof::widget::AbstractTextCompiler::PAGE_OPEN, + mof::makeConstantHandler(mof::Color4f(1, 1, 1, 1)), + 0 + ); + + text_compiler->setBehaviorOnColor + ( + mof::widget::AbstractTextCompiler::PAGE_CLOSE, + mof::makeConstantHandler(mof::Color4f(1, 1, 1, 1)), + 0 + ); + } + + return mof::makeFactoryMethod + ( + [text]() {return text_compiler->compile_d(text).release();}, + is_disable_item + ); +} + + + diff --git a/saisei-1_0/rpg/rpg/widget/createMenuView.hpp b/saisei-1_0/rpg/rpg/widget/createMenuView.hpp index 5ea62f6..37a4c2f 100644 --- a/saisei-1_0/rpg/rpg/widget/createMenuView.hpp +++ b/saisei-1_0/rpg/rpg/widget/createMenuView.hpp @@ -1,8 +1,8 @@ -#pragma once -#include -#include -#include - -using mof::widget::WidgetView; - -mof::FactoryMethod createMenuView(const mof::tstring& text, bool is_disable_item); +#pragma once +#include +#include +#include + +using mof::widget::WidgetView; + +mof::FactoryMethod createMenuView(const mof::tstring& text, bool is_disable_item);