GrafX2 2.9.3227
The ultimate 256-color painting program
win32screen.c File Reference
#include <windows.h>
#include <windowsx.h>
#include <malloc.h>
#include <stdio.h>
#include "gfx2mem.h"
#include "gfx2log.h"
#include "screen.h"
#include "errors.h"
#include "input.h"
#include "keyboard.h"
#include "unicode.h"
+ Include dependency graph for win32screen.c:

Functions

int Handle_special_key_press (void)
 check Keys that emulate mouse moves, etc. More...
 
int Release_control (int key_code, int modifier)
 
void * GFX2_Get_Window_Handle ()
 
static void Win32_Repaint (HWND hwnd)
 Blit our "framebuffer" bitmap to the Window. More...
 
static LRESULT CALLBACK Win32_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 WindowProc callback function. More...
 
int Init_Win32 (HINSTANCE hInstance, HINSTANCE hPrevInstance)
 
static int Video_AllocateDib (int width, int height)
 
static void Win32_CreateWindow (int width, int height, int fullscreen)
 
void GFX2_Set_mode (int *width, int *height, int fullscreen)
 Sets the new screen/window dimensions. More...
 
byte Get_Screen_pixel (int x, int y)
 
void Set_Screen_pixel (int x, int y, byte value)
 
byteGet_Screen_pixel_ptr (int x, int y)
 
void Screen_FillRect (int x, int y, int w, int h, byte color)
 
void Update_rect (short x, short y, unsigned short width, unsigned short height)
 
void Flush_update (void)
 
void Update_status_line (short char_pos, short width)
 
int GFX2_SetPalette (const T_Components *colors, int firstcolor, int ncolors)
 
void Clear_border (byte color)
 Clears the parts of screen that are outside of the editing area. More...
 
void Allow_drag_and_drop (int flag)
 Activates or desactivates file drag-dropping in program window. More...
 
void Define_icon (void)
 Set application icon(s) More...
 
void Set_mouse_position (void)
 set (system) mouse cursor position More...
 
int GFX2_GetScreenSize (int *width, int *height)
 Get Screen dimensions. More...
 
int GFX2_MessageBox (const char *text, const char *caption, unsigned int type)
 Display a modal message. More...
 

Variables

int user_feedback_required
 
word Input_new_mouse_X
 
word Input_new_mouse_Y
 
byte Input_new_mouse_K
 
static HBITMAP Windows_DIB = NULL
 
static void * Windows_Screen = NULL
 
static int Windows_DIB_width = 0
 
static int Windows_DIB_height = 0
 
static HWND Win32_hwnd = NULL
 
static int Win32_Is_Fullscreen = 0
 
volatile int Allow_colorcycling = 0
 

Function Documentation

◆ Handle_special_key_press()

◆ Release_control()

◆ GFX2_Get_Window_Handle()

◆ Win32_Repaint()

static void Win32_Repaint ( HWND  hwnd)
static

Blit our "framebuffer" bitmap to the Window.

References FALSE, GFX2_INFO, GFX2_Log(), and Windows_DIB.

Referenced by Win32_WindowProc().

◆ Win32_WindowProc()

◆ Init_Win32()

int Init_Win32 ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance 
)

References Error, ERROR_INIT, GFX2_Log(), GFX2_WARNING, NULL, and Win32_WindowProc().

Referenced by main().

◆ Video_AllocateDib()

static int Video_AllocateDib ( int  width,
int  height 
)
static

◆ Win32_CreateWindow()

static void Win32_CreateWindow ( int  width,
int  height,
int  fullscreen 
)
static

◆ GFX2_Set_mode()

void GFX2_Set_mode ( int *  width,
int *  height,
int  fullscreen 
)

◆ Get_Screen_pixel()

byte Get_Screen_pixel ( int  x,
int  y 
)

◆ Set_Screen_pixel()

void Set_Screen_pixel ( int  x,
int  y,
byte  value 
)

◆ Get_Screen_pixel_ptr()

byte * Get_Screen_pixel_ptr ( int  x,
int  y 
)

References NULL, Windows_DIB_width, and Windows_Screen.

Referenced by Screen_FillRect().

◆ Screen_FillRect()

void Screen_FillRect ( int  x,
int  y,
int  w,
int  h,
byte  color 
)

◆ Update_rect()

void Update_rect ( short  x,
short  y,
unsigned short  width,
unsigned short  height 
)

References FALSE, NULL, Pixel_height, Pixel_width, and Win32_hwnd.

Referenced by Update_status_line().

◆ Flush_update()

void Flush_update ( void  )

◆ Update_status_line()

void Update_status_line ( short  char_pos,
short  width 
)

◆ GFX2_SetPalette()

int GFX2_SetPalette ( const T_Components colors,
int  firstcolor,
int  ncolors 
)

◆ Clear_border()

void Clear_border ( byte  color)

Clears the parts of screen that are outside of the editing area.

There is such area only if the screen mode is not a multiple of the pixel size, eg: 3x3 pixels in 1024x768 leaves 1 column on the right, 0 rows on bottom.

◆ Allow_drag_and_drop()

void Allow_drag_and_drop ( int  flag)

Activates or desactivates file drag-dropping in program window.

References FALSE, GFX2_Get_Window_Handle(), and TRUE.

◆ Define_icon()

void Define_icon ( void  )

Set application icon(s)

◆ Set_mouse_position()

void Set_mouse_position ( void  )

set (system) mouse cursor position

References GFX2_Log(), GFX2_WARNING, Mouse_X, Mouse_Y, Pixel_height, Pixel_width, and Win32_hwnd.

◆ GFX2_GetScreenSize()

int GFX2_GetScreenSize ( int *  width,
int *  height 
)

Get Screen dimensions.

References NULL.

Referenced by Set_all_video_modes().

◆ GFX2_MessageBox()

int GFX2_MessageBox ( const char *  text,
const char *  caption,
unsigned int  type 
)

Display a modal message.

Parameters
textbody of the modal message
captiontitle of the message
typeone of GFX2_MB_INFO, GFX2_MB_ERROR, GFX2_MB_WARNING
Returns
0 for error

References GFX2_Get_Window_Handle().

Variable Documentation

◆ user_feedback_required

int user_feedback_required
extern

Referenced by Get_input(), and Win32_WindowProc().

◆ Input_new_mouse_X

word Input_new_mouse_X
extern

◆ Input_new_mouse_Y

word Input_new_mouse_Y
extern

◆ Input_new_mouse_K

◆ Windows_DIB

HBITMAP Windows_DIB = NULL
static

◆ Windows_Screen

void* Windows_Screen = NULL
static

◆ Windows_DIB_width

◆ Windows_DIB_height

int Windows_DIB_height = 0
static

◆ Win32_hwnd

◆ Win32_Is_Fullscreen

int Win32_Is_Fullscreen = 0
static

Referenced by GFX2_Set_mode(), and Win32_WindowProc().

◆ Allow_colorcycling

volatile int Allow_colorcycling = 0