OSDN Git Service

最初のコミット。
authorSFPGMR <sfpg@git.sourceforge.jp>
Tue, 7 Dec 2010 07:16:45 +0000 (16:16 +0900)
committerSFPGMR <sfpg@git.sourceforge.jp>
Tue, 7 Dec 2010 07:16:45 +0000 (16:16 +0900)
17 files changed:
win64/exception.cpp [new file with mode: 0644]
win64/exception.h [new file with mode: 0644]
win64/message_loop.cpp [new file with mode: 0644]
win64/message_loop.h [new file with mode: 0644]
win64/sf_com.cpp [new file with mode: 0644]
win64/sf_com.h [new file with mode: 0644]
win64/sf_memory.h [new file with mode: 0644]
win64/sf_windows.cpp [new file with mode: 0644]
win64/sf_windows.h [new file with mode: 0644]
win64/singleton.h [new file with mode: 0644]
win64/stdafx.cpp [new file with mode: 0644]
win64/stdafx.h [new file with mode: 0644]
win64/undo_redo.h [new file with mode: 0644]
win64/win64.vcxproj [new file with mode: 0644]
win64/win64.vcxproj.filters [new file with mode: 0644]
win64/win64.vcxproj.user [new file with mode: 0644]
win64/winmain.cpp [new file with mode: 0644]

diff --git a/win64/exception.cpp b/win64/exception.cpp
new file mode 100644 (file)
index 0000000..1451fe4
--- /dev/null
@@ -0,0 +1,88 @@
+#include "stdafx.h"
+#include "exception.h"
+#include <objbase.h>
+#include <wtypes.h>
+#include <winerror.h>
+#include <avrt.h>
+#include <strsafe.h>
+#include <audioclient.h>
+#include <audiopolicy.h>
+
+
+
+#define BOOST_ASSIGN_MAX_PARAMS 7
+#include <boost/assign.hpp>
+#include <boost/assign/ptr_list_of.hpp>
+#include <boost/assign/ptr_list_inserter.hpp>
+#include <boost/foreach.hpp>
+#include "sf_memory.h"
+
+using namespace boost;
+
+namespace sf
+{
+//typedef CComPtr<IAudioClient> IAudioClientPtr;
+std::map<HRESULT,std::wstring> com_error_  = boost::assign::list_of<std::pair<HRESULT,std::wstring> >
+    (E_POINTER,L"E_POINTER")
+    (E_INVALIDARG,L"E_INVALIDARG")
+    (DWRITE_E_FILEFORMAT,L"DWRITE_E_FILEFORMAT")
+    (DWRITE_E_UNEXPECTED,L"DWRITE_E_UNEXPECTED")
+    (DWRITE_E_NOFONT,L"DWRITE_E_NOFONT")
+    (DWRITE_E_FILENOTFOUND,L"DWRITE_E_FILENOTFOUND")
+    (DWRITE_E_FILEACCESS,L"DWRITE_E_FILEACCESS")
+    (DWRITE_E_FONTCOLLECTIONOBSOLETE,L"DWRITE_E_FONTCOLLECTIONOBSOLETE")
+    (DWRITE_E_ALREADYREGISTERED,L"DWRITE_E_ALREADYREGISTERED")
+       (AUDCLNT_E_NOT_INITIALIZED,L"AUDCLNT_E_NOT_INITIALIZED")
+       (AUDCLNT_E_ALREADY_INITIALIZED,L"AUDCLNT_E_ALREADY_INITIALIZED")
+    (AUDCLNT_E_WRONG_ENDPOINT_TYPE,L"AUDCLNT_E_WRONG_ENDPOINT_TYPE")
+       (AUDCLNT_E_DEVICE_INVALIDATED,L"AUDCLNT_E_DEVICE_INVALIDATED")
+       (AUDCLNT_E_NOT_STOPPED,L"AUDCLNT_E_NOT_STOPPED")
+       (AUDCLNT_E_BUFFER_TOO_LARGE,L"AUDCLNT_E_BUFFER_TOO_LARGE")
+       (AUDCLNT_E_OUT_OF_ORDER,L"AUDCLNT_E_OUT_OF_ORDER")
+       (AUDCLNT_E_UNSUPPORTED_FORMAT,L"AUDCLNT_E_UNSUPPORTED_FORMAT")
+       (AUDCLNT_E_INVALID_SIZE,L"AUDCLNT_E_INVALID_SIZE")
+       (AUDCLNT_E_DEVICE_IN_USE,L"AUDCLNT_E_DEVICE_IN_USE")
+       (AUDCLNT_E_BUFFER_OPERATION_PENDING,L"AUDCLNT_E_BUFFER_OPERATION_PENDING")
+       (AUDCLNT_E_THREAD_NOT_REGISTERED,L"AUDCLNT_E_THREAD_NOT_REGISTERED")
+       (AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED,L"AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED")
+       (AUDCLNT_E_ENDPOINT_CREATE_FAILED,L"AUDCLNT_E_ENDPOINT_CREATE_FAILED")
+       (AUDCLNT_E_SERVICE_NOT_RUNNING,L"AUDCLNT_E_SERVICE_NOT_RUNNING")
+       (AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED,L"AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED")
+       (AUDCLNT_E_EXCLUSIVE_MODE_ONLY,L"AUDCLNT_E_EXCLUSIVE_MODE_ONLY")
+       (AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL,L"AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL")
+       (AUDCLNT_E_EVENTHANDLE_NOT_SET,L"AUDCLNT_E_EVENTHANDLE_NOT_SET")
+       (AUDCLNT_E_INCORRECT_BUFFER_SIZE,L"AUDCLNT_E_INCORRECT_BUFFER_SIZE")
+       (AUDCLNT_E_BUFFER_SIZE_ERROR,L"AUDCLNT_E_BUFFER_SIZE_ERROR")
+       (AUDCLNT_S_BUFFER_EMPTY,L"AUDCLNT_S_BUFFER_EMPTY")
+       (AUDCLNT_S_THREAD_ALREADY_REGISTERED,L"AUDCLNT_S_THREAD_ALREADY_REGISTERED");
+       
+
+win32_error_exception::win32_error_exception(boost::uint32_t hr)
+: std::exception("HRESULT ERROR"),hresult_(hr)
+{
+       local_memory<wchar_t> mem;
+       DWORD result = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,0,hr,0,(LPWSTR)&mem,0,0);
+       if(result != 0){
+               error_ = mem.get();
+       } else {
+               std::map<HRESULT,std::wstring>::iterator it = com_error_.find(hr);
+               if(it != com_error_.end())
+               {
+                       error_ = it->second;
+               } else {
+                       error_ = (boost::wformat(L"0x%x \95s\96¾\82ÈCOM\83G\83\89\81[") % hr).str();
+               }
+
+       }
+};
+
+win32_error_exception::win32_error_exception()
+{
+       hresult_ = ::GetLastError();
+       local_memory<wchar_t> mem;
+       DWORD rv =  FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,0,hresult_,0,(LPWSTR)&mem,0,0);
+       error_ = mem.get();
+       //Logger::outputDebugPrintf(L"Win32 Error %x %s",hresult_,mem.Get() );
+};
+
+}
\ No newline at end of file
diff --git a/win64/exception.h b/win64/exception.h
new file mode 100644 (file)
index 0000000..db8b405
--- /dev/null
@@ -0,0 +1,34 @@
+#pragma once
+
+namespace sf
+{
+///Exception
+       class exception : public std::exception
+       {
+       public:
+               explicit exception(const std::wstring& reason)
+               {
+                       m_reason = reason;
+               };
+               const wchar_t * what() {return m_reason.c_str();};
+               const std::wstring& what_str() { return m_reason;};
+       protected:
+               std::wstring m_reason;
+       };
+
+       class win32_error_exception : std::exception 
+       {
+       public:
+               win32_error_exception(boost::uint32_t hr);
+               win32_error_exception();
+
+               virtual ~win32_error_exception() {};
+               boost::uint32_t hresult() {return hresult_;}
+               std::wstring& error() {return error_;}
+       private:
+               boost::uint32_t hresult_;
+               std::wstring error_;
+       };
+
+
+}
\ No newline at end of file
diff --git a/win64/message_loop.cpp b/win64/message_loop.cpp
new file mode 100644 (file)
index 0000000..480f396
--- /dev/null
@@ -0,0 +1,6 @@
+#include "stdafx.h"
+#include "message_loop.h"
+
+namespace sf {
+
+}
diff --git a/win64/message_loop.h b/win64/message_loop.h
new file mode 100644 (file)
index 0000000..003b174
--- /dev/null
@@ -0,0 +1,70 @@
+#pragma once
+/*
+  ==============================================================================
+
+   This file is part of the S.F.Tracker
+   Copyright 2005-7 by Satoshi Fujiwara.
+
+   S.F.Tracker can be redistributed and/or modified under the terms of the
+   GNU General Public License, as published by the Free Software Foundation;
+   either version 2 of the License, or (at your option) any later version.
+
+   S.F.Tracker is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with S.F.Tracker; if not, visit www.gnu.org/licenses or write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
+   Boston, MA 02111-1307 USA
+
+  ==============================================================================
+*/
+/** @file
+ *  @brief 
+ *  @author S.F. (Satoshi Fujiwara)
+ */
+namespace sf {
+       struct run_message_loop
+       {
+               run_message_loop(){};
+               inline WPARAM operator()()
+               {
+                       MSG msg;
+                       while (GetMessage(&msg, NULL, 0, 0))
+                       {
+                               TranslateMessage(&msg);
+                               DispatchMessage(&msg);
+                       }
+      return msg.wParam;
+               }
+
+               ~run_message_loop(void){};
+       };
+
+       struct peek_message_loop
+       {
+               typedef boost::function<void ()> func_type;
+               explicit peek_message_loop(func_type func)  {func_ =  func;};
+               inline WPARAM operator()()
+               {
+                       MSG msg = {0};
+                       while( WM_QUIT != msg.message )
+                       {
+                               if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
+                               {
+                                       TranslateMessage( &msg );
+                                       DispatchMessage( &msg );
+                               }
+                               else
+                               {
+                                       func_();  // Do some rendering
+                               }
+                       }
+      return msg.wParam;
+               };
+       private:
+               func_type func_;
+       };
+}
diff --git a/win64/sf_com.cpp b/win64/sf_com.cpp
new file mode 100644 (file)
index 0000000..09bdee7
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+  ==============================================================================
+
+   This file is part of the S.F.Tracker
+   Copyright 2005-7 by Satoshi Fujiwara.
+
+   S.F.Tracker can be redistributed and/or modified under the terms of the
+   GNU General Public License, as published by the Free Software Foundation;
+   either version 2 of the License, or (at your option) any later version.
+
+   S.F.Tracker is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with S.F.Tracker; if not, visit www.gnu.org/licenses or write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
+   Boston, MA 02111-1307 USA
+
+  ==============================================================================
+*/
+/** @file
+ *  @brief util
+ *  @author S.F. (Satoshi Fujiwara)
+ */
+
+#include "stdafx.h"
+#include <objbase.h>
+#include "sf_com.h"
+namespace sf {
+
+    struct com_initialize::impl
+    {
+               impl(void * reserved,unsigned int init) : hr(::CoInitializeEx(reserved,init))
+        {
+        }
+
+        ~impl()
+        {
+                       if(hr == S_OK){
+                   ::CoUninitialize();
+                       }
+        }
+       private:
+               HRESULT hr;
+    };
+
+    com_initialize::com_initialize(void * reserved,unsigned int  init)
+        : m_impl(new com_initialize::impl(reserved,init))
+    {
+    };
+
+       //template <typename ComClass,typename ComInterface> boost::intrusive_ptr<ComInterface> com_creator<ComClass,ComInterface>::create_instance()
+       //{
+       //      ComClass * com_ptr;
+       //      CoCreateInstance( __uuidof(ComClass), NULL,
+       //                       CLSCTX_ALL, __uuidof(ComInterface),
+       //                       (void**)&com_ptr);
+       //      return instrusive_ptr<ComClass>(com_ptr,false);
+       //};
+
+
+}
\ No newline at end of file
diff --git a/win64/sf_com.h b/win64/sf_com.h
new file mode 100644 (file)
index 0000000..d32b7d3
--- /dev/null
@@ -0,0 +1,100 @@
+#pragma once
+/*
+  ==============================================================================
+
+   This file is part of the Shooting3
+   Copyright 2005-7 by Satoshi Fujiwara.
+
+   S.F.Tracker can be redistributed and/or modified under the terms of the
+   GNU General Public License, as published by the Free Software Foundation;
+   either version 2 of the License, or (at your option) any later version.
+
+   S.F.Tracker is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with S.F.Tracker; if not, visit www.gnu.org/licenses or write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
+   Boston, MA 02111-1307 USA
+
+  ==============================================================================
+*/
+/** @file
+ *  @brief util
+ *  @author S.F. (Satoshi Fujiwara)
+ */
+#include "objbase.h"
+namespace sf 
+{
+    enum com_init 
+    {
+        multi_threaded  = 0x0,
+        apartment_threaded = 0x2,
+        disable_ole1dde   = 0x4,
+        speed_over_memory = 0x8
+    };
+
+    struct com_initialize
+    {
+        struct impl;
+        com_initialize(void * reserved = NULL,unsigned int init = multi_threaded);
+        ~com_initialize() {};
+    private:
+        boost::shared_ptr<impl> m_impl;
+    };
+
+       template <typename ComClass,typename ComInterface> 
+                 boost::intrusive_ptr<ComInterface> create_instance()
+                 {
+                       ComInterface * com_ptr;
+                       CoCreateInstance( __uuidof(ComClass), NULL,
+                                        CLSCTX_ALL, __uuidof(ComInterface),
+                                        (void**)&com_ptr);
+                       return boost::intrusive_ptr<ComInterface>(com_ptr,false);
+
+                 };
+                       template <typename COMInterface> 
+               struct IUnknownImpl : public COMInterface 
+               {
+                       IUnknownImpl() : ref_(1) {}; 
+                       virtual ~IUnknownImpl() {};
+                       ULONG __stdcall AddRef()
+                       {
+                               return InterlockedIncrement(&ref_);
+                       }
+
+                       ULONG __stdcall Release()
+                       {
+                               ULONG ref = InterlockedDecrement(&ref_);
+                               if (0 == ref)
+                               {
+                                       delete this;
+                               }
+                               return ref;
+                       }
+
+                       HRESULT __stdcall QueryInterface(REFIID riid, VOID **ppObj)
+                       {
+                               if (IID_IUnknown == riid)
+                               {
+                                       AddRef();
+                                       *ppObj = (IUnknown*)this;
+                               }
+                               else if (__uuidof(COMInterface) == riid)
+                               {
+                                       AddRef();
+                                       *ppObj = (COMInterface*)this;
+                               }
+                               else
+                               {
+                                       *ppObj = NULL;
+                                       return E_NOINTERFACE;
+                               }
+                               return S_OK;
+                       }
+               private:
+                       LONG ref_;
+               };
+}
\ No newline at end of file
diff --git a/win64/sf_memory.h b/win64/sf_memory.h
new file mode 100644 (file)
index 0000000..20e225f
--- /dev/null
@@ -0,0 +1,100 @@
+#pragma once
+namespace sf {
+// policy class
+struct heap_memory_free_policy
+{
+template< typename T >
+void operator()( const T* AMemory ) const
+{
+if( NULL != AMemory )
+::HeapFree( ::GetProcessHeap(), 0, AMemory );
+}
+};
+// policy class
+struct local_memory_free_policy
+{
+template< typename T >
+void operator()( const T* AMemory ) const
+{
+if( NULL != AMemory )
+::LocalFree( AMemory );
+}
+};
+// policy class
+struct co_task_memory_free_policy
+{
+template< typename T >
+void operator()( const T* AMemory ) const
+{
+if( NULL != AMemory )
+::CoTaskMemFree( AMemory );
+}
+};
+// base guard class
+template< typename T,class TFreePolicy >
+class base_memory
+{
+private:
+T *FMemory;
+
+public:
+base_memory( T* AMemory = NULL )
+: FMemory( AMemory ) {}
+
+virtual ~base_memory( void )
+{ reset(); }
+
+T* release( void )
+{
+T *tmp = FMemory;
+FMemory = NULL;
+return tmp;
+}
+
+void reset( T* AMemory = NULL )
+{
+if( AMemory != FMemory )
+{
+if( NULL != FMemory )
+TFreePolicy( FMemory );
+
+FMemory = AMemory;
+}
+}
+
+T* get( void )
+{ return FMemory; }
+
+T** operator&( void )
+{ return &FMemory; }
+
+};
+template< typename T >
+class heap_memory : public base_memory< T, 
+heap_memory_free_policy >
+{
+public:
+heap_memory( T* AMemory = NULL )
+: base_memory< T, heap_memory_free_policy >( AMemory )
+{ }
+};
+template< typename T >
+class local_memory : public base_memory< T, 
+local_memory_free_policy >
+{
+public:
+local_memory( T* AMemory = NULL )
+: base_memory< T, local_memory_free_policy >( AMemory )
+{ }
+};
+template< typename T >
+class co_task_memory : public base_memory< T, 
+co_task_memory_free_policy >
+{
+public:
+co_task_memory( T* AMemory = NULL )
+: base_memory< T, co_task_memory_free_policy >( AMemory )
+{ }
+};
+
+};
diff --git a/win64/sf_windows.cpp b/win64/sf_windows.cpp
new file mode 100644 (file)
index 0000000..f2757c3
--- /dev/null
@@ -0,0 +1,517 @@
+#include "stdafx.h"
+#define BOOST_ASSIGN_MAX_PARAMS 7
+#include <boost/assign.hpp>
+#include <boost/assign/ptr_list_of.hpp>
+#include <boost/assign/ptr_list_inserter.hpp>
+#include <boost/foreach.hpp>
+#include "sf_windows.h"
+#include "exception.h"
+
+#define THROW_IF_ERR(hres) \
+  if (FAILED(hres)) { throw sf::win32_error_exception(hres); }
+
+#ifndef HINST_THISCOMPONENT
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;
+#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
+#endif
+
+namespace sf 
+{
+  LRESULT base_window::window_proc(HWND hwnd,boost::uint32_t message, WPARAM wParam, LPARAM lParam)
+  {
+
+    LRESULT result = 0;
+    switch (message)
+    {
+    case WM_CREATE:
+      {
+        // TODO:
+        create_device();
+        break;
+      }
+    case WM_SIZE:
+      {
+        //if (render_target_)
+        //{
+        //     D2D1_SIZE_U size;
+        //     size.width = lParam & 0xFFFF;
+        //     size.height = (lParam >> 16) & 0xFFFF; ;
+
+        //     // Note: This method can fail, but it's okay to ignore the
+        //     // error here -- it will be repeated on the next call to
+        //     // EndDraw.
+        //     //render_target_->Resize(size);
+        //}
+      }
+    case WM_PAINT:
+      {
+        //create_device();
+
+        paint_struct begin_paint(hwnd);
+
+        //if (!(render_target_->CheckWindowState() & D2D1_WINDOW_STATE_OCCLUDED))
+        //{
+        //     // Retrieve the size of the render target.
+        //     D2D1_SIZE_F renderTargetSize = render_target_->GetSize();
+        //     try {
+        //             //render_target_->BeginDraw();
+        //             base_->on_render();
+        //             //THROW_IF_ERR(render_target_->EndDraw());
+        //     } catch (sf::win32_error_exception& e )
+        //     {
+        //             if(e.hresult() == D2DERR_RECREATE_TARGET)
+        //             {
+        //                     discard_device();
+        //             } else {
+        //                     throw;
+        //             }
+        //     }
+        //}
+        return FALSE;
+      }
+    case WM_DISPLAYCHANGE:
+      {
+        ::InvalidateRect(hwnd, NULL, FALSE);
+      }
+    case WM_ERASEBKGND:
+      {
+        return FALSE;
+      }
+    case WM_MOUSEMOVE:
+      {
+        //                                     on_mouse_move(GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam),wParam); 
+      }
+    case WM_LBUTTONDOWN:
+      {
+      }
+    }
+    return ::DefWindowProcW(hwnd,message,wParam,lParam);
+  };
+
+
+  void base_window::create_device_independent_resources()
+  {
+
+    // Direct2DFactory \82Ì\90\90¬
+
+    if(!factory_){
+#if defined(DEBUG) || defined(_DEBUG)
+      D2D1_FACTORY_OPTIONS options;
+      options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION ;
+      THROW_IF_ERR(D2D1CreateFactory(
+        D2D1_FACTORY_TYPE_SINGLE_THREADED,
+        options,
+        &factory_
+        ));
+#else
+      THROW_IF_ERR(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &factory_));
+#endif
+
+    }
+
+    if(!write_factory_){
+      THROW_IF_ERR(::DWriteCreateFactory(
+        DWRITE_FACTORY_TYPE_SHARED,
+        __uuidof(IDWriteFactory),
+        reinterpret_cast<IUnknown**>(&write_factory_)
+        ));
+    }
+
+
+    //wic_imaging_factory_.CreateInstance(CLSID_WICImagingFactory);
+
+    //thunk_proc_ = (WNDPROC)thunk_.getCode();
+
+  };
+
+  void base_window::register_class (
+    wchar_t * menu_name,
+    boost::uint32_t        style ,
+    boost::int32_t     cbClsExtra,
+    HICON       hIcon ,
+    HCURSOR     hCursor,
+    HBRUSH      hbrBackground ,
+    HICON       hIconSm
+    )          
+  {
+    wnd_class_.reset(new sf::window_class_ex(menu_name,name_,HINST_THISCOMPONENT,thunk_proc_,style,cbClsExtra,hIcon,hCursor,hbrBackground,hIconSm));
+  }
+
+  /** \83f\83t\83H\83\8b\83g\90Ý\92è */
+  void base_window::register_class()
+  {
+    wnd_class_.reset(new sf::window_class_ex(0,name_,HINST_THISCOMPONENT,thunk_proc_));
+  }
+
+  void base_window::create_window()
+  {
+    // Create the application window.
+    //
+    // Because the CreateWindow function takes its size in pixels, we
+    // obtain the system DPI and use it to scale the window size.
+    FLOAT dpiX, dpiY;
+    //factory_->GetDesktopDpi(&dpiX, &dpiY);
+
+
+    // Window\82ð\8dì\90¬\82·\82é
+    CreateWindow(
+      name_.c_str(),
+      title_.c_str(),
+      WS_OVERLAPPEDWINDOW,
+      CW_USEDEFAULT,
+      CW_USEDEFAULT,
+      static_cast<boost::uint32_t>(ceil(width_ /** dpiX / 96.f*/)),
+      static_cast<boost::uint32_t>(ceil(height_ /** dpiY / 96.f*/)),
+      NULL,
+      NULL,
+      HINST_THISCOMPONENT,
+      this
+      );
+  }
+
+  void base_window::create_device()
+  {
+
+    //         input_.reset(new input(HINST_THISCOMPONENT,hwnd_));
+    HRESULT hr = S_OK;
+
+
+    //\83E\83B\83\93\83h\83E\82Ì\8c»\8dÝ\82Ì\95\9d\81A\8d\82\82³\82ð\8b\81\82ß\82é
+    RECT rc;
+    GetClientRect( hwnd_, &rc );
+    boost::uint32_t width = rc.right - rc.left;
+    boost::uint32_t height = rc.bottom - rc.top;
+
+    {
+      //wic_imaging_factory_.CreateInstance(CLSID_WICImagingFactory);
+      //                       bitmap_ = load_bitmap_from_file(render_target_,wic_imaging_factory_,L"myship.png");
+    }
+
+    if(!render_target_)
+    {
+      RECT rc;
+      GetClientRect(hwnd_, &rc);
+
+      D2D1_SIZE_U size = D2D1::SizeU(
+        rc.right - rc.left,
+        rc.bottom - rc.top
+        );
+
+      THROW_IF_ERR(factory_->CreateHwndRenderTarget(
+        D2D1::RenderTargetProperties(),
+        D2D1::HwndRenderTargetProperties(hwnd_, size,D2D1_PRESENT_OPTIONS_IMMEDIATELY),
+        &render_target_
+        ));
+      // Create a DC render target 
+      //D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(
+      //       D2D1_RENDER_TARGET_TYPE_DEFAULT,
+      //       D2D1::PixelFormat(
+      //               DXGI_FORMAT_B8G8R8A8_UNORM,
+      //               D2D1_ALPHA_MODE_IGNORE
+      //               ) , 0.0, 0.0,
+      //       D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE
+      //       );
+
+      //THROW_IF_ERR(factory_->CreateDCRenderTarget(
+      //       &props,
+      //       &render_target_
+      //       ));
+    }
+  }
+
+
+  void base_window::discard_device()
+  {
+    /*         if(render_target_)
+    {
+    render_target_.Release();
+    }*/
+  }
+
+  void base_window::show(boost::uint32_t show_flag) 
+  {
+    //HRESULT hr = S_OK;
+    //BOOL enable;
+    //DwmIsCompositionEnabled (&enable);
+    //if(enable){
+    //   //Create and populate the BlurBehind structre
+    //   DWM_BLURBEHIND bb = {0};
+    //   //Enable Blur Behind and Blur Region;
+    //   bb.dwFlags = DWM_BB_ENABLE;
+    //   bb.fEnable = true;
+    //   bb.hRgnBlur = NULL;
+
+    //   //Enable Blur Behind
+    //   hr = DwmEnableBlurBehindWindow(hwnd_, &bb);
+    //}
+    ::ShowWindow(hwnd_,show_flag);
+  }
+  void base_window::update() {::UpdateWindow(hwnd_);}
+
+  base_window::~base_window()
+  {
+    safe_release(factory_);
+    safe_release(write_factory_);
+
+  }
+
+
+  base_window::base_window(const std::wstring& title,const std::wstring& name,bool fit_to_display,float width,float height)
+    : title_(title),name_(name),fit_to_display_(fit_to_display),
+    width_(width),height_(height),thunk_(this,base_window::WndProc),hwnd_(0)
+  {
+    thunk_proc_ = (WNDPROC)thunk_.getCode();
+    //create_device_independent_resources();
+  }
+
+
+
+  base_window::operator HWND()
+  {
+    return hwnd_;
+  };
+
+  //ID2D1FactoryPtr base_window::factory() { return impl_->factory();};
+  //ID2D1HwndRenderTargetPtr base_window::render_target() { return impl_->render_target();};
+  //IDWriteFactoryPtr base_window::write_factory() {return impl_->write_factory();};
+
+  toplevel_window_ptr create_toplevel_window
+    (
+    const std::wstring& menu_name,
+    const std::wstring& name,
+    const boost::uint32_t show_flag,
+    bool fit_to_display,
+    float width,
+    float height
+    )
+  {
+    toplevel_window* p = new toplevel_window(menu_name,name,fit_to_display,width,height);
+    p->create_device_independent_resources();
+    p->register_class();
+    p->create_window();
+    p->show(show_flag);
+    p->update();
+    return toplevel_window_ptr(p);
+  }
+
+  LRESULT toplevel_window::window_proc(HWND hwnd,boost::uint32_t message, WPARAM wParam, LPARAM lParam) 
+  {
+
+
+    switch (message)
+    {
+    case WM_CREATE:
+      {
+        // TODO:
+        create_device();
+        break;
+      }
+    case WM_SIZE:
+      {
+        //if (render_target_)
+        //{
+        //     D2D1_SIZE_U size;
+        //     size.width = lParam & 0xFFFF;
+        //     size.height = (lParam >> 16) & 0xFFFF; ;
+
+        //     // Note: This method can fail, but it's okay to ignore the
+        //     // error here -- it will be repeated on the next call to
+        //     // EndDraw.
+        //     render_target_->Resize(size);
+        //}
+      }
+    case WM_PAINT:
+      {
+        //create_device();
+
+        { 
+          paint_struct begin_paint(hwnd);
+          // \95`\89æ\83R\81[\83h\82Ì\8cÄ\82Ñ\8fo\82µ
+          render();
+        }
+        return FALSE;
+      }
+    case WM_DISPLAYCHANGE:
+      {
+        ::InvalidateRect(hwnd, NULL, FALSE);
+      }
+    case WM_ERASEBKGND:
+      {
+        return FALSE;
+      }
+    case WM_MOUSEMOVE:
+      {
+        //                                     on_mouse_move(GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam),wParam); 
+      }
+    case WM_LBUTTONDOWN:
+      {
+      }
+    }
+
+    if(message == WM_CLOSE)
+    {
+      // \8cã\8en\96\96
+      discard_device();
+      // \83\8c\83\93\83_\81[\83^\81[\83Q\83b\83g\82Ì\83\8a\83\8a\81[\83X
+      safe_release(render_target_);
+      // Window\82Ì\94j\8aü
+      BOOL ret(::DestroyWindow(hwnd));
+      BOOST_ASSERT(ret != 0);
+    }
+
+    if(message == WM_DESTROY)
+    {
+      ::PostQuitMessage(0);
+      return 0;
+    }
+
+    return ::DefWindowProcW(hwnd,message,wParam,lParam);
+  }
+
+  void toplevel_window::main_loop()
+  {
+    render();
+  }
+
+  void toplevel_window::render()
+  {
+
+    static float t = 0.0f;
+
+    if (render_target_)
+    {
+      // Retrieve the size of the render target.
+      D2D1_SIZE_F renderTargetSize = render_target_->GetSize();
+      try {
+        render_target_->BeginDraw();
+        render_target_->Clear(D2D1::ColorF(D2D1::ColorF::White));
+        render_target_->SetTransform(D2D1::Matrix3x2F::Identity());
+        //render_target_->Clear(D2D1::ColorF(D2D1::ColorF::White));
+        ID2D1SolidColorBrushPtr brush;
+        render_target_->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black), &brush);
+        ID2D1SolidColorBrushPtr brushr;
+        render_target_->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Red), &brushr);
+
+        D2D1_RECT_F layoutRect = D2D1::RectF(50.f, 50.f, 600.f, 200.f);
+        IDWriteTextFormatPtr write_text_format;
+        // Text Format\82Ì\8dì\90¬
+        THROW_IF_ERR(write_factory_->CreateTextFormat(
+          L"\83\81\83C\83\8a\83I",                // Font family name.
+          NULL,                       // Font collection (NULL sets it to use the system font collection).
+          DWRITE_FONT_WEIGHT_REGULAR,
+          DWRITE_FONT_STYLE_NORMAL,
+          DWRITE_FONT_STRETCH_NORMAL,
+          48.0f,
+          L"ja-jp",
+          &write_text_format
+          ));
+        // Actually draw the text at the origin.
+        std::wstring m(L"\82±\82ñ\82É\82¿\82Í\81A64Bit\82Ì\90¢\8aE\81IBy S.F.");
+        render_target_->DrawTextW(
+          m.c_str(),
+          m.size(),
+          write_text_format,
+          layoutRect, 
+          brush);
+        THROW_IF_ERR(render_target_->EndDraw());
+
+      }  catch(...) {
+        throw;
+      }
+    }
+  };
+
+  //
+  // Creates a Direct2D bitmap from the specified
+  // file name.
+  //
+  ID2D1BitmapPtr load_bitmap_from_file(
+    ID2D1HwndRenderTargetPtr render_target,
+    IWICImagingFactoryPtr wic_factory,
+    std::wstring uri,
+    boost::uint32_t destination_width,
+    boost::uint32_t destination_height
+    )
+  {
+    HRESULT hr = S_OK;
+
+    IWICBitmapDecoderPtr decoder;
+    IWICBitmapFrameDecodePtr decoder_source;
+    IWICStreamPtr stream;
+    IWICFormatConverterPtr converter;
+    IWICBitmapScalerPtr scaler;
+    ID2D1BitmapPtr bitmap;
+
+    THROW_IF_ERR(wic_factory->CreateDecoderFromFilename(
+      uri.c_str(),
+      NULL,
+      GENERIC_READ,
+      WICDecodeMetadataCacheOnLoad,
+      &decoder
+      ));
+
+    // Create the initial frame.
+    THROW_IF_ERR(decoder->GetFrame(0, &decoder_source));
+
+    // Convert the image format to 32bppPBGRA
+    // (DXGI_FORMAT_B8G8R8A8_UNORM + D2D1_ALPHA_MODE_PREMULTIPLIED).
+    THROW_IF_ERR(hr = wic_factory->CreateFormatConverter(&converter));
+
+    // If a new width or height was specified, create an
+    // IWICBitmapScaler and use it to resize the image.
+    if (destination_width != 0 || destination_height != 0)
+    {
+      boost::uint32_t originalWidth, originalHeight;
+      THROW_IF_ERR(decoder_source->GetSize((UINT*)&originalWidth, (UINT*)&originalHeight));
+      if (destination_width == 0)
+      {
+        FLOAT scalar = static_cast<FLOAT>(destination_height) / static_cast<FLOAT>(originalHeight);
+        destination_width = static_cast<boost::uint32_t>(scalar * static_cast<FLOAT>(originalWidth));
+      }
+      else if (destination_height == 0)
+      {
+        FLOAT scalar = static_cast<FLOAT>(destination_width) / static_cast<FLOAT>(originalWidth);
+        destination_height = static_cast<boost::uint32_t>(scalar * static_cast<FLOAT>(originalHeight));
+      }
+
+      THROW_IF_ERR(wic_factory->CreateBitmapScaler(&scaler));
+      THROW_IF_ERR(scaler->Initialize(
+        decoder_source,
+        destination_width,
+        destination_height,
+        WICBitmapInterpolationModeCubic
+        ));
+      THROW_IF_ERR(converter->Initialize(
+        scaler.GetInterfacePtr(),
+        GUID_WICPixelFormat32bppPBGRA,
+        WICBitmapDitherTypeNone,
+        NULL,
+        0.f,
+        WICBitmapPaletteTypeMedianCut
+        ));
+    }
+    else // Don't scale the image.
+    {
+      THROW_IF_ERR(converter->Initialize(
+        decoder_source.GetInterfacePtr(),
+        GUID_WICPixelFormat32bppPBGRA,
+        WICBitmapDitherTypeNone,
+        NULL,
+        0.f,
+        WICBitmapPaletteTypeMedianCut
+        ));
+    }
+
+    // Create a Direct2D bitmap from the WIC bitmap.
+    THROW_IF_ERR(render_target->CreateBitmapFromWicBitmap(
+      converter.GetInterfacePtr(),
+      NULL,
+      &bitmap
+      ));
+
+    return bitmap;
+  }
+
+
+}
+
diff --git a/win64/sf_windows.h b/win64/sf_windows.h
new file mode 100644 (file)
index 0000000..cbabaaa
--- /dev/null
@@ -0,0 +1,348 @@
+#pragma once
+/*
+*/
+// Windows Header Files:
+#include "exception.h"
+#define XBYAK64
+#include "xbyak.h"
+// DLL\82Ì\83\8a\83\93\83N
+#pragma comment(lib,"d2d1.lib")
+#pragma comment(lib,"winmm.lib")
+#pragma comment(lib,"dwrite.lib")
+#pragma comment(lib,"dwmapi.lib")
+
+//#include "input.h"
+
+_COM_SMARTPTR_TYPEDEF(ID2D1Factory,__uuidof(ID2D1Factory));
+_COM_SMARTPTR_TYPEDEF(IWICImagingFactory, __uuidof(IWICImagingFactory));
+_COM_SMARTPTR_TYPEDEF(IDWriteFactory , __uuidof(IDWriteFactory));
+_COM_SMARTPTR_TYPEDEF(IDWriteGdiInterop , __uuidof(IDWriteGdiInterop));
+_COM_SMARTPTR_TYPEDEF(IDWriteFontFace , __uuidof(IDWriteFontFace));
+_COM_SMARTPTR_TYPEDEF(IDWriteFont , __uuidof(IDWriteFont));
+_COM_SMARTPTR_TYPEDEF(IDWriteFontFamily , __uuidof(IDWriteFontFamily));
+_COM_SMARTPTR_TYPEDEF(IDWriteFontCollection , __uuidof(IDWriteFontCollection));
+_COM_SMARTPTR_TYPEDEF(IDWriteLocalizedStrings , __uuidof(IDWriteLocalizedStrings));
+_COM_SMARTPTR_TYPEDEF(ID2D1HwndRenderTarget , __uuidof(ID2D1HwndRenderTarget));
+_COM_SMARTPTR_TYPEDEF(ID2D1BitmapRenderTarget , __uuidof(ID2D1BitmapRenderTarget));
+_COM_SMARTPTR_TYPEDEF(ID2D1GdiInteropRenderTarget , __uuidof(ID2D1GdiInteropRenderTarget));
+_COM_SMARTPTR_TYPEDEF(IDWriteTextFormat, __uuidof(IDWriteTextFormat));
+_COM_SMARTPTR_TYPEDEF(IDWriteTextLayout, __uuidof(IDWriteTextLayout));
+_COM_SMARTPTR_TYPEDEF(ID2D1PathGeometry , __uuidof(ID2D1PathGeometry));
+_COM_SMARTPTR_TYPEDEF(ID2D1LinearGradientBrush , __uuidof(ID2D1LinearGradientBrush));
+_COM_SMARTPTR_TYPEDEF(ID2D1GradientStopCollection , __uuidof(ID2D1GradientStopCollection));
+_COM_SMARTPTR_TYPEDEF(ID2D1SolidColorBrush , __uuidof(ID2D1SolidColorBrush));
+_COM_SMARTPTR_TYPEDEF(ID2D1BitmapBrush , __uuidof(ID2D1BitmapBrush));
+_COM_SMARTPTR_TYPEDEF(ID2D1Bitmap , __uuidof(ID2D1Bitmap));
+_COM_SMARTPTR_TYPEDEF(IWICBitmapDecoder,__uuidof(IWICBitmapDecoder));
+_COM_SMARTPTR_TYPEDEF(IWICBitmapFrameDecode,__uuidof(IWICBitmapFrameDecode));
+_COM_SMARTPTR_TYPEDEF(IWICStream,__uuidof(IWICStream));
+_COM_SMARTPTR_TYPEDEF(IWICFormatConverter,__uuidof(IWICFormatConverter));
+_COM_SMARTPTR_TYPEDEF(IWICBitmapScaler,__uuidof(IWICBitmapScaler));
+
+template <class COM_SMART_PTR > inline void safe_release(COM_SMART_PTR& ptr)
+{
+  if(ptr)
+  {
+    ptr.Release();
+  }
+};
+
+namespace sf{
+
+  ID2D1BitmapPtr load_bitmap_from_file(
+    ID2D1HwndRenderTargetPtr render_target,
+    IWICImagingFactoryPtr wic_factory,
+    std::wstring uri,
+    boost::uint32_t destination_width = 0,
+    boost::uint32_t destination_height = 0
+    );
+
+  /** WNDCLASSEX\83\89\83b\83p\83N\83\89\83X */
+  struct window_class_ex
+  {
+    window_class_ex(
+      const wchar_t*  menu_name ,
+      const std::wstring&  class_name ,
+      HINSTANCE   hInstance = NULL,
+      WNDPROC     lpfnWndProc = ::DefWindowProcW,
+      boost::uint32_t        style = CS_HREDRAW | CS_VREDRAW,
+      boost::int32_t     cbClsExtra  = 0,
+      HICON       hIcon = ::LoadIcon(NULL,IDI_APPLICATION),
+      HCURSOR     hCursor = ::LoadCursor(NULL, IDC_ARROW),
+      HBRUSH      hbrBackground = ::CreateSolidBrush(0xff000000),
+      HICON       hIconSm = NULL
+      ) : is_register_(false)
+    {
+
+      if(::GetClassInfoExW(hInstance,class_name.c_str(),&wndclass_) == 0)
+      {
+        if(::GetLastError() == ERROR_CLASS_DOES_NOT_EXIST)
+        { 
+          ::ZeroMemory(&wndclass_,sizeof(wndclass_));
+          wndclass_.lpszMenuName = (LPCWSTR)menu_name;
+          wndclass_.lpszClassName = class_name.c_str();
+          wndclass_.cbSize = sizeof(::WNDCLASSEXW);
+          wndclass_.cbWndExtra = sizeof(LONG_PTR);
+          wndclass_.hInstance = hInstance;
+          wndclass_.lpfnWndProc = lpfnWndProc;
+          wndclass_.style = style;
+          wndclass_.cbClsExtra = cbClsExtra;
+          wndclass_.hIcon = hIcon;
+          wndclass_.hCursor = hCursor;
+          wndclass_.hbrBackground = hbrBackground;
+          wndclass_.hIconSm = hIconSm;
+          atom_ = ::RegisterClassExW(&wndclass_) ;
+          BOOST_ASSERT(atom_ != 0);
+          is_register_ = true;
+        } else {
+          throw win32_error_exception();
+        }
+      } else {
+        is_register_ = false;
+      }
+    };
+
+    ~window_class_ex()
+    {
+      if(is_register_){
+        ::UnregisterClassW(wndclass_.lpszClassName,wndclass_.hInstance);
+      }
+    }
+
+  private:
+    bool is_register_;
+    ATOM atom_;
+    ::WNDCLASSEXW wndclass_;
+  };
+
+
+
+  struct get_dc {
+    get_dc(HWND hwnd) : hwnd_(hwnd),hdc_(GetDC(hwnd)) {}
+    HDC get(){return hdc_;}
+    ~get_dc(){::ReleaseDC(hwnd_,hdc_);}
+  private:
+    HDC hdc_;
+    HWND hwnd_;
+  };
+
+  struct compatible_dc {
+    compatible_dc(HDC hdc) : hdc_(::CreateCompatibleDC(hdc)){}; 
+    ~compatible_dc(){::DeleteDC(hdc_);};
+    HDC get() { return hdc_;};
+  private:
+    HDC hdc_;
+  };
+
+  struct ref_dc {
+    ref_dc(HDC& hdc) : hdc_(hdc) {};
+    ~ref_dc(){};
+    HDC get() { return hdc_;};
+  private:
+    HDC& hdc_;
+  };
+
+  struct d2_dc {
+    d2_dc(ID2D1GdiInteropRenderTargetPtr& ptr,D2D1_DC_INITIALIZE_MODE mode) :hdc_(0),ptr_(ptr)
+    {
+      hr_ = ptr->GetDC(mode,&hdc_);
+    };
+    ~d2_dc(){ptr_->ReleaseDC(NULL);};
+    HDC get() { return hdc_;};
+  private:
+    HRESULT hr_;
+    HDC hdc_;
+    ID2D1GdiInteropRenderTargetPtr& ptr_;
+  };
+
+  template <typename Holder>
+  struct device_context
+  {
+    explicit device_context(Holder* holder) : holder_(holder){};
+    ~device_context() {}
+    operator HDC(){return holder_->get();}
+  private:
+    boost::scoped_ptr<Holder> holder_;
+  };
+
+  typedef device_context<d2_dc> d2_dc_type;
+
+  struct paint_struct 
+  {
+    paint_struct(HWND hwnd) : hwnd_(hwnd)
+    {
+      ::BeginPaint(hwnd,&paintstruct_);
+    }
+    ~paint_struct() {::EndPaint(hwnd_,&paintstruct_);}
+    PAINTSTRUCT* operator->(){return &paintstruct_;}
+  private:
+    HWND hwnd_;
+    PAINTSTRUCT paintstruct_;
+  };
+
+  template <typename T>
+  struct begin_draw
+  {
+    begin_draw(T& render_target) : render_target_(render_target) ,is_end_(false) {render_target->BeginDraw();}
+    HRESULT end_draw() 
+    {
+      HRESULT hr = S_OK;
+      if(!is_end_) { 
+        hr = render_target_->EndDraw();
+        is_end_ = true;
+      }
+
+      return hr;
+    };
+    ~begin_draw(){ if(!is_end_) { render_target_->EndDraw();}}
+  private:
+    T& render_target_;
+    bool is_end_;
+  };
+
+  struct mouse
+  {
+    mouse() : x_(0.0f),y_(0.0f),left_button_(false),middle_button_(false),right_button_(false){}
+  private:
+    float x_,y_;
+    bool left_button_,middle_button_,right_button_;
+  };
+
+  /** window \83x\81[\83X\83N\83\89\83X */
+  struct base_window 
+  {
+    typedef boost::signals2::signal<LRESULT (HWND,boost::uint32_t,WPARAM, LPARAM) > on_message_type;
+    on_message_type on_message;
+    typedef boost::signals2::signal<void ()> on_render_type;
+    on_render_type on_render;
+    operator HWND();
+  protected:
+    base_window(
+      const std::wstring& title,
+      const std::wstring& name,bool fit_to_display,
+      float width,float height);
+    ~base_window();
+    void register_class (
+      wchar_t* menu_name,
+      boost::uint32_t style, 
+      boost::int32_t     cbClsExtra  = 0,
+      HICON       hIcon = ::LoadIcon(NULL,IDI_APPLICATION),
+      HCURSOR     hCursor = ::LoadCursor(NULL, IDC_ARROW),
+      HBRUSH      hbrBackground = ::CreateSolidBrush(0xff000000),
+      HICON       hIconSm = NULL
+      );               
+
+    /** \83f\83t\83H\83\8b\83g\90Ý\92è */
+    void register_class();
+    void create_window();
+    void update();
+    void show(boost::uint32_t show_flag);
+    virtual void discard_device();
+    virtual void create_device();
+    virtual void create_device_independent_resources();
+    virtual LRESULT window_proc(HWND hwnd,boost::uint32_t message, WPARAM wParam, LPARAM lParam);
+  protected:
+    static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+    {
+      base_window* ptr = reinterpret_cast<base_window*>(hwnd);
+      hwnd = ptr->hwnd_;
+      return ptr->window_proc(hwnd,message,wParam,lParam);
+    };
+
+    // this\82Æhwnd\82ð\82Â\82È\82®thunk\83N\83\89\83X
+    struct hwnd_this_thunk : public Xbyak::CodeGenerator {
+      hwnd_this_thunk(base_window* impl,WNDPROC proc)
+      {
+        // rcx\82Éhwnd\82ª\8ai\94[\82³\82ê\82Ä\82¢\82é\82Ì\82Å\81A\82»\82ê\82ðimpl->hwnd\82É\95Û\91
+        mov(qword[&(impl->hwnd_)],rcx);
+        // \91ã\82í\82è\82Éthis\82Ì\83A\83h\83\8c\83X\82ðrcx\82É\8ai\94[
+        mov(rcx,(LONG_PTR)impl);
+        // r10\82Éproc(Window \83v\83\8d\83V\81[\83W\83\83)\82Ö\82Ì\83A\83h\83\8c\83X\82ð\8ai\94[
+        mov(r10,(LONG_PTR)proc);
+        // Window \83v\83\8d\83V\81[\83W\83\83\82Ö\82Ö\83W\83\83\83\93\83v
+        jmp(r10);
+      }
+    };
+
+    HWND hwnd_;
+    ID2D1FactoryPtr factory_;
+    ID2D1HwndRenderTargetPtr render_target_;
+    IDWriteFactoryPtr write_factory_;
+    IWICImagingFactoryPtr wic_imaging_factory_;
+    hwnd_this_thunk thunk_;
+    std::wstring title_;
+    std::wstring name_;
+    float width_,height_;
+    bool fit_to_display_;
+    boost::shared_ptr<sf::window_class_ex> wnd_class_;
+    WNDPROC thunk_proc_;
+  };
+
+  struct toplevel_window;
+  typedef boost::shared_ptr<toplevel_window> toplevel_window_ptr;
+  
+  /** toplevel_window \82ð\90\90¬\82·\82é\8aÖ\90\94 */
+  toplevel_window_ptr create_toplevel_window (
+    const std::wstring& menu_name,
+    const std::wstring& name,
+    const boost::uint32_t show_flag = SW_SHOWNORMAL,
+    bool fit_to_display = false,
+    float width = 640,
+    float height = 480
+  );
+  
+  
+  
+  /** toplevel \83E\83B\83\93\83h\83E\83N\83\89\83X */
+  /* \82±\82Ì\83N\83\89\83X\82Í\81Acreate_toplevel_window \8aÖ\90\94\82©\82ç\82Ì\82Ý\90\90¬\89Â\94\ */
+  struct toplevel_window : public base_window
+  {
+    friend   toplevel_window_ptr create_toplevel_window
+    (
+         const std::wstring& menu_name,
+         const std::wstring& name,
+         const boost::uint32_t show_flag,
+         bool fit_to_display ,
+         float width ,
+         float height
+    );
+       void main_loop();
+  protected:
+       void render();
+       toplevel_window(const std::wstring& menu_name,const std::wstring& name,bool fit_to_display,float width = 640,float height = 480) : base_window(menu_name,name,fit_to_display,width,height) 
+       {
+               on_render.connect(boost::bind(&toplevel_window::render,this));
+       };
+       LRESULT toplevel_window::window_proc(HWND hwnd,boost::uint32_t message, WPARAM wParam, LPARAM lParam);
+  };
+
+  struct av_mm_thread_characteristics
+  {
+    av_mm_thread_characteristics(std::wstring& str) : task_name_(str)
+    {
+      handle_ = ::AvSetMmThreadCharacteristicsW(str.c_str(),(LPDWORD)&task_index_);
+    }
+
+    bool set_priority(AVRT_PRIORITY p){return (::AvSetMmThreadPriority(handle_,p) == TRUE);}
+
+    ~av_mm_thread_characteristics()
+    {
+      ::AvRevertMmThreadCharacteristics(handle_);
+    }
+
+  private:
+    std::wstring task_name_;
+    boost::uint32_t task_index_;
+    HANDLE handle_;
+  };
+
+  struct widget
+  {
+    void draw();
+    float x_,y_;
+  };
+
+  typedef sf::begin_draw<ID2D1BitmapRenderTargetPtr> begin_draw_bitmap;
+  typedef sf::begin_draw<ID2D1HwndRenderTargetPtr> begin_draw_hwnd;
+
+}
\ No newline at end of file
diff --git a/win64/singleton.h b/win64/singleton.h
new file mode 100644 (file)
index 0000000..6c38ca8
--- /dev/null
@@ -0,0 +1,55 @@
+#pragma once
+/*
+  ==============================================================================
+
+   This file is part of the S.F.Tracker
+   Copyright 2005-7 by Satoshi Fujiwara.
+
+   S.F.Tracker can be redistributed and/or modified under the terms of the
+   GNU General Public License, as published by the Free Software Foundation;
+   either version 2 of the License, or (at your option) any later version.
+
+   S.F.Tracker is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with S.F.Tracker; if not, visit www.gnu.org/licenses or write to the
+   Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
+   Boston, MA 02111-1307 USA
+
+  ==============================================================================
+*/
+/** @file
+ *  @brief 
+ *  @author S.F. (Satoshi Fujiwara)
+ */
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+namespace sf {
+    template<typename BaseClass,template <class> class PointerType = boost::shared_ptr > struct singleton 
+    {
+        typedef PointerType<BaseClass> ptr;
+        friend  BaseClass;
+        static ptr& instance()
+        {
+            boost::call_once(init,flag_);
+            return instance_;
+        };
+
+
+        singleton(){};
+    private:
+        singleton(const singleton& );
+               static void init(){instance_.reset(new BaseClass);};
+        static PointerType<BaseClass> instance_;
+        static boost::once_flag flag_;
+    };
+
+    template<class BaseClass,template <class> class PointerType> boost::once_flag singleton<BaseClass,PointerType>::flag_ = BOOST_ONCE_INIT;
+    template<class BaseClass,template <class> class PointerType> PointerType<BaseClass> singleton<BaseClass,PointerType>::instance_;
+};
+
+
diff --git a/win64/stdafx.cpp b/win64/stdafx.cpp
new file mode 100644 (file)
index 0000000..a94f8e8
--- /dev/null
@@ -0,0 +1,8 @@
+// stdafx.cpp : \95W\8f\80\83C\83\93\83N\83\8b\81[\83h\82Ì\82Ý\82ð\8aÜ\82Þ\83\\81[\83\83t\83@\83C\83\8b\82Å\82·\81B
+// STed2.pch \82Í\81A\83v\83\8a\83R\83\93\83p\83C\83\8b\8dÏ\82Ý\83w\83b\83_\81[\82É\82È\82è\82Ü\82·\81B
+//  stdafx.obj \82É\82Í\83v\83\8a\83R\83\93\83p\83C\83\8b\8c^\8fî\95ñ\82ª\8aÜ\82Ü\82ê\82Ü\82·\81B
+
+#include "stdafx.h"
+
+// TODO: \82±\82Ì\83t\83@\83C\83\8b\82Å\82Í\82È\82­\81ASTDAFX.H \82Å\95K\97v\82È
+// \92Ç\89Á\83w\83b\83_\81[\82ð\8eQ\8fÆ\82µ\82Ä\82­\82¾\82³\82¢\81B
diff --git a/win64/stdafx.h b/win64/stdafx.h
new file mode 100644 (file)
index 0000000..ffb13c3
--- /dev/null
@@ -0,0 +1,114 @@
+// stdafx.h : \95W\8f\80\82Ì\83V\83X\83e\83\80 \83C\83\93\83N\83\8b\81[\83\83t\83@\83C\83\8b\82Ì\83C\83\93\83N\83\8b\81[\83\83t\83@\83C\83\8b\81A\82Ü\82½\82Í
+// \8eQ\8fÆ\89ñ\90\94\82ª\91½\82­\81A\82©\82Â\82 \82Ü\82è\95Ï\8dX\82³\82ê\82È\82¢\81A\83v\83\8d\83W\83F\83N\83g\90ê\97p\82Ì\83C\83\93\83N\83\8b\81[\83\83t\83@\83C\83\8b
+// \82ð\8bL\8fq\82µ\82Ü\82·\81B
+//
+
+#pragma once
+#include <SDKDDKVer.h>
+
+#ifndef UNICODE
+#define UNICODE
+#endif
+// STL
+#define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
+//
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER              // Allow use of features specific to Windows 7 or later.
+#define WINVER 0x0700       // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT        // Allow use of features specific to Windows 7 or later.
+#define _WIN32_WINNT 0x0700 // Change this to the appropriate value to target other versions of Windows.
+#endif
+#define DIRECTINPUT_VERSION 0x0800
+#include <tchar.h>
+#include <iostream>
+#include <fstream>
+#include <exception>
+#include <memory>
+#include <string>
+#include <map>
+#include <locale>
+#include <fstream>
+#include <algorithm>
+#include <functional>
+
+// Boost
+//#include <boost/archive/xml_woarchive.hpp>
+//#include <boost/archive/xml_wiarchive.hpp>
+//#include <boost/archive/text_woarchive.hpp>
+//#include <boost/archive/text_wiarchive.hpp>
+//#include <boost/archive/text_oarchive.hpp>
+//#include <boost/archive/text_iarchive.hpp>
+//#include <boost/archive/binary_woarchive.hpp>
+//#include <boost/archive/binary_wiarchive.hpp>
+//#include <boost/archive/binary_oarchive.hpp>
+//#include <boost/archive/binary_iarchive.hpp>
+
+//#include <boost/serialization/export.hpp>
+//#include <boost/serialization/is_abstract.hpp>
+//#include <boost/serialization/version.hpp>
+//#include <boost/serialization/serialization.hpp>
+//#include <boost/serialization/split_member.hpp>
+//#include <boost/serialization/string.hpp>
+//#include <boost/serialization/shared_ptr.hpp>
+//#include <boost/serialization/vector.hpp>
+//#include <boost/serialization/nvp.hpp>
+//#include <boost/serialization/void_cast.hpp>
+#include <boost/scoped_ptr.hpp> 
+#include <boost/scoped_array.hpp> 
+#include <boost/shared_ptr.hpp> 
+#include <boost/shared_array.hpp> 
+#include <boost/intrusive_ptr.hpp>
+#include <boost/format.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/array.hpp>
+#include <boost/thread.hpp>
+#include <boost/optional.hpp>
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/variant.hpp>
+#include <boost/any.hpp>
+#include <boost/signals2.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/ptr_container/ptr_container.hpp>
+#include <boost/thread/condition.hpp>
+//#include <boost/serialization/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_array.hpp>
+#include <boost/ptr_container/serialize_ptr_container.hpp>
+//#include "serialization.h"
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/convenience.hpp>
+#include "sf_com.h"
+//#include <d3d10_1.h>
+//#include <d3d10.h>
+//#include <d3d11.h>
+//#include <d3dx10.h>
+//#include <d3dx11.h>
+#include "dinput.h"
+#include <wincodec.h>
+#include <windows.h>
+#include <windowsx.h>
+#include <wincodec.h>
+#include <wincodecsdk.h>
+
+#include <comdef.h>
+#include "avrt.h"
+#include "mmsystem.h"
+#include <d2d1.h>
+#include <d2d1helper.h>
+#include <dwrite.h>
+#include "dwmapi.h" 
+//#include <wincodec.h>
+//#include <wincodecsdk.h>
+//#include <d3dx11effect.h>
+//#include <d3dxGlobal.h>
+//#include "exception.h"
+//#include "singleton.h"
+//#include "code_converter.h"
+//#include "logger.h"
+
+
+// TODO: \83v\83\8d\83O\83\89\83\80\82É\95K\97v\82È\92Ç\89Á\83w\83b\83_\81[\82ð\82±\82±\82Å\8eQ\8fÆ\82µ\82Ä\82­\82¾\82³\82¢\81B
diff --git a/win64/undo_redo.h b/win64/undo_redo.h
new file mode 100644 (file)
index 0000000..80201bb
--- /dev/null
@@ -0,0 +1,163 @@
+#pragma once
+/** @file
+ *  @brief undo redo command class
+ *  @author S.F. (Satoshi Fujiwara)
+ */
+
+#include <stack>
+namespace sf {
+    namespace model {
+        struct command_manager;
+
+        struct command_interface 
+        {
+            virtual ~command_interface(){};
+            virtual const bool can_undo() const throw() = 0;
+            virtual const bool can_redo() const throw() = 0;
+            virtual const bool is_terminate() const throw()  = 0;
+            virtual void undo() = 0;
+            virtual void redo() = 0;
+            virtual void execute() = 0;
+            virtual const std::wstring& name() const throw() = 0;
+        };
+
+        struct abstract_command : public command_interface 
+        {
+            abstract_command(const bool terminate)
+                : m_terminate(terminate){}
+            abstract_command(const abstract_command& src)
+                : m_terminate(src.m_terminate) {}
+
+            virtual ~abstract_command(){};
+            virtual const bool is_terminate() const throw() {return m_terminate;}
+            virtual void execute() {redo();}
+            virtual const std::wstring& name() const throw() = 0;
+        
+        protected:
+            bool m_terminate;
+        };
+
+        struct command : public abstract_command
+        {
+            typedef boost::function<void () > func_type;
+            command(const std::wstring& command_name,const func_type& exec_func,const func_type& undo_func,const bool term = true)
+                : abstract_command(term),m_name(command_name),m_undo_func(undo_func),m_exec_func(exec_func),m_terminate(term)
+            {
+                //m_undo_func = undo_func;
+                //m_exec_func = exec_func;
+                //m_terminate = term;
+            };
+
+            command(const std::wstring& command_name,const func_type& exec_func,const bool term = true) 
+                : abstract_command(term),m_name(command_name),m_exec_func(exec_func),m_terminate(term)
+            {
+                //m_exec_func = exec_func;
+                //m_terminate = term;
+            };
+
+            ~command(){};
+            
+            const bool can_undo() const throw()
+            {
+                return !m_undo_func.empty();
+            }; 
+            
+            const bool can_redo() const throw()
+            {
+                return !m_exec_func.empty();
+            };
+            
+            const bool is_terminate() const throw() { return m_terminate;};
+            void undo(){m_undo_func();};
+            void redo(){m_exec_func();};
+            void execute(){m_exec_func();};
+            const std::wstring& name() const throw() {return m_name;}
+
+        private:
+            func_type m_undo_func;
+            func_type m_exec_func;
+            bool m_terminate;
+            std::wstring m_name;
+            static void null_func(){};
+
+        };
+
+        struct command_manager
+        {
+            typedef boost::function<void (command_manager&)> changed_evt_func;
+            typedef boost::ptr_deque<sf::model::command_interface> container_type;
+
+            command_manager(){};
+            ~command_manager(){};
+
+            void add(command_interface* exec_command)
+            {
+                if(exec_command->can_undo())
+                {
+                    m_redo.clear();
+                    m_undo.push_front(exec_command);
+                    m_func(*this);
+                }
+            }
+
+            void undo()
+            {
+                bool term_ = false;
+                while(!term_ && !m_undo.empty())
+                {
+                   // (_T("undo() size: %d \n"),m_undo.size());
+                    m_undo.front().undo();
+                    term_ = m_undo.front().is_terminate();
+                    m_redo.push_front(m_undo.pop_front().release());
+//                    m_undo.pop_front();
+                }
+
+                if(!m_func.empty())
+                {
+                    m_func(*this);
+                }
+            }
+
+            void redo()
+            {
+                bool term_ = false;
+                while(!term_ && !m_redo.empty())
+                {
+                    m_redo.front().redo();
+                    term_ = m_redo.front().is_terminate();
+                    m_undo.push_front(m_redo.pop_front().release());
+//                    m_redo.pop_front();
+                }
+
+                if(!m_func.empty())
+                {
+                    m_func(*this);
+                }
+
+            }
+
+            void clear()
+            {
+                m_undo.clear();
+                m_redo.clear();
+                if(!m_func.empty())
+                {
+                    m_func(*this);
+                }
+            }
+
+            const container_type& undo_buf() const throw() {return m_undo;}  
+            const container_type& redo_buf() const throw() {return m_redo;}
+               const bool is_undo(){return !m_undo.empty();};
+               const bool is_redo(){return !m_undo.empty();};
+
+            void event_func(const changed_evt_func& func){m_func = func;};
+
+        private:
+            changed_evt_func m_func;
+            container_type m_undo;
+            container_type m_redo;
+        };
+    };
+};
diff --git a/win64/win64.vcxproj b/win64/win64.vcxproj
new file mode 100644 (file)
index 0000000..7ccb2ed
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{55239BC8-10C5-45D4-9F0B-FDDFEE8DAE55}</ProjectGuid>
+    <RootNamespace>win64</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <PlatformToolset>Windows7.1SDK</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>Windows7.1SDK</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="..\..\..\Props\SF.props" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="..\..\..\Props\SF.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <FloatingPointModel>Precise</FloatingPointModel>
+      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="exception.cpp" />
+    <ClCompile Include="message_loop.cpp" />
+    <ClCompile Include="sf_com.cpp" />
+    <ClCompile Include="sf_windows.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="winmain.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="exception.h" />
+    <ClInclude Include="message_loop.h" />
+    <ClInclude Include="sf_com.h" />
+    <ClInclude Include="sf_memory.h" />
+    <ClInclude Include="sf_windows.h" />
+    <ClInclude Include="singleton.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="undo_redo.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/win64/win64.vcxproj.filters b/win64/win64.vcxproj.filters
new file mode 100644 (file)
index 0000000..2a5a13c
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="ソース ファイル">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="ヘッダー ファイル">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="リソース ファイル">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="winmain.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="exception.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="sf_com.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="sf_windows.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+    <ClCompile Include="message_loop.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="exception.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="sf_com.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="sf_memory.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="sf_windows.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="singleton.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="undo_redo.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+    <ClInclude Include="message_loop.h">
+      <Filter>ソース ファイル</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/win64/win64.vcxproj.user b/win64/win64.vcxproj.user
new file mode 100644 (file)
index 0000000..ace9a86
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+</Project>
\ No newline at end of file
diff --git a/win64/winmain.cpp b/win64/winmain.cpp
new file mode 100644 (file)
index 0000000..3788c4d
--- /dev/null
@@ -0,0 +1,20 @@
+#include "stdafx.h"
+#include "sf_windows.h"
+#include "message_loop.h"
+#include "sf_com.h"
+
+int APIENTRY _tWinMain(HINSTANCE hInstance,
+                     HINSTANCE hPrevInstance,
+                     LPTSTR    lpCmdLine,
+                     int       nCmdShow)
+{
+       UNREFERENCED_PARAMETER(hPrevInstance);
+       UNREFERENCED_PARAMETER(lpCmdLine);
+  // COM\82Ì\8f\89\8aú\89»
+  sf::com_initialize init();
+  // \83E\83B\83\93\83h\83E\82Ì\8dì\90¬
+  sf::toplevel_window_ptr 
+    window(sf::create_toplevel_window(std::wstring(L"Test Window"),std::wstring(L"Test Window")));
+  // \83\81\83b\83Z\81[\83W\83\8b\81[\83v\82Ì\8eÀ\8ds
+  return sf::run_message_loop()();
+}
\ No newline at end of file