2011-08-02 00:10:15 +00:00
|
|
|
#include <sysinit.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include "basic/basic.h"
|
|
|
|
#include "basic/byteorder.h"
|
|
|
|
#include "basic/config.h"
|
|
|
|
|
|
|
|
#include "lcd/lcd.h"
|
|
|
|
#include "lcd/print.h"
|
|
|
|
|
|
|
|
#include "filesystem/ff.h"
|
|
|
|
#include "filesystem/select.h"
|
2011-08-04 23:33:48 +00:00
|
|
|
#include "filesystem/execute.h"
|
2011-08-02 00:10:15 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2011-08-04 14:57:18 +00:00
|
|
|
void simpleNickname(void);
|
|
|
|
|
2011-08-02 00:10:15 +00:00
|
|
|
void fancyNickname(void) {
|
2011-08-04 14:57:18 +00:00
|
|
|
if(GLOBAL(l0nick)){
|
2011-08-05 15:39:00 +00:00
|
|
|
if(execute_file(GLOBAL(nickl0)))
|
2011-08-04 14:57:18 +00:00
|
|
|
GLOBAL(l0nick)=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!GLOBAL(l0nick))
|
|
|
|
simpleNickname();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void simpleNickname(void) {
|
2011-08-02 00:10:15 +00:00
|
|
|
int dx=0;
|
|
|
|
int dy=0;
|
|
|
|
static uint32_t ctr=0;
|
|
|
|
ctr++;
|
|
|
|
|
2011-08-02 19:01:27 +00:00
|
|
|
setExtFont(GLOBAL(nickfont));
|
|
|
|
dx=DoString(0,0,GLOBAL(nickname));
|
|
|
|
dx=(RESX-dx)/2;
|
|
|
|
if(dx<0)
|
|
|
|
dx=0;
|
|
|
|
dy=(RESY-getFontHeight())/2;
|
2011-08-02 00:10:15 +00:00
|
|
|
|
|
|
|
lcdClear();
|
|
|
|
DoString(dx,dy,GLOBAL(nickname));
|
|
|
|
lcdRefresh();
|
|
|
|
|
2011-08-02 19:01:27 +00:00
|
|
|
while(getInputRaw()==BTN_NONE){
|
|
|
|
work_queue();
|
|
|
|
};
|
2011-08-02 00:10:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
void init_nick(void){
|
2011-08-02 00:10:15 +00:00
|
|
|
readFile("nick.cfg",GLOBAL(nickname),MAXNICK);
|
2011-08-02 19:23:10 +00:00
|
|
|
readFile("font.cfg",GLOBAL(nickfont),FILENAMELEN);
|
2011-08-04 14:57:18 +00:00
|
|
|
readFile("l0nick.cfg",GLOBAL(nickl0),FILENAMELEN);
|
2011-08-02 00:10:15 +00:00
|
|
|
};
|
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
//# MENU nick editNick
|
2011-08-02 00:10:15 +00:00
|
|
|
void doNick(void){
|
|
|
|
input("Nickname:", GLOBAL(nickname), 32, 127, MAXNICK-1);
|
|
|
|
writeFile("nick.cfg",GLOBAL(nickname),strlen(GLOBAL(nickname)));
|
|
|
|
getInputWait();
|
|
|
|
};
|
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
//# MENU nick changeFont
|
2011-08-02 00:10:15 +00:00
|
|
|
void doFont(void){
|
|
|
|
getInputWaitRelease();
|
|
|
|
if( selectFile(GLOBAL(nickfont),"F0N") != 0){
|
|
|
|
lcdPrintln("No file selected.");
|
|
|
|
return;
|
|
|
|
};
|
2011-08-02 21:53:41 +00:00
|
|
|
writeFile("font.cfg",GLOBAL(nickfont),strlen(GLOBAL(nickfont)));
|
2011-08-02 00:10:15 +00:00
|
|
|
|
|
|
|
lcdClear();
|
|
|
|
setIntFont(&Font_7x8);
|
2011-08-02 19:23:10 +00:00
|
|
|
lcdPrintln("Test:");
|
|
|
|
setExtFont(GLOBAL(nickfont));
|
|
|
|
lcdPrintln(GLOBAL(nickname));
|
2011-08-02 00:10:15 +00:00
|
|
|
lcdDisplay();
|
2011-08-02 19:23:10 +00:00
|
|
|
setIntFont(&Font_7x8);
|
2011-08-02 00:10:15 +00:00
|
|
|
while(!getInputRaw())delayms(10);
|
|
|
|
};
|
2011-08-04 14:57:18 +00:00
|
|
|
|
|
|
|
//# MENU nick chooseAnim
|
|
|
|
void doAnim(void){
|
|
|
|
getInputWaitRelease();
|
|
|
|
if( selectFile(GLOBAL(nickl0),"NIK") != 0){
|
|
|
|
lcdPrintln("No file selected.");
|
|
|
|
GLOBAL(l0nick)=0;
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
writeFile("l0nick.cfg",GLOBAL(nickl0),strlen(GLOBAL(nickl0)));
|
|
|
|
GLOBAL(l0nick)=1;
|
2011-08-05 12:57:22 +00:00
|
|
|
saveConfig();
|
2011-08-04 14:57:18 +00:00
|
|
|
getInputWaitRelease();
|
|
|
|
};
|