Skip to content
Browse files

small cpp-specific fix

  • Loading branch information...
1 parent c461669 commit 8932ddd7bbe431ee83bc1715e72010b226aa2069 Alexander Hohlov committed Jan 17, 2012
View
BIN Export/flash/bin/FlixelNMETest.swf
Binary file not shown.
View
BIN Export/flash/bin/MyApplication.swf
Binary file not shown.
View
71 Export/flash/haxe/ApplicationMain.hx
@@ -1,71 +0,0 @@
-import Minimalcompshx;
-import nme.Assets;
-
-
-class ApplicationMain {
-
- static var mPreloader:NMEPreloader;
-
- public static function main () {
-
- var call_real = true;
-
-
- var loaded:Int = nme.Lib.current.loaderInfo.bytesLoaded;
- var total:Int = nme.Lib.current.loaderInfo.bytesTotal;
-
- if (loaded < total || true) /* Always wait for event */ {
-
- call_real = false;
- mPreloader = new NMEPreloader();
- nme.Lib.current.addChild(mPreloader);
- mPreloader.onInit();
- mPreloader.onUpdate(loaded,total);
- nme.Lib.current.addEventListener (nme.events.Event.ENTER_FRAME, onEnter);
-
- }
-
-
- if (call_real)
- Minimalcompshx.main();
- }
-
- static function onEnter (_) {
-
- var loaded:Int = nme.Lib.current.loaderInfo.bytesLoaded;
- var total:Int = nme.Lib.current.loaderInfo.bytesTotal;
- mPreloader.onUpdate(loaded,total);
-
- if (loaded >= total) {
-
- mPreloader.onLoaded();
- nme.Lib.current.removeEventListener(nme.events.Event.ENTER_FRAME, onEnter);
- nme.Lib.current.removeChild(mPreloader);
- mPreloader = null;
-
- Minimalcompshx.main ();
-
- }
-
- }
-
- public static function getAsset (inName:String):Dynamic {
-
-
- if (inName=="assets/pf_ronda_seven.ttf")
-
- return Assets.getFont ("assets/pf_ronda_seven.ttf");
-
-
-
- return null;
-
- }
-
-}
-
-
-
-
- class NME_assets_pf_ronda_seven_ttf extends nme.text.Font { }
-
View
7 Export/flash/haxe/Assets.hx
@@ -1,7 +0,0 @@
-class Assets
-{
-
- public static inline var assets_pf_ronda_seven_ttf = "assets/pf_ronda_seven.ttf";
-
-}
-
View
41 Export/flash/haxe/NMEPreloader.hx
@@ -1,41 +0,0 @@
-import nme.display.Sprite;
-
-class NMEPreloader extends Sprite
-{
- public function new()
- {
- super();
- }
-
- public function onInit() {}
-
- public function getWidth():Float { return 400; }
- public function getHeight():Float { return 300; }
-
- public function onUpdate(inBytes:Int,inTotal:Int)
- {
- var frac = inBytes/inTotal;
- var w = getWidth();
- var h = getHeight();
-
- var gfx = graphics;
- gfx.clear();
- var x0 = 20;
- w-=40;
- var y0 = h/2-20;
- var h = 40;
-
- gfx.lineStyle(1,0x00ff00);
- gfx.drawRect(x0,y0,w,h);
- gfx.beginFill(0x00ff00);
- gfx.drawRect(x0,y0, frac*w, h);
-
- }
-
- public function onLoaded()
- {
- }
-}
-
-
-
View
10 Export/flash/haxe/debug.hxml
@@ -1,10 +0,0 @@
--main ApplicationMain
--D nme_install_tool
--cp Source
--lib nme
--swf-version 10
--swf9 Export/flash/bin/FlixelNMETest.swf
--swf-header 400:300:30:ffffff
--cp Export/flash/haxe
--D fdb
--debug
View
87 Export/flash/haxe/nme/installer/Assets.hx
@@ -1,87 +0,0 @@
-package nme.installer;
-
-
-import nme.display.BitmapData;
-import nme.media.Sound;
-import nme.net.URLRequest;
-import nme.text.Font;
-import nme.utils.ByteArray;
-import ApplicationMain;
-
-
-/**
- * ...
- * @author Joshua Granick
- */
-
-class Assets {
-
-
- public static function getBitmapData (id:String):BitmapData {
-
- switch (id) {
-
-
- }
-
- return null;
-
- }
-
-
- public static function getBytes (id:String):ByteArray {
-
- switch (id) {
-
- case "assets/pf_ronda_seven.ttf": return cast (new NME_assets_pf_ronda_seven_ttf (), ByteArray);
-
- }
-
- return null;
-
- }
-
-
- public static function getFont (id:String):Font {
-
- switch (id) {
-
- case "assets/pf_ronda_seven.ttf": return cast (new NME_assets_pf_ronda_seven_ttf (), Font);
-
- }
-
- return null;
-
- }
-
-
- public static function getSound (id:String):Sound {
-
- switch (id) {
-
-
- }
-
- return null;
-
- }
-
-
- public static function getText (id:String):String {
-
- var bytes:ByteArray = getBytes (id);
-
- if (bytes == null) {
-
- return null;
-
- } else {
-
- return bytes.readUTFBytes (bytes.length);
-
- }
-
- }
-
-
-}
View
8 Export/flash/haxe/release.hxml
@@ -1,8 +0,0 @@
--main ApplicationMain
--D nme_install_tool
--cp Source
--lib nme
--swf-version 10
--swf9 Export/flash/bin/FlixelNMETest.swf
--swf-header 400:300:30:ffffff
--cp Export/flash/haxe
View
35 Source/com/bit101/components/Text.hx
@@ -32,7 +32,9 @@ import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
+#if flash
import flash.text.StyleSheet;
+#end
class Text extends Component
{
@@ -49,7 +51,9 @@ class Text extends Component
var _selectable:Bool;
var _html:Bool;
var _format:TextFormat;
- var _styleSheet : StyleSheet;
+ #if flash
+ var _styleSheet : StyleSheet;
+ #end
/**
* Constructor
@@ -86,7 +90,9 @@ class Text extends Component
_panel.color = Style.TEXT_BACKGROUND;
_format = new TextFormat(Style.fontName, Style.fontSize, Style.LABEL_TEXT);
- _styleSheet = new StyleSheet ();
+ #if flash
+ _styleSheet = new StyleSheet();
+ #end
_tf = new TextField();
_tf.x = 2;
@@ -99,14 +105,19 @@ class Text extends Component
_tf.wordWrap = true;
_tf.selectable = true;
_tf.type = TextFieldType.INPUT;
- if (_html)
- {
- _tf.styleSheet = _styleSheet;
- }
- else
- {
- _tf.defaultTextFormat = _format;
- }
+
+ #if flash
+ if (_html)
+ {
+ _tf.styleSheet = _styleSheet;
+ }
+ else
+ {
+ _tf.defaultTextFormat = _format;
+ }
+ #else
+ _tf.defaultTextFormat = _format;
+ #end
_tf.addEventListener(Event.CHANGE, onChange);
@@ -247,7 +258,9 @@ class Text extends Component
public function setHtml(b:Bool):Bool
{
_html = b;
- _tf.styleSheet = b ? _styleSheet : null;
+ #if flash
+ _tf.styleSheet = b ? _styleSheet : null;
+ #end
invalidate();
return b;
}
View
4 Source/com/bit101/components/WheelMenu.hx
@@ -126,7 +126,7 @@ class WheelMenu extends Component {
/**
* Hides the menu.
*/
- public function hide():Void
+ override public function hide():Void
{
visible = false;
if (stage != null)
@@ -150,7 +150,7 @@ class WheelMenu extends Component {
/**
* Shows the menu - placing it on top level of parent and centering around mouse.
*/
- public function show():Void
+ override public function show():Void
{
x = Math.round(parent.mouseX);
y = Math.round(parent.mouseY);

0 comments on commit 8932ddd

Please sign in to comment.
Something went wrong with that request. Please try again.