Refactored DoConfig a bit

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
Gabriel Ravier 2019-09-11 09:27:54 +02:00
parent 88f22510ee
commit 47fbf3ece7
No known key found for this signature in database
GPG key ID: 1E75F156884F3DCE

View file

@ -63,8 +63,8 @@ static void LongToChars(unsigned long long_var, unsigned char *chars)
RadioRow::RadioRow(char offset){
char *temp = new char[2];
*(temp) = (char)(49+offset); //Muhahahahahahah!
*(temp+1) = '\0';
temp[0] = '1' + offset;
temp[1] = '\0';
this->group = new Fl_Group(140+offset*30, 150, 30, 180);
this->group->label(temp);
this->group->align(FL_ALIGN_TOP_LEFT);
@ -142,7 +142,7 @@ void read_Config(){
}
for(char i=0;i<8;i++){
const unsigned long button = CharsToLong(config.buttons[i]);
if(button<9 && button>0){
if(button<6 && button>0){
const unsigned int button_lookup[6] = {0, 1, 2, 4, 5, 3};
joyRows[i]->value(button_lookup[button-1]);
}
@ -224,27 +224,33 @@ int main(int argc, char* argv[]){
for(char i=0;i<8;i++){
joyRows[i] = new RadioRow(i);
}
//There's no Label class alright? I'll switch it as soon as one is introduced.
Fl_Group *labeljump = new Fl_Group(10, 150, 10, 20);
labeljump->label("Jump:");
labeljump->align(FL_ALIGN_RIGHT);
labeljump->end();
Fl_Group *labelattack = new Fl_Group(10, 180, 10, 20);
labelattack->label("Attack:");
labelattack->align(FL_ALIGN_RIGHT);
labelattack->end();
Fl_Group *labelweaponup = new Fl_Group(10, 210, 10, 20);
labelweaponup->label("Weapon+:");
labelweaponup->align(FL_ALIGN_RIGHT);
labelweaponup->end();
Fl_Group *labelweapondown = new Fl_Group(10, 240, 10, 20);
labelweapondown->label("Weapon-:");
labelweapondown->align(FL_ALIGN_RIGHT);
labelweapondown->end();
Fl_Group *labelitem = new Fl_Group(10, 270, 10, 20);
labelitem->label("Items:");
labelitem->align(FL_ALIGN_RIGHT);
labelitem->end();
Fl_Group *labelmap = new Fl_Group(10, 300, 10, 20);
labelmap->label("Map:");
labelmap->align(FL_ALIGN_RIGHT);