Add directdraw test. configure script displays the available engines
SVN revision: 30095
This commit is contained in:
parent
f26352de0e
commit
b50e551a93
47
configure.in
47
configure.in
|
@ -48,34 +48,59 @@ PKG_CHECK_MODULES([EVAS], evas)
|
||||||
|
|
||||||
PCFLAGS=$CFLAGS
|
PCFLAGS=$CFLAGS
|
||||||
CFLAGS="$EVAS_CFLAGS $CFLAGS"
|
CFLAGS="$EVAS_CFLAGS $CFLAGS"
|
||||||
|
|
||||||
|
have_xlib_opengl="no"
|
||||||
AC_CHECK_HEADER(Evas_Engine_GL_X11.h,
|
AC_CHECK_HEADER(Evas_Engine_GL_X11.h,
|
||||||
[ AC_DEFINE(HAVE_EVAS_GL, 1, [Evas GL Engine Support]) ],
|
[ AC_DEFINE(HAVE_EVAS_GL, 1, [Evas GL Engine Support])
|
||||||
|
have_xlib_opengl="yes" ],
|
||||||
[ dummy=no ],
|
[ dummy=no ],
|
||||||
[ #include <Evas.h> ]
|
[ #include <Evas.h> ]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
have_xlib="no"
|
||||||
AC_CHECK_HEADER(Evas_Engine_Software_X11.h,
|
AC_CHECK_HEADER(Evas_Engine_Software_X11.h,
|
||||||
[ AC_DEFINE(HAVE_SOFTWARE_X11, 1, [Evas Software X11 Engine Support]) ],
|
[ AC_DEFINE(HAVE_SOFTWARE_X11, 1, [Evas Software X11 Engine Support])
|
||||||
|
have_xlib="yes" ],
|
||||||
[ dummy=no ],
|
[ dummy=no ],
|
||||||
[ #include <Evas.h> ]
|
[ #include <Evas.h> ]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
have_xlib_render="no"
|
||||||
AC_CHECK_HEADER(Evas_Engine_XRender_X11.h,
|
AC_CHECK_HEADER(Evas_Engine_XRender_X11.h,
|
||||||
[ AC_DEFINE(HAVE_XRENDER_X11, 1, [Evas XRender X11 Engine Support]) ],
|
[ AC_DEFINE(HAVE_XRENDER_X11, 1, [Evas XRender X11 Engine Support])
|
||||||
|
have_xlib_render="yes" ],
|
||||||
[ dummy=no ],
|
[ dummy=no ],
|
||||||
[ #include <Evas.h> ]
|
[ #include <Evas.h> ]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
have_xlib_16="no"
|
||||||
AC_CHECK_HEADER(Evas_Engine_Software_16_X11.h,
|
AC_CHECK_HEADER(Evas_Engine_Software_16_X11.h,
|
||||||
[ AC_DEFINE(HAVE_SOFTWARE_16_X11, 1, [Evas Software 16bit X11 Engine Support]) ],
|
[ AC_DEFINE(HAVE_SOFTWARE_16_X11, 1, [Evas Software 16bit X11 Engine Support])
|
||||||
|
have_xlib_16="yes" ],
|
||||||
|
[ dummy=no ],
|
||||||
|
[ #include <Evas.h> ]
|
||||||
|
)
|
||||||
|
|
||||||
|
have_ddraw="no"
|
||||||
|
AC_CHECK_HEADER(Evas_Engine_Software_DDraw.h,
|
||||||
|
[ AC_DEFINE(HAVE_SOFTWARE_DDRAW, 1, [Evas Software DirectDraw Engine Support])
|
||||||
|
have_ddraw="yes"
|
||||||
|
ddraw_libs="-lddraw -ldxguid" ],
|
||||||
[ dummy=no ],
|
[ dummy=no ],
|
||||||
[ #include <Evas.h> ]
|
[ #include <Evas.h> ]
|
||||||
)
|
)
|
||||||
CFLAGS=$PCFLAGS
|
CFLAGS=$PCFLAGS
|
||||||
|
|
||||||
|
if test "x$have_xlib" = "xyes" -o "x$have_xlib_16" = "xyes" -o "x$have_xlib_render" = "xyes" "x$have_xlib_opengl" = "xyes" ; then
|
||||||
AC_PATH_XTRA
|
AC_PATH_XTRA
|
||||||
x_dir=${x_dir:-/usr/X11R6}
|
x_dir=${x_dir:-/usr/X11R6}
|
||||||
x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
|
x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
|
||||||
x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
|
x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST(x_cflags)
|
AC_SUBST(x_cflags)
|
||||||
AC_SUBST(x_libs)
|
AC_SUBST(x_libs)
|
||||||
|
AC_SUBST(ddraw_libs)
|
||||||
|
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
|
@ -83,3 +108,17 @@ src/Makefile
|
||||||
src/bin/Makefile
|
src/bin/Makefile
|
||||||
data/Makefile
|
data/Makefile
|
||||||
])
|
])
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo " $PACKAGE $VERSION"
|
||||||
|
echo
|
||||||
|
echo " Engines:"
|
||||||
|
echo " Software Xlib...........: ${have_xlib}"
|
||||||
|
echo " Software Xlib 16 bits...: ${have_xlib_16}"
|
||||||
|
echo " X Render Xlib...........: ${have_xlib_render}"
|
||||||
|
echo " Open GL Xlib............: ${have_xlib_opengl}"
|
||||||
|
echo " Software DirectDraw.....: ${have_ddraw}"
|
||||||
|
echo
|
||||||
|
echo " Installation:"
|
||||||
|
echo " prefix..................: ${prefix}"
|
||||||
|
echo
|
||||||
|
|
|
@ -15,6 +15,7 @@ engine_software_x11.c engine_software_x11.h \
|
||||||
engine_gl_x11.c engine_gl_x11.h \
|
engine_gl_x11.c engine_gl_x11.h \
|
||||||
engine_xrender_x11.c engine_xrender_x11.h \
|
engine_xrender_x11.c engine_xrender_x11.h \
|
||||||
engine_software_16_x11.c engine_software_16_x11.h \
|
engine_software_16_x11.c engine_software_16_x11.h \
|
||||||
|
engine_software_ddraw.c engine_software_ddraw.h \
|
||||||
ui.c ui.h \
|
ui.c ui.h \
|
||||||
about.c about.h \
|
about.c about.h \
|
||||||
tests.h \
|
tests.h \
|
||||||
|
@ -43,4 +44,4 @@ rect_solid.c \
|
||||||
rect_blend_few.c \
|
rect_blend_few.c \
|
||||||
rect_solid_few.c
|
rect_solid_few.c
|
||||||
|
|
||||||
expedite_LDFLAGS = @EVAS_LIBS@ @x_libs@ -lm
|
expedite_LDFLAGS = @EVAS_LIBS@ @x_libs@ @ddraw_libs@ -lm
|
||||||
|
|
|
@ -0,0 +1,377 @@
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_SOFTWARE_DDRAW
|
||||||
|
int
|
||||||
|
engine_software_ddraw_args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: No Software DirectDraw Engine built\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
engine_software_ddraw_loop(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#include <windows.h>
|
||||||
|
#include <windowsx.h>
|
||||||
|
#include <ddraw.h>
|
||||||
|
#include <Evas_Engine_Software_DDraw.h>
|
||||||
|
|
||||||
|
|
||||||
|
static HWND window;
|
||||||
|
|
||||||
|
static int
|
||||||
|
_directdraw_init (HWND window,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
LPDIRECTDRAW *object,
|
||||||
|
LPDIRECTDRAWSURFACE *surface_primary,
|
||||||
|
LPDIRECTDRAWSURFACE *surface_back,
|
||||||
|
int *depth)
|
||||||
|
{
|
||||||
|
DDSURFACEDESC2 surface_desc;
|
||||||
|
DDPIXELFORMAT pixel_format;
|
||||||
|
LPDIRECTDRAWCLIPPER clipper;
|
||||||
|
LPDIRECTDRAW o;
|
||||||
|
DDSURFACEDESC2 *sd;
|
||||||
|
HRESULT res;
|
||||||
|
|
||||||
|
res = DirectDrawCreateEx (NULL, (void **)&o, &IID_IDirectDraw7, NULL);
|
||||||
|
if (FAILED(res))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
res = IDirectDraw7_SetCooperativeLevel (o, window, DDSCL_NORMAL);
|
||||||
|
if (FAILED(res))
|
||||||
|
{
|
||||||
|
IDirectDraw7_Release (o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = IDirectDraw7_CreateClipper (o, 0, &clipper, NULL);
|
||||||
|
if (FAILED(res))
|
||||||
|
{
|
||||||
|
IDirectDraw7_Release (o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = IDirectDrawClipper_SetHWnd (clipper, 0, window);
|
||||||
|
if (FAILED(res))
|
||||||
|
{
|
||||||
|
IDirectDrawClipper_Release (clipper);
|
||||||
|
IDirectDraw7_Release (o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
|
||||||
|
sd=&surface_desc;
|
||||||
|
res = IDirectDraw7_CreateSurface (o, (DDSURFACEDESC *)sd,
|
||||||
|
surface_primary, NULL);
|
||||||
|
if (FAILED(res))
|
||||||
|
{
|
||||||
|
IDirectDrawClipper_Release (clipper);
|
||||||
|
IDirectDraw7_Release (o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = IDirectDrawSurface7_SetClipper (*surface_primary, clipper);
|
||||||
|
if (FAILED(res))
|
||||||
|
{
|
||||||
|
IDirectDrawClipper_Release (clipper);
|
||||||
|
IDirectDrawSurface7_Release (*surface_primary);
|
||||||
|
IDirectDraw7_Release (o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset (&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||||
|
surface_desc.dwWidth = width;
|
||||||
|
surface_desc.dwHeight = height;
|
||||||
|
|
||||||
|
sd=&surface_desc;
|
||||||
|
res = IDirectDraw7_CreateSurface (o, (DDSURFACEDESC *)sd,
|
||||||
|
surface_back, NULL);
|
||||||
|
if (FAILED(res))
|
||||||
|
{
|
||||||
|
IDirectDrawClipper_Release (clipper);
|
||||||
|
IDirectDrawSurface7_Release (*surface_primary);
|
||||||
|
IDirectDraw7_Release (o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeroMemory(&pixel_format, sizeof(pixel_format));
|
||||||
|
pixel_format.dwSize = sizeof(pixel_format);
|
||||||
|
IDirectDrawSurface7_GetPixelFormat(*surface_primary, &pixel_format);
|
||||||
|
|
||||||
|
*object = o;
|
||||||
|
*depth = pixel_format.dwRGBBitCount;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LRESULT CALLBACK
|
||||||
|
MainWndProc(HWND hwnd,
|
||||||
|
UINT uMsg,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (uMsg)
|
||||||
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
return 0;
|
||||||
|
case WM_DESTROY:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
return 0;
|
||||||
|
case WM_WINDOWPOSCHANGED: {
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
|
hdc = BeginPaint (window, &ps);
|
||||||
|
printf ("WM_WINDOWPOSCHANGED (%d, %d), (%d, %d)\n",
|
||||||
|
ps.rcPaint.left,
|
||||||
|
ps.rcPaint.top,
|
||||||
|
ps.rcPaint.right - ps.rcPaint.left + 1,
|
||||||
|
ps.rcPaint.bottom - ps.rcPaint.top + 1);
|
||||||
|
evas_damage_rectangle_add(evas,
|
||||||
|
ps.rcPaint.left, ps.rcPaint.top,
|
||||||
|
ps.rcPaint.right - ps.rcPaint.left + 1,
|
||||||
|
ps.rcPaint.bottom - ps.rcPaint.top + 1);
|
||||||
|
EndPaint(window, &ps);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case WM_SIZING:
|
||||||
|
{
|
||||||
|
PRECT rect = (PRECT)lParam;
|
||||||
|
|
||||||
|
printf ("WM_SIZING\n");
|
||||||
|
evas_output_size_set(evas,
|
||||||
|
rect->right - rect->left + 1,
|
||||||
|
rect->bottom - rect->top + 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
printf ("WM_RBUTTONDOWN\n");
|
||||||
|
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
||||||
|
evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
|
||||||
|
return 0;
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
||||||
|
evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
|
||||||
|
return 0;
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
||||||
|
evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
|
||||||
|
return 0;
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
||||||
|
evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
|
||||||
|
return 0;
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL);
|
||||||
|
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
||||||
|
return 0;
|
||||||
|
case WM_MOUSELEAVE:
|
||||||
|
evas_event_feed_mouse_out(evas, 0, NULL);
|
||||||
|
return 0;
|
||||||
|
/* FIXME : can't find an event when the mouse is entering */
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
case WM_SYSKEYDOWN: {
|
||||||
|
int key;
|
||||||
|
|
||||||
|
key = LOWORD(wParam);
|
||||||
|
|
||||||
|
if ((key == VK_SHIFT) ||
|
||||||
|
(key == VK_LSHIFT) ||
|
||||||
|
(key == VK_RSHIFT))
|
||||||
|
evas_key_modifier_on(evas, "Shift");
|
||||||
|
if ((key == VK_CONTROL) ||
|
||||||
|
(key == VK_LCONTROL) ||
|
||||||
|
(key == VK_RCONTROL))
|
||||||
|
evas_key_modifier_on(evas, "Control");
|
||||||
|
if ((key == VK_MENU) ||
|
||||||
|
(key == VK_LMENU) ||
|
||||||
|
(key == VK_RMENU))
|
||||||
|
evas_key_modifier_on(evas, "Alt");
|
||||||
|
if ((key == VK_LWIN) ||
|
||||||
|
(key == VK_RWIN))
|
||||||
|
evas_key_modifier_on(evas, "Super");
|
||||||
|
|
||||||
|
if (key == VK_CAPITAL)
|
||||||
|
{
|
||||||
|
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
|
||||||
|
evas_key_lock_off(evas, "Caps_Lock");
|
||||||
|
else
|
||||||
|
evas_key_lock_on(evas, "Caps_Lock");
|
||||||
|
}
|
||||||
|
if (key == VK_NUMLOCK)
|
||||||
|
{
|
||||||
|
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
|
||||||
|
evas_key_lock_off(evas, "Num_Lock");
|
||||||
|
else
|
||||||
|
evas_key_lock_on(evas, "Num_Lock");
|
||||||
|
}
|
||||||
|
if (key == VK_SCROLL)
|
||||||
|
{
|
||||||
|
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
|
||||||
|
evas_key_lock_off(evas, "Scroll_Lock");
|
||||||
|
else
|
||||||
|
evas_key_lock_on(evas, "Scroll_Lock");
|
||||||
|
}
|
||||||
|
if (key == VK_ESCAPE)
|
||||||
|
evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
|
||||||
|
if (key == VK_RETURN)
|
||||||
|
evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
|
||||||
|
if (key == VK_LEFT)
|
||||||
|
evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL);
|
||||||
|
if (key == VK_RIGHT)
|
||||||
|
evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL);
|
||||||
|
if (key == 81)
|
||||||
|
evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
|
||||||
|
if (key == 113)
|
||||||
|
evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case WM_KEYUP:
|
||||||
|
case WM_SYSKEYUP: {
|
||||||
|
int key;
|
||||||
|
|
||||||
|
key = LOWORD(wParam);
|
||||||
|
|
||||||
|
if ((key == VK_SHIFT) ||
|
||||||
|
(key == VK_LSHIFT) ||
|
||||||
|
(key == VK_RSHIFT))
|
||||||
|
evas_key_modifier_off(evas, "Shift");
|
||||||
|
if ((key == VK_CONTROL) ||
|
||||||
|
(key == VK_LCONTROL) ||
|
||||||
|
(key == VK_RCONTROL))
|
||||||
|
evas_key_modifier_off(evas, "Control");
|
||||||
|
if ((key == VK_MENU) ||
|
||||||
|
(key == VK_LMENU) ||
|
||||||
|
(key == VK_RMENU))
|
||||||
|
evas_key_modifier_off(evas, "Alt");
|
||||||
|
if ((key == VK_LWIN) ||
|
||||||
|
(key == VK_RWIN))
|
||||||
|
evas_key_modifier_off(evas, "Super");
|
||||||
|
if (key == VK_ESCAPE)
|
||||||
|
evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
|
||||||
|
if (key == VK_RETURN)
|
||||||
|
evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL);
|
||||||
|
if (key == VK_LEFT)
|
||||||
|
evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL);
|
||||||
|
if (key == VK_RIGHT)
|
||||||
|
evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL);
|
||||||
|
if (key == 81)
|
||||||
|
evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
|
||||||
|
if (key == 113)
|
||||||
|
evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
engine_software_ddraw_args(int argc, char **argv)
|
||||||
|
{
|
||||||
|
WNDCLASS wc;
|
||||||
|
HINSTANCE hinstance;
|
||||||
|
MSG msg;
|
||||||
|
LPDIRECTDRAW object;
|
||||||
|
LPDIRECTDRAWSURFACE surface_primary;
|
||||||
|
LPDIRECTDRAWSURFACE surface_back;
|
||||||
|
Evas_Engine_Info_Software_DDraw *einfo;
|
||||||
|
int depth;
|
||||||
|
int i;
|
||||||
|
int ok = 0;
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
if ((!strcmp(argv[i], "-e")) && (i < (argc - 1)))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (!strcmp(argv[i], "ddraw")) ok = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ok) return 0;
|
||||||
|
|
||||||
|
hinstance = GetModuleHandle(0);
|
||||||
|
|
||||||
|
wc.style = 0;
|
||||||
|
wc.lpfnWndProc = MainWndProc;
|
||||||
|
wc.cbClsExtra = 0;
|
||||||
|
wc.cbWndExtra = 0;
|
||||||
|
wc.hInstance = hinstance;
|
||||||
|
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
|
||||||
|
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.lpszClassName = "Evas_Software_DDraw_Test";
|
||||||
|
|
||||||
|
if(!RegisterClass(&wc)) return EXIT_FAILURE;
|
||||||
|
|
||||||
|
window = CreateWindowEx(0,
|
||||||
|
"Evas_Software_DDraw_Test",
|
||||||
|
"Evas_Software_DDraw_Test",
|
||||||
|
WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
win_w, win_h,
|
||||||
|
NULL, NULL, hinstance, NULL);
|
||||||
|
if (!window) return EXIT_FAILURE;
|
||||||
|
|
||||||
|
if (!_directdraw_init(window, win_w, win_h,
|
||||||
|
&object,
|
||||||
|
&surface_primary,
|
||||||
|
&surface_back,
|
||||||
|
&depth))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
|
||||||
|
einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(evas);
|
||||||
|
if (!einfo)
|
||||||
|
{
|
||||||
|
printf("Evas does not support the Software DirectDraw Engine\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
einfo->info.window = window;
|
||||||
|
einfo->info.object = object;
|
||||||
|
einfo->info.surface_primary = surface_primary;
|
||||||
|
einfo->info.surface_back = surface_back;
|
||||||
|
einfo->info.depth = depth;
|
||||||
|
einfo->info.rotation = 0;
|
||||||
|
evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);
|
||||||
|
|
||||||
|
/* the second parameter is ignored, as it's the first call of ShowWindow */
|
||||||
|
ShowWindow(window, SW_SHOWDEFAULT);
|
||||||
|
UpdateWindow(window);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
engine_software_ddraw_loop(void)
|
||||||
|
{
|
||||||
|
MSG msg;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
again:
|
||||||
|
if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
res = GetMessage (&msg, NULL, 0, 0);
|
||||||
|
TranslateMessage (&msg);
|
||||||
|
DispatchMessage (&msg);
|
||||||
|
|
||||||
|
goto again;
|
||||||
|
printf ("fin loop\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_SOFTWARE_DDRAW */
|
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef __ENGINE_SOFTWARE_DDRAW_H__
|
||||||
|
#define __ENGINE_SOFTWARE_DDRAW_H__
|
||||||
|
|
||||||
|
|
||||||
|
int engine_software_ddraw_args(int argc, char **argv);
|
||||||
|
void engine_software_ddraw_loop(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __ENGINE_SOFTWARE_DDRAW_H__ */
|
|
@ -1099,6 +1099,8 @@ _engine_args(int argc, char **argv)
|
||||||
loop_func = engine_xrender_x11_loop;
|
loop_func = engine_xrender_x11_loop;
|
||||||
if (engine_software_16_x11_args(argc, argv))
|
if (engine_software_16_x11_args(argc, argv))
|
||||||
loop_func = engine_software_16_x11_loop;
|
loop_func = engine_software_16_x11_loop;
|
||||||
|
if (engine_software_ddraw_args(argc, argv))
|
||||||
|
loop_func = engine_software_ddraw_loop;
|
||||||
if (!loop_func)
|
if (!loop_func)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -1108,7 +1110,7 @@ _engine_args(int argc, char **argv)
|
||||||
" -e ENGINE\n"
|
" -e ENGINE\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Where ENGINE can be one of:\n"
|
"Where ENGINE can be one of:\n"
|
||||||
" x11 xr gl x11-16\n"
|
" x11 xr gl x11-16 ddraw\n"
|
||||||
);
|
);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "engine_gl_x11.h"
|
#include "engine_gl_x11.h"
|
||||||
#include "engine_xrender_x11.h"
|
#include "engine_xrender_x11.h"
|
||||||
#include "engine_software_16_x11.h"
|
#include "engine_software_16_x11.h"
|
||||||
|
#include "engine_software_ddraw.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue