📄 plays2k.c
字号:
/**************************************************************************
* |plays2k| - description *
* ------------------- *
* begin : |2006-6-7| *
* copyright : (C) |2006| by |optec| *
* email : |egxsun@126.com| *
**************************************************************************/
/*
** 盲啪禄莽拧聥氓潞聫
** $Id: plays2k.c,v 0.01 wangxf in 2006-06-08
**
** The demo for playing FNT file.
**
** Copyright (C) 2006 ~ 2006 wangxf.
**
** Create date: 2006/06/08
*/
/*
** TODO:2006-11-08 egxsun@126.com
*/
#ifdef _USE_NEWGAL
#include <minigui/fixedmath.h>
#endif
#include "type.h"
#include "plays2k.h"
#include "schedule.h"
#include "effectimpl.h"
#include "tcp.h"
#include "datastruct.h"
#if defined(__WINS__)
#define PACKED
#else
#define PACKED __attribute__((packed, aligned(1)))
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <math.h>
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef _USE_NEWGAL
#include <minigui/fixedmath.h>
#endif
typedef struct SClr
{
char m_clrRValue;
char m_clrGValue;
char m_clrBValue;
}PACKED SClr;
// global parameter define
static SClr COLOR_FOUR[4] = { {0,0,0},
{0,255,0},
{255,0,0},
{255,128,64}};
char charTOOR_FOUR [8] = {0x00, 0x03, 0x03, 0x00, 0x01, 0x02, 0x00, 0x03};
char charTOOR_NINE [8] = {0x00, 0x0F, 0x0C, 0x03, 0x05, 0x0A, 0x00, 0x0C};
static SClr COLOR_NINE[9] = { {0,0,0},
{181, 0, 57},
{255, 0, 57},
{0, 113, 33},
{0, 186, 0},
{222, 162, 0},
{222, 182, 0},
{222, 211, 0},
{255, 255, 0}};
char char_INDEX_NINE [9] ={
0x00, 0x08, 0x0A, 0x04, 0x06, 0x0C, 0x0E, 0x0D, 0x0F
};
static char filename[] = "a.S2K";
// end region
// macro define region
//#define DEFAULT_WIDTH 640
//#define DEFAULT_HEIGHT 400
//#define DEFAULT_X 320
//#define DEFAULT_Y 200
//#define WINDOW_SCALE 4
// end region
int BegX;int BegY;int Speed;int Wait;static char cCxFileName[]="res/cm6.CX4";int DrawCX(HWND hWnd, HDC hdc)
{ printf( "start DRAWCX! \n"); printf( "open cx file:%s!\n",cCxFileName);
FILE * fd_read;
//FILE * fd_out;
BYTE b1, b2;
int icount = 0;
char name[9];
BYTE * realcolor;
BYTE * colorref;
short read = 0;
short width,height;
short colornum;
int iloop = 0;
int jloop = 0;
int iindex = 0;
int jindex = 0;
BYTE color1, color2, color3, color4;
BYTE btemp; // 忙炉聫盲啪陋猫卤隆莽沤聽莽聜鹿忙聲掳忙聧庐
int times;
RECT rect;
int colorindex;
// To open the system setting file.
fd_read = fopen (cCxFileName, "rb"); /////脪陋脨脼啪脛拢卢脮芒脌茂脦脛艗镁脪脩鸥颅沤貌驴陋
//fd_out = fopen("out.txt", "wr");
if (fd_read == NULL)
{
printf( "Failed to open the system setting file:%s!",cCxFileName);
fclose(fd_read);
return -1;
}
rewind(fd_read);
// To get the size of the system setting file.
fread(&b1, sizeof(BYTE), 1, fd_read);
if(b1 == 0x5e)
{
//fprintf(fd_out, "氓聸聸猫卤隆莽沤聽");
fseek(fd_read, 128, 0);
//忙聳聡盲禄露茂艗聦氓聛聫莽搂禄茅聡聫茂艗聦氓聨聼忙聺楼盲艙聧莽艙庐
do
{
read = fread(name, sizeof(char), 8, fd_read);
//氓颅聵氓聜拧忙聲掳莽禄聞茂艗聦氓聧聲盲艙聧茂艗聦氓鈧
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -