gui_win32.cpp File Reference


Detailed Description

Win32 GUI implementation.

Allows use of gfx without SDL on WIndows

Id
gui_win32.cpp,v 1.8 2008/03/14 15:31:29 iamcamiel Exp

X-1.5 Camiel Vanderhoeven 05-MAR-2008 Multi-threading version.

X-1.4 Camiel Vanderhoeven 12-FEB-2008 Moved keyboard code into it's own class (CKeyboard)

X-1.3 Camiel Vanderhoeven 22-JAN-2008 Commented out mousewheel-code, doesn't work with older win32 versions.

X-1.2 Camiel Vanderhoeven 19-JAN-2008 Changed window title.

X-1.1 Camiel Vanderhoeven 19-JAN-2008 Initial version for ES40 emulator.

Definition in file gui_win32.cpp.

#include "../StdAfx.h"
#include <process.h>
#include "gui_win32_font.h"
#include "keymap.h"
#include "../Configurator.h"
#include "../VGA.h"
#include "../Keyboard.h"
#include "gui.h"

Go to the source code of this file.

Data Structures

class  bx_win32_gui_c
struct  QueueEvent
struct  sharedThreadInfo

Defines

#define EXIT_GUI_SHUTDOWN   1
#define EXIT_GMH_FAILURE   2
#define EXIT_FONT_BITMAP_ERROR   3
#define EXIT_NORMAL   4
#define EXIT_HEADER_BITMAP_ERROR   5
#define SCANCODE_BUFSIZE   20
#define MOUSE_PRESSED   0x20000000
#define MOUSE_MOTION   0x22000000
#define BX_SYSKEY   (KF_UP | KF_REPEAT | KF_ALTDOWN)

Functions

int libwin32_LTX_plugin_init (CConfigurator *cfg)
void libwin32_LTX_plugin_fini (void)
void enq_key_event (u32, u32)
void enq_mouse_event (void)
QueueEventdeq_key_event (void)
LRESULT CALLBACK mainWndProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK simWndProc (HWND, UINT, WPARAM, LPARAM)
VOID UIThread (PVOID)
void terminateEmul (int)
void create_vga_font (void)
static unsigned char reverse_bitorder (unsigned char)
void DrawBitmap (HDC, HBITMAP, int, int, int, int, int, int, DWORD, unsigned char)
void DrawChar (HDC, unsigned char, int, int, unsigned char cColor, int, int)
void updateUpdated (int, int, int, int)
static void processMouseXY (int x, int y, int z, int windows_state, int implied_state_change)
static void resetDelta ()
static void cursorWarped ()
void resize_main_window ()
void SetMouseCapture ()
COLORREF GetColorRef (unsigned char attr)

Variables

static bx_win32_gui_ctheGui = NULL
static QueueEvent keyevents [20]
static unsigned head = 0
static unsigned tail = 0
static int mouse_button_state = 0
static int ms_xdelta = 0
static int ms_ydelta = 0
static int ms_zdelta = 0
static int ms_lastx = 0
static int ms_lasty = 0
static int ms_savedx = 0
static int ms_savedy = 0
static BOOL mouseCaptureMode
static BOOL mouseCaptureNew
static BOOL mouseToggleReq
static unsigned long workerThread = 0
static DWORD workerThreadID = 0
static int mouse_buttons = 3
static unsigned x_tilesize = 0
static unsigned y_tilesize = 0
static BITMAPINFO * bitmap_info = (BITMAPINFO*) 0
static RGBQUAD * cmap_index
static HBITMAP MemoryBitmap = NULL
static HDC MemoryDC = NULL
static RECT updated_area
static BOOL updated_area_valid = false
static HWND desktopWindow
static RECT desktop
static BOOL queryFullScreen = false
static int desktop_x
static int desktop_y
static unsigned prev_cursor_x = 0
static unsigned prev_cursor_y = 0
static HBITMAP vgafont [256]
static int xChar = 8
static int yChar = 16
static unsigned int text_rows = 25
static unsigned int text_cols = 80
static u8 text_pal_idx [16]
static u8 h_panning = 0
static u8 v_panning = 0
static u16 line_compare = 1023
static unsigned dimension_x
static unsigned dimension_y
static unsigned current_bpp
static unsigned stretched_x
static unsigned stretched_y
static unsigned stretch_factor = 1
static BOOL BxTextMode = true
static BOOL fix_size = false
static HWND hotKeyReceiver = NULL
static HWND saveParent = NULL
static char szAppName [] = "ES40 Emulator"
static char szWindowName [] = "ES40 Emulator"
sharedThreadInfo stInfo
u32 win32_to_bx_key [2][0x100]


Define Documentation

#define BX_SYSKEY   (KF_UP | KF_REPEAT | KF_ALTDOWN)

Definition at line 115 of file gui_win32.cpp.

Referenced by simWndProc().

#define EXIT_FONT_BITMAP_ERROR   3

Definition at line 107 of file gui_win32.cpp.

Referenced by create_vga_font(), and terminateEmul().

#define EXIT_GMH_FAILURE   2

Definition at line 106 of file gui_win32.cpp.

Referenced by bx_win32_gui_c::specific_init(), and terminateEmul().

#define EXIT_GUI_SHUTDOWN   1

Definition at line 105 of file gui_win32.cpp.

Referenced by terminateEmul(), and UIThread().

#define EXIT_HEADER_BITMAP_ERROR   5

Definition at line 109 of file gui_win32.cpp.

#define EXIT_NORMAL   4

Definition at line 108 of file gui_win32.cpp.

Referenced by bx_win32_gui_c::exit(), and terminateEmul().

#define MOUSE_MOTION   0x22000000

Definition at line 114 of file gui_win32.cpp.

Referenced by enq_mouse_event(), and bx_win32_gui_c::handle_events().

#define MOUSE_PRESSED   0x20000000

Definition at line 113 of file gui_win32.cpp.

Referenced by bx_win32_gui_c::handle_events(), and processMouseXY().

#define SCANCODE_BUFSIZE   20

Definition at line 112 of file gui_win32.cpp.

Referenced by deq_key_event(), enq_key_event(), and enq_mouse_event().


Function Documentation

void create_vga_font ( void   ) 

static void cursorWarped (  )  [static]

QueueEvent * deq_key_event ( void   ) 

Definition at line 1274 of file gui_win32.cpp.

References BX_ERROR, SCANCODE_BUFSIZE, and tail.

Referenced by bx_win32_gui_c::handle_events().

void DrawBitmap ( HDC  hdc,
HBITMAP  hBitmap,
int  xStart,
int  yStart,
int  width,
int  height,
int  fcol,
int  frow,
DWORD  dwRop,
unsigned char  cColor 
)

Definition at line 1916 of file gui_win32.cpp.

References GetColorRef(), and updateUpdated().

Referenced by bx_win32_gui_c::text_update().

void DrawChar ( HDC  ,
unsigned  char,
int  ,
int  ,
unsigned char  cColor,
int  ,
int   
)

void enq_key_event ( u32  key,
u32  press_release 
)

void enq_mouse_event ( void   ) 

COLORREF GetColorRef ( unsigned char  attr  ) 

Definition at line 1909 of file gui_win32.cpp.

Referenced by DrawBitmap().

void libwin32_LTX_plugin_fini ( void   ) 

Definition at line 104 of file gui_win32.cpp.

int libwin32_LTX_plugin_init ( CConfigurator cfg  ) 

Definition at line 104 of file gui_win32.cpp.

LRESULT CALLBACK mainWndProc ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 860 of file gui_win32.cpp.

References BX_ERROR, and sharedThreadInfo::simWnd.

Referenced by UIThread().

static void processMouseXY ( int  x,
int  y,
int  z,
int  windows_state,
int  implied_state_change 
) [static]

static void resetDelta (  )  [static]

Definition at line 525 of file gui_win32.cpp.

References sharedThreadInfo::mouseCS, ms_lasty, ms_savedy, ms_ydelta, and ms_zdelta.

Referenced by enq_mouse_event().

void resize_main_window (  ) 

unsigned char reverse_bitorder ( unsigned char  b  )  [static]

Definition at line 1896 of file gui_win32.cpp.

Referenced by create_vga_font().

void SetMouseCapture (  ) 

Definition at line 908 of file gui_win32.cpp.

References cursorWarped(), and sharedThreadInfo::simWnd.

Referenced by simWndProc().

LRESULT CALLBACK simWndProc ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)

void terminateEmul ( int  reason  ) 

VOID UIThread ( PVOID  pvoid  ) 

void updateUpdated ( int  x1,
int  y1,
int  x2,
int  y2 
)


Variable Documentation

BITMAPINFO* bitmap_info = (BITMAPINFO*) 0 [static]

Definition at line 142 of file gui_win32.cpp.

BOOL BxTextMode = true [static]

Definition at line 168 of file gui_win32.cpp.

RGBQUAD* cmap_index [static]

Definition at line 143 of file gui_win32.cpp.

unsigned current_bpp [static]

Definition at line 165 of file gui_win32.cpp.

RECT desktop [static]

Definition at line 149 of file gui_win32.cpp.

int desktop_x [static]

Definition at line 151 of file gui_win32.cpp.

int desktop_y [static]

Definition at line 151 of file gui_win32.cpp.

HWND desktopWindow [static]

Definition at line 148 of file gui_win32.cpp.

unsigned dimension_x [static]

Definition at line 165 of file gui_win32.cpp.

unsigned dimension_y [static]

BOOL fix_size = false [static]

Definition at line 169 of file gui_win32.cpp.

u8 h_panning = 0 [static]

Definition at line 161 of file gui_win32.cpp.

Referenced by bx_sdl_gui_c::text_update().

unsigned head = 0 [static]

Definition at line 130 of file gui_win32.cpp.

HWND hotKeyReceiver = NULL [static]

Definition at line 170 of file gui_win32.cpp.

QueueEvent keyevents[20] [static]

Definition at line 129 of file gui_win32.cpp.

u16 line_compare = 1023 [static]

Definition at line 162 of file gui_win32.cpp.

Referenced by bx_sdl_gui_c::text_update(), CS3Trio64::update(), and CCirrus::update().

HBITMAP MemoryBitmap = NULL [static]

Definition at line 144 of file gui_win32.cpp.

HDC MemoryDC = NULL [static]

Definition at line 145 of file gui_win32.cpp.

int mouse_button_state = 0 [static]

Definition at line 131 of file gui_win32.cpp.

int mouse_buttons = 3 [static]

Definition at line 138 of file gui_win32.cpp.

BOOL mouseCaptureMode [static]

Definition at line 135 of file gui_win32.cpp.

BOOL mouseCaptureNew [static]

Definition at line 135 of file gui_win32.cpp.

BOOL mouseToggleReq [static]

Definition at line 135 of file gui_win32.cpp.

int ms_lastx = 0 [static]

Definition at line 133 of file gui_win32.cpp.

int ms_lasty = 0 [static]

Definition at line 133 of file gui_win32.cpp.

Referenced by cursorWarped(), processMouseXY(), and resetDelta().

int ms_savedx = 0 [static]

Definition at line 134 of file gui_win32.cpp.

int ms_savedy = 0 [static]

Definition at line 134 of file gui_win32.cpp.

Referenced by cursorWarped(), processMouseXY(), and resetDelta().

int ms_xdelta = 0 [static]

Definition at line 132 of file gui_win32.cpp.

int ms_ydelta = 0 [static]

Definition at line 132 of file gui_win32.cpp.

Referenced by enq_mouse_event(), processMouseXY(), and resetDelta().

int ms_zdelta = 0 [static]

Definition at line 132 of file gui_win32.cpp.

Referenced by enq_mouse_event(), processMouseXY(), and resetDelta().

unsigned prev_cursor_x = 0 [static]

Definition at line 154 of file gui_win32.cpp.

Referenced by bx_sdl_gui_c::text_update().

unsigned prev_cursor_y = 0 [static]

Definition at line 155 of file gui_win32.cpp.

Referenced by bx_sdl_gui_c::text_update().

BOOL queryFullScreen = false [static]

Definition at line 150 of file gui_win32.cpp.

HWND saveParent = NULL [static]

Definition at line 171 of file gui_win32.cpp.

Definition at line 190 of file gui_win32.cpp.

unsigned stretch_factor = 1 [static]

Definition at line 167 of file gui_win32.cpp.

unsigned stretched_x [static]

Definition at line 166 of file gui_win32.cpp.

unsigned stretched_y [static]

Definition at line 166 of file gui_win32.cpp.

char szAppName[] = "ES40 Emulator" [static]

Definition at line 173 of file gui_win32.cpp.

char szWindowName[] = "ES40 Emulator" [static]

Definition at line 174 of file gui_win32.cpp.

unsigned tail = 0 [static]

unsigned int text_cols = 80 [static]

u8 text_pal_idx[16] [static]

Definition at line 159 of file gui_win32.cpp.

unsigned int text_rows = 25 [static]

Definition at line 158 of file gui_win32.cpp.

Referenced by bx_sdl_gui_c::dimension_update(), and bx_sdl_gui_c::text_update().

bx_win32_gui_c* theGui = NULL [static]

Definition at line 103 of file gui_win32.cpp.

RECT updated_area [static]

Definition at line 146 of file gui_win32.cpp.

BOOL updated_area_valid = false [static]

Definition at line 147 of file gui_win32.cpp.

u8 v_panning = 0 [static]

HBITMAP vgafont[256] [static]

Definition at line 156 of file gui_win32.cpp.

u32 win32_to_bx_key[2][0x100]

Definition at line 204 of file gui_win32.cpp.

unsigned long workerThread = 0 [static]

Definition at line 136 of file gui_win32.cpp.

DWORD workerThreadID = 0 [static]

Definition at line 137 of file gui_win32.cpp.

unsigned x_tilesize = 0 [static]

Definition at line 141 of file gui_win32.cpp.

int xChar = 8 [static]

Definition at line 157 of file gui_win32.cpp.

unsigned y_tilesize = 0 [static]

int yChar = 16 [static]

Definition at line 157 of file gui_win32.cpp.

Referenced by bx_win32_gui_c::dimension_update(), and bx_win32_gui_c::text_update().


SourceForge.net Logo
Project space on SourceForge.net