From 381f18a7911145b1412ee157ceca4271d1cb31df Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Wed, 8 Aug 2018 11:36:39 -0700 Subject: [PATCH] Electron tweak --- project/src/backend/sdl/SDLApplication.cpp | 10 +++++----- src/lime/tools/HXProject.hx | 13 +++++++++++-- templates/electron/haxe/ElectronSetup.hx | 4 ++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp index 1abca6711..2bf69edfa 100644 --- a/project/src/backend/sdl/SDLApplication.cpp +++ b/project/src/backend/sdl/SDLApplication.cpp @@ -627,17 +627,17 @@ namespace lime { case SDL_MOUSEWHEEL: mouseEvent.type = MOUSE_WHEEL; - + if (event->wheel.direction == SDL_MOUSEWHEEL_FLIPPED) { - + mouseEvent.x = -event->wheel.x; mouseEvent.y = -event->wheel.y; - + } else { - + mouseEvent.x = event->wheel.x; mouseEvent.y = event->wheel.y; - + } break; diff --git a/src/lime/tools/HXProject.hx b/src/lime/tools/HXProject.hx index e52e95a83..cbf76acac 100644 --- a/src/lime/tools/HXProject.hx +++ b/src/lime/tools/HXProject.hx @@ -168,8 +168,17 @@ class HXProject extends Script { platformType = PlatformType.WEB; architectures = []; - defaultWindow.width = 0; - defaultWindow.height = 0; + if (!targetFlags.exists ("electron")) { + + defaultWindow.width = 0; + defaultWindow.height = 0; + + } else { + + // platformType = PlatformType.DESKTOP; + + } + defaultWindow.fps = 60; defaultWindow.allowHighDPI = false; diff --git a/templates/electron/haxe/ElectronSetup.hx b/templates/electron/haxe/ElectronSetup.hx index 049c5523a..0477bf9f2 100644 --- a/templates/electron/haxe/ElectronSetup.hx +++ b/templates/electron/haxe/ElectronSetup.hx @@ -42,8 +42,8 @@ class ElectronSetup { var window:OpenFLWindow = windows[i]; var width:Int = window.width; var height:Int = window.height; - if (width < 1200) width = 1200; - if (height < 800) height = 800; + if (width == 0) width = 800; + if (height == 0) height = 600; var frame:Bool = window.borderless == false; electron.main.App.on( 'ready', function(e) {