Add lime-tools as dependency, move /examples to /samples for consistency, update HerokuShaders and SimpleOpenGL samples

This commit is contained in:
Joshua Granick
2013-12-17 16:44:21 -08:00
parent c1d558073c
commit 7306ef8d36
65 changed files with 2154 additions and 2462 deletions

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,13 @@
sound.ogg / sound.wav
http://www.freesound.org/people/FreqMan/sounds/42899/
The files are under the following license :
This work is licensed under the Attribution License.
See the above link for more details.
ambience.ogg
https://soundcloud.com/underscorediscovery/menuambience

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta
title="lime example - Simple Audio Example"
package="com.limeframework.audioexample"
version="1.0.0"
company="limeframework"
/>
<app main="Main" path="bin" file="lime_example_audio" />
<window
width="960"
height="640"
orientation="landscape"
background="0x161616"
depth-buffer="true"
fps="60"
vsync="true"
resizable="true"
/>
<assets path="Assets" rename="assets" include="*"/>
<source path="src" />
<haxelib name="lime" />
</project>

View File

@@ -0,0 +1,107 @@
//Ported and modified from OpenFL samples
//underscorediscovery
import lime.AudioHandler.Sound;
import lime.utils.Assets;
import lime.Lime;
//Import GL stuff from lime
import lime.gl.GL;
//Press any key to reset the music
//Click to play a sound
class Main {
public var lib : Lime;
//Some value to mess with the clear color
private var red_value : Float = 1.0;
private var red_direction : Int = 1;
private var dt : Float = 0.016;
private var end_dt : Float = 0;
public function new() { }
public function ready( _lime : Lime ) {
//Store a reference
lib = _lime;
// Init the shaders and view
init();
} //ready
public function init() {
lib.audio.create('music', 'assets/ambience.ogg', true );
lib.audio.create('sound', 'assets/sound.ogg', false);
lib.audio.create('sound_wav', 'assets/sound.wav', false);
lib.audio.get('music').play(5);
lib.audio.get('music').on_complete(function(sound:Sound){
trace("music complete!");
});
} //init
//Called each frame by lime for logic (called before render)
public function update() {
dt = haxe.Timer.stamp() - end_dt;
end_dt = haxe.Timer.stamp();
//an awful magic number to change the value slowly
red_value += (red_direction * 0.3) * dt;
if(red_value >= 1) {
red_value = 1;
red_direction = -red_direction;
} else if(red_value <= 0) {
red_value = 0;
red_direction = -red_direction;
}
} //update
//Called by lime
public function onmousemove(_event:Dynamic) {
}
//Called by lime
public function onmousedown(_event:Dynamic) {
lib.audio.get('sound').play(3,0);
}
//Called by lime
public function onmouseup(_event:Dynamic) {
}
//Called by lime
public function onkeydown(_event:Dynamic) {
lib.audio.get('music').position = 0.0;
}
//Called by lime
public function onkeyup(_event:Dynamic) {
}
//Called by lime
public function render() {
//Set the viewport for GL
GL.viewport( 0, 0, lib.config.width, lib.config.height );
//Set the clear color to a weird color that bounces around
GL.clearColor( red_value, red_value*0.5, red_value*0.3, 1);
//Clear the buffers
GL.clear( GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT );
} //render
} //Main