vgl.h revision 53013
128328Ssos/*- 228328Ssos * Copyright (c) 1991-1997 S�ren Schmidt 328328Ssos * All rights reserved. 428328Ssos * 528328Ssos * Redistribution and use in source and binary forms, with or without 628328Ssos * modification, are permitted provided that the following conditions 728328Ssos * are met: 828328Ssos * 1. Redistributions of source code must retain the above copyright 928328Ssos * notice, this list of conditions and the following disclaimer 1028328Ssos * in this position and unchanged. 1128328Ssos * 2. Redistributions in binary form must reproduce the above copyright 1228328Ssos * notice, this list of conditions and the following disclaimer in the 1328328Ssos * documentation and/or other materials provided with the distribution. 1428328Ssos * 3. The name of the author may not be used to endorse or promote products 1528328Ssos * derived from this software withough specific prior written permission 1628328Ssos * 1728328Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1828328Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1928328Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2028328Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2128328Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2228328Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2328328Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2428328Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2528328Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2628328Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2728328Ssos * 2850476Speter * $FreeBSD: head/lib/libvgl/vgl.h 53013 1999-11-08 11:37:46Z yokota $ 2928328Ssos */ 3028328Ssos 3128328Ssos#include <stdlib.h> 3228328Ssos#include <unistd.h> 3328328Ssos#include <string.h> 3428328Ssos#include <machine/cpufunc.h> 3528328Ssos 3628328Ssostypedef unsigned char byte; 3728328Ssostypedef struct { 3828328Ssos byte Type; 3928328Ssos int Xsize, Ysize; 4053013Syokota int VXsize, VYsize; 4153013Syokota int Xorigin, Yorigin; 4228328Ssos byte *Bitmap; 4328328Ssos} VGLBitmap; 4428328Ssos 4553013Syokota#define VGLBITMAP_INITIALIZER(t, x, y, bits) \ 4653013Syokota { (t), (x), (y), 0, 0, 0, 0, (bits) } 4753013Syokota 4828328Ssos/* 4928328Ssos * Defined Type's 5028328Ssos */ 5128328Ssos#define MEMBUF 0 5228328Ssos#define VIDBUF4 1 5328328Ssos#define VIDBUF8 2 5428328Ssos#define VIDBUF8X 3 5553013Syokota#define VIDBUF8S 4 5653013Syokota#define VIDBUF4S 5 5728328Ssos#define NOBUF 255 5828328Ssos 5928328Ssostypedef struct VGLText { 6028328Ssos byte Width, Height; 6128328Ssos byte *BitmapArray; 6228328Ssos} VGLText; 6328328Ssos 6428328Ssostypedef struct VGLObject { 6528328Ssos int Id; 6628328Ssos int Type; 6728328Ssos int Status; 6828328Ssos int Xpos, Ypos; 6928328Ssos int Xhot, Yhot; 7028328Ssos VGLBitmap *Image; 7128328Ssos VGLBitmap *Mask; 7228328Ssos int (*CallBackFunction)(); 7328328Ssos} VGLObject; 7428328Ssos 7528328Ssos#define MOUSE_IMG_SIZE 16 7628328Ssos#define VGL_MOUSEHIDE 0 7728328Ssos#define VGL_MOUSESHOW 1 7828328Ssos#define VGL_MOUSEFREEZE 0 7928328Ssos#define VGL_MOUSEUNFREEZE 1 8028328Ssos#define VGL_DIR_RIGHT 0 8128328Ssos#define VGL_DIR_UP 1 8228328Ssos#define VGL_DIR_LEFT 2 8328328Ssos#define VGL_DIR_DOWN 3 8430044Ssos#define VGL_RAWKEYS 1 8530044Ssos#define VGL_CODEKEYS 2 8630044Ssos#define VGL_XLATEKEYS 3 8728328Ssos 8853013Syokotaextern video_adapter_info_t VGLAdpInfo; 8953013Syokotaextern video_info_t VGLModeInfo; 9053013Syokotaextern VGLBitmap *VGLDisplay; 9153013Syokotaextern byte *VGLBuf; 9228328Ssos 9328328Ssos/* 9428328Ssos * Prototypes 9528328Ssos */ 9628328Ssos/* bitmap.c */ 9728328Ssosint __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); 9828328Ssosint VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); 9953013SyokotaVGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits); 10053013Syokotavoid VGLBitmapDestroy(VGLBitmap *object); 10153013Syokotaint VGLBitmapAllocateBits(VGLBitmap *object); 10230044Ssos/* keyboard.c */ 10330044Ssosint VGLKeyboardInit(int mode); 10430044Ssosvoid VGLKeyboardEnd(void); 10530044Ssosint VGLKeyboardGetCh(void); 10628328Ssos/* main.c */ 10728328Ssosvoid VGLEnd(void); 10828328Ssosint VGLInit(int mode); 10928328Ssosvoid VGLCheckSwitch(void); 11053013Syokotaint VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize); 11153013Syokotaint VGLPanScreen(VGLBitmap *object, int x, int y); 11253013Syokotaint VGLSetSegment(unsigned int offset); 11328328Ssos/* mouse.c */ 11428328Ssosvoid VGLMousePointerShow(void); 11528328Ssosvoid VGLMousePointerHide(void); 11628328Ssosvoid VGLMouseMode(int mode); 11728328Ssosvoid VGLMouseAction(int dummy); 11828328Ssosvoid VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask); 11928328Ssosvoid VGLMouseSetStdImage(void); 12028328Ssosint VGLMouseInit(int mode); 12128328Ssosint VGLMouseStatus(int *x, int *y, char *buttons); 12228328Ssosint VGLMouseFreeze(int x, int y, int width, int hight, byte color); 12328328Ssosvoid VGLMouseUnFreeze(void); 12428328Ssos/* simple.c */ 12528328Ssosvoid VGLSetXY(VGLBitmap *object, int x, int y, byte color); 12628328Ssosbyte VGLGetXY(VGLBitmap *object, int x, int y); 12728328Ssosvoid VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color); 12828328Ssosvoid VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color); 12928328Ssosvoid VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, byte color); 13028328Ssosvoid VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color); 13128328Ssosvoid VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, byte color); 13228328Ssosvoid VGLClear(VGLBitmap *object, byte color); 13328328Ssosvoid VGLRestorePalette(void); 13428328Ssosvoid VGLSavePalette(void); 13528328Ssosvoid VGLSetPalette(byte *red, byte *green, byte *blue); 13628328Ssosvoid VGLSetPaletteIndex(byte color, byte red, byte green, byte blue); 13728328Ssosvoid VGLSetBorder(byte color); 13828328Ssosvoid VGLBlankDisplay(int blank); 13928328Ssos/* text.c */ 14028328Ssosint VGLTextSetFontFile(char *filename); 14128328Ssosvoid VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir); 14228328Ssosvoid VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir); 143