mirror of
https://github.com/holub/mame
synced 2025-05-01 12:16:56 +03:00
159 lines
4.6 KiB
C
159 lines
4.6 KiB
C
//============================================================
|
|
//
|
|
// window.h - SDL window handling
|
|
//
|
|
// Copyright (c) 1996-2006, Nicola Salmoria and the MAME Team.
|
|
// Visit http://mamedev.org for licensing and usage restrictions.
|
|
//
|
|
// SDLMAME by Olivier Galibert and R. Belmont
|
|
//
|
|
//============================================================
|
|
|
|
#ifndef __SDLWINDOW__
|
|
#define __SDLWINDOW__
|
|
|
|
#include <SDL/SDL.h>
|
|
#include "video.h"
|
|
#include "render.h"
|
|
#include "sdlsync.h"
|
|
|
|
#include "osd_opengl.h"
|
|
#include "osdsdl.h"
|
|
|
|
// I don't like this, but we're going to get spurious "cast to integer of different size" warnings on
|
|
// at least one architecture without doing it this way.
|
|
#ifdef PTR64
|
|
typedef UINT64 HashT;
|
|
#else
|
|
typedef UINT32 HashT;
|
|
#endif
|
|
|
|
//============================================================
|
|
// TYPE DEFINITIONS
|
|
//============================================================
|
|
|
|
typedef struct _sdl_window_info sdl_window_info;
|
|
struct _sdl_window_info
|
|
{
|
|
// Pointer to next window
|
|
sdl_window_info * next;
|
|
|
|
// Pointer to machine
|
|
running_machine * machine;
|
|
|
|
// Draw Callbacks
|
|
int (*create)(sdl_window_info *window, int width, int height);
|
|
void (*resize)(sdl_window_info *window, int width, int height);
|
|
int (*draw)(sdl_window_info *window, UINT32 dc, int update);
|
|
render_primitive_list &(*get_primitives)(sdl_window_info *window);
|
|
int (*xy_to_render_target)(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
|
void (*destroy_all_textures)(sdl_window_info *window);
|
|
void (*destroy)(sdl_window_info *window);
|
|
void (*clear)(sdl_window_info *window);
|
|
|
|
// window handle and info
|
|
char title[256];
|
|
|
|
// monitor info
|
|
sdl_monitor_info * monitor;
|
|
int fullscreen;
|
|
int index;
|
|
|
|
// diverse flags
|
|
int minwidth, minheight;
|
|
int maxwidth, maxheight;
|
|
int depth;
|
|
int refresh;
|
|
int windowed_width;
|
|
int windowed_height;
|
|
int startmaximized;
|
|
|
|
// rendering info
|
|
osd_event * rendered_event;
|
|
render_target * target;
|
|
render_primitive_list *primlist;
|
|
|
|
// drawing data
|
|
void * dxdata;
|
|
|
|
// cache of physical width and height
|
|
int width;
|
|
int height;
|
|
|
|
// current blitwidth and height
|
|
int blitwidth;
|
|
int blitheight;
|
|
|
|
int totalColors; // total colors from machine/sdl_window_config
|
|
int start_viewscreen;
|
|
|
|
// per window modes ...
|
|
int scale_mode;
|
|
|
|
// GL specific
|
|
int prescale;
|
|
|
|
#if (SDL_VERSION_ATLEAST(1,3,0))
|
|
// Needs to be here as well so we can identify window
|
|
SDL_Window *sdl_window;
|
|
SDL_Renderer *sdl_renderer;
|
|
// These are used in combine resizing events ... #if SDL13_COMBINE_RESIZE
|
|
int resize_width;
|
|
int resize_height;
|
|
osd_ticks_t last_resize;
|
|
#endif
|
|
};
|
|
|
|
typedef struct _sdl_draw_info sdl_draw_info;
|
|
struct _sdl_draw_info
|
|
{
|
|
void (*exit)(void);
|
|
void (*attach)(sdl_draw_info *info, sdl_window_info *window);
|
|
};
|
|
|
|
//============================================================
|
|
// GLOBAL VARIABLES
|
|
//============================================================
|
|
|
|
// window - list
|
|
extern sdl_window_info *sdl_window_list;
|
|
|
|
//============================================================
|
|
// PROTOTYPES
|
|
//============================================================
|
|
|
|
// core initialization
|
|
int sdlwindow_init(running_machine *machine);
|
|
|
|
// creation/deletion of windows
|
|
int sdlwindow_video_window_create(running_machine *machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config);
|
|
void sdlwindow_video_window_update(running_machine *machine, sdl_window_info *window);
|
|
void sdlwindow_blit_surface_size(sdl_window_info *window, int window_width, int window_height);
|
|
void sdlwindow_toggle_full_screen(running_machine *machine, sdl_window_info *window);
|
|
void sdlwindow_modify_prescale(running_machine *machine, sdl_window_info *window, int dir);
|
|
void sdlwindow_resize(sdl_window_info *window, INT32 width, INT32 height);
|
|
void sdlwindow_clear(sdl_window_info *window);
|
|
|
|
|
|
//============================================================
|
|
// PROTOTYPES - drawsdl.c
|
|
//============================================================
|
|
|
|
int drawsdl_init(sdl_draw_info *callbacks);
|
|
const char *drawsdl_scale_mode_str(int index);
|
|
int drawsdl_scale_mode(const char *s);
|
|
|
|
//============================================================
|
|
// PROTOTYPES - drawogl.c
|
|
//============================================================
|
|
|
|
int drawogl_init(running_machine &machine, sdl_draw_info *callbacks);
|
|
|
|
//============================================================
|
|
// PROTOTYPES - draw13.c
|
|
//============================================================
|
|
|
|
int draw13_init(running_machine &machine, sdl_draw_info *callbacks);
|
|
|
|
#endif /* __SDLWINDOW__ */
|