Nspire I/O  2.0
 All Data Structures Files Functions Variables
Functions | Variables
console.c File Reference
#include "nspireio2.h"
#include <os.h>

Functions

void nio_drawstr (int offset_x, int offset_y, int x, int y, char *str, char bgColor, char textColor)
void nio_drawch (int offset_x, int offset_y, int x, int y, char ch, char bgColor, char textColor)
void nio_load (char *path, nio_console *c)
void nio_save (char *path, nio_console *c)
char nio_getch (void)
void nio_InitConsole (nio_console *c, int size_x, int size_y, int offset_x, int offset_y, char background_color, char foreground_color)
void nio_DrawConsole (nio_console *c)
void nio_Clear (nio_console *c)
void nio_ScrollDown (nio_console *c)
void nio_DrawChar (nio_console *c, int pos_x, int pos_y)
void nio_SetChar (nio_console *c, char ch, int pos_x, int pos_y)
void nio_PrintChar (nio_console *c, char ch)
void nio_PrintStr (nio_console *c, char *str)
void nio_printf (nio_console *c, char *format,...)
void nio_SetColor (nio_console *c, char background_color, char foreground_color)
void nio_EnableDrawing (nio_console *c, BOOL enable_drawing)
char nio_GetChar (nio_console *c)
int nio_GetStr (nio_console *c, char *str)
void nio_CleanUp (nio_console *c)

Variables

BOOL shift = FALSE
BOOL caps = FALSE
BOOL ctrl = FALSE

Detailed Description

Author:
Julian Mackeben aka compu compu.nosp@m.juck.nosp@m.el@go.nosp@m.ogle.nosp@m.mail..nosp@m.com
Version:
2.0

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org/copyleft/gpl.html

DESCRIPTION

Console functions


Function Documentation

void nio_CleanUp ( nio_console c)

Frees the allocated memory.

Parameters:
cConsole
void nio_Clear ( nio_console c)

Clears a console.

Parameters:
cConsole
void nio_drawch ( int  offset_x,
int  offset_y,
int  x,
int  y,
char  ch,
char  bgColor,
char  textColor 
)

Draws a char to the screen

Parameters:
offset_xx offset (pixel)
offset_yy offset (pixel)
xColumn
yRow
chString
bgColorBackground color
textColorText color
void nio_DrawChar ( nio_console c,
int  pos_x,
int  pos_y 
)

Draws a char from a console to the screen at the given position; It is not saved.

Parameters:
cConsole
pos_xColumn
pos_yRow

Draws a console to the screen.

Parameters:
cConsole
void nio_drawstr ( int  offset_x,
int  offset_y,
int  x,
int  y,
char *  str,
char  bgColor,
char  textColor 
)

Draws a string to the screen

Parameters:
offset_xx offset (pixel)
offset_yy offset (pixel)
xColumn
yRow
strString
bgColorBackground color
textColorText color
void nio_EnableDrawing ( nio_console c,
BOOL  drawing_enabled 
)

Enables immediate drawing when a character is written to the console.

Parameters:
cConsole
drawing_enabledWhen this is true, a char will be immediately drawn to the screen, false: The console will not refresh if you write data to it
char nio_getch ( void  )

Reads a char from the keyboard

Returns:
ASCII char
char nio_GetChar ( nio_console c)

Reads a char and prints it to the console.

Parameters:
cConsole
Returns:
ASCII char
int nio_GetStr ( nio_console c,
char *  str 
)

Reads a string and prints it to the console.

Parameters:
cConsole
strString destination
void nio_InitConsole ( nio_console c,
int  size_x,
int  size_y,
int  offset_x,
int  offset_y,
char  background_color,
char  foreground_color 
)

Initializes a console.

Parameters:
cConsole
size_xNumber of columns
size_yNumber of rows
offset_xx offset (pixel)
offset_yy offset (pixel)
background_colorDefault background color
foreground_colorDefault foreground color
void nio_load ( char *  path,
nio_console c 
)

Loads a console to flash storage.

Parameters:
pathFile path
cConsole
void nio_PrintChar ( nio_console c,
char  ch 
)

Prints a char in a console.

Parameters:
cConsole
chChar
void nio_printf ( nio_console c,
char *  format,
  ... 
)

Prints a formatted string to a console.

Parameters:
cConsole
formatFormat string
...Additional arguments
void nio_PrintStr ( nio_console c,
char *  str 
)

Prints a string in a console.

Parameters:
cConsole
strString
void nio_save ( char *  path,
nio_console c 
)

Saves a console to flash storage.

Parameters:
pathFile path
cConsole
void nio_ScrollDown ( nio_console c)

Scrolls the console one line down.

Parameters:
cConsole
void nio_SetChar ( nio_console c,
char  ch,
int  pos_x,
int  pos_y 
)

Saves a char in a console at the given position; It is not drawn.

Parameters:
cConsole
chchar to be stored
pos_xColumn
pos_yRow
void nio_SetColor ( nio_console c,
char  background_color,
char  foreground_color 
)

Sets the Foreground/Background color.

Parameters:
cConsole
background_colorBackground color
foreground_colorForeground color