OSDN Git Service

Boost.MSMでメニュー部分を実装 master
authorsfpgmr <sfpg@users.sourceforge.jp>
Sun, 24 Jun 2012 01:40:02 +0000 (10:40 +0900)
committersfpgmr <sfpg@users.sourceforge.jp>
Sun, 24 Jun 2012 01:40:02 +0000 (10:40 +0900)
21 files changed:
ShootingGame/App.xaml.cpp
ShootingGame/App.xaml.h
ShootingGame/EnvelopeEditorControl.xaml
ShootingGame/GameMain.cpp
ShootingGame/GameMain.h
ShootingGame/GameStateMachine.cpp
ShootingGame/GameStateMachine.h
ShootingGame/MainPage.xaml
ShootingGame/MainPage.xaml.cpp
ShootingGame/MainPage.xaml.h
ShootingGame/MenuPage.xaml [new file with mode: 0644]
ShootingGame/MenuPage.xaml.cpp [new file with mode: 0644]
ShootingGame/MenuPage.xaml.h [new file with mode: 0644]
ShootingGame/ShootingGame.vcxproj
ShootingGame/SoundDriver.cpp
ShootingGame/SoundEditor.h [new file with mode: 0644]
ShootingGame/SoundEditorPage.xaml
ShootingGame/SoundEditorPage.xaml.h
ShootingGame/SoundManager.cpp
ShootingGame/WaveTableSynth.cpp
ShootingGame/pch.h

index 66e0f8f..9edca8e 100644 (file)
@@ -4,7 +4,6 @@
 //
 
 #include "pch.h"
-#include "MainPage.xaml.h"
 #include "App.xaml.h"
 
 using namespace ShootingGame;
@@ -74,19 +73,20 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent
 //  Window::Current->Content = rootFrame;
 //     Window::Current->Activate();
 
+
+  //state_;
+  gameMain_ = ref new GameMain();
+
        // フレームを現在のウィンドウに配置し、アクティブであることを確認します
-       mainPage_ = ref new MainPage();
+       mainPage_ = ref new MainPage(gameMain_);
 
+  gameMain_->Initialize(Window::Current->CoreWindow,mainPage_->SwapChainBackgroundPanel(),DisplayProperties::LogicalDpi);
 
        // Place the frame in the current Window and ensure that it is active
        Window::Current->Content = mainPage_;
        Window::Current->Activated += ref new WindowActivatedEventHandler(this, &App::OnWindowActivationChanged);
        Window::Current->Activate();
 
-  //state_;
-  gameMain_ = ref new GameMain();
-       gameMain_->Initialize(Window::Current->CoreWindow,mainPage_->SwapChainBackgroundPanel(),DisplayProperties::LogicalDpi);
-
        eventToken_ = 
                CompositionTarget::Rendering::add
                (ref new EventHandler<Object^>(this, &App::OnRendering));
index 7ea9cd4..e6e59c0 100644 (file)
@@ -7,8 +7,8 @@
 
 #include "App.g.h"
 #include "MainPage.xaml.h"
-#include "SoundDriver.h"
 #include "GameMain.h"
+#include "SoundDriver.h"
 #include "BasicTimer.h"
 
 namespace ShootingGame
@@ -27,7 +27,7 @@ namespace ShootingGame
       return mainPage_->SwapChainBackgroundPanel();
     }
 
-  private:
+   private:
     MainPage^ mainPage_;
     GameMain^ gameMain_;
     BasicTimer^ timer_;
index 1524afc..4ffaffb 100644 (file)
@@ -8,7 +8,7 @@
     mc:Ignorable="d" Height="212.667" Width="453.667">
     
     <Grid>
-        <Slider HorizontalAlignment="Left" Margin="13.333,13,0,0" VerticalAlignment="Top" Width="310" Height="43" UseLayoutRounding="True" ScrollViewer.VerticalScrollBarVisibility="Auto"/>
+        <Slider HorizontalAlignment="Left" Margin="13.333,13,0,0" VerticalAlignment="Top" Width="310" Height="43" UseLayoutRounding="True" ScrollViewer.VerticalScrollBarVisibility="Auto" Maximum="100" Value="10" Minimum="0"/>
         <Slider HorizontalAlignment="Left" Margin="13.333,61,0,0" VerticalAlignment="Top" Width="310" Height="44"/>
         <Slider HorizontalAlignment="Left" Margin="13.333,110,0,0" VerticalAlignment="Top" Width="310" Height="43"/>
         <Slider HorizontalAlignment="Left" Margin="13.333,158,0,0" VerticalAlignment="Top" Width="310" Height="45.333"/>
index dd63617..91977f8 100644 (file)
@@ -6,40 +6,38 @@
 //// Copyright (c) Microsoft Corporation. All rights reserved
 
 #include "pch.h"
-#include "SoundDriver.h"
+//#include "MainPage.xaml.h"
 #include "GameMain.h"
-#include "windows.ui.xaml.media.dxinterop.h"
-#include "GameStateMachine.h"
 
 using namespace Microsoft::WRL;
-using namespace Windows::Foundation;
-using namespace Windows::Foundation::Collections;
-using namespace Windows::UI::Core;
-using namespace Windows::UI::ViewManagement;
-
-using namespace Windows::UI::ApplicationSettings;
-using namespace Windows::UI::Popups;
-using namespace Windows::UI::Xaml::Controls;
-using namespace Windows::Graphics::Display;
+//using namespace Windows::Foundation;
+//using namespace Windows::Foundation::Collections;
+//using namespace Windows::UI::Core;
+//using namespace Windows::UI::ViewManagement;
+//
+//using namespace Windows::UI::ApplicationSettings;
+//using namespace Windows::UI::Popups;
+//using namespace Windows::UI::Xaml::Controls;
+//using namespace Windows::Graphics::Display;
 using namespace DirectX;
 using namespace D2D1;
 using namespace concurrency;
-
-
 using namespace BasicSprites;
-using namespace boost;
+
 namespace ShootingGame {
+
 const float GameMain::BACKBUFFER_WIDTH = 320.0f;
 const float GameMain::BACKBUFFER_HEIGHT = 240.0f;
 
 
-GameMain::GameMain() : backBufferViewPort_(0.0f,0.0f,BACKBUFFER_WIDTH,BACKBUFFER_HEIGHT) , isDestroy_(true),state_(this)
+GameMain::GameMain() 
+  :backBufferViewPort_(0.0f,0.0f,BACKBUFFER_WIDTH,BACKBUFFER_HEIGHT) , isDestroy_(true),state_(this),
+  eventHolder_(::CreateEventEx(NULL, NULL, 0, EVENT_MODIFY_STATE | SYNCHRONIZE))
 {
-//  GameStateMachine machine;
+  //  GameStateMachine machine;
   soundDriver_.reset(new sf::SoundDriver());
   soundManager_.reset(new sf::SoundManager(*soundDriver_.get()));
-
-
   //soundThread_ = std::thread(
   //   [this]() -> void 
   //  {
@@ -51,7 +49,7 @@ GameMain::GameMain() : backBufferViewPort_(0.0f,0.0f,BACKBUFFER_WIDTH,BACKBUFFER
 GameMain::~GameMain()
 {
   StopSound();
-
+  eventHolder_.reset();
   //if(soundThread_.joinable())
   //{
   //   soundThread_.join();
@@ -536,7 +534,7 @@ float GameMain::RandFloat(float min, float max)
 void GameMain::ExecuteSoundThread()
 {
   //sf::com_init comInit;
-//  InitSound();
+  //  InitSound();
   soundManager_->Sequencer().Play();
   while(!isDestroy_)
   {
@@ -545,6 +543,8 @@ void GameMain::ExecuteSoundThread()
     // soundDriver_->Update();
     // soundDriver_->Render();
   }
+  ::SetEvent(eventHolder_.get());
+  //isDestroy_ = false;
 }
 
 void GameMain::StartSound()
@@ -565,7 +565,7 @@ void GameMain::StopSound()
   // \83T\83E\83\93\83h\8dÄ\90\83X\83\8c\83b\83h\82Ì\92â\8e~
   if(!isDestroy_){
     isDestroy_ = true;
-    soundTask_.wait();
+    WaitForSingleObjectEx(eventHolder_.get(),INFINITE,FALSE);
   }
 }
 
@@ -642,5 +642,6 @@ void GameMain::LoadTexture(const std::wstring& filename,ID3D11Texture2D** texPtr
     );
 }
 
+
 }
 
index bab94ba..ecbb374 100644 (file)
 #include "AutoThrottle.h"
 #include "BasicSprites.h"
 #include "BasicLoader.h"
-#include "SoundManager.h"
 #include "GameStateMachine.h"
+#include "SoundManager.h"
 
 namespace ShootingGame {
-struct CharacterData
-{
-  float2 pos;
-  float2 vel;
-  float rot;
-  float rotVel;
-  float scale;
-};
-
-ref class GameMain : public DirectXBase
-{
-internal:
-  GameMain();
-  ~GameMain();
-  virtual void CreateDeviceIndependentResources() override;
-  virtual void CreateDeviceResources() override;
-  virtual void CreateWindowSizeDependentResources() override;
-  virtual void Render() override;
-
-  void Initialize(
-    _In_ Windows::UI::Core::CoreWindow^ window,
-    _In_ Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ swapChainPanel,
-    _In_ float dpi
-    ) ;
-
-  void Update(float timeTotal, float timeDelta);
-
-  static const float BACKBUFFER_WIDTH;
-  static const float BACKBUFFER_HEIGHT;
-
-  sf::SoundManager& GameMain::SoundManager()
-  {
-    return *soundManager_;
-  }
+  
 
-  sf::SoundDriver& GameMain::SoundDriver()
+  struct CharacterData
   {
-    return *soundDriver_;
-  }
+    float2 pos;
+    float2 vel;
+    float rot;
+    float rotVel;
+    float scale;
+  };
 
-  BasicSprites::SpriteBatch^ GameMain::SpriteBatch()
+//  ref class MainPage;
+  
+  ref class GameMain : public DirectXBase
   {
-    return spriteBatch_;
-  }
-
-  ::AutoThrottle^ GameMain::AutoThrottle() {return autoThrottle_;}
-  ::SampleOverlay^ GameMain::SampleOverlay() {return sampleOverlay_;}
-
-//  void InitSound();
-  float RandFloat(float min, float max);
-  void StartSound();
-  void StopSound();
-  void ClearScreen();
-  void RenderScreen();
-
-  void LoadTexture(const std::wstring& filename,ID3D11Texture2D** texPtrAddr);
-private:
-  GameStateMachine state_;
-  void ExecuteSoundThread();
-  ::SampleOverlay^ sampleOverlay_;
-  ::AutoThrottle^ autoThrottle_;
-  BasicSprites::SpriteBatch^ spriteBatch_;
-  Microsoft::WRL::ComPtr<ID3D11Texture2D> backBuffer_;
-  Microsoft::WRL::ComPtr<ID3D11RenderTargetView>  backBufferRenderTargetView_;
-  //  Microsoft::WRL::ComPtr<ID3D11DepthStencilView>  backBufferDepthStencilView_;
-  //   Microsoft::WRL::ComPtr<ID3D11DepthStencilState> backBufferDepthStencilState_;
-  float scale_;
-  CD3D11_VIEWPORT backBufferViewPort_;
-  CD3D11_VIEWPORT swapChainViewPort_;
-  std::vector<CharacterData> characters_;
-  bool isDestroy_;
-  Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel_;
-  std::unique_ptr<sf::SoundManager> soundManager_;
-  std::unique_ptr<sf::SoundDriver> soundDriver_;
-  //std::thread soundThread_;
-  concurrency::task<void> soundTask_;
-};
+  internal:
+    
+    delegate void SubFrameFuncDelegate(Windows::UI::Xaml::Controls::Page^ p);
+    delegate void IsBackButtonEnabledDelgate(bool v);
+
+    explicit GameMain();
+    ~GameMain();
+    virtual void CreateDeviceIndependentResources() override;
+    virtual void CreateDeviceResources() override;
+    virtual void CreateWindowSizeDependentResources() override;
+    virtual void Render() override;
+
+    void Initialize(
+      _In_ Windows::UI::Core::CoreWindow^ window,
+      _In_ Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ swapChainPanel,
+      _In_ float dpi
+      ) ;
+
+    void Update(float timeTotal, float timeDelta);
+
+    static const float BACKBUFFER_WIDTH;
+    static const float BACKBUFFER_HEIGHT;
+
+    sf::SoundManager& GameMain::SoundManager()
+    {
+      return *soundManager_;
+    }
+
+    sf::SoundDriver& GameMain::SoundDriver()
+    {
+      return *soundDriver_;
+    }
+
+    BasicSprites::SpriteBatch^ GameMain::SpriteBatch()
+    {
+      return spriteBatch_;
+    }
+
+    ::AutoThrottle^ GameMain::AutoThrottle() {return autoThrottle_;}
+    ::SampleOverlay^ GameMain::SampleOverlay() {return sampleOverlay_;}
+
+    //  void InitSound();
+    float RandFloat(float min, float max);
+    void StartSound();
+    void StopSound();
+    void ClearScreen();
+    void RenderScreen();
+
+    void LoadTexture(const std::wstring& filename,ID3D11Texture2D** texPtrAddr);
+
+    void Subframe(Windows::UI::Xaml::Controls::Page^ p)
+    {
+      subFrameFunction_(p);
+    }
+
+    void SetSubFrameFunc(SubFrameFuncDelegate^ func)
+    {
+        subFrameFunction_ = func;
+    }
+
+    ShootingGame::GameStateMachine&  GameMain::GameStateMachine()
+    {
+      return state_;
+    }
+
+    void SetIsBackButtonEnabledDelgate(IsBackButtonEnabledDelgate^ d)
+    {
+      isBackButtonEnabledDelgate_ = d;
+    }
+
+    void IsBackButtonEnabled(bool v)
+    {
+      isBackButtonEnabledDelgate_(v);
+    }
+
+  private:
+//    std::function<void(Windows::UI::Xaml::Controls::Page^ p)> subFrameFunction_;
+    SubFrameFuncDelegate^ subFrameFunction_;
+    IsBackButtonEnabledDelgate^ isBackButtonEnabledDelgate_;
+    ShootingGame::GameStateMachine state_;
+    void ExecuteSoundThread();
+    ::SampleOverlay^ sampleOverlay_;
+    ::AutoThrottle^ autoThrottle_;
+    BasicSprites::SpriteBatch^ spriteBatch_;
+    Microsoft::WRL::ComPtr<ID3D11Texture2D> backBuffer_;
+    Microsoft::WRL::ComPtr<ID3D11RenderTargetView>  backBufferRenderTargetView_;
+    //  Microsoft::WRL::ComPtr<ID3D11DepthStencilView>  backBufferDepthStencilView_;
+    // Microsoft::WRL::ComPtr<ID3D11DepthStencilState> backBufferDepthStencilState_;
+    float scale_;
+    CD3D11_VIEWPORT backBufferViewPort_;
+    CD3D11_VIEWPORT swapChainViewPort_;
+    std::vector<CharacterData> characters_;
+    bool isDestroy_;
+    Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel_;
+    std::unique_ptr<sf::SoundManager> soundManager_;
+    std::unique_ptr<sf::SoundDriver> soundDriver_;
+    concurrency::task<void> soundTask_;
+    sf::handle_holder eventHolder_;
+  };
 }
index 772700b..201f1f9 100644 (file)
@@ -2,13 +2,18 @@
 //#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
 //#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 //or whatever you need                       
 //#define BOOST_MPL_LIMIT_MAP_SIZE 30 //or whatever you need   
+
+//#include "MainPage.xaml.h"
+#include "GameMain.h"
+#include "SoundDriver.h"
+#include "MenuPage.xaml.h"
+
+#pragma hdrstop
+
 #include <boost/msm/back/state_machine.hpp>
 #include <boost/msm/front/state_machine_def.hpp>
 #include <boost/msm/front/functor_row.hpp>
 
-#include "GameStateMachine.h"
-#include "GameMain.h"
-#include "SoundDriver.h"
 
 using namespace Microsoft::WRL;
 using namespace Windows::Foundation;
@@ -18,7 +23,15 @@ using namespace Windows::UI::ViewManagement;
 
 using namespace Windows::UI::ApplicationSettings;
 using namespace Windows::UI::Popups;
+using namespace Windows::UI::Xaml;
 using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Interop;
+using namespace Windows::UI::Xaml::Navigation;
+
 using namespace Windows::Graphics::Display;
 using namespace DirectX;
 using namespace D2D1;
@@ -27,15 +40,17 @@ using namespace concurrency;
 
 using namespace BasicSprites;
 
-namespace msmf =  boost::msm::front;
-namespace msmb =   boost::msm::back;
+namespace msmf = boost::msm::front;
+namespace msmb = boost::msm::back;
+
+#include "SoundEditor.h"
 
 namespace ShootingGame 
 {
 
   namespace State 
   {
-    struct Init : boost::msm::front::state<>
+    struct Init : msmf::state<>
     {
       template <class Event, class Fsm> 
       void on_entry(Event const& e, Fsm& f )
@@ -47,7 +62,7 @@ namespace ShootingGame
       GameMain^ gameMain_;
     };
 
-    struct Title : boost::msm::front::state<> 
+    struct Title : msmf::state<> 
     {
       template <class Event, class Fsm> 
       void on_entry(Event const&, Fsm& ) {};
@@ -55,7 +70,7 @@ namespace ShootingGame
       void on_exit(Event const&, Fsm& ) {};
     };
 
-    struct Demo : boost::msm::front::state<>
+    struct Demo : msmf::state<>
     {
       template <class Event, class Fsm> 
       void on_entry(Event const&, Fsm& ) {};
@@ -63,21 +78,14 @@ namespace ShootingGame
       void on_exit(Event const&, Fsm& ) {};
     };
 
-    struct Menu : boost::msm::front::state<>
-    {
-      template <class Event, class Fsm> 
-      void on_entry(Event const&, Fsm& ) {};
-      template <class Event, class Fsm> 
-      void on_exit(Event const&, Fsm& ) {};
-    };
 
-    struct Running_ : boost::msm::front::state_machine_def<Running_>
+    struct Running_ : msmf::state_machine_def<Running_>
     {
 
       struct Update 
       {
-      template <class Fsm,class Evt,class SourceState,class TargetState> 
-          void operator()(Evt const& e, Fsm& fsm, SourceState&,TargetState& ) 
+        template <class Fsm,class Evt,class SourceState,class TargetState> 
+        void operator()(Evt const& e, Fsm& fsm, SourceState&,TargetState& ) 
         {
 
         }
@@ -85,8 +93,8 @@ namespace ShootingGame
 
       struct Render
       {
-      template <class Fsm,class Evt,class SourceState,class TargetState> 
-          void operator()(Evt const& e, Fsm& fsm, SourceState&,TargetState& ) 
+        template <class Fsm,class Evt,class SourceState,class TargetState> 
+        void operator()(Evt const& e, Fsm& fsm, SourceState&,TargetState& ) 
         {
           ShootingGame::GameMain^ gameMain = fsm.GameMain();
           BasicSprites::SpriteBatch^ spriteBatch = fsm.GameMain()->SpriteBatch();
@@ -148,6 +156,7 @@ namespace ShootingGame
       void on_entry(Event const& evt, Fsm&  fsm) 
       {
         gameMain_ = fsm.GameMain();
+        gameMain_->IsBackButtonEnabled(true);
         gameMain_->StopSound();
         InitSound();
         gameMain_->StartSound();
@@ -155,26 +164,45 @@ namespace ShootingGame
       };
 
       typedef boost::mpl::vector<Action> initial_state;
-      template <class FSM,class Event>
-      void no_transition(Event const& ,FSM&, int state)
-      {
-        BOOST_ASSERT(false);
-      }
+
+      struct Exit : msmf::exit_pseudo_state<msmf::none> {};
 
       template <class Event, class Fsm> 
-      void on_exit(Event const&, Fsm& ) {};
+      void on_exit(Event const& e, Fsm& fsm)
+      { 
+        gameMain_->StopSound();
+        test_.Reset();
+
+        gameMain_->ClearScreen();
+
+        gameMain_->RenderScreen();
+        gameMain_->Present();
+
+        gameMain_->RenderScreen();
+       gameMain_->Present();
+
+      };
+
       struct transition_table 
         : boost::mpl::vector<
         msmf::Row<Action,Event::Update,msmf::none,Update,msmf::none>,
-        msmf::Row<Action,Event::Render,msmf::none,Render,msmf::none>
+        msmf::Row<Action,Event::Render,msmf::none,Render,msmf::none>,
+        msmf::Row<Action,Event::Back,Exit>
         >
       {};
 
+    // No handled event handler
+        template <class Fsm,class Event> 
+        void no_transition(Event const& e, Fsm& ,int state) {
+            std::cout << "No handled event in Sm1 " << typeid(e).name() << " on State " << state << std::endl;
+        }
+
       ShootingGame::GameMain^ Running_::GameMain(){return gameMain_;} 
       ID3D11Texture2D * texture()
       {
         return test_.Get();
       }; 
+
     private:
       void InitSound()
       {
@@ -341,14 +369,69 @@ namespace ShootingGame
 
     typedef boost::msm::back::state_machine<Running_> Running;
 
-    struct SoundEdit : boost::msm::front::state<>
+    // \83\81\83j\83\85\81[\8fó\91Ô
+    struct Menu_ : msmf::state_machine_def<Menu_>
     {
       template <class Event, class Fsm> 
-      void on_entry(Event const&, Fsm& ) {};
+      void on_entry(Event const&, Fsm&  fsm) 
+      {
+        gameMain_ = fsm.GameMain();
+        gameMain_->IsBackButtonEnabled(false);
+      };
+
       template <class Event, class Fsm> 
-      void on_exit(Event const&, Fsm& ) {};
+      void on_exit(Event const&, Fsm& )
+      {
+      };
+
+      // \83A\83C\83h\83\8b\8fó\91Ô
+      struct Idle : msmf::state<> 
+      {
+        template <class Event, class Fsm> 
+        void on_entry(Event const&, Fsm&  fsm) 
+        {
+          gameMain_ = fsm.GameMain();
+          MenuPage^ menuPage_ = ref new MenuPage(gameMain_->GameStateMachine());
+          gameMain_->Subframe(menuPage_);
+          gameMain_->IsBackButtonEnabled(false);
+        }
+
+        template <class Event, class Fsm> 
+        void on_exit(Event const&, Fsm& )
+        {
+          gameMain_->Subframe(nullptr);
+          menuPage_ = nullptr;
+        };
+      private:
+        ShootingGame::GameMain^ gameMain_;
+        MenuPage^ menuPage_;
+      };
+      typedef Idle initial_state;
+
+
+      // \8fó\91Ô\91J\88Ú\83e\81[\83u\83\8b
+      struct transition_table 
+        : boost::mpl::vector<
+        msmf::Row<Idle,Event::PushStart,State::Running>,
+        msmf::Row<State::Running::exit_pt<State::Running_::Exit>,msmf::none,Idle>,
+        msmf::Row<Idle,Event::PushSoundEdit,State::SoundEdit>,
+        msmf::Row<State::SoundEdit::exit_pt<State::SoundEdit_::Exit>,msmf::none,Idle>
+        >
+      {};
+    // No handled event handler
+        template <class Fsm,class Event> 
+        void no_transition(Event const& e, Fsm& ,int state) {
+ //           std::cout << "No handled event in Sm1 " << typeid(e).name() << " on State " << state << std::endl;
+        }
+
+      // \83v\83\8d\83p\83e\83B
+      ShootingGame::GameMain^ Menu_::GameMain(){return gameMain_;} 
+    private:
+      ShootingGame::GameMain^ gameMain_;
     };
 
+    typedef msmb::state_machine<Menu_> Menu;
+
     struct Exit : boost::msm::front::state<>
     {
       template <class Event, class Fsm> 
@@ -370,7 +453,7 @@ namespace ShootingGame
 
     struct transition_table 
       : boost::mpl::vector<
-      msmf::Row<State::Init,Event::Init,State::Running>//,
+      msmf::Row<State::Init,Event::Init,State::Menu>
       //     msmf::Row<State::Running,Event::Update,boost::msm::front::none,State::Running::Update>
       /*      _row<State::Menu,Event::PushStart,State::Running>,
       _row<State::Menu,Event::PushSoundEdit,State::SoundEdit>,
@@ -379,11 +462,10 @@ namespace ShootingGame
       _row<State::SoundEdit,Event::Escape,State::Menu>*/
       >{};
 
-    template <class FSM,class Event>
-    void no_transition(Event const& ,FSM&, int state)
-    {
-     // BOOST_ASSERT(false);
-    }
+    template <class Event, class Fsm> 
+        void no_transition(Event const& e, Fsm& ,int state) {
+ //           std::cout << "No handled event in Sm1 " << typeid(e).name() << " on State " << state << std::endl;
+        }
 
     explicit GameStateMachine_(GameMain^ main) :gameMain_(main)
     {
@@ -444,5 +526,9 @@ namespace ShootingGame
   template void GameStateMachine::ProcessEvent<Event::Init>(Event::Init const &e);
   template void GameStateMachine::ProcessEvent<Event::Update>(Event::Update const &e);
   template void GameStateMachine::ProcessEvent<Event::Render>(Event::Render const &e);
+  template void GameStateMachine::ProcessEvent<Event::PushStart>(Event::PushStart const &e);
+  template void GameStateMachine::ProcessEvent<Event::PushSoundEdit>(Event::PushSoundEdit const &e);
+  template void GameStateMachine::ProcessEvent<Event::Escape>(Event::Escape const &e);
+  template void GameStateMachine::ProcessEvent<Event::Back>(Event::Back const &e);
 
 }
index 354b5d9..2880b5e 100644 (file)
@@ -11,21 +11,19 @@ namespace ShootingGame
     struct Update {};
     struct Render {};
     struct Escape {};
+    struct Back {};
   }
   
   ref class GameMain; 
   
   struct GameStateMachine {
-  private:
-    struct impl;
-  public:
-
     explicit  GameStateMachine(GameMain^ main);
     template <class Event> void ProcessEvent(Event const& e);
     void Start();
     void Stop();
     ~GameStateMachine();
   private:
+    struct impl;
     std::unique_ptr<impl> impl_;
   };
 
index 2633d8d..1dc2fc3 100644 (file)
@@ -9,25 +9,29 @@
     xmlns:common="using:ShootingGame.Common"
 
     mc:Ignorable="d" Foreground="#FFFBF5F5" >
-    <SwapChainBackgroundPanel x:Name="DXSwapChainPanel" >
+    <SwapChainBackgroundPanel x:Name="DXSwapChainPanel" ManipulationMode="None" >
 <Grid x:Name="RouteGrid">
             <Grid.RowDefinitions>
                 <RowDefinition Height="109*"/>
                 <RowDefinition Height="659*"/>
             </Grid.RowDefinitions>
             <Grid Grid.Row="0">
+<Button x:Name="backButton" Style="{StaticResource BackButtonStyle}" Click="backButton_Click" Margin="19,0,0,29"/>
+<UserControl x:Name="SubMenu"/>
+
+
                 
+                                
             <TextBlock HorizontalAlignment="Left" Height="23" Margin="486,24,0,0" TextWrapping="Wrap" Text="処理時間" VerticalAlignment="Top" Width="86" FontSize="20"/>
             <TextBlock x:Name="processTime" HorizontalAlignment="Left" Height="23" Margin="572,24,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="20"/>
             <TextBlock HorizontalAlignment="Left" Height="18" Margin="833,29,0,0" TextWrapping="Wrap" Text="フレームレート" VerticalAlignment="Top" Width="139" FontSize="12"/>
-            <TextBlock x:Name="frameTime" HorizontalAlignment="Left" Height="18" Margin="977,29,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="20"/>
+            <TextBlock x:Name="frameTime" HorizontalAlignment="Left" Height="18" Margin="977,29,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="13.333"/>
             <TextBlock HorizontalAlignment="Left" Height="18" Margin="833,47,0,0" TextWrapping="Wrap" Text="最大" VerticalAlignment="Top" Width="139" FontSize="12"/>
-            <TextBlock x:Name="frameTimeMax" HorizontalAlignment="Left" Height="18" Margin="977,47,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="20"/>
+            <TextBlock x:Name="frameTimeMax" HorizontalAlignment="Left" Height="18" Margin="977,47,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="13.333"/>
             <TextBlock HorizontalAlignment="Left" Height="15" Margin="833,65,0,0" TextWrapping="Wrap" Text="最小" VerticalAlignment="Top" Width="139" FontSize="12"/>
-            <TextBlock x:Name="frameTimeMin" HorizontalAlignment="Left" Height="15" Margin="977,65,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="20"/>
+            <TextBlock x:Name="frameTimeMin" HorizontalAlignment="Left" Height="15" Margin="977,65,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="13.333"/>
             <TextBlock HorizontalAlignment="Left" Height="19" Margin="833,85,0,0" TextWrapping="Wrap" Text="平均" VerticalAlignment="Top" Width="139" FontSize="12"/>
-            <TextBlock x:Name="frameTimeAvg" HorizontalAlignment="Left" Height="19" Margin="977,85,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="12"/>
-<Button Content="Button" HorizontalAlignment="Left" Margin="317,61,0,0" VerticalAlignment="Top" Click="Button_Click_1"/>
+            <TextBlock x:Name="frameTimeAvg" HorizontalAlignment="Left" Height="19" Margin="977,85,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="121" FontSize="13.333"/>
             </Grid>
             <UserControl x:Name="SubContent" Grid.Row="1" />
         </Grid>
index c43d871..695c881 100644 (file)
@@ -4,11 +4,10 @@
 //
 
 #include "pch.h"
+#include "GameMain.h"
 #include "MainPage.xaml.h"
 #include "SoundEditorPage.xaml.h"
 
-using namespace ShootingGame;
-
 using namespace Platform;
 using namespace Windows::Foundation;
 using namespace Windows::Foundation::Collections;
@@ -22,26 +21,54 @@ using namespace Windows::UI::Xaml::Interop;
 using namespace Windows::UI::Xaml::Navigation;
 
 // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
+namespace ShootingGame
+{
+
 
-MainPage::MainPage()
+MainPage::MainPage(GameMain^ g) : gameMain_(g)
 {
   InitializeComponent();
+  //std::function<void (Windows::UI::Xaml::Controls::Page^ )> f(std::bind(&MainPage::Subframe,this,std::placeholders::_1));
+  gameMain_->SetSubFrameFunc(ref new GameMain::SubFrameFuncDelegate(this,&MainPage::Subframe));
+  gameMain_->SetIsBackButtonEnabledDelgate( ref new GameMain::IsBackButtonEnabledDelgate
+  (
+    [this](bool v)
+    {
+      backButton->IsEnabled = v;
+    }
+  )
+  );
+}
 
-  hiddenFrame_ = ref new Windows::UI::Xaml::Controls::Frame();
-  hiddenFrame_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
-  RouteGrid->Children->Append(hiddenFrame_);
-  TypeName t = {ref new String(L"ShootingGame.SoundEditorPage"),TypeKind::Custom};
-  if(!hiddenFrame_->Navigate(t,this))
+void MainPage::Subframe(Windows::UI::Xaml::Controls::Page^ p)
+{
+  if(p != nullptr)
   {
-    throw ref new FailureException(ref new String(L"サウンドエディタに切り替えできませんでした。"));
-  };
-
-  Page^ hiddenPage = safe_cast<Page^>(hiddenFrame_->Content);
-  UIElement^ content = hiddenPage->Content;
-  hiddenPage->Content = nullptr;
-  SubContent->Content =  content;
+   // hiddenFrame_->
+     UIElement^ content = p->Content; 
+     p->Content = nullptr;
+     SubContent->Content = content;
+  } else {
+     SubContent->Content = nullptr;
+  }
 }
 
+//UIElement^ MainPage::NavigateSubframe(Windows::UI::Xaml::Interop::TypeName typeName)
+//{
+//  if(!hiddenFrame_->Navigate(typeName,this))
+//  {
+//    throw ref new FailureException(ref new String(L"切り替えできませんでした。"));
+//  };
+//
+//  Page^ hiddenPage = safe_cast<Page^>(hiddenFrame_->Content);
+//  UIElement^ content = hiddenPage->Content;
+//  hiddenPage->Content = nullptr;
+//  SubContent->Content =  content;
+//  return  content;
+//;
+//}
+
+
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
@@ -66,28 +93,38 @@ void MainPage::UpdateFrameTime(float delta,float max,float min,float avg)
 }
 
 
-void ShootingGame::MainPage::Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
-{
-  //TypeName t = {ref new String(L"ShootingGame.SoundEditorPage"),TypeKind::Custom};
-  // if(!hiddenFrame_->Navigate(t,this))
-  // {
-  //   throw ref new FailureException(ref new String(L"サウンドエディタに切り替えできませんでした。"));
-  // };
-
-  //  Page^ hiddenPage = safe_cast<Page^>(hiddenFrame_->Content);
-  //  UIElement^ content = hiddenPage->Content;
-  //  hiddenPage->Content = nullptr;
-  //  SubContent->Content =  content;
-
-  //Grid^ grid = safe_cast<Grid^>(hiddenPage->FindName(L"LayoutRoot"));
-  //if(grid != nullptr){
-  //// Get each element.
-  //UIElement^ c = safe_cast<UIElement^>(grid->FindName(L"Editor"));
-  //UIElementCollection^ collection = grid->Children;
-  //unsigned int  index;
-  //collection->IndexOf(c, &index);
-  //collection->RemoveAt(index);
-  //SubContent->Content =  c;
-  //}
+//void ShootingGame::MainPage::Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
+//{
+//  //TypeName t = {ref new String(L"ShootingGame.SoundEditorPage"),TypeKind::Custom};
+//  // if(!hiddenFrame_->Navigate(t,this))
+//  // {
+//  //   throw ref new FailureException(ref new String(L"サウンドエディタに切り替えできませんでした。"));
+//  // };
+//
+//  //  Page^ hiddenPage = safe_cast<Page^>(hiddenFrame_->Content);
+//  //  UIElement^ content = hiddenPage->Content;
+//  //  hiddenPage->Content = nullptr;
+//  //  SubContent->Content =  content;
+//
+//  //Grid^ grid = safe_cast<Grid^>(hiddenPage->FindName(L"LayoutRoot"));
+//  //if(grid != nullptr){
+//  //// Get each element.
+//  //UIElement^ c = safe_cast<UIElement^>(grid->FindName(L"Editor"));
+//  //UIElementCollection^ collection = grid->Children;
+//  //unsigned int  index;
+//  //collection->IndexOf(c, &index);
+//  //collection->RemoveAt(index);
+//  //SubContent->Content =  c;
+//  //}
+//
+//} 
 
-} 
+//void MainPage::GameMain(ShootingGame::GameMain^  p){gameMain_ = p;}
+//
+//ShootingGame::GameMain^ MainPage::GameMain(){return gameMain_; }
+//
+void ShootingGame::MainPage::backButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
+{
+   gameMain_->GameStateMachine().ProcessEvent(Event::Back());
+}
+}
\ No newline at end of file
index 143c1bc..907204e 100644 (file)
@@ -5,28 +5,30 @@
 
 #pragma once
 #include "Common\LayoutAwarePage.h"
+#include "GameMain.h"
 #include "MainPage.g.h"
 
 namespace ShootingGame
 {
-       /// <summary>
-       /// An empty page that can be used on its own or navigated to within a Frame.
-       /// </summary>
-       public ref class MainPage sealed
-       {
-       public:
-               MainPage();
+
+  /// <summary>
+  /// An empty page that can be used on its own or navigated to within a Frame.
+  /// </summary>
+  public ref class MainPage
+  {
+  internal:
+    MainPage(GameMain^ g);
     Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ MainPage::SwapChainBackgroundPanel()
     {
       return DXSwapChainPanel;
     }
-               void UpdateProcessTime(float delta);
-               void UpdateFrameTime(float delta,float max,float min,float avg);
-
-       protected:
-               virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
+    void UpdateProcessTime(float delta);
+    void UpdateFrameTime(float delta,float max,float min,float avg);
+    void Subframe(Windows::UI::Xaml::Controls::Page^ p);
+  protected:
+    virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
   private:
-    Windows::UI::Xaml::Controls::Frame^ hiddenFrame_;
-    void Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+    void backButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+    GameMain^ gameMain_;
   };
 }
diff --git a/ShootingGame/MenuPage.xaml b/ShootingGame/MenuPage.xaml
new file mode 100644 (file)
index 0000000..06dc7e0
--- /dev/null
@@ -0,0 +1,30 @@
+<common:LayoutAwarePage
+    x:Name="pageRoot"
+    x:Class="ShootingGame.MenuPage"
+    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
+    IsTabStop="false"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:local="using:ShootingGame"
+    xmlns:common="using:ShootingGame.Common"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d">
+
+    <Page.Resources>
+
+        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
+        <x:String x:Key="AppName">My Application</x:String>
+    </Page.Resources>
+    <Grid HorizontalAlignment="Left" Height="768" VerticalAlignment="Top" Width="1366">
+        <Button x:Name="StartButton" Content="ゲーム開始" HorizontalAlignment="Center" Height="75" Margin="470,220,464,473" VerticalAlignment="Center" Width="432" Click="Button_Click_2" FontSize="24"/>
+        <Button x:Name="EditSoundButton" Content="サウンド編集" HorizontalAlignment="Center" Height="75" Margin="470,316,464,377" VerticalAlignment="Center" Width="432" FontSize="24" Click="EditSoundButton_Click"/>
+        <Button x:Name="EditPosition" Content="配置エディタ" HorizontalAlignment="Center" Height="75" Margin="470,412,464,281" VerticalAlignment="Center" Width="432" FontSize="24"/>
+    </Grid>
+
+    <!--
+        This grid acts as a root panel for the page that defines two rows:
+        * Row 0 contains the back button and page title
+        * Row 1 contains the rest of the page layout
+    -->
+</common:LayoutAwarePage>
diff --git a/ShootingGame/MenuPage.xaml.cpp b/ShootingGame/MenuPage.xaml.cpp
new file mode 100644 (file)
index 0000000..197be4e
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// MenuPage.xaml.cpp
+// Implementation of the MenuPage class
+//
+
+#include "pch.h"
+#include "MenuPage.xaml.h"
+
+using namespace ShootingGame;
+
+using namespace Platform;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+using namespace Windows::UI::Xaml;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Navigation;
+
+// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234237
+
+MenuPage::MenuPage(GameStateMachine& g) : gameStateMachine_(g)
+{
+       InitializeComponent();
+}
+
+/// <summary>
+/// Populates the page with content passed during navigation.  Any saved state is also
+/// provided when recreating a page from a prior session.
+/// </summary>
+/// <param name="navigationParameter">The parameter value passed to
+/// <see cref="Frame::Navigate(Type, Object)"/> when this page was initially requested.
+/// </param>
+/// <param name="pageState">A map of state preserved by this page during an earlier
+/// session.  This will be null the first time a page is visited.</param>
+void MenuPage::LoadState(Object^ navigationParameter, IMap<String^, Object^>^ pageState)
+{
+       (void) navigationParameter;     // Unused parameter
+       (void) pageState;       // Unused parameter
+}
+
+/// <summary>
+/// Preserves state associated with this page in case the application is suspended or the
+/// page is discarded from the navigation cache.  Values must conform to the serialization
+/// requirements of <see cref="SuspensionManager::SessionState"/>.
+/// </summary>
+/// <param name="pageState">An empty map to be populated with serializable state.</param>
+void MenuPage::SaveState(IMap<String^, Object^>^ pageState)
+{
+       (void) pageState;       // Unused parameter
+}
+
+
+void ShootingGame::MenuPage::Button_Click_2(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
+{
+  gameStateMachine_.ProcessEvent(Event::PushStart());
+}
+
+
+void ShootingGame::MenuPage::Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
+{
+
+}
+
+
+void ShootingGame::MenuPage::EditSoundButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
+{
+  gameStateMachine_.ProcessEvent(Event::PushSoundEdit());
+
+}
diff --git a/ShootingGame/MenuPage.xaml.h b/ShootingGame/MenuPage.xaml.h
new file mode 100644 (file)
index 0000000..828c1f0
--- /dev/null
@@ -0,0 +1,31 @@
+//
+// MenuPage.xaml.h
+// Declaration of the MenuPage class
+//
+
+#pragma once
+#include "Common\LayoutAwarePage.h" // Required by generated header
+#include "MainPage.xaml.h"
+#include "GameMain.h"
+#include "MenuPage.g.h"
+
+namespace ShootingGame
+{
+       /// <summary>
+       /// A basic page that provides characteristics common to most applications.
+       /// </summary>
+       public ref class MenuPage sealed
+       {
+  internal:
+               explicit MenuPage(GameStateMachine& g);
+       protected:
+               virtual void LoadState(Platform::Object^ navigationParameter,
+                       Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
+               virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
+  private:
+    GameStateMachine& gameStateMachine_;
+    void Button_Click_2(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+    void Button_Click_1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+    void EditSoundButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+  };
+}
index 2368d56..21a11af 100644 (file)
     <ClInclude Include="exception.h" />
     <ClInclude Include="GameMain.h" />
     <ClInclude Include=".\GameStateMachine.h" />
+    <ClInclude Include="MenuPage.xaml.h">
+      <DependentUpon>MenuPage.xaml</DependentUpon>
+    </ClInclude>
     <ClInclude Include="pch.h" />
     <ClInclude Include="App.xaml.h">
       <DependentUpon>App.xaml</DependentUpon>
     <ClInclude Include="sf_com.h" />
     <ClInclude Include="sf_memory.h" />
     <ClInclude Include="SoundDriver.h" />
+    <ClInclude Include="SoundEditor.h" />
     <ClInclude Include="SoundEditorPage.xaml.h">
       <DependentUpon>SoundEditorPage.xaml</DependentUpon>
     </ClInclude>
     <Page Include="MainPage.xaml">
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="MenuPage.xaml">
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="SoundEditorPage.xaml">
       <SubType>Designer</SubType>
     </Page>
     <ClCompile Include="MainPage.xaml.cpp">
       <DependentUpon>MainPage.xaml</DependentUpon>
     </ClCompile>
+    <ClCompile Include="MenuPage.xaml.cpp">
+      <DependentUpon>MenuPage.xaml</DependentUpon>
+    </ClCompile>
     <ClCompile Include="pch.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
index a31b028..12a23c6 100644 (file)
@@ -10,7 +10,7 @@ using namespace Concurrency;
 using namespace Platform;
 #pragma comment(lib, "mmdevapi.lib")
 
-using namespace std::placeholders;
+namespace stps = std::placeholders;
 using namespace Microsoft::WRL;
 
 namespace {
@@ -107,7 +107,7 @@ namespace sf {
     //    : public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler > 
   {
 
-    impl() : bufferIndex_(0),eventHolder_(nullptr),processBuffer_(std::bind(&SoundDriver::impl::DefaultProcessBuffer,this,_1,_2)),isStart_(false)
+    impl() : bufferIndex_(0),eventHolder_(nullptr),processBuffer_(std::bind(&SoundDriver::impl::DefaultProcessBuffer,this,stps::_1,stps::_2)),isStart_(false)
     {
       //::AvMMAvSetMmThreadCharacteristics
       String^ deviceID = MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Default);
@@ -265,7 +265,7 @@ namespace sf {
     void ResetProcessBufferFunc()
     {
       Stop();
-      processBuffer_ = std::move(std::bind(&SoundDriver::impl::DefaultProcessBuffer,this,_1,_2));
+      processBuffer_ = std::move(std::bind(&SoundDriver::impl::DefaultProcessBuffer,this,stps::_1,stps::_2));
       Start();
     }
 
diff --git a/ShootingGame/SoundEditor.h b/ShootingGame/SoundEditor.h
new file mode 100644 (file)
index 0000000..4b2bd30
--- /dev/null
@@ -0,0 +1,72 @@
+#pragma once
+
+#include "SoundEditorPage.xaml.h"
+
+namespace ShootingGame 
+{
+  namespace State {
+    struct SoundEdit_ : msmf::state_machine_def<SoundEdit_>
+    {
+      template <class Event, class Fsm> 
+      void on_entry(Event const&, Fsm&  fsm) 
+      {
+        gameMain_ = fsm.GameMain();
+      };
+
+      template <class Event, class Fsm> 
+      void on_exit(Event const&, Fsm& )
+      {
+
+      };
+
+      // \8fI\97¹\8fó\91Ô
+      struct Exit : msmf::exit_pseudo_state<msmf::none> {};
+
+      // \83A\83C\83h\83\8b\8fó\91Ô
+      struct Idle : msmf::state<> 
+      {
+        template <class Event, class Fsm> 
+        void on_entry(Event const&, Fsm&  fsm) 
+        {
+          gameMain_ = fsm.GameMain();
+          SoundEditorPage^ page_ = ref new SoundEditorPage();
+          gameMain_->Subframe(page_);
+          gameMain_->IsBackButtonEnabled(true);
+        }
+
+        template <class Event, class Fsm> 
+        void on_exit(Event const&, Fsm& )
+        {
+          gameMain_->Subframe(nullptr);
+          page_ = nullptr;
+        };
+      private:
+        ShootingGame::GameMain^ gameMain_;
+        SoundEditorPage^ page_;
+      };
+
+      typedef boost::mpl::vector<Idle> initial_state;
+
+      // \8fó\91Ô\91J\88Ú\83e\81[\83u\83\8b
+      struct transition_table 
+        : boost::mpl::vector<
+        msmf::Row<Idle,Event::Back,Exit>
+        >
+      {};
+
+      // No handled event handler
+      template <class Fsm,class Event> 
+      void no_transition(Event const& e, Fsm& ,int state)
+      {
+        //           std::cout << "No handled event in Sm1 " << typeid(e).name() << " on State " << state << std::endl;
+      }
+
+      // \83v\83\8d\83p\83e\83B
+      ShootingGame::GameMain^ SoundEdit_::GameMain(){return gameMain_;} 
+    private:
+      ShootingGame::GameMain^ gameMain_;  };
+
+    typedef msmb::state_machine<SoundEdit_> SoundEdit;
+
+  }
+}
\ No newline at end of file
index 5720aa9..1db5ee9 100644 (file)
@@ -26,6 +26,7 @@
 <Grid x:Name="LayoutRoot" >
 <local:EnvelopeEditorControl Margin="10,10.5,902,546.052" Height="Auto" Width="Auto"/>
             <TextBlock HorizontalAlignment="Left" Height="90" Margin="697.956,31.955,0,0" TextWrapping="Wrap" Text="Sound Editor Page" VerticalAlignment="Top" Width="221"/>
+        <Slider HorizontalAlignment="Left" Margin="551,185,0,0" VerticalAlignment="Top" Width="511"/>
 
         <VisualStateManager.VisualStateGroups>
 
index 615ab7c..b3f819f 100644 (file)
@@ -20,7 +20,7 @@ namespace ShootingGame
 
        protected:
                virtual void LoadState(Platform::Object^ navigationParameter,
-                       Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
-               virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override;
+                       Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) ;
+               virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) ;
        };
 }
index 2bef127..bdd6b1c 100644 (file)
@@ -1,13 +1,14 @@
 #include "pch.h"
 #include "SoundManager.h"
-using namespace std::placeholders;
+
+namespace stps = std::placeholders;
 
 namespace sf {
 SoundManager::SoundManager(SoundDriver& driver) : driver_(driver),synth_(driver_.Format()),sequencer_(synth_,driver_.Format())
 {
     sequencer_.Tempo(150.0f);
     TestSong song(sequencer_.SequenceTracks());
-    driver_.SetProcessBufferFunc(std::bind(&SoundManager::ProcessBuffer,this,_1,_2));
+    driver_.SetProcessBufferFunc(std::bind(&SoundManager::ProcessBuffer,this,stps::_1,stps::_2));
 }
 
 void SoundManager::ProcessBuffer(boost::shared_array<float> arr,int bufferSize)
index 95a81ef..175fd34 100644 (file)
@@ -2,7 +2,7 @@
 //#include "xbyak\xbyak.h"
 #include "WaveTableSynth.h"
 
-using namespace std::placeholders;
+namespace stps = std::placeholders;
 
 namespace sf {
 
@@ -42,9 +42,9 @@ namespace sf {
     waveTable_ = p;
     if(waveTable_->stereo)
     {
-      processor_ = std::bind(&sf::Synthesizer::WaveTableOscillator::ProcessStereo,this,_1,_2,_3);
+      processor_ = std::bind(&sf::Synthesizer::WaveTableOscillator::ProcessStereo,this,stps::_1,stps::_2,stps::_3);
     } else {
-      processor_ = std::bind(&sf::Synthesizer::WaveTableOscillator::ProcessMono,this,_1,_2,_3);
+      processor_ = std::bind(&sf::Synthesizer::WaveTableOscillator::ProcessMono,this,stps::_1,stps::_2,stps::_3);
     }
 
   }
index 6b43051..65180f8 100644 (file)
@@ -52,4 +52,6 @@
 #include "sf_com.h"
 #include "sf_memory.h"
 #define COMPTR_TYPEDEF(x) typedef Microsoft::WRL::ComPtr<x> x## Ptr
+#include "windows.ui.xaml.media.dxinterop.h"
+