1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
//
// "$Id: Fl_PicoAndroid_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $"
//
// Definition of Android Window interface based on SDL
//
// Copyright 1998-2016 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
#include "../../config_lib.h"
#include "Fl_PicoAndroid_Window_Driver.H"
#include "Fl_PicoAndroid_Screen_Driver.H"
#include <jni.h>
#include <errno.h>
#include <android/sensor.h>
#include <android/log.h>
#include <android_native_app_glue.h>
#include <FL/x.H>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Window_Driver.H>
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *win)
{
return new Fl_PicoAndroid_Window_Driver(win);
}
Fl_PicoAndroid_Window_Driver::Fl_PicoAndroid_Window_Driver(Fl_Window *win)
: Fl_Pico_Window_Driver(win)
{
}
Fl_PicoAndroid_Window_Driver::~Fl_PicoAndroid_Window_Driver()
{
}
Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow()
{
Fl_PicoAndroid_Screen_Driver *scr = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver();
Fl_Group::current(0);
if (pWindow->parent() && !Fl_X::i(pWindow->window())) {
pWindow->set_visible();
return 0L;
}
Window parent;
if (pWindow->parent()) {
parent = fl_xid(pWindow->window());
} else {
parent = 0;
}
Fl_X *x = new Fl_X;
x->other_xid = 0;
x->w = pWindow;
x->region = 0;
if (!pWindow->force_position()) {
// pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pWindow->w(), pWindow->h(), 0);
} else {
// pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0);
}
pNativeWindow = scr->pApp->window;
// x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
x->next = Fl_X::first;
x->wait_for_expose = 0;
pWindow->i = x;
Fl_X::first = x;
pWindow->set_visible();
pWindow->redraw();
flush();
int old_event = Fl::e_number;
pWindow->handle(Fl::e_number = FL_SHOW);
Fl::e_number = old_event;
return x;
}
#include <FL/fl_draw.h>
void Fl_PicoAndroid_Window_Driver::flush()
{
Fl_PicoAndroid_Screen_Driver *scr = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver();
// LOGI("Flush...");
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
pWindow->flush();
// fl_color(FL_RED);
// fl_rectf(10, 10, 300, 400);
scr->drawFrame();
}
//
// End of "$Id: Fl_PicoSDL_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $".
//
|