summaryrefslogtreecommitdiff
path: root/ide/AndroidStudio3/app/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2018-03-07 16:29:31 +0000
committerMatthias Melcher <fltk@matthiasm.com>2018-03-07 16:29:31 +0000
commitdcc10a6a0a4cf0ec6e2a2a95f8b110230d65f1aa (patch)
treecf3eb30b0a11f54c0ed89013d07ac23619201a85 /ide/AndroidStudio3/app/src
parent2df5cb850a8aa3388cd5bc1ef0c8d3bc6f214d4f (diff)
Android: improvements to Fl:flush() implementation. Initial draw, no wasted draw cycles.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12717 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'ide/AndroidStudio3/app/src')
-rw-r--r--ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx b/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx
index bba38a5b7..b3204cdfd 100644
--- a/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx
+++ b/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx
@@ -52,15 +52,17 @@ struct engine {
struct engine engine = { 0 };
+#if 0
static void engine_draw_frame()
{
//if (Fl_Android_Application::lock_screen()) {
- Fl::damage(FL_DAMAGE_ALL);
- win->redraw();
+ //Fl::damage(FL_DAMAGE_ALL);
+ //win->redraw();
Fl::flush();
// Fl_Android_Application::unlock_and_post_screen();
//}
}
+ #endif
static void engine_term_display() {
engine.animating = 0;
@@ -110,7 +112,7 @@ static void engine_handle_cmd(int32_t cmd) {
ANativeWindow_getHeight(app->window),
#endif
WINDOW_FORMAT_RGB_565);
- engine_draw_frame();
+ Fl::damage(FL_DAMAGE_EXPOSE);
}
break;
case APP_CMD_TERM_WINDOW:
@@ -127,7 +129,7 @@ static void engine_handle_cmd(int32_t cmd) {
break;
case APP_CMD_LOST_FOCUS:
engine.animating = 0;
- engine_draw_frame();
+ //engine_draw_frame();
break;
default: break;
}
@@ -145,9 +147,14 @@ int main(int argc, char **argv)
win = new Fl_Window(10, 10, 600, 400, "Hallo");
btn = new Fl_Button(190, 200, 280, 35, "Hello, Android!");
btn->color(FL_LIGHT2);
- win->show();
- Fl::damage(FL_DAMAGE_ALL);
- win->redraw();
+ win->show(argc, argv);
+ int x;
+ if (Fl::damage())
+ x = 0;
+ if (win->damage())
+ x = 2;
+ //Fl::damage(FL_DAMAGE_ALL);
+ //win->redraw();
// loop waiting for stuff to do.
@@ -161,7 +168,7 @@ int main(int argc, char **argv)
// If not animating, we will block forever waiting for events.
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
- while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,
+ while ((ident=ALooper_pollAll(Fl::damage() ? 0 : -1, NULL, &events,
(void**)&source)) >= 0) {
// Process this event.