#include <boost/assign/ptr_list_of.hpp>
#include <boost/assign/ptr_list_inserter.hpp>
#include <boost/foreach.hpp>
+
+#if _DEBUG
+#define _CRTDBG_MAP_ALLOC
+#include <crtdbg.h>
+#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
+#endif
+
#include "sf_windows.h"
#include "exception.h"
+
+
#define THROW_IFERR(hres) \
if (FAILED(hres)) { throw sf::win32_error_exception(hres); }
//
// 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;
+ //FLOAT dpiX, dpiY;
//factory_->GetDesktopDpi(&dpiX, &dpiY);
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
- static_cast<uint32_t>(ceil(width_ /** dpiX / 96.f*/)),
- static_cast<uint32_t>(ceil(height_ /** dpiY / 96.f*/)),
+ static_cast<uint32_t>(dpi_.scale_x(width_)),
+ static_cast<uint32_t>(dpi_.scale_y(height_)),
NULL,
NULL,
HINST_THISCOMPONENT,
this
);
+ ::GetWindowPlacement(hwnd_,&wp_);
}
- void base_win32_window::show(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_win32_window::show()
+ //{
+ // //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_,SW_SHOW);
+ // ::GetWindowPlacement(&wp_);
+ //}
+
void base_win32_window::update() {::UpdateWindow(hwnd_);}
base_win32_window::base_win32_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_win32_window::WndProc),hwnd_(0)
{
+ memset(&wp_,0,sizeof(wp_));
+ wp_.length = sizeof(WINDOWPLACEMENT);
thunk_proc_ = (WNDPROC)thunk_.getCode();
//create_device_independent_resources();
}