📄 aihomesdk.h
字号:
/* * CChess Copyright (C) 2006 wesley.wang lily.ru * wq1977@gmail.com rujingli@163.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */#include "allegro.h"#include "cstdio"#ifndef WIN32#include "pthread.h"#include <fcntl.h>#include <sys/socket.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/un.h>#include <errno.h>#include <string.h>#include <lirc/lirc_client.h>#endif#define WIDTH 800#define HEIGHT 600class aihomegame { public: aihomegame(){done=false; buffer=NULL; page1=NULL; page2=NULL;active_page=NULL;UseFlip=false;}; virtual ~aihomegame(){}; virtual bool ProcInput(int keycode){ return false;}; virtual void Draw()=0; virtual void Update(){}; virtual bool Init(){return true;}; virtual void Quit(){}; void CommonProcInput(int keycode); bool CommonInit(); void CommonQuit(); void CommonDraw(); void Done() {done=true;}; bool IsDone() {return done;}; protected: bool done,UseFlip; BITMAP *buffer; BITMAP *page1, *page2; BITMAP *active_page;};#define AIHOME_START(x) int main(){ \ x game;\ game.CommonInit();\ while (!game.IsDone()){ \ while (keypressed()) {\ game.CommonProcInput(readkey()); \ } \ game.Update();\ game.CommonDraw(); \ }\ game.CommonQuit();\ return 0;\}\END_OF_MAIN()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -