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

📄 hz.c

📁 一款ucgui下的五子棋游戏
💻 C
字号:
#include "string.h"
#include "fcntl.h"
#include "io.h"
#include <stdio.h>


#include "Common.h"
#include "GUI_Private.H"

//#include "GProtect.h"

static int handle;
//static FILE* handle;

int OpenHZ(const char *Hz16Path)
{
	 return (handle=open(Hz16Path,O_BINARY));
/* 2005-06-17 9:08:32
	int ret = 1;
	handle=fopen(Hz16Path, "rb");
	if(handle == 0) ret = -1;
	return ret;	*/
}

int CloseHZ()
{

 if (handle<0) return -1;
 else return close (handle);
/* 2005-06-17 9:08:40
 if (handle == 0) return -1;
 else return fclose(handle);
*/
}

int GetBit(unsigned char c,int n)
{
	return((c>>n)&1);
}

int WriteHZ (int x, int y,const char *p,int color)
{
  U16 c1,c2,rec;
  long l;
  char pixeldata[32];

  int BytesPerLine;
  GUI_DRAWMODE DrawMode = GUI_Context.TextMode;
  GUI_DRAWMODE OldDrawMode;

  if (handle<0 ) return 0;
  if (p==NULL) return 0;

  c1=(p[0]-0xa1)&0x07f;
  c2=(p[1]-0xa1)&0x07f;

  rec=c1*94+c2;
  l=rec*32L;

  lseek(handle,l,SEEK_SET);
  read(handle,pixeldata,32);

/* 2005-06-17 9:09:08
  fseek(handle,l,SEEK_SET);
  fread(pixeldata,32, 1, handle);*/

  BytesPerLine = 2;
  OldDrawMode  = LCD_SetDrawMode(DrawMode);
  LCD_DrawBitmap (GUI_Context.DispPosX, GUI_Context.DispPosY,
		  HZSIZEX,HZSIZEY,
		  1, 1,
		  1,            /*Bits per Pixel */
		  BytesPerLine,
		  (U8*)pixeldata,
//		  NULL  /* no palette means default palette */
		  &LCD_BKCOLORINDEX  /* no palette means default palette */
		  );
  /* Fill empty pixel lines */
  /*
  if (GUI_Context.pAFont->YDist > GUI_Context.pAFont->YSize) {
    int YMag = GUI_Context.pAFont->YMag;
    int YDist = GUI_Context.pAFont->YDist * YMag;
    int YSize = GUI_Context.pAFont->YSize * YMag;
    if (DrawMode != LCD_DRAWMODE_TRANS) {
    LCD_COLOR OldColor = GUI_GetColor();
    GUI_SetColor(GUI_GetBkColor());
    LCD_FillRect(GUI_Context.DispPosX,
		 GUI_Context.DispPosY + YSize,
		 GUI_Context.DispPosX + pCharInfo->XSize,
		 GUI_Context.DispPosY + YDist);
    GUI_SetColor(OldColor);
  }
  */
  LCD_SetDrawMode(OldDrawMode); /* Restore draw mode */
  GUI_Context.DispPosX += HZSIZEX;
  return 1;
}

⌨️ 快捷键说明

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