Descent3/lib/linux/lnxdraw.h

126 lines
3.4 KiB
C
Raw Normal View History

2024-04-16 03:43:29 +00:00
#ifndef __LNXDRAW_H_
#define __LNXDRAW_H_
//#include "dyna_xwin.h"
//#include "dyna_xext.h"
#include <SDL.h>
2024-04-16 18:56:40 +00:00
typedef struct {
// Display *dDisplay; // Which X-Windows Display to use
int nScreen; // Which X-Windows screen to use
} LnxVideoDesc;
typedef struct {
unsigned int bpp; // bits per pixel.
unsigned int dwFlags; // flags for window
unsigned int dwWidth; // width of the created window
unsigned int dwHeight; // height of the created window
unsigned int dwXPos; // Top-Left X position
unsigned int dwYPos; // Top-Left Y position
char *lpszName; // Window name
// Window *pre_created_window; // Window already created
// XVisualInfo pre_created_visinfo;
} LnxWindowDesc;
2024-04-16 03:43:29 +00:00
//#define LNXDRAWF_USEPRECREATEDWIN 0x01
2024-04-16 18:56:40 +00:00
typedef struct {
// XSizeHints *lpSizeHints;
// XWMHints *lpWmHints;
// XClassHint *lpClassHints;
// Visual *lpXvisual;
// Window wWindow;
SDL_Surface *surface;
// bool bHaveSharedMemory;
bool bLocked;
// bool WindowPreCreated;
// XVisualInfo viVisualInfo;
// Colormap cmColorMap;
unsigned char *lpBuffer;
// GC m_GC;
// XImage *lpImage;
// XShmSegmentInfo shmInfo;
unsigned int dwWidth; // width of the created window
unsigned int dwHeight; // height of the created window
bool fullScreen;
unsigned int lock_x, lock_y, lock_w, lock_h;
unsigned char *lock_ptr;
} LnxWindow;
2024-04-16 03:43:29 +00:00
//////////////////////
// LnxDraw_InitVideo
//////////////////////
// Initializes the Linux video system (for X-Windows)
2024-04-16 18:56:40 +00:00
//
2024-04-16 03:43:29 +00:00
// Returns:
// 0 : no error
// -1 : invalid parameter
// -2 : already initialized
int LnxDraw_InitVideo(LnxVideoDesc *ldesc);
/////////////////////////
// LnxDraw_CreateWindow
/////////////////////////
// Creates and displays a window
2024-04-16 18:56:40 +00:00
//
2024-04-16 03:43:29 +00:00
// Returns:
// 0 : no error (handle in lphandle)
// -1 : invalid parameter
// -2 : Display not opened
// -3 : Out of memory
2024-04-16 18:56:40 +00:00
int LnxDraw_CreateWindow(LnxWindowDesc *ldesc, LnxWindow **lphandle);
2024-04-16 03:43:29 +00:00
//////////////////////////
// LnxDraw_DestroyWindow
//////////////////////////
// Closes and deletes a window
2024-04-16 18:56:40 +00:00
//
2024-04-16 03:43:29 +00:00
// Returns:
// 0 : no error
// -1 : invalid parameter
int LnxDraw_DestroyWindow(LnxWindow *handle);
////////////////////////
// LnxDraw_LockSurface
////////////////////////
// Locks the window surface, giving you a pointer to write data to
2024-04-16 18:56:40 +00:00
//
2024-04-16 03:43:29 +00:00
// Returns:
// true : success
// false : error
2024-04-16 18:56:40 +00:00
bool LnxDraw_LockSurface(LnxWindow *wnd, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
unsigned char **ptr, int *pitch);
2024-04-16 03:43:29 +00:00
//////////////////////////
// LnxDraw_UnlockSurface
//////////////////////////
// Unlocks the window surface, blitting the buffer
2024-04-16 18:56:40 +00:00
//
void LnxDraw_UnlockSurface(LnxWindow *wnd, unsigned char *ptr);
2024-04-16 03:43:29 +00:00
////////////////////////////
/// LnxDraw_Blit
////////////////////////////
// Blits a buffer to the window
2024-04-16 18:56:40 +00:00
//
2024-04-16 03:43:29 +00:00
// Returns:
// 0 : no error
// -1 : invalid parameter
// -2 : unknown error
2024-04-16 18:56:40 +00:00
int LnxDraw_Blit(LnxWindow *wnd, unsigned char *ptr, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
2024-04-16 03:43:29 +00:00
////////////////////////
// LnxDraw_GetRGBMasks
////////////////////////
// Returns the RGB masks for the display
2024-04-16 18:56:40 +00:00
//
2024-04-16 03:43:29 +00:00
// Returns:
// 0 : no error
// -1 : invalid parameters
2024-04-16 18:56:40 +00:00
int LnxDraw_GetRGBMasks(LnxWindow *wnd, unsigned int *r, unsigned int *g, unsigned int *b);
2024-04-16 03:43:29 +00:00
#endif