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{
|
||||
public:
|
||||
public:
|
||||
RadioRow(char offset);
|
||||
int value();
|
||||
void value(int input);
|
||||
private:
|
||||
private:
|
||||
Fl_Group *group;
|
||||
Fl_Radio_Round_Button *buttons[6];
|
||||
Fl_Group *label;
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue