… | |
… | |
122 | $EV::DIED = sub { |
122 | $EV::DIED = sub { |
123 | DC::fatal Carp::longmess $@; |
123 | DC::fatal Carp::longmess $@; |
124 | }; |
124 | }; |
125 | |
125 | |
126 | my $MAX_FPS = 60; |
126 | my $MAX_FPS = 60; |
127 | my $MIN_FPS = 5; # unused as of yet |
|
|
128 | |
127 | |
129 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
128 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
130 | |
129 | |
131 | our $LAST_REFRESH; |
130 | our $LAST_REFRESH; |
132 | our $NOW; |
131 | our $NOW; |
… | |
… | |
1141 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
1140 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
1142 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1141 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1143 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
1142 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
1144 | $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1143 | $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1145 | |
1144 | |
1146 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153");#d# |
1145 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# |
1147 | |
1146 | |
1148 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1147 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1149 | $t->add_at (0,0, new DC::UI::Label text => "a a a a", c_rowspan => 1, c_colspan => 2); |
1148 | $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); |
1150 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1); |
1149 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1151 | $t->add_at (1,2, new DC::UI::Label text => "c c c c", c_rowspan => 1, c_colspan => 2); |
1150 | $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); |
1152 | $t->add_at (0,1, new DC::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1); |
1151 | $t->add_at (0,1, new DC::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1153 | $t->add_at (1,1, new DC::UI::Label text => "e"); |
1152 | $t->add_at (1,1, new DC::UI::Label text => "e"); |
1154 | |
1153 | |
1155 | $table->add_at (7, 6, my $c = new DC::UI::Canvas); |
1154 | $table->add_at (7, 6, my $c = new DC::UI::Canvas); |
1156 | |
1155 | |
1157 | $c->add_items ({ |
1156 | $c->add_items ({ |
… | |
… | |
2294 | $DC::UI::ROOT->draw; |
2293 | $DC::UI::ROOT->draw; |
2295 | DC::SDL_GL_SwapBuffers; |
2294 | DC::SDL_GL_SwapBuffers; |
2296 | $LAST_REFRESH = $NOW; |
2295 | $LAST_REFRESH = $NOW; |
2297 | } |
2296 | } |
2298 | |
2297 | |
2299 | my $want_refresh = EV::idle_ns \&force_refresh; |
2298 | my $want_refresh = EV::prepare_ns \&force_refresh; |
2300 | |
2299 | |
2301 | my $input = EV::periodic 0, 1/60, undef, sub { |
2300 | my $input = EV::periodic 0, 1 / $MAX_FPS, undef, sub { |
2302 | $NOW = time; |
2301 | $NOW = EV::now; |
2303 | |
2302 | |
2304 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2303 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2305 | for DC::poll_events; |
2304 | for DC::poll_events; |
2306 | |
2305 | |
2307 | if (%animate_object) { |
2306 | if (%animate_object) { |