123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- /* --------------------------------------------------
- Rozhrani k 2D grafice
- --------------------------------------------------
- */
- #ifndef __BERUSKY3D_KOFOLA2D_H__
- #define __BERUSKY3D_KOFOLA2D_H__
- #include "2D_graphic.h"
- #define DDX2_BACK_BUFFER (-1)
- #define NO_SURFACE (-1)
- typedef void (* DDX2_DEVICE_SCREEN_CALLBACK)(void);
- typedef struct _DDX2_SURFACE
- {
- bitmapa *p_bmp;
- } DDX2_SURFACE;
- typedef struct _DDX2_SURFACE_DEVICE_3D
- {
- int text;
- int filtr;
- int format;
- BODUV map[4]; // Mapovaci koordinaty v texture
- int back_dx, // Rozmery back-bufferu
- back_dy;
- int text_x, // Pozice a rozmery textury v Back-bufferu
- text_y,
- text_dx,
- text_dy,
- text_real_dx,
- text_real_dy;
- int scr_x, // Rozmery a pozice device na obrazovce
- scr_y,
- scr_dx,
- scr_dy;
- } DDX2_SURFACE_DEVICE_3D;
- typedef struct _DDX2_SURFACE_DEVICE
- {
- struct _DDX2_SURFACE_DEVICE *p_next;
-
- bitmapa *p_back_buffer;
- DDX2_SURFACE_DEVICE_3D hw;
-
- int rnum;
- RECT *p_rlist;
- int draw;
-
- DDX2_DEVICE_SCREEN_CALLBACK p_resize_callback;
- } DDX2_SURFACE_DEVICE;
- typedef struct _DDX2_SURFACE_LIST
- {
- int surf_num;
- int surf_max;
- DDX2_SURFACE *p_slist;
- dword pruhledna_barva;
- } DDX2_SURFACE_LIST;
- typedef size_ptr DeviceHandle;
- typedef int SurfaceHandle;
- //------------------------------------------------------------------------------------------------
- // Name: ddx2Init()
- // Desc: Vyrobi rezervoar na surfacy
- //------------------------------------------------------------------------------------------------
- int ddx2Init(int max_surfacu, dword pruhledna_barva);
- //------------------------------------------------------------------------------------------------
- // Name: ddx2Release()
- // Desc: Zrusi rezervovar na surfacy
- //------------------------------------------------------------------------------------------------
- void ddx2Release(void);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceCreate()
- // Desc: Vyrobi renderovaci device a vlozi ho to seznamu devicu
- // filtr - TRUE - linear, FALSE - near
- // bpp - 16/32
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceCreate(int linear_filtr, int bpp, bool cursor_device = FALSE);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceSetActive()
- // Desc: Nastavi renderovaci device jako aktivni
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceSetActive(DeviceHandle handle);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceSetCursor()
- // Desc: Set this device as a cursor device
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceSetCursor(DeviceHandle handle);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceRemove()
- // Desc: Zrusi zarizeni, pokud je aktivni nastavi aktivni prvni v seznamu
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceRemove(DeviceHandle handle);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceResBackBuffer(int back_dx, int back_dy)
- // Desc: Nastavi rozmer back-bufferu
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceSetBackBufferSize(int back_dx, int back_dy);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceSetBackBufferRect(int text_x, int text_y, int text_dx, int text_dy)
- // Desc: Nastavi pozici a rozmery textury v back-bufferu
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceSetBackBufferRect(int text_x, int text_y, int text_dx, int text_dy);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceSetTextRenderRec(int vx, int vy, int v_dx, int v_dy)
- // Desc: Nastavi oblast textury, ktera se bude prenaset na obrazovku
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceSetTextRenderRec(int vx, int vy, int v_dx, int v_dy);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceSetScreenRec(int scr_x, int scr_y, int scr_dx, int scr_dy)
- // Desc: Nastavi pozici textury na obrazovce (umisteni + rozmer)
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceSetScreenRec(int scr_x, int scr_y, int scr_dx = 0, int scr_dy = 0);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceSetScreenRecCallback(DDX2DEVICESCREENRECCALLBACK p_callback)
- // Desc: Sets a callback for screen resize
- //-----------------------------------------------------------------------------
- void ddx2ScreenResDefaultCallback(void);
- DeviceHandle ddx2DeviceSetScreenRecCallback(DDX2_DEVICE_SCREEN_CALLBACK p_callback);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceDeaktivuj()
- // Desc: Odmapuje aktivni zarizeni zobrazovky (smaze texturu a pod.)
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceDeaktivuj(void);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceSetRender(int draw)
- // Desc: Povoli/zakaze kresleni device (na zacatku je kresleni zakazano)
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceSetRender(int draw);
- //-----------------------------------------------------------------------------
- // Name: ddx2DeviceGetInfo()
- // Desc: Cte informace o velikost obsazene pameti a poctu surfacu (vsech)
- //-----------------------------------------------------------------------------
- DeviceHandle ddx2DeviceGetInfo(int *p_surfacu, int *p_mem);
- //-----------------------------------------------------------------------------
- // Name: ddx2SetRect()
- // Desc: Nastavi seznam recu na kresleni, NULL = nic nekreslit
- //-----------------------------------------------------------------------------
- void ddx2SetRect(RECT * p_rlist, int rnum);
- //------------------------------------------------------------------------------------------------
- // finds first free index
- //------------------------------------------------------------------------------------------------
- SurfaceHandle ddx2FindFreeSurface(void);
- //------------------------------------------------------------------------------------------------
- // release bitmap
- //------------------------------------------------------------------------------------------------
- SurfaceHandle ddx2ReleaseBitmap(SurfaceHandle iSurface);
- //------------------------------------------------------------------------------------------------
- // load bitmap from a directory na pozici
- //------------------------------------------------------------------------------------------------
- SurfaceHandle ddx2LoadBitmapPos(SurfaceHandle handle, char *pFileName, char *pDirName);
- //------------------------------------------------------------------------------------------------
- // load bitmap from a directory
- //------------------------------------------------------------------------------------------------
- SurfaceHandle ddx2LoadBitmap(char *pFileName, char *pDirName);
- //------------------------------------------------------------------------------------------------
- // load bitmap from DISK
- //------------------------------------------------------------------------------------------------
- SurfaceHandle ddx2LoadBitmapDisk(char *pFileName);
- //------------------------------------------------------------------------------------------------
- // load bitmap from DISK na pozici
- //------------------------------------------------------------------------------------------------
- SurfaceHandle ddx2LoadBitmapPosDisk(SurfaceHandle handle, char *pFileName);
- //------------------------------------------------------------------------------------------------
- // load list of bitmaps from a directory
- //------------------------------------------------------------------------------------------------
- int ddx2LoadList(char *pFileName, char *pBmpDir, char *p_bmp_dir);
- //------------------------------------------------------------------------------------------------
- // Create Surface
- //------------------------------------------------------------------------------------------------
- SurfaceHandle ddx2CreateSurface(int x, int y, int idx);
- void ddx2DrawSurfaceColorKey(int iSurface, int *com, int layer, COLORREF color);
- void ddx2DrawDisplayColorKey(int *com, int layer, COLORREF color);
- void ddx2DrawSurface(int iSurface, int *com, int layer);
- void ddx2DrawDisplay(int *com, int layer);
- BOOL ddx2TransparentBlt(SurfaceHandle dst, int dx, int dy, int dsirka, int dvyska,
- SurfaceHandle src, int sx, int sy, dword pruhledna);
- BOOL ddx2TransparentBltDisplay(int dx, int dy, int dsirka, int dvyska,
- int dcSrcSurface,
- int sx, int sy, int ssirka, int svyska,
- UINT crTransparent);
- BOOL ddx2TransparentBltFull(SurfaceHandle dst, int dx, int dy,
- SurfaceHandle src, dword barva);
- BOOL ddx2BitBlt(SurfaceHandle dst, int dx, int dy, int sirka, int vyska,
- SurfaceHandle src, int sx, int sy);
- BOOL ddx2BitBltStretch(SurfaceHandle dst, int dx, int dy, int dst_width, int dst_height,
- SurfaceHandle src, int sx, int sy, int src_width, int src_height);
- BOOL ddx2BitBltDisplay(int dx, int dy, int sirka, int vyska,
- int dcSrcSurface, int sx, int sy);
- BOOL ddx2BitBltFull(SurfaceHandle dst, int dx, int dy, SurfaceHandle src);
- int ddx2GetWidth(SurfaceHandle src);
- int ddx2GetHeight(SurfaceHandle src);
- void ddx2CleareSurfaceColor(SurfaceHandle iSurface, COLORREF color);
- void ddx2FillRect(SurfaceHandle iSurface, RECT * rect, COLORREF color);
- void ddx2CleareSurface(SurfaceHandle iSurface);
- void ddx2AddRectItem(RECT_LINE * p_rl, RECT rect, int iLayer = 0);
- void ddx2DrawCursor(SurfaceHandle iSurface, int x, int y, int dx, int dy, dword pruhledna);
- void ddx2DrawCursorSetDraw(int draw);
- //------------------------------------------------------------------------------------------------
- // Povoli/zakaze rendering hry (3D modelu a pod.)
- //------------------------------------------------------------------------------------------------
- void ddx2GameRender(int render);
- // ----------------------------------------------------------------------------
- // Name: ddx2RenderDevices()
- // Desc: Vykresli menu pouze menu, bez mazani obrazovky a flipu
- // Vola se pokud se menu ma kreslit jako soucast hry (volat po renderingu
- // menu s listim)
- // ----------------------------------------------------------------------------
- void ddx2RenderDevices(G_KONFIG * p_ber);
- // ----------------------------------------------------------------------------
- // Name: ddx2RenderujVse()
- // Desc: Vykresli menu
- // Kresli menu vcetne vymazani obrazovky
- // ----------------------------------------------------------------------------
- void ddx2RenderujVse(G_KONFIG * p_ber);
- #endif
|