luxos/SysCore/include/conio.h

104 lines
3.4 KiB
C

#ifndef __CONIO_H
#define __CONIO_H
#include <stdlib.h>
//#define _ATTRIB 0x0F
typedef struct {
/** Console window width. */
unsigned width;
/** Console window height. */
unsigned height;
/** Default colors (can be changed later with ConsoleSetDefaultColors() routine)*/
unsigned char defcolors;
/** Pointer to a routine to set the blinking cursor position.\n
Parameters are as following: (int x, int y), where x, y is a 2D position on the screen. */
void (*cursor)(int, int);
/** Pointer to a routine to put a character in a specified position.\n
Parameters are as following: (int x, int y, unsigned char c),\n
* where: x, y = 2D position on the screen\n
* c = ascii character*/
void (*putc)(int, int, unsigned char);
/** Pointer to a routine to return a character in a specified position.\n
Parameters are as following: (int x, int y), where x, y is a 2D position on the screen. */
unsigned char (*getc)(int, int);
/** Pointer to a routine to set the colors for the character in the specified position\n
Parameters are as following: (int x, int y, unsigned char color),\n
* where: x, y = 2D position on the screen\n
* color = index in 16 color palette for background (high nibble) and foreground (low nibble)*/
void (*putcolor)(int, int, unsigned char);
/** Pointer to a routine to return the colors for the character in the specified position\n
Parameters are as following: (int x, int y, unsigned char c),\n
* where: x, y = 2D position on the screen*/
unsigned char (*getcolor)(int, int);
} ConsoleScreen;
typedef struct {
/**Integer coordonates*/
int X, Y;
} Point;
typedef struct {
/**Unsigned integer coordonates.*/
unsigned X, Y;
} UPoint;
enum COLORS {
BLACK = 0x0,
BLUE = 0x1,
GREEN = 0x2,
CYAN = 0x3,
RED = 0x4,
MAGENTA = 0x5,
BROWN = 0x6,
LIGHTGRAY = 0x7,
DARKGRAY = 0x8,
LIGHTBLUE = 0x9,
LIGHTGREEN = 0xA,
LIGHTCYAN = 0xB,
LIGHTRED = 0xC,
LIGHTMAGENTA = 0xD,
YELLOW = 0xE,
WHITE = 0xF,
BLINK = 0x80
};
enum CURSORSHAPE {
_NOCURSOR = 0x0,
_SOLIDCURSOR = 0x1,
_NORMALCURSOR = 0x2
};
/***/
//extern char* cgets(char* string);
extern void ConsoleInstall(ConsoleScreen screen);
extern void ConsoleUpdateCursor(UPoint position, unsigned char type);
extern void ConsoleScroll(unsigned lines);
/** Clears to end of line in text window\n\n
Declaration: void clreol(void);\n\n
Remarks:\n
clreol clears all characters from the cursor position to the end of the line
within the current text window, without moving the cursor.\n\n
Return Value: None*/
extern void clreol();
extern void clrscr();
extern int gettext (int left, int top, int right, int bottom, unsigned char* dest);
extern void gotoxy (int x, int y);
extern int cprintf(const char* str, ...);
extern int cputs(const char* str);
extern int cgets(char* string, int maxlen);
extern int getch();
extern int getche();
extern void movetext(int left, int top, int right, int bottom, int destleft, int desttop);
extern int putch(const char c);
extern int puttext(int left, int top, int right, int bottom, unsigned char* src);
extern void _setcursortype (int cursor);
extern int wherex();
extern int wherey();
#endif