Skip to content

Instantly share code, notes, and snippets.

@hvgotcodes
Created April 30, 2012 01:35
Show Gist options
  • Save hvgotcodes/2554723 to your computer and use it in GitHub Desktop.
Save hvgotcodes/2554723 to your computer and use it in GitHub Desktop.
hsc.ui = {}
hsc.ui.views = {}
# inits the app
hsc.ui.init = ->
Ti.UI.setBackgroundColor('#000');
pWidth = Ti.Platform.displayCaps.platformWidth;
pHeight = Ti.Platform.displayCaps.platformHeight;
Ti.App.SCREEN_WIDTH = if pWidth > pHeight then pHeight else pWidth;
Ti.App.SCREEN_HEIGHT = if pWidth > pHeight then pWidth else pHeight;
hsc.ui.gotoSplashScreen()
# creates a new splash screen if one doesn't exist and opens it.
hsc.ui.gotoSplashScreen = ->
if not hsc.ui.views['splash']
spashScreen = new hsc.ui.SplashView()
hsc.ui.views['splash'] = splashScreen
splashScreen.open();
#include some views
Ti.include('/views/splash.js')
----------------------------- compile to -----
// Generated by CoffeeScript 1.3.1
(function() {
hsc.ui = {};
hsc.ui.views = {};
hsc.ui.init = function() {
var pHeight, pWidth;
Ti.UI.setBackgroundColor('#000');
pWidth = Ti.Platform.displayCaps.platformWidth;
pHeight = Ti.Platform.displayCaps.platformHeight;
Ti.App.SCREEN_WIDTH = pWidth > pHeight ? pHeight : pWidth;
Ti.App.SCREEN_HEIGHT = pWidth > pHeight ? pWidth : pHeight;
return hsc.ui.gotoSplashScreen();
};
hsc.ui.gotoSplashScreen = function() {
var spashScreen;
if (!hsc.ui.views['splash']) {
spashScreen = new hsc.ui.SplashView();
hsc.ui.views['splash'] = splashScreen;
}
return splashScreen.open();
};
Ti.include('/views/splash.js');
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment