xref: /freebsd/lib/libvgl/vgl.h (revision 5acf51ea02ea31f47358e87bacdaaaa6c9ed7dc4)
19a57b7d2SSøren Schmidt /*-
29a57b7d2SSøren Schmidt  * Copyright (c) 1991-1997 S�ren Schmidt
39a57b7d2SSøren Schmidt  * All rights reserved.
49a57b7d2SSøren Schmidt  *
59a57b7d2SSøren Schmidt  * Redistribution and use in source and binary forms, with or without
69a57b7d2SSøren Schmidt  * modification, are permitted provided that the following conditions
79a57b7d2SSøren Schmidt  * are met:
89a57b7d2SSøren Schmidt  * 1. Redistributions of source code must retain the above copyright
99a57b7d2SSøren Schmidt  *    notice, this list of conditions and the following disclaimer
109a57b7d2SSøren Schmidt  *    in this position and unchanged.
119a57b7d2SSøren Schmidt  * 2. Redistributions in binary form must reproduce the above copyright
129a57b7d2SSøren Schmidt  *    notice, this list of conditions and the following disclaimer in the
139a57b7d2SSøren Schmidt  *    documentation and/or other materials provided with the distribution.
149a57b7d2SSøren Schmidt  * 3. The name of the author may not be used to endorse or promote products
159a57b7d2SSøren Schmidt  *    derived from this software withough specific prior written permission
169a57b7d2SSøren Schmidt  *
179a57b7d2SSøren Schmidt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
189a57b7d2SSøren Schmidt  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
199a57b7d2SSøren Schmidt  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
209a57b7d2SSøren Schmidt  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
219a57b7d2SSøren Schmidt  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
229a57b7d2SSøren Schmidt  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239a57b7d2SSøren Schmidt  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249a57b7d2SSøren Schmidt  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259a57b7d2SSøren Schmidt  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
269a57b7d2SSøren Schmidt  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279a57b7d2SSøren Schmidt  *
287f3dea24SPeter Wemm  * $FreeBSD$
299a57b7d2SSøren Schmidt  */
309a57b7d2SSøren Schmidt 
319a57b7d2SSøren Schmidt #include <stdlib.h>
329a57b7d2SSøren Schmidt #include <unistd.h>
339a57b7d2SSøren Schmidt #include <string.h>
349a57b7d2SSøren Schmidt #include <machine/cpufunc.h>
359a57b7d2SSøren Schmidt 
369a57b7d2SSøren Schmidt typedef unsigned char byte;
379a57b7d2SSøren Schmidt typedef struct {
389a57b7d2SSøren Schmidt   byte 	Type;
399a57b7d2SSøren Schmidt   int  	Xsize, Ysize;
405acf51eaSKazutaka YOKOTA   int  	VXsize, VYsize;
415acf51eaSKazutaka YOKOTA   int   Xorigin, Yorigin;
429a57b7d2SSøren Schmidt   byte 	*Bitmap;
439a57b7d2SSøren Schmidt } VGLBitmap;
449a57b7d2SSøren Schmidt 
455acf51eaSKazutaka YOKOTA #define VGLBITMAP_INITIALIZER(t, x, y, bits)	\
465acf51eaSKazutaka YOKOTA 	{ (t), (x), (y), 0, 0, 0, 0, (bits) }
475acf51eaSKazutaka YOKOTA 
489a57b7d2SSøren Schmidt /*
499a57b7d2SSøren Schmidt  * Defined Type's
509a57b7d2SSøren Schmidt  */
519a57b7d2SSøren Schmidt #define MEMBUF		0
529a57b7d2SSøren Schmidt #define VIDBUF4		1
539a57b7d2SSøren Schmidt #define VIDBUF8		2
549a57b7d2SSøren Schmidt #define VIDBUF8X	3
555acf51eaSKazutaka YOKOTA #define VIDBUF8S	4
565acf51eaSKazutaka YOKOTA #define VIDBUF4S	5
579a57b7d2SSøren Schmidt #define NOBUF		255
589a57b7d2SSøren Schmidt 
599a57b7d2SSøren Schmidt typedef struct VGLText {
609a57b7d2SSøren Schmidt   byte	Width, Height;
619a57b7d2SSøren Schmidt   byte	*BitmapArray;
629a57b7d2SSøren Schmidt } VGLText;
639a57b7d2SSøren Schmidt 
649a57b7d2SSøren Schmidt typedef struct VGLObject {
659a57b7d2SSøren Schmidt   int	  	Id;
669a57b7d2SSøren Schmidt   int	  	Type;
679a57b7d2SSøren Schmidt   int	  	Status;
689a57b7d2SSøren Schmidt   int	  	Xpos, Ypos;
699a57b7d2SSøren Schmidt   int	  	Xhot, Yhot;
709a57b7d2SSøren Schmidt   VGLBitmap 	*Image;
719a57b7d2SSøren Schmidt   VGLBitmap 	*Mask;
729a57b7d2SSøren Schmidt   int		(*CallBackFunction)();
739a57b7d2SSøren Schmidt } VGLObject;
749a57b7d2SSøren Schmidt 
759a57b7d2SSøren Schmidt #define MOUSE_IMG_SIZE		16
769a57b7d2SSøren Schmidt #define VGL_MOUSEHIDE		0
779a57b7d2SSøren Schmidt #define VGL_MOUSESHOW		1
789a57b7d2SSøren Schmidt #define VGL_MOUSEFREEZE		0
799a57b7d2SSøren Schmidt #define VGL_MOUSEUNFREEZE	1
809a57b7d2SSøren Schmidt #define VGL_DIR_RIGHT		0
819a57b7d2SSøren Schmidt #define VGL_DIR_UP		1
829a57b7d2SSøren Schmidt #define VGL_DIR_LEFT		2
839a57b7d2SSøren Schmidt #define VGL_DIR_DOWN		3
84b478da36SSøren Schmidt #define VGL_RAWKEYS		1
85b478da36SSøren Schmidt #define VGL_CODEKEYS		2
86b478da36SSøren Schmidt #define VGL_XLATEKEYS		3
879a57b7d2SSøren Schmidt 
885acf51eaSKazutaka YOKOTA extern video_adapter_info_t	VGLAdpInfo;
895acf51eaSKazutaka YOKOTA extern video_info_t		VGLModeInfo;
909a57b7d2SSøren Schmidt extern VGLBitmap 		*VGLDisplay;
915acf51eaSKazutaka YOKOTA extern byte 			*VGLBuf;
929a57b7d2SSøren Schmidt 
939a57b7d2SSøren Schmidt /*
949a57b7d2SSøren Schmidt  * Prototypes
959a57b7d2SSøren Schmidt  */
969a57b7d2SSøren Schmidt /* bitmap.c */
979a57b7d2SSøren Schmidt int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
989a57b7d2SSøren Schmidt int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);
995acf51eaSKazutaka YOKOTA VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits);
1005acf51eaSKazutaka YOKOTA void VGLBitmapDestroy(VGLBitmap *object);
1015acf51eaSKazutaka YOKOTA int VGLBitmapAllocateBits(VGLBitmap *object);
102b478da36SSøren Schmidt /* keyboard.c */
103b478da36SSøren Schmidt int VGLKeyboardInit(int mode);
104b478da36SSøren Schmidt void VGLKeyboardEnd(void);
105b478da36SSøren Schmidt int VGLKeyboardGetCh(void);
1069a57b7d2SSøren Schmidt /* main.c */
1079a57b7d2SSøren Schmidt void VGLEnd(void);
1089a57b7d2SSøren Schmidt int VGLInit(int mode);
1099a57b7d2SSøren Schmidt void VGLCheckSwitch(void);
1105acf51eaSKazutaka YOKOTA int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize);
1115acf51eaSKazutaka YOKOTA int VGLPanScreen(VGLBitmap *object, int x, int y);
1125acf51eaSKazutaka YOKOTA int VGLSetSegment(unsigned int offset);
1139a57b7d2SSøren Schmidt /* mouse.c */
1149a57b7d2SSøren Schmidt void VGLMousePointerShow(void);
1159a57b7d2SSøren Schmidt void VGLMousePointerHide(void);
1169a57b7d2SSøren Schmidt void VGLMouseMode(int mode);
1179a57b7d2SSøren Schmidt void VGLMouseAction(int dummy);
1189a57b7d2SSøren Schmidt void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask);
1199a57b7d2SSøren Schmidt void VGLMouseSetStdImage(void);
1209a57b7d2SSøren Schmidt int VGLMouseInit(int mode);
1219a57b7d2SSøren Schmidt int VGLMouseStatus(int *x, int *y, char *buttons);
1229a57b7d2SSøren Schmidt int VGLMouseFreeze(int x, int y, int width, int hight, byte color);
1239a57b7d2SSøren Schmidt void VGLMouseUnFreeze(void);
1249a57b7d2SSøren Schmidt /* simple.c */
1259a57b7d2SSøren Schmidt void VGLSetXY(VGLBitmap *object, int x, int y, byte color);
1269a57b7d2SSøren Schmidt byte VGLGetXY(VGLBitmap *object, int x, int y);
1279a57b7d2SSøren Schmidt void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
1289a57b7d2SSøren Schmidt void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
1299a57b7d2SSøren Schmidt void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color);
1309a57b7d2SSøren Schmidt void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
1319a57b7d2SSøren Schmidt void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color);
1329a57b7d2SSøren Schmidt void VGLClear(VGLBitmap *object, byte color);
1339a57b7d2SSøren Schmidt void VGLRestorePalette(void);
1349a57b7d2SSøren Schmidt void VGLSavePalette(void);
1359a57b7d2SSøren Schmidt void VGLSetPalette(byte *red, byte *green, byte *blue);
1369a57b7d2SSøren Schmidt void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue);
1379a57b7d2SSøren Schmidt void VGLSetBorder(byte color);
1389a57b7d2SSøren Schmidt void VGLBlankDisplay(int blank);
1399a57b7d2SSøren Schmidt /* text.c */
1409a57b7d2SSøren Schmidt int VGLTextSetFontFile(char *filename);
1419a57b7d2SSøren Schmidt void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir);
1429a57b7d2SSøren Schmidt void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir);
143