/* use default 8x8 font */ GUI_Font::GUI_Font() { SDL_Surface *temp=GUI_DefaultFont(); fontStore=SDL_ConvertSurface(temp,temp->format,SDL_SWSURFACE); charh = fontStore->h/16; charw = fontStore->w/16; freefont=1; SetTransparency(1); }
/* use given YxY surface */ GUI_Font::GUI_Font(SDL_Surface *bitmap) { if (bitmap==NULL) fontStore=GUI_DefaultFont(); else fontStore=bitmap; charh = fontStore->h/16; charw = fontStore->w/16; freefont=0; SetTransparency(1); }
/* use default 8x8 font */ GUI_Font::GUI_Font(Uint8 fontType) { SDL_Surface *temp; w_data = NULL; if(fontType == GUI_FONT_6X8) temp = GUI_Font6x8(); else if(fontType == GUI_FONT_GUMP) { temp = GUI_FontGump(); w_data = GUI_FontGumpWData(); } else temp = GUI_DefaultFont(); fontStore=SDL_ConvertSurface(temp,temp->format,SDL_SWSURFACE); charh = fontStore->h/16; charw = fontStore->w/16; freefont=1; SetTransparency(1); }
GUI_TermWin:: GUI_TermWin(int x, int y, int w, int h, SDL_Surface *Font, void (*KeyProc)(SDLKey key, Uint16 unicode), int scrollback) : GUI_Scrollable(NULL, x, y, w, h) { printf("FUNCTION CALL: GUI_TermWin:: GUI_TermWin\n"); FILE *f=fopen("debug.log","a"); fprintf(f,"FUNCTION CALL: GUI_TermWin:: GUI_TermWin\n"); fclose(f); /* The font surface should be a 16x16 character pixmap */ if ( Font == NULL ) { font = GUI_DefaultFont(); } else { font = Font; } charh = font->h/16; charw = font->w/16; rows = h/(charh-1); /* Bottom row in font is not displayed */ cols = w/charw; if ( scrollback == 0 ) { scrollback = rows; } total_rows = scrollback; /* Allocate and clear the character buffer */ vscreen = new Uint8[total_rows*cols]; Clear(); /* Set the user-defined keyboard handler */ keyproc = KeyProc; repeat_key = SDLK_UNKNOWN; repeat_unicode = 0; /* Set key event translation on */ translated = SDL_EnableUNICODE(1); }