-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto detect window size and etc. #1811
Changes from 12 commits
dd7fc91
535f5c8
c66c350
7257057
c243bbb
5309f79
63e0406
3a6caf0
bb2d895
feae523
3730d00
e365f2a
d0e5732
ea5d7ee
098606e
4a1714e
7f5c388
16ae6e4
4f0c996
0c30773
d516806
fa34754
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,7 +232,7 @@ class FlxGame extends Sprite | |
* @param SkipSplash Whether you want to skip the flixel splash screen in FLX_NO_DEBUG or not. | ||
* @param StartFullscreen Whether to start the game in fullscreen mode (desktop targets only), false by default | ||
*/ | ||
public function new(GameSizeX:Int = 640, GameSizeY:Int = 480, ?InitialState:Class<FlxState>, Zoom:Float = 1, UpdateFramerate:Int = 60, DrawFramerate:Int = 60, SkipSplash:Bool = false, StartFullscreen:Bool = false) | ||
public function new(GameSizeX:Int = 0, GameSizeY:Int = 0, ?InitialState:Class<FlxState>, Zoom:Float = 1, UpdateFramerate:Int = 60, DrawFramerate:Int = 60, SkipSplash:Bool = false, StartFullscreen:Bool = false) | ||
{ | ||
super(); | ||
|
||
|
@@ -243,6 +243,14 @@ class FlxGame extends Sprite | |
// Super high priority init stuff | ||
_inputContainer = new Sprite(); | ||
|
||
if (GameSizeX == 0) | ||
{ | ||
GameSizeX = Std.int(Lib.current.stage.window.width); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be shorter / nicer to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that matters? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have tried using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I thought they are the same. |
||
} | ||
if (GameSizeY == 0) | ||
{ | ||
GameSizeY = Std.int(Lib.current.stage.window.height); | ||
} | ||
// Basic display and update setup stuff | ||
FlxG.init(this, GameSizeX, GameSizeY, Zoom); | ||
|
||
|
@@ -561,7 +569,7 @@ class FlxGame extends Sprite | |
|
||
if (_skipSplash || FlxSplash.nextState != null) // already played | ||
{ | ||
_requestedState = cast Type.createInstance(_initialState, []); | ||
_requestedState = cast (Type.createInstance(_initialState, [])); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There shouldn't be any parens here, |
||
if (FlxSplash.nextState == null) | ||
{ | ||
_gameJustStarted = true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,19 @@ class FlxPoint implements IFlxPooled | |
return this; | ||
} | ||
|
||
/** | ||
* Multiply this point by a scalar. | ||
* | ||
* @param scalar How much times this point will be as it before. | ||
* @return This point. | ||
*/ | ||
public function multiply(scalar:Float):FlxPoint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not redundant.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm aware, that doesn't make it any less redundant - both functions have the same implementation. Since If anything, |
||
{ | ||
x *= scalar; | ||
y *= scalar; | ||
return this; | ||
} | ||
|
||
/** | ||
* Helper function, just copies the values from the specified point. | ||
* | ||
|
@@ -358,7 +371,7 @@ class FlxPoint implements IFlxPooled | |
{ | ||
angle = c2 - c1 * ((x + ay) / (ay - x)); | ||
} | ||
angle = ((y < 0) ? -angle : angle) * FlxAngle.TO_DEG; | ||
angle = ((y < 0) ? - angle : angle) * FlxAngle.TO_DEG; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accidentally reformatted? |
||
|
||
if (angle > 90) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The special meaning of
0
forGameSizeX
andGameSizeY
should be documented in the@param
docs.