mirror of
https://github.com/rricharz/Tek4010.git
synced 2026-04-26 03:58:54 +00:00
further refinements
This commit is contained in:
44
main.c
44
main.c
@@ -46,7 +46,8 @@ extern FILE *putKeys;
|
||||
|
||||
static cairo_surface_t *global_surface, *global_surface2;
|
||||
static int global_firstcall;
|
||||
static int global_char;
|
||||
|
||||
int globalClearPersistent;
|
||||
|
||||
static void do_drawing(cairo_t *, GtkWidget *);
|
||||
|
||||
@@ -106,26 +107,31 @@ static void do_drawing(cairo_t *cr, GtkWidget *widget)
|
||||
|
||||
static void on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
|
||||
{
|
||||
printf("key pressed, state =%04X, keyval=%04X\r\n", event->state, event->keyval);
|
||||
int ch;
|
||||
// printf("key pressed, state =%04X, keyval=%04X\r\n", event->state, event->keyval);
|
||||
|
||||
// control keys
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
global_char = event->keyval & 0x1F;
|
||||
|
||||
// shift special keys
|
||||
else if ((event->state & GDK_SHIFT_MASK) && ((event->keyval & 0xFF00) == 0xFF00)) {
|
||||
global_char = event->keyval & 0xFEFF;
|
||||
printf("Shift key %04x\n",global_char);
|
||||
}
|
||||
|
||||
// normal keys
|
||||
else {
|
||||
global_char = event->keyval;
|
||||
if (putKeys) {
|
||||
printf("Sending character %c to child process\n", global_char);
|
||||
putc(global_char,putKeys); // pipe key to child process, if stream open
|
||||
if ((event->keyval == 0xFF50) || // "home" key
|
||||
(event->keyval == 0xFF55) || // "page up" key
|
||||
(event->keyval == 0xFF56)) // "page down" key
|
||||
{
|
||||
globalClearPersistent = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// control keys
|
||||
else if ((event->keyval >= 0xFF00) && (event->keyval <= 0xFF1F))
|
||||
ch = event->keyval & 0x1F;
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
ch = event->keyval & 0x1F;
|
||||
|
||||
// normal keys
|
||||
else if ((event->keyval >= 0x0020) && (event->keyval <= 0x007F))
|
||||
ch = event->keyval & 0x7F;
|
||||
|
||||
else return;
|
||||
|
||||
if (putKeys)
|
||||
putc(ch,putKeys); // pipe key to child process, if stream open
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
|
||||
167
tek4010.c
167
tek4010.c
@@ -9,26 +9,37 @@
|
||||
|
||||
#define MEM 128
|
||||
|
||||
#define TODO 4 // for speed reasons, draw TODO small vectors until screen updates
|
||||
#define TODO 6 // for speed reasons, draw multiple objects until screen updates
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "tek4010.h"
|
||||
|
||||
static int counter = 0;
|
||||
static int memx1[MEM], memy1[MEM], memx2[MEM], memy2[MEM];
|
||||
static float memv[MEM];
|
||||
extern void gtk_main_quit();
|
||||
extern int globalClearPersistent;
|
||||
|
||||
static int count = 0;
|
||||
/* not yet used, for dsrk mode
|
||||
int memx1[MEM], memy1[MEM], memx2[MEM], memy2[MEM];
|
||||
float memv[MEM];
|
||||
*/
|
||||
|
||||
int count = 0;
|
||||
static int mode;
|
||||
static int x0,y0,x2,y2;
|
||||
|
||||
int leftmargin;
|
||||
|
||||
int hDotsPerChar;
|
||||
int vDotsPerChar;
|
||||
|
||||
FILE *getData;
|
||||
int getDataPipe[2];
|
||||
|
||||
@@ -84,15 +95,13 @@ int getk()
|
||||
close(getDataPipe[1]); // not used
|
||||
close(putKeysPipe[0]); // not used
|
||||
|
||||
printf("rsh is running\n");
|
||||
|
||||
// use termios to turn off line buffering for both pipes
|
||||
struct termios term;
|
||||
tcgetattr(getDataPipe[0], &term);
|
||||
term.c_lflag &= ~ICANON ;
|
||||
tcsetattr(getDataPipe[0], TCSANOW,&term);
|
||||
tcgetattr(putKeysPipe[1], &term);
|
||||
term.c_lflag &= ~ICANON ;
|
||||
// term.c_lflag &= ~ICANON ;
|
||||
tcsetattr(putKeysPipe[0], TCSANOW,&term);
|
||||
|
||||
// open now a stream from the getDataPipe descriptor
|
||||
@@ -125,9 +134,9 @@ int getk()
|
||||
void tek4010_init()
|
||||
// put any code here to initialize the tek4010
|
||||
{
|
||||
counter = 0; // example
|
||||
x0 = 0;
|
||||
y0 = WINDOW_HEIGHT - WINDOW_HEIGHT / 36;
|
||||
hDotsPerChar = WINDOW_WIDTH / 74;
|
||||
vDotsPerChar = WINDOW_HEIGHT / 35;
|
||||
globalClearPersistent = 1;
|
||||
}
|
||||
|
||||
int tek4010_on_timer_event()
|
||||
@@ -166,11 +175,9 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
|
||||
int ch;
|
||||
int todo;
|
||||
char s[2];
|
||||
int showCursor = 1;
|
||||
|
||||
if (first) { // first surface is only cleared to black once
|
||||
cairo_set_source_rgb(cr, 0, 0, 0);
|
||||
cairo_paint(cr);
|
||||
|
||||
/* if (first) {
|
||||
for (int i=0; i<MEM; i++) {
|
||||
memx1[i]=2;
|
||||
memy1[i]=i * (WINDOW_HEIGHT/MEM);
|
||||
@@ -178,6 +185,14 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
|
||||
memy2[i]=i * (WINDOW_HEIGHT/MEM);
|
||||
memv[i]=0;
|
||||
}
|
||||
} */
|
||||
if (globalClearPersistent) {
|
||||
cairo_set_source_rgb(cr, 0, 0, 0);
|
||||
cairo_paint(cr);
|
||||
globalClearPersistent = 0;
|
||||
x0 = 0;
|
||||
y0 = WINDOW_HEIGHT - vDotsPerChar;
|
||||
leftmargin = 0;
|
||||
}
|
||||
cairo_set_source_rgba(cr2, 0, 0, 0, 0); // second surface is cleared each time
|
||||
cairo_set_operator(cr2, CAIRO_OPERATOR_SOURCE);
|
||||
@@ -191,19 +206,26 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
|
||||
cairo_set_source_rgb(cr, 0, 0.8, 0);
|
||||
|
||||
cairo_select_font_face(cr, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size(cr, 16);
|
||||
cairo_set_font_size(cr, 18);
|
||||
cairo_select_font_face(cr2, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
|
||||
cairo_set_font_size(cr2, 16);
|
||||
cairo_set_font_size(cr2, 18);
|
||||
|
||||
todo = TODO;
|
||||
|
||||
do {
|
||||
ch = getk();
|
||||
if (ch == 31) {
|
||||
if (ch == 31) { // exit from graphics mode
|
||||
mode = 0;
|
||||
ch = getk();
|
||||
}
|
||||
if (ch == -1) todo = 0; // no char available
|
||||
if (ch == -1) todo--; // no char available, need to allow for updates
|
||||
|
||||
if ((mode>=1) && (mode <=9) &&
|
||||
((ch==31) || (ch==13))) {
|
||||
mode = 0; // leave graphics mode
|
||||
showCursor = 0;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case 1: y0 = 32 * (ch - 32); mode++; break;
|
||||
case 2: y0 = y0 + ch - 96; mode++; break;
|
||||
@@ -212,13 +234,14 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
|
||||
case 5: y2 = 32 * (ch - 32); mode++; break;
|
||||
case 6: y2 = y2 + ch - 96; mode++; break;
|
||||
case 7: x2 = 32 * (ch - 32); mode++; break;
|
||||
case 8: x2 = x2 + ch - 64; mode++; break;
|
||||
case 9: cairo_move_to(cr, x0, WINDOW_HEIGHT - y0);
|
||||
case 8: x2 = x2 + ch - 64;
|
||||
cairo_move_to(cr, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_line_to(cr, x2, WINDOW_HEIGHT - y2);
|
||||
cairo_stroke (cr);
|
||||
cairo_move_to(cr2, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_line_to(cr2, x2, WINDOW_HEIGHT - y2);
|
||||
cairo_stroke (cr2);
|
||||
showCursor = 0;
|
||||
|
||||
// for speed reasons, do not update screen right away
|
||||
// if many very small verctors are drawn
|
||||
@@ -228,44 +251,98 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
|
||||
if ((y2-y0) > TODO) todo = 0;
|
||||
if ((y0-y2) > TODO) todo = 0;
|
||||
|
||||
mode = 0;
|
||||
x0 = x2; // prepare to additional vectors
|
||||
y0 = y2;
|
||||
mode = 5;
|
||||
break;
|
||||
case 10: // handle escape modes
|
||||
switch (ch) {
|
||||
case 12:cairo_set_source_rgb(cr, 0, 0.0, 0);
|
||||
cairo_paint(cr);
|
||||
cairo_set_source_rgb(cr, 0, 0.8, 0);
|
||||
x0 = 0;
|
||||
y0 = WINDOW_HEIGHT - WINDOW_HEIGHT / 36;
|
||||
case 12: cairo_set_source_rgb(cr, 0, 0.0, 0); // clear screen
|
||||
cairo_paint(cr);
|
||||
cairo_set_source_rgb(cr, 0, 0.8, 0);
|
||||
x0 = 0;
|
||||
y0 = WINDOW_HEIGHT - vDotsPerChar;
|
||||
mode = 0;
|
||||
break;
|
||||
case '[': // a second escape code follows, do not reset mode
|
||||
break;
|
||||
default: // printf("Escape code %d\n",ch);
|
||||
mode = 0;
|
||||
break;
|
||||
}
|
||||
mode = 0;
|
||||
break;
|
||||
default:switch (ch) {
|
||||
case 0: return; break;
|
||||
case EOF: return; break;
|
||||
case 9: x0 = x0 + 1 - (x0 % (8 * WINDOW_WIDTH / 74)) + 8* WINDOW_WIDTH / 74 - 1;
|
||||
break;
|
||||
case 10: y0 -= WINDOW_HEIGHT / 36; x0 = 0;
|
||||
if (y0 < 10) y0 = WINDOW_HEIGHT - WINDOW_HEIGHT / 36;
|
||||
break;
|
||||
case 13: mode = 0; todo = 0; x0 = 0; break;
|
||||
case 27: mode = 10; break; // escape mode
|
||||
case 29: mode = 1; break;
|
||||
default:// if (ch != -1) printf("ch code %d\n",ch);
|
||||
switch (ch) {
|
||||
case 0: break;
|
||||
case EOF: break;
|
||||
case 8: // backspace
|
||||
x0 -= hDotsPerChar;
|
||||
if (x0<leftmargin) x0 = leftmargin;
|
||||
break;
|
||||
case 9: // tab
|
||||
x0 = x0 - (x0 % (8 * hDotsPerChar)) + 8 * hDotsPerChar;
|
||||
break;
|
||||
case 10: // new line
|
||||
y0 -= vDotsPerChar;
|
||||
if (y0 < 4) {
|
||||
y0 = WINDOW_HEIGHT - vDotsPerChar;
|
||||
if (leftmargin) leftmargin = 0;
|
||||
else leftmargin = WINDOW_WIDTH / 2;
|
||||
}
|
||||
x0 = leftmargin;
|
||||
break;
|
||||
case 11: // VT, move one line up
|
||||
y0 += vDotsPerChar;
|
||||
break;
|
||||
case 13: // return
|
||||
mode = 0; todo = 0; x0 = leftmargin;
|
||||
break;
|
||||
case 27: // escape
|
||||
mode = 10;
|
||||
break;
|
||||
case 29: // group separator
|
||||
mode = 1;
|
||||
break;
|
||||
case 31: // US, leave graphics mode
|
||||
mode = 0;
|
||||
break;
|
||||
default:
|
||||
if ((ch >= 32) && (ch <=127)) { // printable character
|
||||
if ((ch >= 32) && (ch <=127)) { // printable character
|
||||
if (y0 < 8) y0 = 8;
|
||||
s[0] = ch;
|
||||
s[1] = 0;
|
||||
cairo_move_to(cr, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_move_to(cr, x0, WINDOW_HEIGHT - y0 + 4);
|
||||
cairo_show_text(cr, s);
|
||||
cairo_move_to(cr2, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_move_to(cr2, x0, WINDOW_HEIGHT - y0 + 4);
|
||||
cairo_show_text(cr2, s);
|
||||
x0 += WINDOW_WIDTH / 74;
|
||||
x0 += hDotsPerChar;
|
||||
todo--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (todo);
|
||||
|
||||
// display cursor
|
||||
|
||||
if (showCursor) {
|
||||
|
||||
cairo_set_source_rgb(cr2, 0, 0.8, 0);
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_rectangle(cr2, x0, WINDOW_HEIGHT - y0 - vDotsPerChar + 8,
|
||||
hDotsPerChar - 3, vDotsPerChar - 3);
|
||||
cairo_fill(cr2);
|
||||
cairo_stroke (cr2);
|
||||
}
|
||||
|
||||
// is child process still running?
|
||||
|
||||
int status;
|
||||
if (waitpid(-1, &status, WNOHANG)) { // Is child process terminated?
|
||||
tek4010_quit();
|
||||
gtk_main_quit();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
241
tek4010.c.1
241
tek4010.c.1
@@ -1,241 +0,0 @@
|
||||
/*
|
||||
* tek4010.c
|
||||
*
|
||||
* A tek 4010 graphics emulator
|
||||
*
|
||||
* Copyright 2016,2019 rricharz
|
||||
*
|
||||
*/
|
||||
|
||||
#define MEM 128
|
||||
|
||||
#define TODO 4 // for speed reasons, draw TODO small vectors until screen updates
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "tek4010.h"
|
||||
|
||||
static int counter = 0;
|
||||
static int memx1[MEM], memy1[MEM], memx2[MEM], memy2[MEM];
|
||||
static float memv[MEM];
|
||||
|
||||
static int count = 0;
|
||||
static int mode;
|
||||
static int x0,y0,x2,y2;
|
||||
|
||||
FILE *getData;
|
||||
int filedes[2]; // the file descriptors of the pipes
|
||||
|
||||
int getk()
|
||||
// get a char, if available, otherwise return -1
|
||||
{
|
||||
static int initialized = 0;
|
||||
char *argv[4];
|
||||
|
||||
if (!initialized) {
|
||||
|
||||
// create pipes for communication between parent and child
|
||||
if (pipe(filedes) == -1) {
|
||||
printf("Cannot initialize pipes\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// now fork a child process
|
||||
pid_t pid = fork();
|
||||
if (pid == -1) {
|
||||
printf("Cannot fork child process\n");
|
||||
exit(1);
|
||||
}
|
||||
else if (pid == 0) { // child process
|
||||
// prepare capturing stdout of child process
|
||||
while ((dup2(filedes[1], STDOUT_FILENO) == -1) && (errno == EINTR)) {}
|
||||
close(filedes[1]);
|
||||
close(filedes[0]);
|
||||
argv[0] = "rsh";
|
||||
argv[1] = "-l";
|
||||
argv[2] = "rene";
|
||||
argv[3]= "pdp11";
|
||||
execl("/usr/bin","rsh",argv);
|
||||
printf("Cannot execute rsh\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
|
||||
getData = popen("rsh -l rene pdp11", "r");
|
||||
if (getData == 0) {
|
||||
printf("cannot execute rsh\n");
|
||||
exit(1);
|
||||
}
|
||||
else printf("rsh is running\n");
|
||||
|
||||
// use termios to turn off line buffering
|
||||
struct termios term;
|
||||
tcgetattr(fileno(getData), &term);
|
||||
term.c_lflag &= ~ICANON ;
|
||||
tcsetattr(fileno(getData), TCSANOW,&term);
|
||||
setbuf(getData,0);
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
int bytesWaiting;
|
||||
ioctl(fileno(getData), FIONREAD, &bytesWaiting);
|
||||
if (bytesWaiting > 0)
|
||||
return getc(getData);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
void tek4010_init()
|
||||
// put any code here to initialize the tek4010
|
||||
{
|
||||
counter = 0; // example
|
||||
x0 = 0;
|
||||
y0 = WINDOW_HEIGHT - WINDOW_HEIGHT / 36;
|
||||
}
|
||||
|
||||
int tek4010_on_timer_event()
|
||||
// if TIMER_INTERVAL in tek4010.h is larger than zero, this function
|
||||
// is called every TIMER-INTERVAL milliseconds
|
||||
// if the function returns 1, the window is redrawn by calling applicatin_draw
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int tek4010_clicked(int button, int x, int y)
|
||||
// is called if a mouse button is clicked in the window
|
||||
// button = 1: means left mouse button; button = 3 means right mouse button
|
||||
// x and y are the coordinates
|
||||
// if the function returns 1, the window is redrawn by calling applicatin_draw
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void tek4010_quit()
|
||||
// is called if the main window is called bevore the tek4010 exits
|
||||
// put any code here which needs to be called on exit
|
||||
{
|
||||
pclose(getData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tek4010_draw(cairo_t *cr, cairo_t *cr2, int width, int height, int first)
|
||||
// draw onto the main window using cairo
|
||||
// width is the actual width of the main window
|
||||
// height is the actual height of the main window
|
||||
// surface1 is used for persistent drawing, surface2 for faiding drawing
|
||||
|
||||
{
|
||||
int ch;
|
||||
int todo;
|
||||
char s[2];
|
||||
|
||||
if (first) { // first surface is only cleared to black once
|
||||
cairo_set_source_rgb(cr, 0, 0, 0);
|
||||
cairo_paint(cr);
|
||||
|
||||
for (int i=0; i<MEM; i++) {
|
||||
memx1[i]=2;
|
||||
memy1[i]=i * (WINDOW_HEIGHT/MEM);
|
||||
memx2[i]=100;
|
||||
memy2[i]=i * (WINDOW_HEIGHT/MEM);
|
||||
memv[i]=0;
|
||||
}
|
||||
}
|
||||
cairo_set_source_rgba(cr2, 0, 0, 0, 0); // second surface is cleared each time
|
||||
cairo_set_operator(cr2, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint(cr2);
|
||||
cairo_set_operator(cr2, CAIRO_OPERATOR_OVER);
|
||||
cairo_set_line_width (cr2, 3);
|
||||
cairo_set_source_rgb(cr2, 1, 1, 1);
|
||||
|
||||
cairo_set_antialias(cr, CAIRO_ANTIALIAS_BEST);
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_set_source_rgb(cr, 0, 0.8, 0);
|
||||
|
||||
cairo_select_font_face(cr, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size(cr, 16);
|
||||
cairo_select_font_face(cr2, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
|
||||
cairo_set_font_size(cr2, 16);
|
||||
|
||||
todo = TODO;
|
||||
|
||||
do {
|
||||
ch = getk();
|
||||
if (ch == 31) {
|
||||
mode = 0;
|
||||
ch = getk();
|
||||
}
|
||||
if (ch == -1) todo = 0; // no char available
|
||||
switch (mode) {
|
||||
case 1: y0 = 32 * (ch - 32); mode++; break;
|
||||
case 2: y0 = y0 + ch - 96; mode++; break;
|
||||
case 3: x0 = 32 * (ch - 32); mode++; break;
|
||||
case 4: x0 = x0 + ch - 64; mode++; break;
|
||||
case 5: y2 = 32 * (ch - 32); mode++; break;
|
||||
case 6: y2 = y2 + ch - 96; mode++; break;
|
||||
case 7: x2 = 32 * (ch - 32); mode++; break;
|
||||
case 8: x2 = x2 + ch - 64; mode++; break;
|
||||
case 9: cairo_move_to(cr, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_line_to(cr, x2, WINDOW_HEIGHT - y2);
|
||||
cairo_stroke (cr);
|
||||
cairo_move_to(cr2, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_line_to(cr2, x2, WINDOW_HEIGHT - y2);
|
||||
cairo_stroke (cr2);
|
||||
|
||||
// for speed reasons, do not update screen right away
|
||||
// if many very small verctors are drawn
|
||||
todo--;
|
||||
if ((x2-x0) > TODO) todo = 0;
|
||||
if ((x0-x2) > TODO) todo = 0;
|
||||
if ((y2-y0) > TODO) todo = 0;
|
||||
if ((y0-y2) > TODO) todo = 0;
|
||||
|
||||
mode = 0;
|
||||
break;
|
||||
case 10: // handle escape modes
|
||||
switch (ch) {
|
||||
case 12:cairo_set_source_rgb(cr, 0, 0.0, 0);
|
||||
cairo_paint(cr);
|
||||
cairo_set_source_rgb(cr, 0, 0.8, 0);
|
||||
x0 = 0;
|
||||
y0 = WINDOW_HEIGHT - WINDOW_HEIGHT / 36;
|
||||
}
|
||||
mode = 0;
|
||||
break;
|
||||
default:switch (ch) {
|
||||
case 0: return; break;
|
||||
case EOF: return; break;
|
||||
case 9: x0 = x0 + 1 - (x0 % (8 * WINDOW_WIDTH / 74)) + 8* WINDOW_WIDTH / 74 - 1;
|
||||
break;
|
||||
case 10: y0 -= WINDOW_HEIGHT / 36; x0 = 0;
|
||||
if (y0 < 10) y0 = WINDOW_HEIGHT - WINDOW_HEIGHT / 36;
|
||||
break;
|
||||
case 13: mode = 0; todo = 0; x0 = 0; break;
|
||||
case 27: mode = 10; break; // escape mode
|
||||
case 29: mode = 1; break;
|
||||
default:
|
||||
if ((ch >= 32) && (ch <=127)) { // printable character
|
||||
s[0] = ch;
|
||||
s[1] = 0;
|
||||
cairo_move_to(cr, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_show_text(cr, s);
|
||||
cairo_move_to(cr2, x0, WINDOW_HEIGHT - y0);
|
||||
cairo_show_text(cr2, s);
|
||||
x0 += WINDOW_WIDTH / 74;
|
||||
todo--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (todo);
|
||||
}
|
||||
@@ -4,5 +4,5 @@
|
||||
#define WINDOW_NAME "Tektronix 4010" // name of main window
|
||||
#define ICON_NAME "" // path to icon for window
|
||||
|
||||
#define TIME_INTERVAL 1 // time interval for timer function in msec
|
||||
#define TIME_INTERVAL 25 // time interval for timer function in msec
|
||||
// 0 means no timer function
|
||||
|
||||
Reference in New Issue
Block a user