Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

SDLX::EventDispatcher #65

Open
kthakore opened this Issue Jul 26, 2011 · 4 comments

Comments

Projects
None yet
1 participant
Owner

kthakore commented Jul 26, 2011

Create an dispatcher which polls the Events.

If it finds a sub e.g. called on_key_down() or on_quit() it will call this function with the params...

So you can easily write something like this:

on_key_down
{
$key = shift;

print "heureka, we've got an 'a'!\n" if 'a' == $key;
}

@ghost ghost assigned kthakore Jul 26, 2011

Owner

kthakore commented Jul 26, 2011

Author: kthakore
Time: 1257953009
Field: difficulty
Value: Tough

Owner

kthakore commented Jul 26, 2011

Author: kthakore
Time: 1257953009
Field: version
Value: 3.5

Owner

kthakore commented Jul 26, 2011

Author: kthakore
Time: 1257953009
Field: comment
Value:

Owner

kthakore commented Jul 26, 2011

Author: Blaizer
Time: 1279890852
Field: comment
Value: I would like this. Good idea.

Here's an idea, Win32::GUI does it like this:

my $main = Win32::GUI::Window->new(
    -name => 'Main',
    -width => 200,
    -height => 200
);

sub Main_Terminate {
    return -1;
}

sub Main_Minimize {
    $main->Disable();
    $main->Hide();
    return 1;
}

It's neat, but probably not needed because SDL can't have multiple windows. Still, it would be good to have a quick look at how Win32::GUI does stuff, it's all pretty neat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment