فهرست منبع

Fixed OSX initial window size.

Branimir Karadžić 10 سال پیش
والد
کامیت
e5801a9d8c
3فایلهای تغییر یافته به همراه10 افزوده شده و 5 حذف شده
  1. 4 4
      examples/26-occlusion/occlusion.cpp
  2. 3 1
      examples/common/entry/entry.h
  3. 3 0
      examples/common/entry/entry_osx.mm

+ 4 - 4
examples/26-occlusion/occlusion.cpp

@@ -63,14 +63,14 @@ class Occlusion : public entry::AppI
 	void init(int _argc, char** _argv) BX_OVERRIDE
 	void init(int _argc, char** _argv) BX_OVERRIDE
 	{
 	{
 		Args args(_argc, _argv);
 		Args args(_argc, _argv);
-		
-		m_state.m_width  = 1280;
-		m_state.m_height = 720;
+
+		uint32_t width  = 1280;
+		uint32_t height = 720;
 		m_debug  = BGFX_DEBUG_TEXT;
 		m_debug  = BGFX_DEBUG_TEXT;
 		m_reset  = BGFX_RESET_VSYNC;
 		m_reset  = BGFX_RESET_VSYNC;
 
 
 		bgfx::init(args.m_type, args.m_pciId);
 		bgfx::init(args.m_type, args.m_pciId);
-		bgfx::reset(m_state.m_width, m_state.m_height, m_reset);
+		bgfx::reset(width, height, m_reset);
 
 
 		// Enable debug text.
 		// Enable debug text.
 		bgfx::setDebug(m_debug);
 		bgfx::setDebug(m_debug);

+ 3 - 1
examples/common/entry/entry.h

@@ -250,7 +250,9 @@ namespace entry
 	struct WindowState
 	struct WindowState
 	{
 	{
 		WindowState()
 		WindowState()
-			: m_nwh(NULL)
+			: m_width(0)
+			, m_height(0)
+			, m_nwh(NULL)
 		{
 		{
 			m_handle.idx = UINT16_MAX;
 			m_handle.idx = UINT16_MAX;
 		}
 		}

+ 3 - 0
examples/common/entry/entry_osx.mm

@@ -469,6 +469,9 @@ namespace entry
 			bx::Thread thread;
 			bx::Thread thread;
 			thread.init(mte.threadFunc, &mte);
 			thread.init(mte.threadFunc, &mte);
 
 
+			WindowHandle handle = { 0 };
+			m_eventQueue.postSizeEvent(handle, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
+
 			while (!(m_exit = [dg applicationHasTerminated]) )
 			while (!(m_exit = [dg applicationHasTerminated]) )
 			{
 			{
 				if (bgfx::RenderFrame::Exiting == bgfx::renderFrame() )
 				if (bgfx::RenderFrame::Exiting == bgfx::renderFrame() )