/* Copyright (c) 1996-2012 Clickteam * * This source code is part of the HTML5 exporter for Clickteam Multimedia Fusion 2. * * Permission is hereby granted to any person obtaining a legal copy * of Clickteam Multimedia Fusion 2 to use or modify this source code for * debugging, optimizing, or customizing applications created with * Clickteam Multimedia Fusion 2. * Any other use of this source code is prohibited. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ CRunFileReader.CND_ISLOADED = 0; CRunFileReader.CND_ISCHANGED = 1; CRunFileReader.CND_LAST = 2; CRunFileReader.ACT_SETFILEREAD = 0; CRunFileReader.ACT_LAST = 1; CRunFileReader.EXP_GETFILENAME = 0; CRunFileReader.EXP_GETFILECONTENT = 1; CRunFileReader.EXP_GETFILETYPE = 2; CRunFileReader.EXP_GETFILESIZE = 3; CRunFileReader.EXP_LAST = 4; var IsAPIReady = false; var jsfile_load = function(file_name) { var scripts=document.getElementsByTagName("script"); var exist=false; for(var i=0;i Whatever happens, this function will always position the file // at the end of the buffer upon exit // this.myString = file.readAStringEOL(); Reads a string until a CR or a CR/LF (works with both) // this.myColor = file.readAColor(); Reads a RGB value // file.skipBytes(number); Skips a number of bytes in the file // Please report to the documentation for more information on the CFile object // The return value is not used in this version of the runtime but maybe later. // So please return false; return false; }, // Handling of the object // --------------------------------------------------------------------- // This function is called at every loop of the game. You have to perform // in it all the tasks necessary for your object to function. // Return values: // - 0 : this function will be called during the next loop // - CRunExtension.REFLAG_ONESHOT : this function will not be called anymore // In this case, call the this.reHandle(); function of the base class // to have it called again. handleRunObject: function() { return 0; // The object will be called next loop }, // Destruction of the object // --------------------------------------------------------------- // Called when the object is actually destroyed. This will always be // after the main game loop, and out of the actions processing : the // destroy process is queued until the very end of the game loop. destroyRunObject: function(bFast) { }, // Displays the object // ---------------------------------------------------------------- // Called when the object needs to be displayed in the browser. // - renderer : the Renderer object which will draw the object // - xDraw : an offset to add to every X coordinate for display // - yDraw : an offset to add to every Y coordinate for display // This function will only be called if the object's flags in the C code // indicate that this is a displayable object (OEFLAG_SPRITE) displayRunObject:function(context, xDraw, yDraw) { // Example of display of an image, taking the layer and frame position // into account // var x = this.ho.hoX - this.rh.rh + this.ho.pLayer.x + xDraw; // var y = this.ho.hoY - this.rh.rh + this.ho.pLayer.y + yDraw; // for future usage ; var x = this.ho.hoX ; var y = this.ho.hoY ; var w = this.ho.hoImgWidth; var h = this.ho.hoImgHeight; if(myim) { context.renderSimpleImage(myImage, 340, 100, 300, 300, 0, 0); } var ccx = this.rh.rhApp.canvas.getContext("2d"); var cw = ccx.canvas.width; var ch = ccx.canvas.height; function resizeGame() { var gameArea = document.getElementById('MMFCanvas'); var widthToHeight = window.innerWidth / window.innerHeight; var newWidth = window.innerWidth; var newHeight = window.innerHeight; var newWidthToHeight = newWidth / newHeight; var bbtn = document.getElementsByTagName("button"); if (newWidthToHeight > widthToHeight) { newWidth = newHeight * widthToHeight; gameArea.style.height = newHeight + 'px'; gameArea.style.width = newWidth + 'px'; } else { newHeight = newWidth / widthToHeight; gameArea.style.width = newWidth + 'px'; gameArea.style.height = newHeight + 'px'; for(var ii=0;ii