⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ldraw.h

📁 ldraw_DOS游戏开发包
💻 H
字号:
/*****************************************************************************
 *    ___       _______                                  
 *   /\_ \     /\_  __ \                                 
 *   \//\ \    \//\ \ \ \                                      
 *     \ \ \     \ \ \ \ \                                   
 *      \_\ \____ \_\ --  \                                    
 *      /\_______\/\_______\                              
 *      \/_______/\/______/                                    
 *
 *
 *      By Lin Wei inc 2000, 
 *      LDraw v2.1 for Watcom C++ 20.1
 *
 *      Main header file for the LDraw library.
 *      This should be included by everyone and everything.
 *
 *      See readme.txt for copyright information.
 */

#ifndef LinDraw_H
#define LinDraw_H
#define LinDraw_Ver   0x201

#include <lsys.h>

///////////////////////  Ordinary Graphics  ///////////////////////////
#define LERR_NONE          0x00
#define LERR_NOMEM         0x01
#define LERR_NOTFIND       0x02
#define LERR_FILEERR       0x03
#define LERR_UNKNOW        0x04

extern short ldraw_error;
extern short Vdx1, Vdy1, Vdx2, Vdy2;
extern short ld_fillMode, ld_workColor, 
             ld_workBColor, ld_x, ld_y;
typedef struct TGDC
{ short x1, y1, x2, y2;
  short x, y, color, bcolor;
  short data[3];
} TGDC; 
///////////////// Ordinary Graphics ///////////////////
void  lgotoxy(short x,short y);
void  lclear();
uchar lrpixel(short x,short y);
void  lputImage(short x,short y,char *b);    
void  lputSpirit(short x,short y,char *spr); 
void  lputSpirit(short x,short y,char *b,short hotX,short hotY);
short lgetImage(short x1,short y1,short x2,short y2,char *b);
void  lImg2Sface(char *img,LSURFACE *ssface);
void  lgetHotXY(short *hotx,short *hoty,char *p);
void  lsetHotXY(short hotx,short hoty,char *p);
void  lgetSize(short *len,short *wid,char *b);
void  lputBlock(short x,short y,char *b);
void  lgetBlock(short x1,short y1,short x2,short y2,char *b);
void  lline(short x1,short y1,short x2,short y2);
void  llineto(short x,short y);
void  lcircle(short x,short y,short radius);
void  lbar(short x1,short y1,short x2,short y2);
void  lrectangle(short x1,short y1,short x2,short y2);
void  lpoly(short fill,short num,short *PointsXY);
void  louttext(char *s);
void  louttext(short *win,char *s);
void  louttextxy(short x,short y,char *s);

void  lsetColor(uchar c);
void  lsetBColor(uchar c);
void  lActiveDC(TGDC *dc);
void  lSaveDC(TGDC *dc);

void  lChineseLoad(char *font);
void  lAscLoad(char *font);
void  lChineseUnLoad();
void  lAscUnLoad();
///////////////   Pal Access  /////////////////
struct RGB
{ char r, g, b; };
typedef struct {
   unsigned char data[32][32][32];
} RGB_MAP;
typedef struct {
   unsigned char data[256][256];
} COLOR_MAP;
extern short lpColorEnd; // color 0-245 is for general using
void  lsetPal(RGB *pal);
void  lloadPal(RGB *pal);
void  lsetPal(uchar color,uchar r,uchar g,uchar b);
void  lpDefaultPal(int i=0);
uchar lpBestfitColor(RGB *pal,short r,short g,short b);
void  lpCreateRgbTable(RGB_MAP *table, RGB *pal, void (*callback)(int pos));
void  lpCreateTransTable(COLOR_MAP *table, RGB *pal, int r, int g, int b, void (*callback)(int pos));
void  lpCreateLightTable(COLOR_MAP *table, RGB *pal, int r, int g, int b, void (*callback)(int pos));
char  ldecPal(short count,RGB *pal);
char  lchgPal(short count,RGB *PalToChange,RGB *SourcePal);
void  laddPal(short addnum,RGB *SourcePal,RGB *result);
void  lpMove(short start,short end,short style,RGB *p);


//////////////   Specil Effect  ///////////////
void  lePImageFade(short x,short y,char *image,short deep); 
      // deep<0 color->dark, deep>0 color->white
///////////////   File Access  ////////////////

/////////////   Pic File Access  //////////////
struct TLpcImage
{ short count; 
  short pageCount, *pageList;
  struct RGB *pal;
  char **LpcImage;
}; // to describe a group of bitmaps

char *lrPicFile(char *picname,long offset,RGB *pal);
char  lsPcxFile(char *img,char *fname,RGB *pal);

short lLoadLpcImage(TLpcImage *lpc,char *fname,long offset);  
void  lDestroyLpc(TLpcImage *lpc);
char *lGetLpcImage(TLpcImage *lpc,short page,short index);
short lGetLpcIndex(TLpcImage *lpc,short page,short index);
char *lLoadLpcUnit(short index,char *fname,long offset);

///////////////////   Mouse Access  ///////////////////
extern short lmlen,lmwid;
extern short mouse_event, mouse_code;
extern short mouse_x, mouse_y, mouse_rb, mouse_sb;

#define MBUTTON_L    2
#define MBUTTON_R    8
char lmInit();
void lmRead(short *x,short *y,short *b);  
void lmPlace(short x,short y);
void lmSetX(short min,short max);
void lmSetY(short min,short max);
void lmOpen();
void lmClose();
void lmImage(char *image);
void lmDraw();
void lmInitTimer();
void lmCloseTimer();
char lmIfTimer();
/////////////////   Windows Access  ///////////////////
struct TWin
{ int mode,index,type,x1,y1,x2,y2,forbid,fmask,style;
  int b1, b2;
  char *title,*savebitmap;
  TGDC wdc;
  int (*proc)(int MyEvent,int index);
};
void lwInitColor();
void lwSetColor(uchar cn,uchar cl,uchar cd,uchar ct,uchar cb,
                uchar ctext,uchar cground);
void lwCreateWin(TWin *w);
void lwDrawButton(short x1,short y1,short x2,short y2,char *str,
                  char *bitmap,char type);

//////////////////   Game Support   ///////////////////
#define LMAX_LAYERS  16

class lenvironment
{ 
public:
  LSURFACE layers[LMAX_LAYERS];
  struct 
   { short flag;
     short left,top,right,bottom;
     short x,y, key_color;
   } datas[LMAX_LAYERS];
  lenvironment();
  ~lenvironment();
  int  create(int i,int len,int wid);
  int  destroy(int i);
  void active(short i);
  void blit_all(short double_buf);
  void blit(short double_buf,short layer);
  void blit_to_scr(short double_buf);
  void set_blitport(short x1,short y1,short x2,short y2,
                    short start,short end);
  void get_data(short *_layer_count,short *_double_buf);
};
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -