void DoClearFrontBuffer(void) // CLEAR DX BUFFER { // clear the screen, and flush it DEBUG_print("DoClearFrontBuffer",DBG_GPU1); // printf("DoClearFrontBuffer\n"); //Write menu/debug text on screen GXColor fontColor = {150,255,150,255}; write_font_init_GX(fontColor); if(ulKeybits&KEY_SHOWFPS) write_font(10,35,szDispBuf, 1.0); int i = 0; DEBUG_update(); for (i=0;i<DEBUG_TEXT_HEIGHT;i++) write_font(10,(10*i+60),text[i], 0.5); //reset swap table from GUI/DEBUG GX_SetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); GX_SetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0); GX_DrawDone(); whichfb ^= 1; GX_CopyDisp(xfb[0], GX_TRUE); GX_DrawDone(); VIDEO_SetNextFramebuffer(xfb[0]); VIDEO_Flush(); // VIDEO_WaitVSync(); }
void SwitchConsole_int(CONSOLE *which){ //this one doesn't sti __asm("cli"); CurrentConsole=which; ProcessConsole=which; //just for now.. write_regs(which->vga_registers); write_font(which->font,which->text_height); RefreshConsole(); }
void WriteCentre( int y, char *string) { int x, t; for (x=t=0; t<strlen(string); t++) x += font_size[(u8)string[t]]; if (x>640) x=640; x = (640 - x) >> 1; write_font(x, y, string); }
void SetConsoleMode(unsigned char video_mode){ ProcessConsole->video_mode=video_mode; ProcessConsole->vga_registers=video_modes[video_mode]; //must resolve the font for each video mode switch(video_mode){ //set appropriate fonts, and sizes case 0: ProcessConsole->font=g_8x8_font; ProcessConsole->text_height=8; ProcessConsole->width=90; ProcessConsole->height=60; ProcessConsole->size=90*60*2; break; case 1: ProcessConsole->font=g_8x16_font; ProcessConsole->text_height=16; ProcessConsole->width=80; ProcessConsole->height=25; ProcessConsole->size=80*25*2; break; case 2: ProcessConsole->font=g_8x16_font; ProcessConsole->text_height=16; ProcessConsole->width=90; ProcessConsole->height=30; ProcessConsole->size=90*30*2; break; case 3: ProcessConsole->font=g_8x8_font; ProcessConsole->text_height=8; ProcessConsole->width=80; ProcessConsole->height=50; ProcessConsole->size=80*50*2; break; case 4: ProcessConsole->font=g_8x8_font; ProcessConsole->text_height=8; ProcessConsole->width=40; ProcessConsole->height=50; ProcessConsole->size=40*50*2; break; case 5: ProcessConsole->font=g_8x16_font; ProcessConsole->text_height=16; ProcessConsole->width=40; ProcessConsole->height=25; ProcessConsole->size=40*25*2; break; } free(ProcessConsole->buffer); ProcessConsole->size=(ProcessConsole->width*2*ProcessConsole->height); ProcessConsole->buffer=malloc(ProcessConsole->size); cls(); __asm("cli"); write_regs(ProcessConsole->vga_registers); write_font(ProcessConsole->font,ProcessConsole->text_height); RefreshConsole(); __asm("sti"); }
int main() { SWFFONT hexfont; memset(&hexfont, 0, sizeof(hexfont)); hexfont.name = (U8*)"HexFont"; hexfont.layout = malloc(sizeof(SWFLAYOUT)); hexfont.numchars = 256; hexfont.maxascii = 256; hexfont.encoding = 32; hexfont.glyph2ascii = malloc(sizeof(U16)*256); hexfont.ascii2glyph = malloc(sizeof(int)*256); hexfont.glyph = malloc(sizeof(SWFGLYPH)*256); hexfont.glyphnames = malloc(sizeof(char*)*256); hexfont.layout->bounds = malloc(sizeof(SRECT)*256); hexfont.layout->kerningcount = 0; hexfont.layout->kerning = 0; int t; int ymax =-0x7fffffff; int ymin = 0x7fffffff; for(t=0;t<256;t++) { drawer_t _draw,*draw=&_draw; swf_Shape01DrawerInit(draw, 0); int x,y; FPOINT d; int rx = 0;//t&15; int ry = 0;//(t&15)^0x05; #define S {d.x*=20*4+2;d.y*=20*4+2;} if(1) { for(x=0;x<8;x++) for(y=0;y<8;y++) { if((x^y)&1) { d.x=x;d.y=-y; S;draw->moveTo(draw, &d); d.x=x+1;d.y=-y; S;draw->lineTo(draw, &d); d.x=x+1;d.y=-y-1; S;draw->lineTo(draw, &d); d.x=x;d.y=-y-1; S;draw->lineTo(draw, &d); d.x=x;d.y=-y; S;draw->lineTo(draw, &d); } } } else { d.x=0;d.y=-0; S;draw->moveTo(draw, &d); d.x=0;d.y=-8; S;draw->lineTo(draw, &d); d.x=8;d.y=-8; S;draw->lineTo(draw, &d); d.x=8;d.y=-0; S;draw->lineTo(draw, &d); d.x=0;d.y=-0; S;draw->lineTo(draw, &d); d.x=1;d.y=-1; S;draw->moveTo(draw, &d); d.x=7;d.y=-1; S;draw->lineTo(draw, &d); d.x=7;d.y=-7; S;draw->lineTo(draw, &d); d.x=1;d.y=-7; S;draw->lineTo(draw, &d); d.x=1;d.y=-1; S;draw->lineTo(draw, &d); } draw->finish(draw); hexfont.glyph[t].shape = swf_ShapeDrawerToShape(draw); hexfont.layout->bounds[t] = swf_ShapeDrawerGetBBox(draw); hexfont.glyph[t].advance = hexfont.layout->bounds[t].xmax + hexfont.layout->bounds[t].xmin; draw->dealloc(draw); hexfont.glyph2ascii[t] = t; hexfont.ascii2glyph[t] = t; hexfont.glyphnames[t] = 0; if(hexfont.layout->bounds[t].ymax > ymax) ymax = hexfont.layout->bounds[t].ymax; if(hexfont.layout->bounds[t].ymin < ymin) ymin = hexfont.layout->bounds[t].ymin; if(t>=0xe4) { /* breaks flashtype, but not (non-flashtype) definefont2 */ //hexfont.glyph2ascii[t] = 0; } } hexfont.layout->ascent = ymin<0?-ymin:0; hexfont.layout->descent = ymax>0?ymax:0; hexfont.layout->leading = hexfont.layout->ascent + hexfont.layout->descent; write_font(&hexfont, "alignzones.swf"); return 0; }