2 * Acess GUI (AxWin) Version 2
3 * By John Hodge (thePowersGang)
7 #include <acess/devices/terminal.h>
10 void Video_Setup(void);
11 void Video_Update(void);
12 void Video_FillRect(short X, short Y, short W, short H, uint32_t Color);
17 void Video_Setup(void)
22 giTerminalFD = open(gsTerminalDevice, OPENFLAG_READ|OPENFLAG_WRITE);
23 if( giTerminalFD == -1 )
25 fprintf(stderr, "ERROR: Unable to open '%s' (%i)\n", gsTerminalDevice, _errno);
30 tmpInt = giScreenWidth;
31 tmpInt = ioctl( giTerminalFD, TERM_IOCTL_WIDTH, &tmpInt );
32 if(tmpInt != giScreenWidth)
34 fprintf(stderr, "Warning: Selected width (%i) is invalid, clipped to %i\n",
35 giScreenWidth, tmpInt);
36 giScreenWidth = tmpInt;
40 tmpInt = giScreenHeight;
41 tmpInt = ioctl( giTerminalFD, TERM_IOCTL_HEIGHT, &tmpInt );
42 if(tmpInt != giScreenHeight)
44 fprintf(stderr, "Warning: Selected height (%i) is invalid, clipped to %i\n",
45 giScreenHeight, tmpInt);
46 giScreenHeight = tmpInt;
50 tmpInt = TERM_MODE_FB;
51 ioctl( giTerminalFD, TERM_IOCTL_MODETYPE, &tmpInt );
53 // Force VT8 to be shown
54 ioctl( giTerminalFD, TERM_IOCTL_FORCESHOW, NULL );
56 // Create local framebuffer (back buffer)
57 gpScreenBuffer = malloc( giScreenWidth*giScreenHeight*4 );
58 memset32( gpScreenBuffer, 0x8888FF, giScreenWidth*giScreenHeight );
62 void Video_Update(void)
64 //seek(giTerminalFD, 0, SEEK_SET);
65 seek(giTerminalFD, 0, 1);
66 write(giTerminalFD, giScreenWidth*giScreenHeight*4, gpScreenBuffer);
69 void Video_FillRect(short X, short Y, short W, short H, uint32_t Color)
71 uint32_t *buf = gpScreenBuffer + Y*giScreenWidth + X;
75 memset32( buf, Color, W );