package helpers;import helpers.GameSize;
/** * @author Shaun Stone (SMKS) */class GameSize{ /** Desktop dimensions **/ private static inline var DESKTOP_WIDTH:UInt = 1920; private static inline var DESKTOP_HEIGHT:UInt = 1080; /** Tablet dimensions **/ private static inline var TABLET_WIDTH:UInt = 960; private static inline var TABLET_HEIGHT:UInt = 540; /** Mobile dimensions **/ private static inline var MOBILE_WIDTH:UInt = 480; private static inline var MOBILE_HEIGHT:UInt = 270;
/** * @return Uint */ public static function getWidthByPlatform():Int { if (TargetPlatform.isMobile()) { return GameSize.MOBILE_WIDTH; } if (TargetPlatform.isTablet()) { return GameSize.TABLET_WIDTH; } return GameSize.DESKTOP_WIDTH; } /** * @return Uint */ public static function getHeightByPlatform():Int { if (TargetPlatform.isMobile()) { return GameSize.MOBILE_HEIGHT; } if (TargetPlatform.isTablet()) { return GameSize.TABLET_HEIGHT; } return GameSize.DESKTOP_HEIGHT; } public static function getPositionByPlatform(pos:Float):Float { if (TargetPlatform.isMobile()) { return pos * 0.25; } if (TargetPlatform.isTablet()) { return pos * 0.5; } return pos; }}
package helpers;
/** * @author Shaun Stone (SMKS) */class TargetPlatform{ public static inline var DESKTOP:String = 'Desktop'; public static inline var TABLET:String = 'Tablet'; public static inline var MOBILE:String = 'Mobile'; /** * @return Bool */ public static function isMobile():Bool { if (Reg.TARGET_DEVICE == MOBILE) { return true; } return false; } /** * @return Bool */ public static function isTablet():Bool { if (Reg.TARGET_DEVICE == TABLET) { return true; } return false; } /** * @return Bool */ public static function isDesktop():Bool { if (Reg.TARGET_DEVICE == DESKTOP) { return true; } return false; } }
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/49c1e6ba-216b-4cc6-adaa-48a5d10b2b9f%40googlegroups.com.--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Visit this group at http://groups.google.com/group/haxeflixel.