Refactored DoConfig a bit
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
parent
88f22510ee
commit
47fbf3ece7
1 changed files with 59 additions and 53 deletions
|
@ -34,11 +34,11 @@ struct data{
|
||||||
};
|
};
|
||||||
|
|
||||||
class RadioRow{
|
class RadioRow{
|
||||||
public:
|
public:
|
||||||
RadioRow(char offset);
|
RadioRow(char offset);
|
||||||
int value();
|
int value();
|
||||||
void value(int input);
|
void value(int input);
|
||||||
private:
|
private:
|
||||||
Fl_Group *group;
|
Fl_Group *group;
|
||||||
Fl_Radio_Round_Button *buttons[6];
|
Fl_Radio_Round_Button *buttons[6];
|
||||||
Fl_Group *label;
|
Fl_Group *label;
|
||||||
|
@ -63,8 +63,8 @@ static void LongToChars(unsigned long long_var, unsigned char *chars)
|
||||||
|
|
||||||
RadioRow::RadioRow(char offset){
|
RadioRow::RadioRow(char offset){
|
||||||
char *temp = new char[2];
|
char *temp = new char[2];
|
||||||
*(temp) = (char)(49+offset); //Muhahahahahahah!
|
temp[0] = '1' + offset;
|
||||||
*(temp+1) = '\0';
|
temp[1] = '\0';
|
||||||
this->group = new Fl_Group(140+offset*30, 150, 30, 180);
|
this->group = new Fl_Group(140+offset*30, 150, 30, 180);
|
||||||
this->group->label(temp);
|
this->group->label(temp);
|
||||||
this->group->align(FL_ALIGN_TOP_LEFT);
|
this->group->align(FL_ALIGN_TOP_LEFT);
|
||||||
|
@ -142,7 +142,7 @@ void read_Config(){
|
||||||
}
|
}
|
||||||
for(char i=0;i<8;i++){
|
for(char i=0;i<8;i++){
|
||||||
const unsigned long button = CharsToLong(config.buttons[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};
|
const unsigned int button_lookup[6] = {0, 1, 2, 4, 5, 3};
|
||||||
joyRows[i]->value(button_lookup[button-1]);
|
joyRows[i]->value(button_lookup[button-1]);
|
||||||
}
|
}
|
||||||
|
@ -224,27 +224,33 @@ int main(int argc, char* argv[]){
|
||||||
for(char i=0;i<8;i++){
|
for(char i=0;i<8;i++){
|
||||||
joyRows[i] = new RadioRow(i);
|
joyRows[i] = new RadioRow(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//There's no Label class alright? I'll switch it as soon as one is introduced.
|
//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);
|
Fl_Group *labeljump = new Fl_Group(10, 150, 10, 20);
|
||||||
labeljump->label("Jump:");
|
labeljump->label("Jump:");
|
||||||
labeljump->align(FL_ALIGN_RIGHT);
|
labeljump->align(FL_ALIGN_RIGHT);
|
||||||
labeljump->end();
|
labeljump->end();
|
||||||
|
|
||||||
Fl_Group *labelattack = new Fl_Group(10, 180, 10, 20);
|
Fl_Group *labelattack = new Fl_Group(10, 180, 10, 20);
|
||||||
labelattack->label("Attack:");
|
labelattack->label("Attack:");
|
||||||
labelattack->align(FL_ALIGN_RIGHT);
|
labelattack->align(FL_ALIGN_RIGHT);
|
||||||
labelattack->end();
|
labelattack->end();
|
||||||
|
|
||||||
Fl_Group *labelweaponup = new Fl_Group(10, 210, 10, 20);
|
Fl_Group *labelweaponup = new Fl_Group(10, 210, 10, 20);
|
||||||
labelweaponup->label("Weapon+:");
|
labelweaponup->label("Weapon+:");
|
||||||
labelweaponup->align(FL_ALIGN_RIGHT);
|
labelweaponup->align(FL_ALIGN_RIGHT);
|
||||||
labelweaponup->end();
|
labelweaponup->end();
|
||||||
|
|
||||||
Fl_Group *labelweapondown = new Fl_Group(10, 240, 10, 20);
|
Fl_Group *labelweapondown = new Fl_Group(10, 240, 10, 20);
|
||||||
labelweapondown->label("Weapon-:");
|
labelweapondown->label("Weapon-:");
|
||||||
labelweapondown->align(FL_ALIGN_RIGHT);
|
labelweapondown->align(FL_ALIGN_RIGHT);
|
||||||
labelweapondown->end();
|
labelweapondown->end();
|
||||||
|
|
||||||
Fl_Group *labelitem = new Fl_Group(10, 270, 10, 20);
|
Fl_Group *labelitem = new Fl_Group(10, 270, 10, 20);
|
||||||
labelitem->label("Items:");
|
labelitem->label("Items:");
|
||||||
labelitem->align(FL_ALIGN_RIGHT);
|
labelitem->align(FL_ALIGN_RIGHT);
|
||||||
labelitem->end();
|
labelitem->end();
|
||||||
|
|
||||||
Fl_Group *labelmap = new Fl_Group(10, 300, 10, 20);
|
Fl_Group *labelmap = new Fl_Group(10, 300, 10, 20);
|
||||||
labelmap->label("Map:");
|
labelmap->label("Map:");
|
||||||
labelmap->align(FL_ALIGN_RIGHT);
|
labelmap->align(FL_ALIGN_RIGHT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue