summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/detect.py2
-rw-r--r--platform/android/dir_access_jandroid.cpp5
-rw-r--r--platform/android/dir_access_jandroid.h1
-rw-r--r--platform/android/export/export.cpp13
-rw-r--r--platform/android/java/src/com/android/godot/Godot.java28
-rw-r--r--platform/android/java/src/com/android/godot/GodotView.java18
-rw-r--r--platform/android/libs/downloader_library/gen/com/android/vending/expansion/downloader/BuildConfig.java2
-rw-r--r--platform/android/os_android.cpp5
-rw-r--r--platform/android/os_android.h2
-rw-r--r--platform/iphone/os_iphone.cpp5
-rw-r--r--platform/iphone/os_iphone.h2
-rw-r--r--platform/javascript/os_javascript.cpp6
-rw-r--r--platform/javascript/os_javascript.h1
-rw-r--r--platform/osx/os_osx.h34
-rw-r--r--platform/osx/os_osx.mm158
-rw-r--r--platform/server/os_server.cpp7
-rw-r--r--platform/server/os_server.h2
-rw-r--r--platform/windows/os_windows.cpp128
-rw-r--r--platform/windows/os_windows.h2
19 files changed, 369 insertions, 52 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 4cf12538db..5ef405f7b6 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -91,7 +91,7 @@ def configure(env):
gcc_path=gcc_path+"/darwin-x86_64/bin" #this may be wrong
env['SHLINKFLAGS'][1] = '-shared'
elif (os.name=="nt"):
- gcc_path=gcc_path+"/windows/bin" #this may be wrong
+ gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index fda4ca7357..98f20b2636 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -105,9 +105,12 @@ bool DirAccessJAndroid::current_is_dir() const{
return true;
}
-bool DirAccessAndroid::current_is_hidden() const{
+
+bool DirAccessJAndroid::current_is_hidden() const {
+
return current!="." && current!=".." && current.begins_with(".");
}
+
void DirAccessJAndroid::list_dir_end(){
if (id==0)
diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h
index 958ea34891..0a696506e6 100644
--- a/platform/android/dir_access_jandroid.h
+++ b/platform/android/dir_access_jandroid.h
@@ -60,6 +60,7 @@ public:
virtual bool list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
+ virtual bool current_is_hidden() const;
virtual void list_dir_end(); ///<
virtual int get_drive_count();
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 3e4ea8a4e0..8199e7c622 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -185,6 +185,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
bool _signed;
bool apk_expansion;
bool remove_prev;
+ bool use_32_fb;
String apk_expansion_salt;
String apk_expansion_pkey;
int orientation;
@@ -279,6 +280,8 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant&
icon=p_value;
else if (n=="package/signed")
_signed=p_value;
+ else if (n=="screen/use_32_bits_view")
+ use_32_fb=p_value;
else if (n=="screen/orientation")
orientation=p_value;
else if (n=="screen/support_small")
@@ -344,6 +347,8 @@ bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret)
r_ret=icon;
else if (n=="package/signed")
r_ret=_signed;
+ else if (n=="screen/use_32_bits_view")
+ r_ret=use_32_fb;
else if (n=="screen/orientation")
r_ret=orientation;
else if (n=="screen/support_small")
@@ -393,6 +398,7 @@ void EditorExportPlatformAndroid::_get_property_list( List<PropertyInfo> *p_list
p_list->push_back( PropertyInfo( Variant::STRING, "package/name") );
p_list->push_back( PropertyInfo( Variant::STRING, "package/icon",PROPERTY_HINT_FILE,"png") );
p_list->push_back( PropertyInfo( Variant::BOOL, "package/signed") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "screen/use_32_bits_view") );
p_list->push_back( PropertyInfo( Variant::INT, "screen/orientation",PROPERTY_HINT_ENUM,"Landscape,Portrait") );
p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_small") );
p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_normal") );
@@ -1158,8 +1164,14 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
err = export_project_files(save_apk_file,&ed,false);
}
+
+
}
+ if (use_32_fb)
+ cl.push_back("-use_depth_32");
+
+
if (cl.size()) {
//add comandline
Vector<uint8_t> clf;
@@ -1534,6 +1546,7 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
quit_request=false;
orientation=0;
remove_prev=true;
+ use_32_fb=true;
device_thread=Thread::create(_device_poll_thread,this);
devices_changed=true;
diff --git a/platform/android/java/src/com/android/godot/Godot.java b/platform/android/java/src/com/android/godot/Godot.java
index 1a7659a473..2abb4cec53 100644
--- a/platform/android/java/src/com/android/godot/Godot.java
+++ b/platform/android/java/src/com/android/godot/Godot.java
@@ -109,6 +109,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
private Button mPauseButton;
private Button mWiFiSettingsButton;
+ private boolean use_32_bits=false;
private boolean mStatePaused;
private int mState;
@@ -255,7 +256,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
// ...add to FrameLayout
layout.addView(edittext);
- mView = new GodotView(getApplication(),io,use_gl2, this);
+ mView = new GodotView(getApplication(),io,use_gl2,use_32_bits, this);
layout.addView(mView,new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
mView.setKeepScreenOn(true);
@@ -399,7 +400,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
for(int i=0;i<command_line.length;i++) {
boolean has_extra = i< command_line.length -1;
- if (command_line[i].equals("-use_apk_expansion")) {
+ if (command_line[i].equals("-use_depth_32")) {
+ use_32_bits=true;
+ } else if (command_line[i].equals("-use_apk_expansion")) {
use_apk_expansion=true;
} else if (has_extra && command_line[i].equals("-apk_expansion_md5")) {
main_pack_md5=command_line[i+1];
@@ -568,9 +571,24 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
}
@Override public void onSensorChanged(SensorEvent event) {
- float x = event.values[0];
- float y = event.values[1];
- float z = event.values[2];
+ Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
+ int displayRotation = display.getRotation();
+
+ float[] adjustedValues = new float[3];
+ final int axisSwap[][] = {
+ { 1, -1, 0, 1 }, // ROTATION_0
+ {-1, -1, 1, 0 }, // ROTATION_90
+ {-1, 1, 0, 1 }, // ROTATION_180
+ { 1, 1, 1, 0 } }; // ROTATION_270
+
+ final int[] as = axisSwap[displayRotation];
+ adjustedValues[0] = (float)as[0] * event.values[ as[2] ];
+ adjustedValues[1] = (float)as[1] * event.values[ as[3] ];
+ adjustedValues[2] = event.values[2];
+
+ float x = adjustedValues[0];
+ float y = adjustedValues[1];
+ float z = adjustedValues[2];
GodotLib.accelerometer(x,y,z);
}
diff --git a/platform/android/java/src/com/android/godot/GodotView.java b/platform/android/java/src/com/android/godot/GodotView.java
index f62431b94b..bd81b7f9af 100644
--- a/platform/android/java/src/com/android/godot/GodotView.java
+++ b/platform/android/java/src/com/android/godot/GodotView.java
@@ -71,14 +71,16 @@ public class GodotView extends GLSurfaceView {
private static GodotIO io;
private static boolean firsttime=true;
private static boolean use_gl2=false;
+ private static boolean use_32=false;
private Godot activity;
- public GodotView(Context context,GodotIO p_io,boolean p_use_gl2, Godot p_activity) {
+ public GodotView(Context context,GodotIO p_io,boolean p_use_gl2, boolean p_use_32_bits, Godot p_activity) {
super(context);
ctx=context;
io=p_io;
use_gl2=p_use_gl2;
+ use_32=p_use_32_bits;
activity = p_activity;
@@ -366,9 +368,17 @@ public class GodotView extends GLSurfaceView {
* custom config chooser. See ConfigChooser class definition
* below.
*/
- setEGLConfigChooser( translucent ?
- new ConfigChooser(8, 8, 8, 8, depth, stencil) :
- new ConfigChooser(5, 6, 5, 0, depth, stencil) );
+
+ if (use_32) {
+ setEGLConfigChooser( translucent ?
+ new ConfigChooser(8, 8, 8, 8, 24, stencil) :
+ new ConfigChooser(8, 8, 8, 8, 24, stencil) );
+
+ } else {
+ setEGLConfigChooser( translucent ?
+ new ConfigChooser(8, 8, 8, 8, 16, stencil) :
+ new ConfigChooser(5, 6, 5, 0, 16, stencil) );
+ }
/* Set the renderer responsible for frame rendering */
setRenderer(new Renderer());
diff --git a/platform/android/libs/downloader_library/gen/com/android/vending/expansion/downloader/BuildConfig.java b/platform/android/libs/downloader_library/gen/com/android/vending/expansion/downloader/BuildConfig.java
index 77ebb4b780..da9d06e63c 100644
--- a/platform/android/libs/downloader_library/gen/com/android/vending/expansion/downloader/BuildConfig.java
+++ b/platform/android/libs/downloader_library/gen/com/android/vending/expansion/downloader/BuildConfig.java
@@ -2,5 +2,5 @@
package com.android.vending.expansion.downloader;
public final class BuildConfig {
- public final static boolean DEBUG = true;
+ public final static boolean DEBUG = false;
} \ No newline at end of file
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 6b91c01dfc..f00e9c2d77 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -291,6 +291,11 @@ void OS_Android::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen)
p_list->push_back(default_videomode);
}
+Size2 OS_Android::get_window_size() const {
+
+ return Vector2(default_videomode.width,default_videomode.height);
+}
+
String OS_Android::get_name() {
return "Android";
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 26dbf4a509..bea5371bbc 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -170,6 +170,8 @@ public:
virtual VideoMode get_video_mode(int p_screen=0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const;
+ virtual Size2 get_window_size() const;
+
virtual String get_name();
virtual MainLoop *get_main_loop() const;
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index aee5f76684..06b48318ec 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -474,6 +474,11 @@ String OSIPhone::get_name() {
return "iOS";
};
+Size2 OSIPhone::get_window_size() const {
+
+ return Vector2(video_mode.width, video_mode.height);
+}
+
bool OSIPhone::has_touchscreen_ui_hint() const {
return true;
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index cb294d07eb..2585a26479 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -167,6 +167,8 @@ public:
virtual void hide_virtual_keyboard();
virtual void set_cursor_shape(CursorShape p_shape);
+
+ virtual Size2 get_window_size() const;
virtual bool has_touchscreen_ui_hint() const;
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 581df84925..4c8d8a4205 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -230,6 +230,12 @@ OS::VideoMode OS_JavaScript::get_video_mode(int p_screen) const {
return default_videomode;
}
+
+Size2 OS_JavaScript::get_window_size() const {
+
+ return Vector2(default_videomode.width,default_videomode.height);
+}
+
void OS_JavaScript::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
p_list->push_back(default_videomode);
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index dfc93d3ff0..2e9c8e14c2 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -127,6 +127,7 @@ public:
virtual VideoMode get_video_mode(int p_screen=0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const;
+ virtual Size2 get_window_size() const;
virtual String get_name();
virtual MainLoop *get_main_loop() const;
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 24f7115938..9ffd4fc3f8 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -99,6 +99,13 @@ public:
CursorShape cursor_shape;
MouseMode mouse_mode;
+
+ bool minimized;
+ bool maximized;
+ bool zoomed;
+ Vector<Rect2> screens;
+ int current_screen;
+ Rect2 restore_rect;
protected:
virtual int get_video_driver_count() const;
@@ -112,16 +119,13 @@ protected:
virtual void set_main_loop( MainLoop * p_main_loop );
virtual void delete_main_loop();
-
public:
-
-
-
-
static OS_OSX* singleton;
+ void wm_minimized(bool p_minimized);
+
virtual String get_name();
virtual void set_cursor_shape(CursorShape p_shape);
@@ -133,6 +137,8 @@ public:
virtual Point2 get_mouse_pos() const;
virtual int get_mouse_button_state() const;
virtual void set_window_title(const String& p_title);
+
+ virtual Size2 get_window_size() const;
virtual void set_icon(const Image& p_icon);
@@ -160,6 +166,24 @@ public:
virtual void move_window_to_foreground();
+ virtual int get_screen_count() const;
+ virtual int get_current_screen() const;
+ virtual void set_current_screen(int p_screen);
+ virtual Point2 get_screen_position(int p_screen=0);
+ virtual Point2 get_window_position() const;
+ virtual void set_window_position(const Point2& p_position);
+ virtual void set_window_size(const Size2 p_size);
+ virtual void set_window_fullscreen(bool p_enabled);
+ virtual bool is_window_fullscreen() const;
+ virtual void set_window_resizable(bool p_enabled);
+ virtual bool is_window_resizable() const;
+ virtual void set_window_minimized(bool p_enabled);
+ virtual bool is_window_minimized() const;
+ virtual void set_window_maximized(bool p_enabled);
+ virtual bool is_window_maximized() const;
+ Size2 get_screen_size(int p_screen);
+
+
void run();
void set_mouse_mode(MouseMode p_mode);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 1c0d1f9991..a20263f9b2 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -227,19 +227,6 @@ static int button_mask=0;
// centerCursor(window);
}
-- (void)windowDidMiniaturize:(NSNotification *)notification
-{
- // _GodotInputWindowIconify(window, GL_TRUE);
-}
-
-- (void)windowDidDeminiaturize:(NSNotification *)notification
-{
- //if (window->monitor)
-// enterFullscreenMode(window);
-
- // _GodotInputWindowIconify(window, GL_FALSE);
-}
-
- (void)windowDidBecomeKey:(NSNotification *)notification
{
// _GodotInputWindowFocus(window, GL_TRUE);
@@ -256,6 +243,21 @@ static int button_mask=0;
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
}
+- (void)windowDidMiniaturize:(NSNotification*)notification
+{
+ OS_OSX::singleton->wm_minimized(true);
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
+};
+
+- (void)windowDidDeminiaturize:(NSNotification*)notification
+{
+
+ OS_OSX::singleton->wm_minimized(false);
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
+};
+
@end
@interface GodotContentView : NSView
@@ -903,7 +905,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
unsigned int attributeCount = 0;
// OS X needs non-zero color size, so set resonable values
- int colorBits = 24;
+ int colorBits = 32;
// Fail if a robustness strategy was requested
@@ -1018,7 +1020,15 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
_ensure_data_dir();
+ NSArray *screenArray = [NSScreen screens];
+ printf("nscreen count %i\n", (int)[screenArray count]);
+ for (int i=0; i<[screenArray count]; i++) {
+ NSRect nsrect = [[screenArray objectAtIndex: i] visibleFrame];
+ screens.push_back(Rect2(nsrect.origin.x, nsrect.origin.y, nsrect.size.width, nsrect.size.height));
+ printf("added screen %i\n", screens.size());
+ };
+ restore_rect = Rect2(get_window_position(), get_window_size());
}
void OS_OSX::finalize() {
@@ -1231,7 +1241,10 @@ void OS_OSX::swap_buffers() {
}
+void OS_OSX::wm_minimized(bool p_minimized) {
+ minimized = p_minimized;
+};
void OS_OSX::set_video_mode(const VideoMode& p_video_mode,int p_screen) {
@@ -1245,6 +1258,119 @@ void OS_OSX::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) cons
}
+
+int OS_OSX::get_screen_count() const {
+
+ return screens.size();
+};
+
+int OS_OSX::get_current_screen() const {
+
+ return current_screen;
+};
+
+void OS_OSX::set_current_screen(int p_screen) {
+
+ current_screen = p_screen;
+};
+
+Point2 OS_OSX::get_screen_position(int p_screen) {
+
+ ERR_FAIL_INDEX_V(p_screen, screens.size(), Point2());
+ return screens[p_screen].pos;
+};
+
+Size2 OS_OSX::get_screen_size(int p_screen) {
+
+ ERR_FAIL_INDEX_V(p_screen, screens.size(), Point2());
+ return screens[p_screen].size;
+};
+
+Point2 OS_OSX::get_window_position() const {
+
+ return Size2([window_object frame].origin.x, [window_object frame].origin.y);
+};
+
+
+void OS_OSX::set_window_position(const Point2& p_position) {
+
+ [window_object setFrame:NSMakeRect(p_position.x, p_position.y, [window_object frame].size.width, [window_object frame].size.height) display:YES];
+};
+
+Size2 OS_OSX::get_window_size() const {
+
+ return Size2([window_object frame].size.width, [window_object frame].size.height);
+};
+
+void OS_OSX::set_window_size(const Size2 p_size) {
+
+ NSRect frame = [window_object frame];
+ [window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, p_size.x, p_size.y) display:YES];
+};
+
+void OS_OSX::set_window_fullscreen(bool p_enabled) {
+
+ [window_object performZoom:nil];
+ zoomed = p_enabled;
+};
+
+bool OS_OSX::is_window_fullscreen() const {
+
+ if ( [window_object respondsToSelector:@selector(isZoomed)] )
+ return [window_object isZoomed];
+
+ return zoomed;
+};
+
+void OS_OSX::set_window_resizable(bool p_enabled) {
+
+ if (p_enabled)
+ [window_object setStyleMask:[window_object styleMask] | NSResizableWindowMask ];
+ else
+ [window_object setStyleMask:[window_object styleMask] & ~NSResizableWindowMask ];
+};
+
+bool OS_OSX::is_window_resizable() const {
+
+ return [window_object styleMask] & NSResizableWindowMask;
+};
+
+void OS_OSX::set_window_minimized(bool p_enabled) {
+
+ if (p_enabled)
+ [window_object performMiniaturize:nil];
+ else
+ [window_object deminiaturize:nil];
+};
+
+bool OS_OSX::is_window_minimized() const {
+
+ if ( [window_object respondsToSelector:@selector(isMiniaturized)])
+ return [window_object isMiniaturized];
+
+ return minimized;
+};
+
+
+void OS_OSX::set_window_maximized(bool p_enabled) {
+
+ if (p_enabled) {
+ restore_rect = Rect2(get_window_position(), get_window_size());
+ [window_object setFrame:[[[NSScreen screens] objectAtIndex:current_screen] visibleFrame] display:YES];
+ } else {
+ set_window_size(restore_rect.size);
+ set_window_position(restore_rect.pos);
+ };
+ maximized = p_enabled;
+};
+
+bool OS_OSX::is_window_maximized() const {
+
+ // don't know
+ return maximized;
+};
+
+
void OS_OSX::move_window_to_foreground() {
[window_object orderFrontRegardless];
@@ -1473,5 +1599,9 @@ OS_OSX::OS_OSX() {
last_id=1;
cursor_shape=CURSOR_ARROW;
+ current_screen = 0;
+ maximized = false;
+ minimized = false;
+ zoomed = false;
}
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 7bc8f61744..1aabf5337b 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -56,7 +56,6 @@ void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_a
args=OS::get_singleton()->get_cmdline_args();
current_videomode=p_desired;
main_loop=NULL;
-
rasterizer = memnew( RasterizerDummy );
@@ -163,6 +162,12 @@ OS::VideoMode OS_Server::get_video_mode(int p_screen) const {
return current_videomode;
}
+
+Size2 OS_Server::get_window_size() const {
+
+ return Vector2(current_videomode.width,current_videomode.height) ;
+}
+
void OS_Server::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index fcf96253ad..f8d346ce48 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -109,6 +109,8 @@ public:
virtual VideoMode get_video_mode(int p_screen=0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const;
+ virtual Size2 get_window_size() const;
+
virtual void move_window_to_foreground();
void run();
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index a8768ea9fd..93275b3d54 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -423,6 +423,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
case WM_RBUTTONUP:
case WM_MOUSEWHEEL:
case WM_LBUTTONDBLCLK:
+ case WM_RBUTTONDBLCLK:
/*case WM_XBUTTONDOWN:
case WM_XBUTTONUP: */{
@@ -476,6 +477,12 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
mb.button_index=1;
mb.doubleclick = true;
} break;
+ case WM_RBUTTONDBLCLK: {
+
+ mb.pressed=true;
+ mb.button_index=2;
+ mb.doubleclick = true;
+ } break;
case WM_MOUSEWHEEL: {
mb.pressed=true;
@@ -1067,6 +1074,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
EnumDisplayMonitors(NULL,NULL,MonitorEnumProc,0);
print_line("DETECTED MONITORS: "+itos(monitor_info.size()));
+ pre_fs_valid=true;
if (video_mode.fullscreen) {
DEVMODE current;
@@ -1089,6 +1097,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
video_mode.fullscreen=false;
}*/
+ pre_fs_valid=false;
}
DWORD dwExStyle;
@@ -1548,15 +1557,43 @@ void OS_Windows::set_window_position(const Point2& p_position){
Size2 OS_Windows::get_window_size() const{
RECT r;
- GetWindowRect(hWnd,&r);
+ GetClientRect(hWnd,&r);
return Vector2(r.right-r.left,r.bottom-r.top);
}
void OS_Windows::set_window_size(const Size2 p_size){
- RECT r;
- GetWindowRect(hWnd,&r);
- MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE);
+ video_mode.width=p_size.width;
+ video_mode.height=p_size.height;
+
+ if (video_mode.fullscreen) {
+ return;
+ }
+
+
+ RECT crect;
+ GetClientRect(hWnd,&crect);
+
+ RECT rect;
+ GetWindowRect(hWnd,&rect);
+ int dx = (rect.right-rect.left)-(crect.right-crect.left);
+ int dy = (rect.bottom-rect.top)-(crect.bottom-crect.top);
+
+ rect.right=rect.left+p_size.width+dx;
+ rect.bottom=rect.top+p_size.height+dy;
+
+
+ //print_line("PRE: "+itos(rect.left)+","+itos(rect.top)+","+itos(rect.right-rect.left)+","+itos(rect.bottom-rect.top));
+
+ /*if (video_mode.resizable) {
+ AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
+ } else {
+ AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE);
+ }*/
+
+ //print_line("POST: "+itos(rect.left)+","+itos(rect.top)+","+itos(rect.right-rect.left)+","+itos(rect.bottom-rect.top));
+
+ MoveWindow(hWnd,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,TRUE);
}
void OS_Windows::set_window_fullscreen(bool p_enabled){
@@ -1564,31 +1601,65 @@ void OS_Windows::set_window_fullscreen(bool p_enabled){
if (video_mode.fullscreen==p_enabled)
return;
+
+
if (p_enabled) {
- GetWindowRect(hWnd,&pre_fs_rect);
+
+ if (pre_fs_valid) {
+ GetWindowRect(hWnd,&pre_fs_rect);
+ //print_line("A: "+itos(pre_fs_rect.left)+","+itos(pre_fs_rect.top)+","+itos(pre_fs_rect.right-pre_fs_rect.left)+","+itos(pre_fs_rect.bottom-pre_fs_rect.top));
+ //MapWindowPoints(hWnd, GetParent(hWnd), (LPPOINT) &pre_fs_rect, 2);
+ //print_line("B: "+itos(pre_fs_rect.left)+","+itos(pre_fs_rect.top)+","+itos(pre_fs_rect.right-pre_fs_rect.left)+","+itos(pre_fs_rect.bottom-pre_fs_rect.top));
+ }
+
int cs = get_current_screen();
Point2 pos = get_screen_position(cs);
Size2 size = get_screen_size(cs);
- RECT WindowRect;
- WindowRect.left = pos.x;
- WindowRect.top = pos.y;
- WindowRect.bottom = pos.y+size.y;
- WindowRect.right = pos.x+size.x;
- DWORD dwExStyle=WS_EX_APPWINDOW;
- DWORD dwStyle=WS_POPUP;
-
- AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);
+ /* r.left = pos.x;
+ r.top = pos.y;
+ r.bottom = pos.y+size.y;
+ r.right = pos.x+size.x;
+*/
+ SetWindowLongPtr(hWnd, GWL_STYLE,
+ WS_SYSMENU | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE);
+ MoveWindow(hWnd, pos.x, pos.y, size.width, size.height, TRUE);
video_mode.fullscreen=true;
- video_mode.width=size.x;
- video_mode.height=size.y;
} else {
+ RECT rect;
+
+ if (pre_fs_valid) {
+ rect=pre_fs_rect;
+ } else {
+ rect.left=0;
+ rect.right=video_mode.width;
+ rect.top=0;
+ rect.bottom=video_mode.height;
+ }
+
+
+
+ if (video_mode.resizable) {
+
+ SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE);
+ //AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
+ MoveWindow(hWnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
+ } else {
+
+ SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE);
+ //AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE);
+ MoveWindow(hWnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
+ }
+
+ video_mode.fullscreen=false;
+ pre_fs_valid=true;
+/*
DWORD dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
DWORD dwStyle=WS_OVERLAPPEDWINDOW;
if (!video_mode.resizable) {
@@ -1599,9 +1670,11 @@ void OS_Windows::set_window_fullscreen(bool p_enabled){
video_mode.fullscreen=false;
video_mode.width=pre_fs_rect.right-pre_fs_rect.left;
video_mode.height=pre_fs_rect.bottom-pre_fs_rect.top;
-
+*/
}
+// MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE);
+
}
bool OS_Windows::is_window_fullscreen() const{
@@ -1610,9 +1683,9 @@ bool OS_Windows::is_window_fullscreen() const{
}
void OS_Windows::set_window_resizable(bool p_enabled){
- if (video_mode.fullscreen || video_mode.resizable==p_enabled)
+ if (video_mode.resizable==p_enabled)
return;
-
+/*
GetWindowRect(hWnd,&pre_fs_rect);
DWORD dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
DWORD dwStyle=WS_OVERLAPPEDWINDOW;
@@ -1621,6 +1694,21 @@ void OS_Windows::set_window_resizable(bool p_enabled){
dwStyle &= ~WS_MAXIMIZEBOX;
}
AdjustWindowRectEx(&pre_fs_rect, dwStyle, FALSE, dwExStyle);
+ */
+
+ if (!video_mode.fullscreen) {
+ if (p_enabled) {
+ SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE);
+ } else {
+ SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE);
+
+ }
+
+ RECT rect;
+ GetWindowRect(hWnd,&rect);
+ MoveWindow(hWnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
+ }
+
video_mode.resizable=p_enabled;
}
@@ -1964,7 +2052,7 @@ String OS_Windows::get_executable_path() const {
wchar_t bufname[4096];
GetModuleFileNameW(NULL,bufname,4096);
String s= bufname;
- print_line("EXEC PATHPó: "+s);
+ print_line("EXEC PATHP¨®: "+s);
return s;
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index c39b3c74a4..4995adc874 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -130,6 +130,7 @@ class OS_Windows : public OS {
int joystick_count;
Joystick joysticks[JOYSTICKS_MAX];
+ Size2 window_rect;
VideoMode video_mode;
MainLoop *main_loop;
@@ -204,6 +205,7 @@ protected:
};
+ bool pre_fs_valid;
RECT pre_fs_rect;
Vector<MonitorInfo> monitor_info;
bool maximized;