C/C++ 105 Loops and conditionals(w/o for loops)
Uploader Comments (ryutenchi)
All Comments (8)
-
GPL DOES NOT mean I can do what I want with it.
it means I can do what YOU want with it.
fuck gpl and my tutorials don't have that annoying whistle in the background ;)
-
Seriously, it's to advanced for me by now. As far as I understand, I should do it backwards. Instead of assigning a key to a function, I should prepare case for every possible key and then let user assaign an action to it, is that right?
After a while I think video on that would be really helpful. I think I am able to solve that riddle myself with help of google, still, I wouldn't mind an example :).
-
I used switch to control my character in some roguelike game. But I wanted to have a possibility of redefining keys anytime so I did this:
char Up=0x77 // hex ASCII for 'w'
char Down=0x73 // hex ASCII for 's'
switch(PressedKey)
{ case Up: blabla; case Down: blabla;
}
Compiler says Up can't be used after case, the same with Down. Why? :|
-
I recommend tearing audio apart from video (with virtualdub for instance) and cleaning it with audacity's Noise Removal effect, then joining audio and video back again (virtualdub). That's one way of doing it.
-
fantastic...........thanx.....
......
I used switch to control my character in some roguelike game. But I wanted to have a possibility of redefining keys anytime so I did this:
char Up=0x77 // hex ASCII for 'w'
char Down=0x73 // hex ASCII for 's'
switch(PressedKey)
{ case Up: blabla; case Down: blabla;
}
Compiler says Up can't be used after case, the same with Down. Why? :|
cgofme 3 years ago
you can only use constants for cases. So you could either do:
case 0x77: blah; case 0x73: blah; or
#define Up 0x77
#define Down 0x73
case Up: blah; case Down blah; or
const char Up = 0x77;
const char Down = 0x73;...blah
the reason for this is that each case must be unique and there is no guarantee that they will be if they are not constant
ryutenchi 3 years ago
Well, that's definitively reasonable. But then, how to make possibility to redefine the keys without recompilation?
cgofme 3 years ago
you can have case 0x77: upArrowCallBack();
and then set the upArrowCallBack to whatever function you want called when the up key is pressed and then you can have a downArrowCallBack etc. Need me to go over callback functions? as for the cases themselves being set at runtime, in order for the compiler to create the machine code for the program it needs constants there. so those must be constant, but what you do in the actual code for the case can be as dynamic as you like^^
ryutenchi 3 years ago
Gd videos ! appart from that damm whistling in the backgroud and quiet mic yeah great keep them coming.
rome877 4 years ago
yeah, I need to get a better mic or get a sound card. thanks for watching despite that!
ryutenchi 4 years ago