MSVC GDI buildfix

This commit is contained in:
Brad Parker 2017-01-05 17:21:13 -05:00
parent 6df175bd31
commit 49d7be9813
6 changed files with 59 additions and 28 deletions

View File

@ -515,6 +515,10 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
{
LRESULT ret;
bool quit = false;
PAINTSTRUCT ps;
HDC hdc;
RECT rc;
POINT aptStar[6] = {50,2, 2,98, 98,33, 2,33, 98,98, 50,2};
if (message == WM_NCLBUTTONDBLCLK)
doubleclick_on_titlebar = true;
@ -522,11 +526,15 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
switch (message)
{
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
TextOut(hdc, 0, 0, "Hello, Windows!", 15);
hdc = BeginPaint(hwnd, &ps);
//TextOut(hdc, 0, 0, "Hello, Windows!", 15);
GetClientRect(hwnd, &rc);
SetMapMode(hdc, MM_ANISOTROPIC);
SetWindowExtEx(hdc, 100, 100, NULL);
SetViewportExtEx(hdc, rc.right, rc.bottom, NULL);
Polyline(hdc, aptStar, 6);
EndPaint(hwnd, &ps);
break;
return 0L;
case WM_DROPFILES:
case WM_SYSCOMMAND:
case WM_CHAR:
@ -856,6 +864,7 @@ bool win32_set_video_mode(void *data,
if (res == -1)
{
RARCH_ERR("GetMessage error code %d\n", GetLastError());
break;
}
else
{

View File

@ -85,7 +85,13 @@ bool win32_get_metrics(void *data,
void win32_show_cursor(bool state);
#ifdef __cplusplus
extern "C" {
#endif
HWND win32_get_window(void);
#ifdef __cplusplus
}
#endif
bool win32_has_focus(void);
@ -96,7 +102,6 @@ void win32_set_window(unsigned *width, unsigned *height,
bool fullscreen, bool windowed_full, void *rect_data);
#ifndef _XBOX
/* FIXME: It should not be necessary to add the W after MONITORINFOEX, but linking fails without it. */
void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use,
unsigned *width, unsigned *height, bool fullscreen, bool windowed_full,
RECT *rect, RECT *mon_rect, DWORD *style);

View File

@ -23,6 +23,10 @@
#include "../../menu/menu_driver.h"
#include "../common/gdi_common.h"
#if defined(_WIN32) && !defined(_XBOX)
#include "../common/win32_common.h"
#endif
static unsigned char *gdi_menu_frame = NULL;
static unsigned gdi_menu_width = 0;
static unsigned gdi_menu_height = 0;
@ -212,8 +216,8 @@ static bool gdi_gfx_frame(void *data, const void *frame,
unsigned width = 0;
unsigned height = 0;
bool draw = true;
gdi_t *gdi = (gdi_t*)data;
(void)data;
(void)frame;
(void)frame_width;
(void)frame_height;
@ -253,6 +257,10 @@ static bool gdi_gfx_frame(void *data, const void *frame,
if (msg)
font_driver_render_msg(NULL, msg, NULL);
video_context_driver_update_window_title();
video_context_driver_swap_buffers();
if (draw)
{
/*gdi_dither_bitmap(gdi_cv, 0, 0,
@ -261,6 +269,8 @@ static bool gdi_gfx_frame(void *data, const void *frame,
gdi_dither, frame_to_copy);*/
}
//UpdateWindow(win32_get_window());
return true;
}

View File

@ -40,16 +40,16 @@
#include "../common/win32_common.h"
static HDC win32_hdc;
static HDC win32_gdi_hdc;
static unsigned win32_major = 0;
static unsigned win32_minor = 0;
static unsigned win32_interval = 0;
static enum gfx_ctx_api win32_api = GFX_CTX_NONE;
static unsigned win32_gdi_major = 0;
static unsigned win32_gdi_minor = 0;
static unsigned win32_gdi_interval = 0;
static enum gfx_ctx_api win32_gdi_api = GFX_CTX_NONE;
void *dinput_gdi;
static void setup_pixel_format(HDC hdc)
static void setup_gdi_pixel_format(HDC hdc)
{
PIXELFORMATDESCRIPTOR pfd = {0};
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
@ -77,7 +77,7 @@ static bool gfx_ctx_gdi_set_resize(void *data,
(void)width;
(void)height;
switch (win32_api)
switch (win32_gdi_api)
{
case GFX_CTX_NONE:
default:
@ -144,7 +144,7 @@ static void *gfx_ctx_gdi_init(void *video_driver)
if (!win32_window_init(&wndclass, true, NULL))
return NULL;
switch (win32_api)
switch (win32_gdi_api)
{
case GFX_CTX_NONE:
default:
@ -160,17 +160,17 @@ static void gfx_ctx_gdi_destroy(void *data)
(void)data;
switch (win32_api)
switch (win32_gdi_api)
{
case GFX_CTX_NONE:
default:
break;
}
if (window && win32_hdc)
if (window && win32_gdi_hdc)
{
ReleaseDC(window, win32_hdc);
win32_hdc = NULL;
ReleaseDC(window, win32_gdi_hdc);
win32_gdi_hdc = NULL;
}
if (window)
@ -186,8 +186,8 @@ static void gfx_ctx_gdi_destroy(void *data)
}
g_inited = false;
win32_major = 0;
win32_minor = 0;
win32_gdi_major = 0;
win32_gdi_minor = 0;
}
static bool gfx_ctx_gdi_set_video_mode(void *data,
@ -200,7 +200,7 @@ static bool gfx_ctx_gdi_set_video_mode(void *data,
goto error;
}
switch (win32_api)
switch (win32_gdi_api)
{
case GFX_CTX_NONE:
default:
@ -254,9 +254,9 @@ static bool gfx_ctx_gdi_bind_api(void *data,
{
(void)data;
win32_major = major;
win32_minor = minor;
win32_api = api;
win32_gdi_major = major;
win32_gdi_minor = minor;
win32_gdi_api = api;
return true;
}
@ -290,15 +290,15 @@ static void gfx_ctx_gdi_swap_buffers(void *data)
{
(void)data;
SwapBuffers(win32_hdc);
SwapBuffers(win32_gdi_hdc);
}
void create_gdi_context(HWND hwnd, bool *quit)
{
(void)quit;
win32_hdc = GetDC(hwnd);
win32_gdi_hdc = GetDC(hwnd);
setup_pixel_format(win32_hdc);
setup_gdi_pixel_format(win32_gdi_hdc);
g_inited = true;
}

View File

@ -221,7 +221,6 @@ VIDEO CONTEXT
#endif
/*============================================================
VIDEO SHADERS
============================================================ */
@ -358,6 +357,10 @@ VIDEO DRIVER
#endif
#include "../gfx/drivers/nullgfx.c"
#if defined(_WIN32) && !defined(_XBOX)
#include "../gfx/drivers/gdi_gfx.c"
#endif
/*============================================================
FONTS
============================================================ */

View File

@ -115,6 +115,10 @@ UI COMMON CONTEXT
#include "../gfx/drivers_context/wgl_ctx.cpp"
#endif
#if defined(_WIN32) && !defined(_XBOX)
#include "../gfx/drivers_context/gdi_ctx.cpp"
#endif
#if defined(HAVE_FFMPEG)
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES3)
#include "../cores/libretro-ffmpeg/fft/fft.cpp"