static int systemPanel( BBString *text,int flags ){ int n; beginPanel(); if( _usew ){ n=MessageBoxW( GetActiveWindow(),bbTmpWString(text),appTitleW(),flags ); }else{ n=MessageBoxA( GetActiveWindow(),bbTmpCString(text),appTitleA(),flags ); } endPanel(); return n; }
BBGfxContext *bbGfxGraphicsCreateGraphics( int width,int height,int depth,int hertz,int flags ){ BBGfxContext *context; int mode; HWND hwnd; int hwnd_style; RECT rect={0,0,width,height}; _initWndClass(); if( depth ){ mode=MODE_DISPLAY; hwnd_style=WS_POPUP; }else{ HWND desktop = GetDesktopWindow(); RECT desktopRect; GetWindowRect(desktop, &desktopRect); rect.left=desktopRect.right/2-width/2; rect.top=desktopRect.bottom/2-height/2; rect.right=rect.left+width; rect.bottom=rect.top+height; mode=MODE_WINDOW; hwnd_style=WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX; } AdjustWindowRectEx( &rect,hwnd_style,0,0 ); hwnd=CreateWindowExW(0, CLASS_NAMEW, appTitleW(), hwnd_style,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,0,0,GetModuleHandle(0),0 ); if( !hwnd ) return 0; GetClientRect( hwnd,&rect ); width=rect.right-rect.left; height=rect.bottom-rect.top; context=(BBGfxContext*)malloc( sizeof(BBGfxContext) ); memset( context,0,sizeof(context) ); context->mode=mode; context->width=width; context->height=height; context->depth=depth; context->hertz=hertz; context->flags=flags; context->hwnd=hwnd; context->succ=_contexts; _contexts=context; bgfx_platform_data_t pd; pd.ndt = NULL; pd.nwh = hwnd; pd.context = NULL; pd.backBuffer = NULL; pd.backBufferDS = NULL; bgfx_set_platform_data(&pd); ShowWindow( hwnd,SW_SHOW ); return context; }