Saner code.

This commit is contained in:
Stefan `Sec` Zehl 2011-08-02 00:03:37 +02:00
parent 162fd9775c
commit 623582bbb4
3 changed files with 16 additions and 5 deletions

View File

@ -2,7 +2,6 @@
#include "basic/basic.h"
#include "lcd/render.h"
#include "lcd/print.h"
/**************************************************************************/
@ -16,11 +15,11 @@ void handleMenu(const struct MENU *the_menu) {
if (the_menu == NULL) return;
// font = &Font_7x8; // Font needs to be set externally?
setSystemFont();
for (numentries = 0; the_menu->entries[numentries] != NULL; numentries++);
visible_lines = (RESY/getFontHeight())-1; // subtract title line
visible_lines = lcdGetVisibleLines()-1; // subtract title line
#ifdef SAFETY
if (visible_lines < 2) return;
#endif
@ -75,7 +74,7 @@ void handleMenu(const struct MENU *the_menu) {
getInputWaitRelease();
if (the_menu->entries[menuselection]->callback!=NULL)
the_menu->entries[menuselection]->callback();
lcdDisplay();
lcdRefresh();
getInputWait();
break;

View File

@ -2,6 +2,7 @@
#include <render.h>
#include <fonts.h>
#include <print.h>
#include <fonts/smallfonts.h>
int x=0;
int y=0;
@ -69,3 +70,13 @@ void lcdSetCrsr(int dx,int dy){
void lcdSetCrsrX(int dx){
x=dx;
};
void setSystemFont(void){
setIntFont(&Font_7x8);
};
int lcdGetVisibleLines(void){
return (RESY/getFontHeight()); // subtract title line
};

View File

@ -10,4 +10,5 @@ void lcdRefresh();
void lcdMoveCrsr(signed int dx,signed int dy);
void lcdSetCrsr(int dx,int dy);
void lcdSetCrsrX(int dx);
void setSystemFont(void);
int lcdGetVisibleLines(void);