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

📄 hardware.h

📁 著名物理引擎Hawk的源代码
💻 H
字号:
/* hardware.h, HAWK game engine
 *
 * Copyright 1997-1998 by Phil Frisbie, Jr.
 * for Hawk Software
 *
 */

#ifndef HARDWARE_H
#define HARDWARE_H

#include "hawk.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Timer functions */
void			initTimer(int);		/* Init a simulated game timer */
unsigned int	readTimer(void);	/* Read from the simulated timer */
unsigned int	getTime(void);		/* Get the current time in milliseconds */
unsigned int	getElapsedTime(void);/* Get the elapsed time since last call */
void			Mpause(unsigned int ms);		/* pause for ms milliseconds */

/* Graphics/window functions */
void			setWindowVars(void *i, void *p, int s);
int				messageLoop(void);
int				createWindow(unsigned int w, unsigned int h);
void			swapBuffers(void);

/* Input functions */
typedef struct {
	int			x, y;		/* mouse position */
	BOOL		lbutton;	/* left button status */
	BOOL		mbutton;	/* middle button status */
	BOOL		rbutton;	/* right button status */
} MOUSE;

typedef struct {
	BOOL		joyleft;	/* joystick pushed left */
	BOOL		joyright;	/* joystick pushed right */
	BOOL		joyforward;	/* joystick pushed forward (up) */
	BOOL		joyback;	/* joystick pulled backward (down) */
	BOOL		hatleft;	/* hat switch pushed left */
	BOOL		hatright;	/* hat switch pushed right */
	BOOL		hatforward;	/* hat switch pushed forward */
	BOOL		hatback;	/* hat switch pushed back */
	BOOL		button1;	/* button1 status */
	BOOL		button2;	/* button2 status */
	BOOL		button3;	/* button3 status */
	BOOL		button4;	/* button4 status */
	BOOL		button5;	/* button5 status */
	BOOL		button6;	/* button6 status */
	BOOL		button7;	/* button7 status */
	BOOL		button8;	/* button8 status */
} JOY;

typedef struct {
	int			numjoy;		/* number of joysticks supported, or 0 if no driver loaded */
	char		*name;		/* name of joystick */
	int			numbuttons;	/* number of jorstick buttons */
	BOOL		hat;		/* has hat switch */
} JOYSTICKINFO;

extern MOUSE Mouse;
extern JOY Joy;
extern unsigned char Keys[256];
extern JOYSTICKINFO Joyinfo;

void			initInput(void);	/* Init all the input devices */
void			getKeys(unsigned char *keys);	/* Get current key status */
void			getMouse(MOUSE *mouse);	/* Get current mouse status */
void			getJoy(JOY *joy);	/* Get the current joystick status */

/* Sound functions */
BOOL initSound(void);

/* Misc functions */
void			fatalError(char *error, ...);
void			printdebug(char *, ...);
BOOL			initGameDLL(void);
void			systemInfo(void);

#ifdef __cplusplus
}
#endif

#endif /* HARDWARE_H */

⌨️ 快捷键说明

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