mslehre / MAS

Maximum Acyclic Subgraph (MAS) - Multiple Sequence Alignment (MSA) Game
1 stars 0 forks source link

Feature/sLt1 button #77

Closed TimonKapischke closed 5 years ago

TimonKapischke commented 5 years ago

I have the problem that I don't know how to pass different function typs with one function call. (void, int, ....)

felbecker commented 5 years ago

Depends on what you mean. Can you give an example? Isn't void(void) for the button function enough? What types of arguments do you expect to pass to it and to return from it?

TimonKapischke commented 5 years ago

void test1() { ...} string test2(graph) {...} string test3() {...}

Button b1 = Button("Button1.png", 100, 100, test1); Button b2 = Button("Button2.png", 200, 100, test2); ...

Maybe we need other functions for the buttons. Not only void functions with no arguments. For level loading : loadLevel(graph); window.close(); (this dosent work yet)

We can also give strings back: With a new variable "GUI_state" we dont need the boolean "is_clicked" variable for every button. string GUI_state = {start, help, settings, level_choosing, ingame}

felbecker commented 5 years ago

We can use lambda expressions (https://en.cppreference.com/w/cpp/language/lambda): std::function<void()> func = [graph] () { do something with graph } They can capture objects or refs to objects ([] brackets) while the function itself has no arguments.

TimonKapischke commented 5 years ago

The create_level() function don't work yet. I can call the SequenceSimulation program but the program doesn't return a FASTA file. I don't know why... Mayby the system call.

felbecker commented 5 years ago

Why has Button a create_level method? I wouldn't use system. Just include the Sequence Simulation code as usual. Or simply use fasta files produced externally.

felbecker commented 5 years ago

Thanks