Giter Site home page Giter Site logo

the1sky / ejecta Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phoboslab/ejecta

0.0 2.0 0.0 100.49 MB

A Fast, Open Source JavaScript, Canvas & Audio Implementation for iOS

Objective-C 74.89% C 14.99% Objective-C++ 5.98% C++ 1.95% JavaScript 2.19%

ejecta's Introduction

Ejecta

Ejecta is a fast, open source JavaScript, Canvas & Audio implementation for iOS. Think of it as a Browser that can only display a Canvas element.

More info & Documentation: http://impactjs.com/ejecta

Ejecta is published under the MIT Open Source License.

Recent Breaking Changes

  • 2013-07-10 - All events now supply a proper event object to their callbacks. The keypress event for EJBindingKeyInput provides the char to callbacks as property of the event object: input.onkeypress = function(event) { console.log(event.char); }

  • 2013-04-15 - The GameCenter's softAuthenticate now calls the callback function with an error if the auth was skipped, instead of doing nothing. Also, softAuthenticate will now always try to auth when called for the very first time after installation.

  • 2013-03-15 - canvas.scaleMode was removed in favor of the canvas.style property. To scale and position your canvas independently from its internal resolution, use the style's width, height, top and left properties. I.e. to always scale to fullscreen: canvas.style.width = window.innerWidth; canvas.style.height = window.innerHeight. Appending px suffixes is ok.

WebGL Support

Recently WebGL support has been merged into the main branch. A huge thanks goes to @vikerman - he did most of the grunt work of the WebGL implementation. To have the WebGL alongside Canvas2D, I modified the old 2D implementation to use OpenGL ES2 instead of ES1, just like WebGL itself.

Unlike with the Canvas2D, if you want to have a WebGL Canvas in retina resolution, you have to manually double the internal resiolution and shrink down the displayed size again through the style. I.e.

canvas.width = window.innerWidth * window.devicePixelRatio;
canvas.height = window.innerHeight * window.devicePixelRatio;
canvas.style.width = window.innerWidth + 'px';
canvas.style.height = window.innerHeight + 'px';

Three.js on iOS with Ejecta

Ejecta always creates the screen Canvas element for you. You have to hand this Canvas element over to Three.js instead of letting it create its own.

renderer = new THREE.WebGLRenderer( {canvas: document.getElementById('canvas')} );

How to use

  1. Create a folder called App within this XCode project
  2. Copy your canvas application into the App folder
  3. Ensure you have at least 1 file named index.js
  4. Build the XCode project

For an example application, copy ./index.js into the App folder. An example App folder with the Three.js Walt CubeMap demo can be found here:

http://phoboslab.org/files/Ejecta-ThreeJS-CubeMap.zip

ejecta's People

Contributors

alexbezuska avatar amadeus avatar ashleyscirra avatar doctb avatar hauptmedia avatar kicktheken avatar leolannenmaki avatar mrspeaker avatar nehz avatar phoboslab avatar pixelrevision avatar srandazzo avatar switer avatar tharit avatar vikerman avatar volune avatar wojciak avatar wreardan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.