diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-10 00:46:12 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-10 00:46:12 +0000 |
| commit | c0cbf0fbde0ac33d3743a6d50bf0fa9f6664a008 (patch) | |
| tree | 8fb9b3e1db8bfef8052deb549af986023fc86915 /ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx | |
| parent | dc2fb581b76ea84ebd70a7ced1291dd26b40fc71 (diff) | |
Android: crude graphics clipping
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12726 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx')
| -rw-r--r-- | ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx b/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx index 911683944..582319020 100644 --- a/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx +++ b/ide/AndroidStudio3/app/src/main/cpp/HelloAndroid.cxx @@ -19,13 +19,25 @@ #include <FL/Fl_Window.H> #include <FL/Fl_Button.H> #include <FL/Enumerations.H> +#include <FL/fl_draw.H> Fl_Window *win; Fl_Button *btn; +class MyButton : public Fl_Button +{ +public: + MyButton(int x, int y, int w, int h, const char *l) : Fl_Button(x, y, w, h, l) { } + void draw() { + fl_push_clip(x(), y(), w()/2, h()/2); + Fl_Button::draw(); + fl_pop_clip(); + } +}; + int h(void*, void*) { - Fl_Android_Application::log_w("App global even %p", Fl::event()); + Fl_Android_Application::log_w("App global event %p", Fl::event()); return 0; } @@ -33,7 +45,7 @@ int main(int argc, char **argv) { Fl::add_system_handler(h, 0); win = new Fl_Window(10, 10, 600, 400, "Hallo"); - btn = new Fl_Button(190, 200, 280, 35, "Hello, Android!"); + btn = new MyButton(190, 200, 280, 35, "Hello, Android!"); btn->color(FL_LIGHT2); win->show(argc, argv); |
