summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2012-02-01 21:43:19 +0100
committerPaul Buetow <paul@buetow.org>2012-02-01 21:43:19 +0100
commit6e6166ebf46b2513257d834ef43e2027238cac88 (patch)
tree195422dd8460c59b5caa1d23e9fcb32726fd8f3d
parent741ffac55d18ee4b21f0385069431636d1eb474c (diff)
fixing event polling bug
-rw-r--r--loadbars15
1 files changed, 8 insertions, 7 deletions
diff --git a/loadbars b/loadbars
index 13a336b..c358f52 100644
--- a/loadbars
+++ b/loadbars
@@ -11,6 +11,7 @@ use warnings;
use Getopt::Long;
+use SDL;
use SDL::App;
use SDL::Rect;
use SDL::Color;
@@ -340,19 +341,19 @@ sub main_loop ($@) {
my $quit : shared = 0;
my $resize_window : shared = 0;
my %newsize : shared;
+ my $event = SDL::Event->new();
my ( $t1, $t2 ) = ( Time::HiRes::time(), undef );
my $event_handler = sub {
- my $event = SDL::Event->new();
+ 1 while $event->poll();
+
+ my $type = $event->type();
+ return if $type != 2;
- $event->poll();
-
- my $type = $event->type();
my $key_name = $event->key_name();
-
- return if $type != 2;
- #debugsay "Event type=$type key_name=$key_name";
+ #debugsay "===> Event type=$type key_name=$key_name";
+
if ( $key_name eq '1' ) {
$C{showcores} = !$C{showcores};