summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/2d/platformer/engine.cfg8
-rw-r--r--platform/android/java/src/com/android/godot/payments/ConsumeTask.java5
-rw-r--r--platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java5
-rw-r--r--platform/android/java/src/com/android/godot/payments/PaymentsManager.java28
-rw-r--r--platform/android/java/src/com/android/godot/payments/PurchaseTask.java4
-rw-r--r--platform/windows/os_windows.cpp7
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/x11/os_x11.cpp5
-rw-r--r--platform/x11/os_x11.h1
-rw-r--r--scene/2d/tile_map.cpp4
-rw-r--r--scene/gui/control.cpp22
-rw-r--r--scene/gui/control.h1
-rw-r--r--scene/main/scene_main_loop.cpp1
-rw-r--r--scene/main/viewport.cpp29
-rw-r--r--scene/main/viewport.h1
15 files changed, 83 insertions, 40 deletions
diff --git a/demos/2d/platformer/engine.cfg b/demos/2d/platformer/engine.cfg
index a377bf8983..d2a998d831 100644
--- a/demos/2d/platformer/engine.cfg
+++ b/demos/2d/platformer/engine.cfg
@@ -9,10 +9,16 @@ name_es="Plataformero"
width=800
height=480
-stretch_2d=true
+stretch_2d=false
stretch_mode="viewport"
stretch_aspect="keep"
+[image_loader]
+
+filter=false
+gen_mipmaps=false
+repeat=false
+
[input]
move_left=[key(Left), jbutton(0, 14)]
diff --git a/platform/android/java/src/com/android/godot/payments/ConsumeTask.java b/platform/android/java/src/com/android/godot/payments/ConsumeTask.java
index 62b33c002a..855bc0578d 100644
--- a/platform/android/java/src/com/android/godot/payments/ConsumeTask.java
+++ b/platform/android/java/src/com/android/godot/payments/ConsumeTask.java
@@ -56,7 +56,8 @@ abstract public class ConsumeTask {
protected void onPostExecute(String param){
if(param == null){
- success();
+
+ success(new PaymentsCache(context).getConsumableValue("ticket", sku));
}else{
error(param);
}
@@ -65,7 +66,7 @@ abstract public class ConsumeTask {
}.execute();
}
- abstract protected void success();
+ abstract protected void success(String ticket);
abstract protected void error(String message);
}
diff --git a/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java
index 531a786dc9..a32ecf2895 100644
--- a/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java
+++ b/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java
@@ -28,11 +28,12 @@ abstract public class HandlePurchaseTask {
public void handlePurchaseRequest(int resultCode, Intent data){
-// Log.d("XXX", "Handling purchase response");
+ Log.d("XXX", "Handling purchase response");
// int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
PaymentsCache pc = new PaymentsCache(context);
String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
+ Log.d("XXX", "Purchase data:" + purchaseData);
// String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
if (resultCode == Activity.RESULT_OK) {
@@ -61,7 +62,7 @@ abstract public class HandlePurchaseTask {
pc.setConsumableFlag("block", productId, true);
pc.setConsumableValue("token", productId, purchaseToken);
- success(purchaseData);
+ success(productId);
return;
} catch (JSONException e) {
error(e.getMessage());
diff --git a/platform/android/java/src/com/android/godot/payments/PaymentsManager.java b/platform/android/java/src/com/android/godot/payments/PaymentsManager.java
index 983f655c35..e8c487dbd8 100644
--- a/platform/android/java/src/com/android/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/com/android/godot/payments/PaymentsManager.java
@@ -84,8 +84,25 @@ public class PaymentsManager {
new HandlePurchaseTask(activity){
@Override
- protected void success(String ticket) {
- godotPaymentV3.callbackSuccess(ticket);
+ protected void success(final String sku) {
+ new ConsumeTask(mService, activity) {
+
+ @Override
+ protected void success(String ticket) {
+// godotPaymentV3.callbackSuccess("");
+ godotPaymentV3.callbackSuccess(ticket);
+ }
+
+ @Override
+ protected void error(String message) {
+ godotPaymentV3.callbackFail();
+
+ }
+ }.consume(sku);
+
+
+
+// godotPaymentV3.callbackSuccess(ticket);
//validatePurchase(purchaseToken, sku);
}
@@ -99,7 +116,8 @@ public class PaymentsManager {
protected void canceled() {
godotPaymentV3.callbackCancel();
- }}.handlePurchaseRequest(resultCode, data);
+ }
+ }.handlePurchaseRequest(resultCode, data);
}
public void validatePurchase(String purchaseToken, final String sku){
@@ -112,8 +130,8 @@ public class PaymentsManager {
new ConsumeTask(mService, activity) {
@Override
- protected void success() {
- godotPaymentV3.callbackSuccess("");
+ protected void success(String ticket) {
+ godotPaymentV3.callbackSuccess(ticket);
}
diff --git a/platform/android/java/src/com/android/godot/payments/PurchaseTask.java b/platform/android/java/src/com/android/godot/payments/PurchaseTask.java
index 3b2cb78d27..f5d8a0298a 100644
--- a/platform/android/java/src/com/android/godot/payments/PurchaseTask.java
+++ b/platform/android/java/src/com/android/godot/payments/PurchaseTask.java
@@ -32,7 +32,7 @@ abstract public class PurchaseTask {
private boolean isLooping = false;
public void purchase(final String sku){
-// Log.d("XXX", "Starting purchase");
+ Log.d("XXX", "Starting purchase for: " + sku);
PaymentsCache pc = new PaymentsCache(context);
Boolean isBlocked = pc.getConsumableFlag("block", sku);
// if(isBlocked){
@@ -68,7 +68,7 @@ abstract public class PurchaseTask {
new ConsumeTask(mService, context) {
@Override
- protected void success() {
+ protected void success(String ticket) {
// Log.d("XXX", "Product was erroniously purchased!");
if(isLooping){
// Log.d("XXX", "It is looping");
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 9871ecba8b..64219d6c17 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1647,6 +1647,13 @@ void OS_Windows::move_window_to_foreground() {
}
+Error OS_Windows::shell_open(String p_uri) {
+
+ ShellExecuteW(NULL, L"open", p_uri.c_str(), NULL, NULL, SW_SHOWNORMAL);
+ return OK;
+}
+
+
String OS_Windows::get_locale() const {
const _WinLocale *wl = &_win_locales[0];
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 6d75ca8d7b..365808d175 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -246,6 +246,8 @@ public:
virtual void make_rendering_thread();
virtual void swap_buffers();
+ virtual Error shell_open(String p_uri);
+
void run();
virtual bool get_swap_ok_cancel() { return true; }
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index ff34d8eb2e..2cb8247799 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1015,6 +1015,11 @@ String OS_X11::get_name() {
return "X11";
}
+Error OS_X11::shell_open(String p_uri) {
+
+
+}
+
void OS_X11::close_joystick(int p_id) {
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index ee50bdea4a..491b8fa00d 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -188,6 +188,7 @@ public:
virtual void make_rendering_thread();
virtual void swap_buffers();
+ virtual Error shell_open(String p_uri);
virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0);
virtual VideoMode get_video_mode(int p_screen=0) const;
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index b9e44d5053..57424d6654 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -585,8 +585,8 @@ TileMap::TileMap() {
center_x=false;
center_y=false;
- fp_adjust=0.4;
- fp_adjust=0.4;
+ fp_adjust=0.01;
+ fp_adjust=0.01;
}
TileMap::~TileMap() {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index e0604b7cb8..4b4b4b3c73 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -645,19 +645,6 @@ void Control::_notification(int p_notification) {
}
-Size2 Control::_window_get_pos() const {
-
- if (data.viewport) {
-
- Rect2 r = data.viewport->get_visible_rect();
- return r.pos;
- } else
- return Point2();
-
- //return get_global_transform().get_origin();
-}
-
-
bool Control::clips_input() const {
return false;
@@ -956,12 +943,11 @@ void Control::_window_input_event(InputEvent p_event) {
window->key_event_accepted=false;
Point2 mpos =(get_canvas_transform()).affine_inverse().xform(Point2(p_event.mouse_button.x,p_event.mouse_button.y));
-
if (p_event.mouse_button.pressed) {
- Size2 pos = mpos - _window_get_pos();
+ Size2 pos = mpos;
if (window->mouse_focus && p_event.mouse_button.button_index!=window->mouse_focus_button) {
//do not steal mouse focus and stuff
@@ -1062,7 +1048,7 @@ void Control::_window_input_event(InputEvent p_event) {
if (window->mouse_over && window->drag_data.get_type()!=Variant::NIL && p_event.mouse_button.button_index==BUTTON_LEFT) {
- Size2 pos = mpos - _window_get_pos();
+ Size2 pos = mpos;
pos = window->focus_inv_xform.xform(pos);
window->mouse_over->drop_data(pos,window->drag_data);
window->drag_data=Variant();
@@ -1072,7 +1058,7 @@ void Control::_window_input_event(InputEvent p_event) {
break;
}
- Size2 pos = mpos - _window_get_pos();
+ Size2 pos = mpos;
p_event.mouse_button.global_x = pos.x;
p_event.mouse_button.global_y = pos.y;
pos = window->focus_inv_xform.xform(pos);
@@ -1103,7 +1089,7 @@ void Control::_window_input_event(InputEvent p_event) {
window->key_event_accepted=false;
Matrix32 localizer = (get_canvas_transform()).affine_inverse();
- Size2 pos = localizer.xform(Size2(p_event.mouse_motion.x,p_event.mouse_motion.y)) - _window_get_pos();
+ Size2 pos = localizer.xform(Size2(p_event.mouse_motion.x,p_event.mouse_motion.y));
Vector2 speed = localizer.basis_xform(Point2(p_event.mouse_motion.speed_x,p_event.mouse_motion.speed_y));
Vector2 rel = localizer.basis_xform(Point2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y));
diff --git a/scene/gui/control.h b/scene/gui/control.h
index dd8854f80e..f9225a1c2b 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -193,7 +193,6 @@ private:
float _get_parent_range(int p_idx) const;
float _get_range(int p_idx) const;
- Point2 _window_get_pos() const;
float _s2a(float p_val, AnchorType p_anchor,float p_range) const;
float _a2s(float p_val, AnchorType p_anchor,float p_range) const;
void _modal_stack_remove();
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index 5ec416fb47..492c7633c1 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -940,7 +940,6 @@ void SceneMainLoop::_update_root_rect() {
} break;
case STRETCH_MODE_VIEWPORT: {
- print_line("VP SIZE: "+viewport_size);
root->set_rect(Rect2(Point2(),viewport_size));
root->set_size_override_stretch(false);
root->set_size_override(false,Size2());
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 0e32fd006d..c13b4eb060 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -764,13 +764,30 @@ bool Viewport::get_render_target_vflip() const{
}
+Matrix32 Viewport::_get_input_pre_xform() const {
+
+ Matrix32 pre_xf;
+ if (render_target) {
+
+ ERR_FAIL_COND_V(to_screen_rect.size.x==0,pre_xf);
+ ERR_FAIL_COND_V(to_screen_rect.size.y==0,pre_xf);
+ pre_xf.scale(rect.size/to_screen_rect.size);
+ pre_xf.elements[2]=-to_screen_rect.pos;
+ } else {
+
+ pre_xf.elements[2]=-rect.pos;
+ }
+
+ return pre_xf;
+}
+
void Viewport::_make_input_local(InputEvent& ev) {
switch(ev.type) {
case InputEvent::MOUSE_BUTTON: {
- Matrix32 ai = get_final_transform().affine_inverse();
+ Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform();
Vector2 g = ai.xform(Vector2(ev.mouse_button.global_x,ev.mouse_button.global_y));
Vector2 l = ai.xform(Vector2(ev.mouse_button.x,ev.mouse_button.y));
ev.mouse_button.x=l.x;
@@ -781,7 +798,7 @@ void Viewport::_make_input_local(InputEvent& ev) {
} break;
case InputEvent::MOUSE_MOTION: {
- Matrix32 ai = get_final_transform().affine_inverse();
+ Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform();
Vector2 g = ai.xform(Vector2(ev.mouse_motion.global_x,ev.mouse_motion.global_y));
Vector2 l = ai.xform(Vector2(ev.mouse_motion.x,ev.mouse_motion.y));
Vector2 r = ai.xform(Vector2(ev.mouse_motion.relative_x,ev.mouse_motion.relative_y));
@@ -795,7 +812,7 @@ void Viewport::_make_input_local(InputEvent& ev) {
} break;
case InputEvent::SCREEN_TOUCH: {
- Matrix32 ai = get_final_transform().affine_inverse();
+ Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform();
Vector2 t = ai.xform(Vector2(ev.screen_touch.x,ev.screen_touch.y));
ev.screen_touch.x=t.x;
ev.screen_touch.y=t.y;
@@ -803,7 +820,7 @@ void Viewport::_make_input_local(InputEvent& ev) {
} break;
case InputEvent::SCREEN_DRAG: {
- Matrix32 ai = get_final_transform().affine_inverse();
+ Matrix32 ai = get_final_transform().affine_inverse() * _get_input_pre_xform();
Vector2 t = ai.xform(Vector2(ev.screen_drag.x,ev.screen_drag.y));
Vector2 r = ai.xform(Vector2(ev.screen_drag.relative_x,ev.screen_drag.relative_y));
Vector2 s = ai.xform(Vector2(ev.screen_drag.speed_x,ev.screen_drag.speed_y));
@@ -821,13 +838,13 @@ void Viewport::_make_input_local(InputEvent& ev) {
void Viewport::_vp_input(const InputEvent& p_ev) {
- if (render_target)
+ if (render_target && to_screen_rect==Rect2())
return; //if render target, can't get input events
//this one handles system input, p_ev are in system coordinates
//they are converted to viewport coordinates
- InputEvent ev = p_ev;
+ InputEvent ev = p_ev;
_make_input_local(ev);
input(ev);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 33e1f27b93..178a7517f0 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -146,6 +146,7 @@ friend class RenderTargetTexture;
void update_worlds();
+ _FORCE_INLINE_ Matrix32 _get_input_pre_xform() const;
void _vp_enter_scene();
void _vp_exit_scene();