Good luck convincing devs to port games to Metal. Stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)Įnjoy, I'm going to have a lot of fun with this.I guess they've totally given up on macOS as a gaming platform by killing off OpenGL. Oh:setPosition(x+oh.speed*oh.directionX, height/4) Stage:removeEventListener(Event.ENTER_FRAME, onEnterFrame) So you need to remove it and then re-add the new one. Because addEventListener keeps a reference to the function, if you redefine the function, the event listener will keep the old one around. So I wanted to see how this worked with that. Normally in a Gideros app you will have everything happening inside of an event handler.
Then the code below it will run every time that it is downloaded. Notice it has a first run check by seeing if the myinfo variable is nil or not. Myinfo:setText("current repeat: ".repeatCount) Myinfo = TextField.new(nil, "loading files.") Here is a basic example of a file you could download. You have to write the downloaded file a certain way for it not to stomp on itself. The state of the downloaded file is maintained each time it is downloaded, so variables hold their values from the previous time.
Every 2 seconds it will download your file(s) again and run them again.
When you run the app it will show that it is downloading the file(s) and run them. Timer:addEventListener(Event.TIMER, onTimer) Local timer = Timer.new(seconds * 1000, 0) Loader = FileLoader.new(downloadURLs, "a")
Return Texture.oldNew("|D|".filename, filtering, options)Īpplication:setOrientation(Application.LANDSCAPE_LEFT) Return Texture.oldNew(filename, filtering, options) Success, error = pcall( function() dofile("|D|".self.dofile) end )įunction Texture.new(filename, filtering, options) Self.loader:addEventListener(Event.PROGRESS, self.onProgress, self) Self.loader:addEventListener(Event.ERROR, self.onError, self) Self.loader:addEventListener(Event.COMPLETE, self.onComplete, self) Self.loader = UrlLoader.new(self.currentURL) :setText("loading ".self.currentFilename) Local download = not exists("|D|".self.currentFilename) Self.currentFilename = string.match(self.currentURL, ".*/(.*)" ) Self.currentDownload = self.currentDownload +1 If ( table.getn(self.urls) >= self.currentDownload ) then Print("error downloading ".self.currentURL) :setText("error downloading ".self.currentFilename) :setText(self.currentFilename." downloaded") Local out = io.open("|D|".self.currentFilename, "wb") Here is the code (Note, this version uses UrlLoader and is compatible with Gideros 2012.2.2 and later). Export the project and put it on your device.
I've been doing this and it works great.īy the way, you should never try to get an app on the AppStore that does this.
Want to run an iPhone (or Android device) app built with Gideros Studio (developer account required) and simultaneously change it's source code and have those changes affect the running app (aka "live coding")? This also allows you to edit on an iPad using Textastic or other Dropbox capable editor and immediately run the code on an iPhone.