Skip to content

Commit

Permalink
Add window.foreground to specify font colour on ios launch screen
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Nov 30, 2021
1 parent 8e60d3c commit 04b36ec
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion templates/ios/Launch Screen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="::APP_TITLE::" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="377.5" width="834" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="textColor" red="::FG_TINT_RED::" green="::FG_TINT_GREEN::" blue="::FG_TINT_BLUE::" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
Expand Down
5 changes: 5 additions & 0 deletions tools/nme/src/platforms/IOSPlatform.hx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ ${hxcpp_include}';
context.TINT_BLUE = ((col) & 0xff) / 0xff;
context.TINT_ALPHA = 1;

var txtCol:Int = project.window.foreground;
context.FG_TINT_RED = ((txtCol>>16) & 0xff) / 0xff;
context.FG_TINT_GREEN = ((txtCol>>8) & 0xff) / 0xff;
context.FG_TINT_BLUE = ((txtCol) & 0xff) / 0xff;

var devTeam = project.getDef("DEVELOPMENT_TEAM");
if (devTeam!=null)
context.DEVELOPMENT_TEAM = devTeam;
Expand Down
7 changes: 7 additions & 0 deletions tools/nme/src/project/NMMLParser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,13 @@ class NMMLParser
value = "0x" + value;
project.window.background = Std.parseInt(value);

case "foreground":
value = StringTools.replace(value, "#", "");
if (value.indexOf("0x") == -1)
value = "0x" + value;
project.window.foreground = Std.parseInt(value);


case "orientation":
var orientation = Reflect.field(Orientation, Std.string(value).toUpperCase());
if (orientation != null)
Expand Down
2 changes: 2 additions & 0 deletions tools/nme/src/project/Window.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Window
public var width:Int;
public var height:Int;
public var background:Int;
public var foreground:Int;
public var parameters:String;
public var fps:Int;
public var hardware:Bool;
Expand All @@ -28,6 +29,7 @@ class Window
height = 600;
parameters = "{}";
background = 0xFFFFFF;
foreground = 0x000000;
fps = 30;
hardware = true;
resizable = true;
Expand Down

0 comments on commit 04b36ec

Please sign in to comment.