jtest.c

来自「二~六键游戏操纵杆(gamepad)控制程序」· C语言 代码 · 共 58 行

C
58
字号
/*
** Test program for joystick library.
**
** This file is part of:
**
** Joystick Library for Dos.
** Version: 1.1
**
** Last modified: June 15th, 1997
**
** (C) 1997 Simone Zanella Productions.
**
** E-mail: szanella@dsi.unive.it
**         zanella@prometeo.it
**
** Web:    http://www.dsi.unive.it/~szanella/index.htm
**         http://members.tripod.com/~szanella/index.htm
**
** Changes from version 1.0:
**
** - added support for 4 and 6 buttons joysticks;
** - added command line parameter mode;
** - changed calibration to manual, to avoid incompatibilities and
**   to get a faster reading;
** - calibration is now saved to JTEST.JC, in JTEST.EXE directory;
** - removed tolerances.
**
** --------------------------------------------------------
**
** This is freeware: use it as you like, but ALWAYS include
** the original author's name in the docs of your program.
**
** --------------------------------------------------------
*/

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "joystick.h"

#ifndef __BORLANDC__
#define min(a, b)    (((a) < (b)) ? (a) : (b))
#define max(a, b)    (((a) > (b)) ? (a) : (b))
#endif

static int mode = JOY_2BUTTONS;

void printstatus(unsigned char jready, unsigned int j0, unsigned int j1)
{
  /* Show status for both joysticks */

  char l[13][26];
  unsigned char j, o, ln;
  unsigned int jflags;

  strcpy(l[0],  "     

⌨️ 快捷键说明

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