Various drawing fixes

This commit is contained in:
simon.kagstrom 2009-11-24 06:36:11 +00:00
parent a9aa219f4b
commit 1adedb732a
2 changed files with 6 additions and 6 deletions

View File

@ -36,7 +36,7 @@ static void run(void)
g_menu->pushEvent(&ev); g_menu->pushEvent(&ev);
} }
g_menu->draw(screen, 0, 80, 400, 400); g_menu->draw(screen, 80, 80, 400, 400);
SDL_Flip(screen); SDL_Flip(screen);
SDL_Delay(50); SDL_Delay(50);
@ -50,7 +50,7 @@ const char *main_menu_messages[] = {
/*05*/ "^|Load|Save|Delete", /*05*/ "^|Load|Save|Delete",
/*06*/ "Keyboard", /*06*/ "Keyboard",
/*07*/ "^|Type|Macro|Bind", /*07*/ "^|Type|Macro|Bind",
/*08*/ "#1-------------------------------------", /*08*/ " ",
/*09*/ "Reset the C=64", /*09*/ "Reset the C=64",
/*10*/ "Networking", /*10*/ "Networking",
/*11*/ "Options", /*11*/ "Options",

View File

@ -77,10 +77,10 @@ void Menu::highlightBackground(SDL_Surface *where, int x, int y, int w, int h)
int font_height = TTF_FontHeight(this->font); int font_height = TTF_FontHeight(this->font);
int bg_y_start = y + font_height / 2 - int bg_y_start = y + font_height / 2 -
this->text_bg_left->h / 2; this->text_bg_left->h / 2;
int bg_x_start = x - this->text_bg_right->w / 2; int bg_x_start = x - this->text_bg_left->w / 3;
int bg_x_end = x + w - int bg_x_end = x + w -
this->text_bg_right->w / 2; (2 * this->text_bg_right->w) / 3;
int n_mid = (bg_x_end - x + this->text_bg_right->w + 4) / this->text_bg_middle->w; int n_mid = (bg_x_end - bg_x_start + this->text_bg_left->w / 3) / this->text_bg_middle->w;
dst = (SDL_Rect){bg_x_start, bg_y_start, 0,0}; dst = (SDL_Rect){bg_x_start, bg_y_start, 0,0};
SDL_BlitSurface(this->text_bg_left, NULL, SDL_BlitSurface(this->text_bg_left, NULL,
@ -132,7 +132,7 @@ void Menu::draw(SDL_Surface *where, int x, int y, int w, int h)
if (i >= this->n_entries) if (i >= this->n_entries)
break; break;
cur_y = (i - start_entry_visible) * line_height; cur_y = y + (i - start_entry_visible) * line_height;
/* Draw the background for the selected entry */ /* Draw the background for the selected entry */
if (this->cur_sel == i) { if (this->cur_sel == i) {