summaryrefslogtreecommitdiff
path: root/platform/android/os_android.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/os_android.cpp')
-rw-r--r--platform/android/os_android.cpp61
1 files changed, 23 insertions, 38 deletions
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 705f0df46e..6772964c2f 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -30,13 +31,13 @@
#include "core/global_config.h"
#include "core/io/file_access_buffered_fa.h"
-#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/unix/dir_access_unix.h"
#include "drivers/unix/file_access_unix.h"
#include "file_access_android.h"
#include "main/main.h"
#include "servers/visual/visual_server_raster.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+//#include "servers/visual/visual_server_wrap_mt.h"
#ifdef ANDROID_NATIVE_ACTIVITY
#include "dir_access_android.h"
@@ -125,18 +126,14 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
AudioDriverManager::add_driver(&audio_driver_android);
- RasterizerGLES2 *rasterizer_gles22 = memnew(RasterizerGLES2(false, use_reload_hooks, false, use_reload_hooks));
- if (gl_extensions)
- rasterizer_gles22->set_extensions(gl_extensions);
- rasterizer = rasterizer_gles22;
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
- rasterizer->set_force_16_bits_fbo(use_16bits_fbo);
-
- visual_server = memnew(VisualServerRaster(rasterizer));
- if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
+ visual_server = memnew(VisualServerRaster);
+ /* if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
- };
+ };*/
visual_server->init();
visual_server->cursor_set_visible(false, 0);
@@ -156,7 +153,7 @@ void OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
input = memnew(InputDefault);
input->set_fallback_mapping("Default Android Gamepad");
- power_manager = memnew(power_android);
+ //power_manager = memnew(power_android);
}
void OS_Android::set_main_loop(MainLoop *p_main_loop) {
@@ -227,7 +224,7 @@ void OS_Android::print(const char *p_format, ...) {
void OS_Android::alert(const String &p_alert, const String &p_title) {
- print("ALERT: %s\n", p_alert.utf8().get_data());
+ //print("ALERT: %s\n", p_alert.utf8().get_data());
if (alert_func)
alert_func(p_alert, p_title);
}
@@ -248,7 +245,7 @@ bool OS_Android::is_mouse_grab_enabled() const {
return false;
}
-Point2 OS_Android::get_mouse_pos() const {
+Point2 OS_Android::get_mouse_position() const {
return Point2();
}
@@ -347,16 +344,16 @@ void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
- last_id = input->joy_button(last_id, p_event.device, p_event.index, p_event.pressed);
+ input->joy_button(p_event.device, p_event.index, p_event.pressed);
break;
case JOY_EVENT_AXIS:
InputDefault::JoyAxis value;
value.min = -1;
value.value = p_event.value;
- last_id = input->joy_axis(last_id, p_event.device, p_event.index, value);
+ input->joy_axis(p_event.device, p_event.index, value);
break;
case JOY_EVENT_HAT:
- last_id = input->joy_hat(last_id, p_event.device, p_event.hat);
+ input->joy_hat(p_event.device, p_event.hat);
break;
default:
return;
@@ -365,7 +362,6 @@ void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
void OS_Android::process_event(InputEvent p_event) {
- p_event.ID = last_id++;
input->parse_input_event(p_event);
}
@@ -380,7 +376,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
//end all if exist
InputEvent ev;
ev.type = InputEvent::MOUSE_BUTTON;
- ev.ID = last_id++;
ev.mouse_button.button_index = BUTTON_LEFT;
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
ev.mouse_button.pressed = false;
@@ -394,7 +389,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = false;
ev.screen_touch.x = touch[i].pos.x;
@@ -413,7 +407,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
//send mouse
InputEvent ev;
ev.type = InputEvent::MOUSE_BUTTON;
- ev.ID = last_id++;
ev.mouse_button.button_index = BUTTON_LEFT;
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
ev.mouse_button.pressed = true;
@@ -421,7 +414,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.mouse_button.y = touch[0].pos.y;
ev.mouse_button.global_x = touch[0].pos.x;
ev.mouse_button.global_y = touch[0].pos.y;
- input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y));
+ input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
last_mouse = touch[0].pos;
input->parse_input_event(ev);
}
@@ -431,7 +424,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = true;
ev.screen_touch.x = touch[i].pos.x;
@@ -446,11 +438,10 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
//send mouse, should look for point 0?
InputEvent ev;
ev.type = InputEvent::MOUSE_MOTION;
- ev.ID = last_id++;
ev.mouse_motion.button_mask = BUTTON_MASK_LEFT;
ev.mouse_motion.x = p_points[0].pos.x;
ev.mouse_motion.y = p_points[0].pos.y;
- input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
+ input->set_mouse_position(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
ev.mouse_motion.speed_x = input->get_last_mouse_speed().x;
ev.mouse_motion.speed_y = input->get_last_mouse_speed().y;
ev.mouse_motion.relative_x = p_points[0].pos.x - last_mouse.x;
@@ -479,7 +470,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
InputEvent ev;
ev.type = InputEvent::SCREEN_DRAG;
- ev.ID = last_id++;
ev.screen_drag.index = touch[i].id;
ev.screen_drag.x = p_points[idx].pos.x;
ev.screen_drag.y = p_points[idx].pos.y;
@@ -496,7 +486,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
//end all if exist
InputEvent ev;
ev.type = InputEvent::MOUSE_BUTTON;
- ev.ID = last_id++;
ev.mouse_button.button_index = BUTTON_LEFT;
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
ev.mouse_button.pressed = false;
@@ -504,14 +493,13 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.mouse_button.y = touch[0].pos.y;
ev.mouse_button.global_x = touch[0].pos.x;
ev.mouse_button.global_y = touch[0].pos.y;
- input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y));
+ input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
input->parse_input_event(ev);
for (int i = 0; i < touch.size(); i++) {
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = false;
ev.screen_touch.x = touch[i].pos.x;
@@ -531,7 +519,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = tp.id;
ev.screen_touch.pressed = true;
ev.screen_touch.x = tp.pos.x;
@@ -546,7 +533,6 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = false;
ev.screen_touch.x = touch[i].pos.x;
@@ -631,8 +617,8 @@ void OS_Android::reload_gfx() {
if (gfx_init_func)
gfx_init_func(gfx_init_ud, use_gl2);
- if (rasterizer)
- rasterizer->reload_vram();
+ //if (rasterizer)
+ // rasterizer->reload_vram();
}
Error OS_Android::shell_open(String p_uri) {
@@ -750,9 +736,9 @@ void OS_Android::native_video_stop() {
void OS_Android::set_context_is_16_bits(bool p_is_16) {
- use_16bits_fbo = p_is_16;
- if (rasterizer)
- rasterizer->set_force_16_bits_fbo(p_is_16);
+ //use_16bits_fbo = p_is_16;
+ //if (rasterizer)
+ // rasterizer->set_force_16_bits_fbo(p_is_16);
}
void OS_Android::joy_connection_changed(int p_device, bool p_connected, String p_name) {
@@ -778,9 +764,8 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI
gfx_init_func = p_gfx_init_func;
gfx_init_ud = p_gfx_init_ud;
main_loop = NULL;
- last_id = 1;
gl_extensions = NULL;
- rasterizer = NULL;
+ //rasterizer = NULL;
use_gl2 = false;
open_uri_func = p_open_uri_func;