Exemplo n.º 1
0
/* Misc. SDL event handling */
void ui_handle_misc_sdl_event(SDL_Event e)
{
    switch (e.type) {
        case SDL_QUIT:
            DBG(("ui_handle_misc_sdl_event: SDL_QUIT"));
            ui_sdl_quit();
            break;
        case SDL_VIDEORESIZE:
            DBG(("ui_handle_misc_sdl_event: SDL_VIDEORESIZE (%d,%d)", (unsigned int)e.resize.w, (unsigned int)e.resize.h));
            sdl_video_resize_event((unsigned int)e.resize.w, (unsigned int)e.resize.h);
            video_canvas_refresh_all(sdl_active_canvas);
            break;
        case SDL_ACTIVEEVENT:
            DBG(("ui_handle_misc_sdl_event: SDL_ACTIVEEVENT"));
            if ((e.active.state & SDL_APPACTIVE) && e.active.gain) {
                video_canvas_refresh_all(sdl_active_canvas);
            }
            break;
        case SDL_VIDEOEXPOSE:
            DBG(("ui_handle_misc_sdl_event: SDL_VIDEOEXPOSE"));
            video_canvas_refresh_all(sdl_active_canvas);
            break;
#ifdef SDL_DEBUG
        case SDL_USEREVENT:
            DBG(("ui_handle_misc_sdl_event: SDL_USEREVENT"));
            break;
        case SDL_SYSWMEVENT:
            DBG(("ui_handle_misc_sdl_event: SDL_SYSWMEVENT"));
            break;
#endif
        default:
            DBG(("ui_handle_misc_sdl_event: unhandled"));
            break;
    }
}
Exemplo n.º 2
0
void SwitchToWindowedModeDx9(HWND hwnd)
{
    video_canvas_t *c;

    fullscreen_transition = 1;

    c = video_canvas_for_hwnd(hwnd);

    video_device_release_dx9(c);

    /* Create statusbar here to get correct dimensions for client window */
    statusbar_create(hwnd);
    ui_set_render_window(c, 0);

    LockWindowUpdate(hwnd);
    SetWindowLong(hwnd, GWL_STYLE, old_style);
    /* Restore  Menu */
    SetMenu(hwnd,old_menu);
    ui_show_menu();
    SetWindowPos(hwnd, HWND_NOTOPMOST, old_rect.left, old_rect.top, old_rect.right - old_rect.left, old_rect.bottom - old_rect.top, SWP_NOCOPYBITS);
    ShowCursor(TRUE);
    LockWindowUpdate(NULL);

    video_device_create_dx9(c, 0);
    video_canvas_refresh_all(c);

    fullscreen_transition = 0;
    c->refreshrate = old_refreshrate;
}
Exemplo n.º 3
0
void SwitchToFullscreenModeDx9(HWND hwnd)
{
    video_canvas_t *c;

    fullscreen_transition = 1;

    c = video_canvas_for_hwnd(hwnd);

    video_device_release_dx9(c);

    statusbar_destroy(hwnd);

    /*  Remove Window stuff that prevents fullscreen display */
    old_style = GetWindowLong(hwnd, GWL_STYLE);
    GetWindowRect(hwnd, &old_rect);
    SetWindowLong(hwnd, GWL_STYLE, old_style & ~WS_SYSMENU & ~WS_CAPTION);
    old_menu = GetMenu(hwnd);
    SetMenu(hwnd, NULL);
    ShowCursor(FALSE);

    ui_set_render_window(c, 1);
    video_device_create_dx9(c, 1);
    video_canvas_refresh_all(c);

    fullscreen_active = 1;
    fullscreen_transition = 0;
}
Exemplo n.º 4
0
int video_canvas_palette_set(struct video_canvas_s *canvas, struct palette_s *palette)
{
	struct palette_s *old_palette;

	if (palette == NULL)
		return 0;

	old_palette = canvas->palette;

	if (canvas->created)
	{
		if (video_canvas_set_palette(canvas, palette) < 0)
			return -1;
	}
	else
		canvas->palette = palette;

	if (old_palette != NULL)
		video_color_palette_free(old_palette);

	if (canvas->created)
		video_canvas_refresh_all(canvas);

	return 0;
}
Exemplo n.º 5
0
static int set_double_scan_enabled(int val, void *param)
{
    video_canvas_t *canvas = (video_canvas_t *)param;

    canvas->videoconfig->doublescan = val ? 1 : 0;
    canvas->videoconfig->color_tables.updated = 0;

    if (canvas->initialized) {
        video_canvas_refresh_all(canvas);
    }
    return 0;
}
Exemplo n.º 6
0
void video_canvas_update_dx9(HWND hwnd, HDC hdc, int xclient, int yclient, int w, int h)
{
    video_canvas_t *canvas;

    canvas = video_canvas_for_hwnd(hwnd);
    if (canvas == NULL) {
        return;
    }

    /* Just refresh the whole canvas */
    video_canvas_refresh_all(canvas);
}
Exemplo n.º 7
0
static int set_scale2x_enabled(int val, void *param)
{
    video_canvas_t *canvas = (video_canvas_t *)param;

    canvas->videoconfig->scale2x = val;

    if (canvas->initialized)
        video_canvas_refresh_all(canvas);

    video_resources_update_ui(canvas);

    return 0;
}
Exemplo n.º 8
0
static int set_chip_rendermode(int val, void *param)
{
    char *chip, *dsize;
    int old, err;
    video_canvas_t *canvas = (video_canvas_t *)param;

    switch (val) {
        case VIDEO_FILTER_NONE:
        case VIDEO_FILTER_CRT:
        case VIDEO_FILTER_SCALE2X:
            break;
        default:
            return -1;
    }

    old = canvas->videoconfig->filter;
    chip = canvas->videoconfig->chip_name;

    DBG(("set_chip_rendermode %s (canvas:%p) (%d->%d)", chip, canvas, old, val));

    dsize = util_concat(chip, "DoubleSize", NULL);

    canvas->videoconfig->filter = val;
    canvas->videoconfig->scale2x = 0; /* FIXME: remove this */
    canvas->videoconfig->color_tables.updated = 0;
    err = 0;
    switch (val) {
        case VIDEO_FILTER_NONE:
            break;
        case VIDEO_FILTER_CRT:
            break;
        case VIDEO_FILTER_SCALE2X:
            /* set double size */
            if (resources_set_int(dsize, 1) < 0) {
                err = 1;
            }
            canvas->videoconfig->scale2x = 1; /* FIXME: remove this */
            break;
    }

    if (err) {
        canvas->videoconfig->filter = old;
    }

    lib_free(dsize);

    if (canvas->initialized) {
        video_canvas_refresh_all(canvas);
    }
    return 0;
}
Exemplo n.º 9
0
void video_canvas_redraw_size(video_canvas_t *canvas, unsigned int width, unsigned int height)
{
	if (canvas->videoconfig->doublesizex)
		width /= 2;
	if (canvas->videoconfig->doublesizey)
		height /= 2;

	if (width != canvas->draw_buffer->canvas_width || height != canvas->draw_buffer->canvas_height)
	{
		canvas->draw_buffer->canvas_width = width;
		canvas->draw_buffer->canvas_height = height;
		video_viewport_resize(canvas);
	}
	video_canvas_refresh_all(canvas);
}