home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
gnu
/
gchsrc31
/
include
/
fastcoun.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-27
|
2KB
|
80 lines
//////////////////////////////////////////////////////////////////////////////
//
// This file is part of the Atari Machine Specific Library,
// and is Copyright 1992 by Warwick W. Allison.
//
// You are free to copy and modify these sources, provided you acknoledge
// the origin by retaining this notice, and adhere to the conditions
// described in the file COPYING.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef _FastCounter_h
#define _FastCounter_h
///////////////////////////////////////////////////////////////////////////
//
// Fast counters are high-speed decimal display objects.
// Currently, only implemented in STLow resolution.
//
// To use, create a screen with " 0123456789" depicted in colour 15,
// each character 8 pixels wide, and all the same height.
//
// Create a CounterFont from this screen.
//
// Create a FastCounter from this font.
//
///////////////////////////////////////////////////////////////////////////
#include <bool.h>
#include <screen.h>
class CounterFont
{
public:
CounterFont(short Height, short Plane=0);
// x must be multiple of 16
GetImages(Screen&,short x,short y);
friend class FastCounter;
Draw(short,long Offset); // Draw "00" to "99"; 100+x=" x", 110=" "
private:
short *Data;
short shifts;
short height;
short plane;
};
class FastCounter
{
public:
// Use given font, draw at (x,y) - x multiple of 16,
// initial counter value v, given number of digits (multiple of 2).
FastCounter(CounterFont*,int x,int y,unsigned v=0,short digits=6);
~FastCounter();
void Draw(); // Draw on current page
void Add(short); // Increase/decrease
void Set(unsigned);
void operator ++ () {Add(1);}
void operator -- () {Add(-1);}
void operator += (short x) {Add(x);}
void operator -= (short x) {Add(-x);}
operator int(); // Convert to int
operator double(); // convert to double
void MoveTo(short x,short y);
void ZeroSuppression(bool on=TRUE); // Turned on by default
private:
bool LeadingZeroes=FALSE;
CounterFont *Font;
unsigned short *Digit;
unsigned short Changed[2];
short Size;
long Offset;
};
#endif