vgl.h revision 50476
1/*-
2 * Copyright (c) 1991-1997 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer
10 *    in this position and unchanged.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 *    derived from this software withough specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/lib/libvgl/vgl.h 50476 1999-08-28 00:22:10Z peter $
29 */
30
31#include <stdlib.h>
32#include <unistd.h>
33#include <string.h>
34#include <machine/cpufunc.h>
35
36typedef unsigned char byte;
37typedef struct {
38  byte 	Type;
39  int  	Xsize, Ysize;
40  byte 	*Bitmap;
41} VGLBitmap;
42
43/*
44 * Defined Type's
45 */
46#define MEMBUF		0
47#define VIDBUF4		1
48#define VIDBUF8		2
49#define VIDBUF8X	3
50#define NOBUF		255
51
52typedef struct VGLText {
53  byte	Width, Height;
54  byte	*BitmapArray;
55} VGLText;
56
57typedef struct VGLObject {
58  int	  	Id;
59  int	  	Type;
60  int	  	Status;
61  int	  	Xpos, Ypos;
62  int	  	Xhot, Yhot;
63  VGLBitmap 	*Image;
64  VGLBitmap 	*Mask;
65  int		(*CallBackFunction)();
66} VGLObject;
67
68#define MOUSE_IMG_SIZE		16
69#define VGL_MOUSEHIDE		0
70#define VGL_MOUSESHOW		1
71#define VGL_MOUSEFREEZE		0
72#define VGL_MOUSEUNFREEZE	1
73#define VGL_DIR_RIGHT		0
74#define VGL_DIR_UP		1
75#define VGL_DIR_LEFT		2
76#define VGL_DIR_DOWN		3
77#define VGL_RAWKEYS		1
78#define VGL_CODEKEYS		2
79#define VGL_XLATEKEYS		3
80
81extern VGLBitmap 	*VGLDisplay;
82
83/*
84 * Prototypes
85 */
86/* bitmap.c */
87int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
88int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
89/* keyboard.c */
90int VGLKeyboardInit(int mode);
91void VGLKeyboardEnd(void);
92int VGLKeyboardGetCh(void);
93/* main.c */
94void VGLEnd(void);
95int VGLInit(int mode);
96void VGLCheckSwitch(void);
97/* mouse.c */
98void VGLMousePointerShow(void);
99void VGLMousePointerHide(void);
100void VGLMouseMode(int mode);
101void VGLMouseAction(int dummy);
102void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask);
103void VGLMouseSetStdImage(void);
104int VGLMouseInit(int mode);
105int VGLMouseStatus(int *x, int *y, char *buttons);
106int VGLMouseFreeze(int x, int y, int width, int hight, byte color);
107void VGLMouseUnFreeze(void);
108/* simple.c */
109void VGLSetXY(VGLBitmap *object, int x, int y, byte color);
110byte VGLGetXY(VGLBitmap *object, int x, int y);
111void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
112void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
113void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
114void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
115void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
116void VGLClear(VGLBitmap *object, byte color);
117void VGLRestorePalette(void);
118void VGLSavePalette(void);
119void VGLSetPalette(byte *red, byte *green, byte *blue);
120void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue);
121void VGLSetBorder(byte color);
122void VGLBlankDisplay(int blank);
123/* text.c */
124int VGLTextSetFontFile(char *filename);
125void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir);
126void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir);
127