I come here before you with nothing but HTML, PHP, CSS and Lua knowledge. Seeing how I consider myself skilled enough with Lua, I keep trying to do things in C++, that I could do in Lua.
Today I wanted to write some simple functions to detect which key is pressed, if a key is pressed, etc. All really basic and mostly useless seeing how most of these functions already exist.
Now I wanted to make some sort of function that works like this:
void keyDownCallback(int keyCode, function callbackFunc)
{
while(true)
{
if(keyIsDown(keyCode))
{
callbackFunc(keyCode);
}
}
}
I hope you instantly see what I mean, I'm trying to call a function that is supposed to be hooked at a certain key press.
How would I go about doing this? Making the callbackFunc actually work?
I hope I can get some help from you guys here.
PS: You're talking to a massive C++ noob here, so be careful not to make it too hard for me ;P












