diff --git a/CHANGELOG.md b/CHANGELOG.md
index 875f311e2..467a8aa93 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+2.4.1 (05/13/2015)
+------------------
+
+* Improve handling of custom error types in HTML5 target
+* Guard icon helpers if PNG encoding fails
+* Fixed Emscripten rebuild
+* Fixed issue on the build server
+
+
2.4.0 (05/12/2015)
------------------
diff --git a/haxelib.json b/haxelib.json
index 4d1d9c654..61352d5be 100644
--- a/haxelib.json
+++ b/haxelib.json
@@ -4,7 +4,7 @@
"license": "MIT",
"tags": [],
"description": "A flexible lightweight layer for Haxe cross-platform developers",
- "version": "2.4.0",
- "releasenote": "Added Cairo, text input and mouse focus events, other improvements",
+ "version": "2.4.1",
+ "releasenote": "Minor fixes",
"contributors": [ "singmajesty" ]
}
diff --git a/js/Boot.hx b/js/Boot.hx
index ef349f969..8a1b15e4c 100644
--- a/js/Boot.hx
+++ b/js/Boot.hx
@@ -27,9 +27,29 @@ private class HaxeError extends js.Error {
public function new(val:Dynamic) untyped {
super();
- this.val = __define_feature__("js.Boot.HaxeError", val);
- this.message = String(val);
- if (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);
+ this.val = untyped __define_feature__("js.Boot.HaxeError", val);
+
+ if (Reflect.hasField (val, "name")) {
+
+ this.name = Reflect.field (val, "name");
+
+ } else {
+
+ this.name = "Error";
+
+ }
+
+ if (Reflect.hasField (val, "message")) {
+
+ this.message = Reflect.field (val, "message");
+
+ } else {
+
+ this.message = Std.string (val);
+
+ }
+
+ untyped if (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);
}
}
diff --git a/legacy/project/Build.xml b/legacy/project/Build.xml
index 7638f6887..e86079c3a 100644
--- a/legacy/project/Build.xml
+++ b/legacy/project/Build.xml
@@ -25,7 +25,7 @@
-
+
@@ -106,7 +106,7 @@
-
+
+
+
@@ -341,19 +350,6 @@
-
-
-
-
+
+
diff --git a/legacy/project/src/common/CURL.cpp b/legacy/project/src/common/CURL.cpp
index fd18315f8..a6fc65d75 100644
--- a/legacy/project/src/common/CURL.cpp
+++ b/legacy/project/src/common/CURL.cpp
@@ -75,6 +75,7 @@ public:
curl_easy_setopt(mHandle, CURLOPT_HEADERDATA, (void *)this);
curl_easy_setopt(mHandle, CURLOPT_NOPROGRESS, 0);
+ curl_easy_setopt(mHandle, CURLOPT_CONNECTTIMEOUT, 30);
if (r.followRedirects)
curl_easy_setopt(mHandle, CURLOPT_FOLLOWLOCATION, 1);
diff --git a/legacy/project/src/opengl/OGL.h b/legacy/project/src/opengl/OGL.h
index 4221fa15a..7ab4bf6cc 100644
--- a/legacy/project/src/opengl/OGL.h
+++ b/legacy/project/src/opengl/OGL.h
@@ -1,7 +1,7 @@
#ifndef INCLUDED_OGL_H
#define INCLUDED_OGL_H
-#if defined(BLACKBERRY) || defined(ANDROID) || defined(WEBOS) || defined(GPH) || defined(RASPBERRYPI) || defined(EMSCRIPTEN)
+#if defined(BLACKBERRY) || defined(ANDROID) || defined(GPH) || defined(RASPBERRYPI) || defined(EMSCRIPTEN)
#define NME_GLES
@@ -26,6 +26,13 @@
//typedef EAGLContext *GLCtx;
#define NME_GLES
+#elif defined(WEBOS)
+
+ #define NME_GLES
+
+ #include
+ #include
+
#elif defined(HX_LINUX)
#define NEED_EXTENSIONS
diff --git a/legacy/project/src/sdl/SDLSound.cpp b/legacy/project/src/sdl/SDLSound.cpp
index 80e01653c..c713e7e65 100644
--- a/legacy/project/src/sdl/SDLSound.cpp
+++ b/legacy/project/src/sdl/SDLSound.cpp
@@ -258,6 +258,7 @@ public:
}
double getLeft() { return 1; }
double getRight() { return 1; }
+ void setPitch(const float &inFloat) {}
double getPosition() { return 1; }
double setPosition(const float &inFloat) { return 1; }
void stop()
@@ -484,6 +485,7 @@ public:
}
double getLeft() { return 1; }
double getRight() { return 1; }
+ void setPitch(const float &inFloat) {}
double getPosition() { return mPlaying ? SDL_GetTicks() - mStartTime : mLength; }
double setPosition(const float &inFloat) { return 1; }
diff --git a/legacy/project/src/sdl/SDLStage.cpp b/legacy/project/src/sdl/SDLStage.cpp
index 9c92e9de2..f6d3f27c8 100644
--- a/legacy/project/src/sdl/SDLStage.cpp
+++ b/legacy/project/src/sdl/SDLStage.cpp
@@ -691,7 +691,7 @@ public:
double mDownY;
const char *getJoystickName(int id) {
- #if !defined(BLACKBERRY) && !defined(EMSCRIPTEN)
+ #if !defined(BLACKBERRY) && !defined(EMSCRIPTEN) && !defined(WEBOS)
return SDL_JoystickNameForIndex(id);
#else
return "";
diff --git a/lime/_backend/flash/FlashApplication.hx b/lime/_backend/flash/FlashApplication.hx
index 23c46bb1b..1264ad06f 100644
--- a/lime/_backend/flash/FlashApplication.hx
+++ b/lime/_backend/flash/FlashApplication.hx
@@ -33,6 +33,8 @@ class FlashApplication {
this.parent = parent;
+ Lib.current.stage.frameRate = 60;
+
AudioManager.init ();
}
@@ -106,6 +108,7 @@ class FlashApplication {
if (config != null) {
+ setFrameRate (config.fps);
var window = new Window (config);
var renderer = new Renderer (window);
parent.addWindow (window);
@@ -152,6 +155,13 @@ class FlashApplication {
}
+ public function getFrameRate ():Float {
+
+ return Lib.current.stage.frameRate;
+
+ }
+
+
private function handleKeyEvent (event:KeyboardEvent):Void {
if (parent.window != null) {
@@ -314,4 +324,11 @@ class FlashApplication {
}
+ public function setFrameRate (value:Float):Float {
+
+ return Lib.current.stage.frameRate = value;
+
+ }
+
+
}
\ No newline at end of file
diff --git a/lime/_backend/html5/HTML5Application.hx b/lime/_backend/html5/HTML5Application.hx
index 7eda98583..2a7ef0547 100644
--- a/lime/_backend/html5/HTML5Application.hx
+++ b/lime/_backend/html5/HTML5Application.hx
@@ -20,7 +20,11 @@ import lime.ui.Window;
class HTML5Application {
- private var cacheTime:Float;
+ private var currentUpdate:Float;
+ private var deltaTime:Float;
+ private var framePeriod:Float;
+ private var lastUpdate:Float;
+ private var nextUpdate:Float;
private var parent:Application;
#if stats
private var stats:Dynamic;
@@ -31,6 +35,11 @@ class HTML5Application {
this.parent = parent;
+ currentUpdate = 0;
+ lastUpdate = 0;
+ nextUpdate = 0;
+ framePeriod = -1;
+
AudioManager.init ();
}
@@ -141,7 +150,7 @@ class HTML5Application {
window.requestAnimFrame = window.requestAnimationFrame;
");
- cacheTime = Date.now ().getTime ();
+ lastUpdate = Date.now ().getTime ();
handleUpdateEvent ();
@@ -150,6 +159,25 @@ class HTML5Application {
}
+ public function getFrameRate ():Float {
+
+ if (framePeriod < 0) {
+
+ return 60;
+
+ } else if (framePeriod == 1000) {
+
+ return 0;
+
+ } else {
+
+ return 1000 / framePeriod;
+
+ }
+
+ }
+
+
private function handleKeyEvent (event:KeyboardEvent):Void {
if (parent.window != null) {
@@ -189,27 +217,51 @@ class HTML5Application {
private function handleUpdateEvent (?__):Void {
- #if stats
- stats.begin ();
- #end
+ currentUpdate = Date.now ().getTime ();
- var currentTime = Date.now ().getTime ();
- var deltaTime = currentTime - cacheTime;
- cacheTime = currentTime;
-
- parent.onUpdate.dispatch (Std.int (deltaTime));
-
- if (parent.renderer != null) {
+ if (currentUpdate >= nextUpdate) {
- parent.renderer.onRender.dispatch (parent.renderer.context);
- parent.renderer.flip ();
+ #if stats
+ stats.begin ();
+ #end
+
+ deltaTime = currentUpdate - lastUpdate;
+
+ parent.onUpdate.dispatch (Std.int (deltaTime));
+
+ if (parent.renderer != null) {
+
+ parent.renderer.onRender.dispatch (parent.renderer.context);
+ parent.renderer.flip ();
+
+ }
+
+ #if stats
+ stats.end ();
+ #end
+
+ if (framePeriod < 0) {
+
+ nextUpdate = currentUpdate;
+ nextUpdate = currentUpdate;
+
+ } else {
+
+ nextUpdate = currentUpdate + framePeriod;
+
+ //while (nextUpdate <= currentUpdate) {
+ //
+ //nextUpdate += framePeriod;
+ //
+ //}
+
+
+ }
+
+ lastUpdate = currentUpdate;
}
- #if stats
- stats.end ();
- #end
-
Browser.window.requestAnimationFrame (cast handleUpdateEvent);
}
@@ -255,4 +307,25 @@ class HTML5Application {
}
+ public function setFrameRate (value:Float):Float {
+
+ if (value >= 60) {
+
+ framePeriod = -1;
+
+ } else if (value > 0) {
+
+ framePeriod = 1000 / value;
+
+ } else {
+
+ framePeriod = 1000;
+
+ }
+
+ return value;
+
+ }
+
+
}
\ No newline at end of file
diff --git a/lime/_backend/native/NativeApplication.hx b/lime/_backend/native/NativeApplication.hx
index f51e5c656..2fb32b32a 100644
--- a/lime/_backend/native/NativeApplication.hx
+++ b/lime/_backend/native/NativeApplication.hx
@@ -34,12 +34,14 @@ class NativeApplication {
public var handle:Dynamic;
+ private var frameRate:Float;
private var parent:Application;
public function new (parent:Application):Void {
this.parent = parent;
+ frameRate = 60;
AudioManager.init ();
@@ -54,6 +56,7 @@ class NativeApplication {
if (config != null) {
+ setFrameRate (config.fps);
var window = new Window (config);
var renderer = new Renderer (window);
parent.addWindow (window);
@@ -112,6 +115,13 @@ class NativeApplication {
}
+ public function getFrameRate ():Float {
+
+ return frameRate;
+
+ }
+
+
private function handleGamepadEvent ():Void {
if (parent.window != null) {
@@ -359,6 +369,14 @@ class NativeApplication {
}
+ public function setFrameRate (value:Float):Float {
+
+ lime_application_set_frame_rate (handle, value);
+ return frameRate = value;
+
+ }
+
+
private function updateTimer ():Void {
if (Timer.sRunningTimers.length > 0) {
@@ -409,6 +427,7 @@ class NativeApplication {
private static var lime_application_create = System.load ("lime", "lime_application_create", 1);
private static var lime_application_exec = System.load ("lime", "lime_application_exec", 1);
private static var lime_application_init = System.load ("lime", "lime_application_init", 1);
+ private static var lime_application_set_frame_rate = System.load ("lime", "lime_application_set_frame_rate", 2);
private static var lime_application_update = System.load ("lime", "lime_application_update", 1);
private static var lime_application_quit = System.load ("lime", "lime_application_quit", 1);
private static var lime_gamepad_event_manager_register = System.load ("lime", "lime_gamepad_event_manager_register", 2);
diff --git a/lime/app/Application.hx b/lime/app/Application.hx
index 69e592424..9d1b71115 100644
--- a/lime/app/Application.hx
+++ b/lime/app/Application.hx
@@ -23,6 +23,7 @@ class Application extends Module {
public static var current (default, null):Application;
public var config (default, null):Config;
+ public var frameRate (get, set):Float;
public var modules (default, null):Array;
/**
@@ -589,6 +590,20 @@ class Application extends Module {
+ @:noCompletion private inline function get_frameRate ():Float {
+
+ return backend.getFrameRate ();
+
+ }
+
+
+ @:noCompletion private inline function set_frameRate (value:Float):Float {
+
+ return backend.setFrameRate (value);
+
+ }
+
+
@:noCompletion private inline function get_renderer ():Renderer {
return renderers[0];
diff --git a/lime/graphics/Image.hx b/lime/graphics/Image.hx
index ec3dfc27e..b8a863003 100644
--- a/lime/graphics/Image.hx
+++ b/lime/graphics/Image.hx
@@ -1336,14 +1336,14 @@ class Image {
}
- public function get_rect ():Rectangle {
+ private function get_rect ():Rectangle {
return new Rectangle (0, 0, width, height);
}
- public function get_src ():Dynamic {
+ private function get_src ():Dynamic {
return buffer.src;
diff --git a/lime/graphics/cairo/Cairo.hx b/lime/graphics/cairo/Cairo.hx
index 0fef27230..feb3dcde5 100644
--- a/lime/graphics/cairo/Cairo.hx
+++ b/lime/graphics/cairo/Cairo.hx
@@ -31,7 +31,7 @@ class Cairo {
public var tolerance (get, set):Float;
public var userData:Dynamic;
- private var handle:Dynamic;
+ @:noCompletion private var handle:Dynamic;
public function new (surface:CairoSurface = null):Void {
@@ -369,6 +369,41 @@ class Cairo {
}
+ public function setFontFace( face:CairoFont ) {
+
+ #if lime_cairo
+ lime_cairo_set_font_face( handle, face.handle );
+ #end
+ }
+
+ public function setFontSize( size:Float ) {
+
+ #if lime_cairo
+ lime_cairo_set_font_size( handle, size );
+ #end
+ }
+
+ public function getFontOptions ():CairoFontOptions {
+
+ #if lime_cairo
+ return new CairoFontOptions( handle );
+ #end
+
+ return cast 0;
+
+ }
+
+
+ public function setFontOptions (value:CairoFontOptions):CairoFontOptions {
+
+ #if lime_cairo
+ lime_cairo_set_font_options (handle, value.handle);
+ #end
+
+ return value;
+
+ }
+
public function setSourceRGB (r:Float, g:Float, b:Float):Void {
@@ -405,6 +440,14 @@ class Cairo {
}
+ public function showText ( utf8:String ) {
+
+ #if lime_cairo
+ lime_cairo_show_text( handle, utf8 );
+ #end
+
+ }
+
public function status ():CairoStatus {
@@ -452,6 +495,22 @@ class Cairo {
}
+ public function rotate (amount:Float):Void {
+
+ #if lime_cairo
+ lime_cairo_rotate (handle, amount);
+ #end
+
+ }
+
+ public function scale (x:Float, y:Float):Void {
+
+ #if lime_cairo
+ lime_cairo_scale (handle, x, y);
+ #end
+
+ }
+
public function translate (x:Float, y:Float):Void {
@@ -462,6 +521,8 @@ class Cairo {
}
+
+
// Get & Set Methods
@@ -469,7 +530,7 @@ class Cairo {
- private function get_antialias ():CairoAntialias {
+ @:noCompletion private function get_antialias ():CairoAntialias {
#if lime_cairo
return lime_cairo_get_antialias (handle);
@@ -480,7 +541,7 @@ class Cairo {
}
- private function set_antialias (value:CairoAntialias):CairoAntialias {
+ @:noCompletion private function set_antialias (value:CairoAntialias):CairoAntialias {
#if lime_cairo
lime_cairo_set_antialias (handle, value);
@@ -491,7 +552,7 @@ class Cairo {
}
- private function get_currentPoint ():Vector2 {
+ @:noCompletion private function get_currentPoint ():Vector2 {
#if lime_cairo
var vec = lime_cairo_get_current_point (handle);
@@ -503,7 +564,7 @@ class Cairo {
}
- private function get_dash ():Array {
+ @:noCompletion private function get_dash ():Array {
#if lime_cairo
return lime_cairo_get_dash (handle);
@@ -514,7 +575,7 @@ class Cairo {
}
- private function set_dash (value:Array):Array {
+ @:noCompletion private function set_dash (value:Array):Array {
#if lime_cairo
lime_cairo_set_dash (handle, value);
@@ -525,7 +586,7 @@ class Cairo {
}
- private function get_dashCount ():Int {
+ @:noCompletion private function get_dashCount ():Int {
#if lime_cairo
return lime_cairo_get_dash_count (handle);
@@ -536,7 +597,7 @@ class Cairo {
}
- private function get_fillRule ():CairoFillRule {
+ @:noCompletion private function get_fillRule ():CairoFillRule {
#if lime_cairo
return lime_cairo_get_fill_rule (handle);
@@ -547,7 +608,7 @@ class Cairo {
}
- private function set_fillRule (value:CairoFillRule):CairoFillRule {
+ @:noCompletion private function set_fillRule (value:CairoFillRule):CairoFillRule {
#if lime_cairo
lime_cairo_set_fill_rule (handle, value);
@@ -558,7 +619,7 @@ class Cairo {
}
- private function get_groupTarget ():CairoSurface {
+ @:noCompletion private function get_groupTarget ():CairoSurface {
#if lime_cairo
return lime_cairo_get_group_target (handle);
@@ -569,7 +630,7 @@ class Cairo {
}
- private function get_hasCurrentPoint ():Bool {
+ @:noCompletion private function get_hasCurrentPoint ():Bool {
#if lime_cairo
return lime_cairo_has_current_point (handle);
@@ -580,7 +641,7 @@ class Cairo {
}
- private function get_lineCap ():CairoLineCap {
+ @:noCompletion private function get_lineCap ():CairoLineCap {
#if lime_cairo
return lime_cairo_get_line_cap (handle);
@@ -591,7 +652,7 @@ class Cairo {
}
- private function set_lineCap (value:CairoLineCap):CairoLineCap {
+ @:noCompletion private function set_lineCap (value:CairoLineCap):CairoLineCap {
#if lime_cairo
lime_cairo_set_line_cap (handle, value);
@@ -602,7 +663,7 @@ class Cairo {
}
- private function get_lineJoin ():CairoLineJoin {
+ @:noCompletion private function get_lineJoin ():CairoLineJoin {
#if lime_cairo
return lime_cairo_get_line_join (handle);
@@ -613,7 +674,7 @@ class Cairo {
}
- private function set_lineJoin (value:CairoLineJoin):CairoLineJoin {
+ @:noCompletion private function set_lineJoin (value:CairoLineJoin):CairoLineJoin {
#if lime_cairo
lime_cairo_set_line_join (handle, value);
@@ -624,7 +685,7 @@ class Cairo {
}
- private function get_lineWidth ():Float {
+ @:noCompletion private function get_lineWidth ():Float {
#if lime_cairo
return lime_cairo_get_line_width (handle);
@@ -635,7 +696,7 @@ class Cairo {
}
- private function set_lineWidth (value:Float):Float {
+ @:noCompletion private function set_lineWidth (value:Float):Float {
#if lime_cairo
lime_cairo_set_line_width (handle, value);
@@ -646,7 +707,7 @@ class Cairo {
}
- private function get_matrix ():Matrix3 {
+ @:noCompletion private function get_matrix ():Matrix3 {
#if lime_cairo
var m = lime_cairo_get_matrix (handle);
@@ -658,7 +719,7 @@ class Cairo {
}
- private function set_matrix (value:Matrix3):Matrix3 {
+ @:noCompletion private function set_matrix (value:Matrix3):Matrix3 {
#if lime_cairo
lime_cairo_set_matrix (handle, value);
@@ -669,7 +730,7 @@ class Cairo {
}
- private function get_miterLimit ():Float {
+ @:noCompletion private function get_miterLimit ():Float {
#if lime_cairo
return lime_cairo_get_miter_limit (handle);
@@ -680,7 +741,7 @@ class Cairo {
}
- private function set_miterLimit (value:Float):Float {
+ @:noCompletion private function set_miterLimit (value:Float):Float {
#if lime_cairo
lime_cairo_set_miter_limit (handle, value);
@@ -691,7 +752,7 @@ class Cairo {
}
- private function get_operator ():CairoOperator {
+ @:noCompletion private function get_operator ():CairoOperator {
#if lime_cairo
return lime_cairo_get_operator (handle);
@@ -702,7 +763,7 @@ class Cairo {
}
- private function set_operator (value:CairoOperator):CairoOperator {
+ @:noCompletion private function set_operator (value:CairoOperator):CairoOperator {
#if lime_cairo
lime_cairo_set_operator (handle, value);
@@ -713,7 +774,7 @@ class Cairo {
}
- private function get_referenceCount ():Int {
+ @:noCompletion private function get_referenceCount ():Int {
#if lime_cairo
return lime_cairo_get_reference_count ();
@@ -724,7 +785,7 @@ class Cairo {
}
- private function get_source ():CairoPattern {
+ @:noCompletion private function get_source ():CairoPattern {
#if lime_cairo
return lime_cairo_get_source (handle);
@@ -735,7 +796,7 @@ class Cairo {
}
- private function set_source (value:CairoPattern):CairoPattern {
+ @:noCompletion private function set_source (value:CairoPattern):CairoPattern {
#if lime_cairo
lime_cairo_set_source (handle, value);
@@ -746,7 +807,7 @@ class Cairo {
}
- private function get_target ():CairoSurface {
+ @:noCompletion private function get_target ():CairoSurface {
#if lime_cairo
return lime_cairo_get_target (handle);
@@ -757,7 +818,7 @@ class Cairo {
}
- private function get_tolerance ():Float {
+ @:noCompletion private function get_tolerance ():Float {
#if lime_cairo
return lime_cairo_get_tolerance ();
@@ -768,7 +829,7 @@ class Cairo {
}
- private function set_tolerance (value:Float):Float {
+ @:noCompletion private function set_tolerance (value:Float):Float {
#if lime_cairo
lime_cairo_set_tolerance (value);
@@ -864,7 +925,11 @@ class Cairo {
private static var lime_cairo_save = System.load ("lime", "lime_cairo_save", 1);
private static var lime_cairo_set_antialias = System.load ("lime", "lime_cairo_set_antialias", 2);
private static var lime_cairo_set_dash = System.load ("lime", "lime_cairo_set_dash", 2);
+ private static var lime_cairo_set_font_face = System.load ("lime", "lime_cairo_set_font_face", 2);
+ private static var lime_cairo_set_font_size = System.load ("lime", "lime_cairo_set_font_size", 2);
private static var lime_cairo_set_fill_rule = System.load ("lime", "lime_cairo_set_fill_rule", 2);
+ private static var lime_cairo_set_font_options = System.load ("lime", "lime_cairo_set_font_options", 2);
+ private static var lime_cairo_get_font_options = System.load ("lime", "lime_cairo_get_font_options", 1);
private static var lime_cairo_set_line_cap = System.load ("lime", "lime_cairo_set_line_cap", 2);
private static var lime_cairo_set_line_join = System.load ("lime", "lime_cairo_set_line_join", 2);
private static var lime_cairo_set_line_width = System.load ("lime", "lime_cairo_set_line_width", 2);
@@ -877,11 +942,14 @@ class Cairo {
private static var lime_cairo_set_source_surface = System.load ("lime", "lime_cairo_set_source_surface", 4);
private static var lime_cairo_set_tolerance = System.load ("lime", "lime_cairo_set_tolerance", 2);
private static var lime_cairo_show_page = System.load ("lime", "lime_cairo_show_page", 1);
+ private static var lime_cairo_show_text = System.load ("lime", "lime_cairo_show_text", 2);
private static var lime_cairo_status = System.load ("lime", "lime_cairo_status", 1);
private static var lime_cairo_stroke = System.load ("lime", "lime_cairo_stroke", 1);
private static var lime_cairo_stroke_extents = System.load ("lime", "lime_cairo_stroke_extents", 5);
private static var lime_cairo_stroke_preserve = System.load ("lime", "lime_cairo_stroke_preserve", 1);
private static var lime_cairo_transform = System.load ("lime", "lime_cairo_transform", 2);
+ private static var lime_cairo_rotate = System.load ("lime", "lime_cairo_rotate", 2);
+ private static var lime_cairo_scale = System.load ("lime", "lime_cairo_scale", 3);
private static var lime_cairo_translate = System.load ("lime", "lime_cairo_translate", 3);
private static var lime_cairo_version = System.load ("lime", "lime_cairo_version", 0);
private static var lime_cairo_version_string = System.load ("lime", "lime_cairo_version_string", 0);
diff --git a/lime/graphics/cairo/CairoFont.hx b/lime/graphics/cairo/CairoFont.hx
new file mode 100644
index 000000000..dc3a31f64
--- /dev/null
+++ b/lime/graphics/cairo/CairoFont.hx
@@ -0,0 +1,30 @@
+package lime.graphics.cairo;
+import lime.text.Font;
+import lime.system.System;
+
+class CairoFont
+{
+ @:noCompletion public var handle:Dynamic;
+
+ public var font(default,null):Font;
+
+ public function new( font : Font ) {
+
+ #if lime_cairo
+ this.font = font;
+ handle = lime_cairo_ft_font_face_create_for_ft_face( font.src, 0 );
+ #end
+ }
+
+ public function destroy() {
+ #if lime_cairo
+ lime_cairo_font_face_destroy (handle);
+ #end
+ }
+
+ #if (cpp || neko || nodejs)
+ private static var lime_cairo_ft_font_face_create_for_ft_face = System.load ("lime", "lime_cairo_ft_font_face_create_for_ft_face", 2);
+ private static var lime_cairo_font_face_destroy = System.load ("lime", "lime_cairo_font_face_destroy", 1);
+ #end
+
+}
\ No newline at end of file
diff --git a/lime/graphics/cairo/CairoFontOptions.hx b/lime/graphics/cairo/CairoFontOptions.hx
new file mode 100644
index 000000000..fa4a6402b
--- /dev/null
+++ b/lime/graphics/cairo/CairoFontOptions.hx
@@ -0,0 +1,118 @@
+package lime.graphics.cairo;
+import lime.graphics.cairo.CairoSubpixelOrder;
+import lime.graphics.cairo.CairoSubpixelOrder;
+import lime.graphics.cairo.CairoSubpixelOrder;
+import lime.text.Font;
+import lime.system.System;
+
+class CairoFontOptions
+{
+ public var antialias (get, set):CairoAntialias;
+ public var subpixelOrder (get, set):CairoSubpixelOrder;
+ public var hintStyle (get, set):CairoHintStyle;
+ public var hintMetrics (get, set):CairoHintMetrics;
+
+ @:noCompletion public var handle:Dynamic;
+
+ public function new( handle : Dynamic = null ) {
+
+ #if lime_cairo
+ if ( handle == null )
+ handle = lime_cairo_font_options_create();
+ #end
+
+ this.handle = handle;
+ }
+
+ @:noCompletion private function get_antialias ():CairoAntialias {
+
+ #if lime_cairo
+ return lime_cairo_font_options_get_antialias (handle);
+ #end
+
+ return cast 0;
+
+ }
+
+
+ @:noCompletion private function set_antialias (value:CairoAntialias):CairoAntialias {
+
+ #if lime_cairo
+ lime_cairo_font_options_set_antialias (handle, value);
+ #end
+
+ return value;
+
+ }
+
+ @:noCompletion private function get_subpixelOrder ():CairoSubpixelOrder {
+
+ #if lime_cairo
+ return lime_cairo_font_options_get_subpixel_order (handle);
+ #end
+
+ return cast 0;
+
+ }
+
+
+ @:noCompletion private function set_subpixelOrder (value:CairoSubpixelOrder):CairoSubpixelOrder {
+
+ #if lime_cairo
+ lime_cairo_font_options_set_subpixel_order (handle, value);
+ #end
+
+ return value;
+
+ }
+
+ @:noCompletion private function get_hintStyle ():CairoHintStyle {
+
+ #if lime_cairo
+ return lime_cairo_font_options_get_hint_style (handle);
+ #end
+
+ return cast 0;
+ }
+
+
+ @:noCompletion private function set_hintStyle (value:CairoHintStyle):CairoHintStyle {
+
+ #if lime_cairo
+ lime_cairo_font_options_set_hint_style (handle, value);
+ #end
+
+ return value;
+ }
+
+ @:noCompletion private function get_hintMetrics ():CairoHintMetrics {
+
+ #if lime_cairo
+ return lime_cairo_font_options_get_hint_metrics (handle);
+ #end
+
+ return cast 0;
+ }
+
+ @:noCompletion private function set_hintMetrics (value:CairoHintMetrics):CairoHintMetrics {
+
+ #if lime_cairo
+ lime_cairo_font_options_set_hint_metrics (handle, value);
+ #end
+
+ return value;
+ }
+
+ #if (cpp || neko || nodejs)
+ private static var lime_cairo_font_options_create = System.load ("lime", "lime_cairo_font_options_create", 0);
+ private static var lime_cairo_font_options_get_antialias = System.load ("lime", "lime_cairo_font_options_get_antialias", 1);
+ private static var lime_cairo_font_options_get_subpixel_order = System.load ("lime", "lime_cairo_font_options_get_subpixel_order", 1);
+ private static var lime_cairo_font_options_get_hint_style = System.load ("lime", "lime_cairo_font_options_get_hint_style", 1);
+ private static var lime_cairo_font_options_get_hint_metrics = System.load ("lime", "lime_cairo_font_options_get_hint_metrics", 1);
+ private static var lime_cairo_font_options_set_antialias = System.load ("lime", "lime_cairo_font_options_set_antialias", 2);
+ private static var lime_cairo_font_options_set_subpixel_order = System.load ("lime", "lime_cairo_font_options_set_subpixel_order", 2);
+ private static var lime_cairo_font_options_set_hint_style = System.load ("lime", "lime_cairo_font_options_set_hint_style", 2);
+ private static var lime_cairo_font_options_set_hint_metrics = System.load ("lime", "lime_cairo_font_options_set_hint_metrics", 2);
+ #end
+
+}
\ No newline at end of file
diff --git a/lime/graphics/cairo/CairoHintMetrics.hx b/lime/graphics/cairo/CairoHintMetrics.hx
new file mode 100644
index 000000000..2f056a5a9
--- /dev/null
+++ b/lime/graphics/cairo/CairoHintMetrics.hx
@@ -0,0 +1,10 @@
+package lime.graphics.cairo;
+
+
+@:enum abstract CairoHintMetrics(Int) from Int to Int {
+
+ public var DEFAULT = 0;
+ public var OFF = 1;
+ public var ON = 2;
+
+}
\ No newline at end of file
diff --git a/lime/graphics/cairo/CairoHintStyle.hx b/lime/graphics/cairo/CairoHintStyle.hx
new file mode 100644
index 000000000..971fbcf9d
--- /dev/null
+++ b/lime/graphics/cairo/CairoHintStyle.hx
@@ -0,0 +1,12 @@
+package lime.graphics.cairo;
+
+
+@:enum abstract CairoHintStyle(Int) from Int to Int {
+
+ public var DEFAULT = 0;
+ public var NONE = 1;
+ public var SLIGHT = 2;
+ public var MEDIUM = 3;
+ public var FULL = 4;
+
+}
\ No newline at end of file
diff --git a/lime/graphics/cairo/CairoPattern.hx b/lime/graphics/cairo/CairoPattern.hx
index 83a9e14e0..2b0ac4915 100644
--- a/lime/graphics/cairo/CairoPattern.hx
+++ b/lime/graphics/cairo/CairoPattern.hx
@@ -110,7 +110,7 @@ abstract CairoPattern(Dynamic) {
- public function get_colorStopCount ():Int {
+ @:noCompletion private function get_colorStopCount ():Int {
#if lime_cairo
return lime_cairo_pattern_get_color_stop_count (this);
@@ -121,7 +121,7 @@ abstract CairoPattern(Dynamic) {
}
- public function get_extend ():CairoExtend {
+ @:noCompletion private function get_extend ():CairoExtend {
#if lime_cairo
return lime_cairo_pattern_get_extend (this);
@@ -132,7 +132,7 @@ abstract CairoPattern(Dynamic) {
}
- public function set_extend (value:CairoExtend):CairoExtend {
+ @:noCompletion private function set_extend (value:CairoExtend):CairoExtend {
#if lime_cairo
lime_cairo_pattern_set_extend (this, value);
@@ -143,7 +143,7 @@ abstract CairoPattern(Dynamic) {
}
- public function get_filter ():CairoFilter {
+ @:noCompletion private function get_filter ():CairoFilter {
#if lime_cairo
return lime_cairo_pattern_get_filter (this);
@@ -154,7 +154,7 @@ abstract CairoPattern(Dynamic) {
}
- public function set_filter (value:CairoFilter):CairoFilter {
+ @:noCompletion private function set_filter (value:CairoFilter):CairoFilter {
#if lime_cairo
lime_cairo_pattern_set_filter (this, value);
@@ -165,7 +165,7 @@ abstract CairoPattern(Dynamic) {
}
- public function get_matrix ():Matrix3 {
+ @:noCompletion private function get_matrix ():Matrix3 {
#if lime_cairo
var m = lime_cairo_pattern_get_matrix (this);
@@ -177,7 +177,7 @@ abstract CairoPattern(Dynamic) {
}
- public function set_matrix (value:Matrix3):Matrix3 {
+ @:noCompletion private function set_matrix (value:Matrix3):Matrix3 {
#if lime_cairo
lime_cairo_pattern_set_matrix (this, value);
diff --git a/lime/graphics/cairo/CairoSubpixelOrder.hx b/lime/graphics/cairo/CairoSubpixelOrder.hx
new file mode 100644
index 000000000..2dfce90ec
--- /dev/null
+++ b/lime/graphics/cairo/CairoSubpixelOrder.hx
@@ -0,0 +1,12 @@
+package lime.graphics.cairo;
+
+
+@:enum abstract CairoSubpixelOrder(Int) from Int to Int {
+
+ public var DEFAULT = 0;
+ public var RGB = 1;
+ public var BGR = 2;
+ public var VRGB = 3;
+ public var VBGR = 4;
+
+}
\ No newline at end of file
diff --git a/lime/graphics/cairo/CairoSurface.hx b/lime/graphics/cairo/CairoSurface.hx
index e78b7685f..5c0bc4045 100644
--- a/lime/graphics/cairo/CairoSurface.hx
+++ b/lime/graphics/cairo/CairoSurface.hx
@@ -57,7 +57,7 @@ abstract CairoSurface(Dynamic) {
public static function fromImage (image:Image):CairoSurface {
#if lime_cairo
- return createForData (image.data.buffer.__getNativePointer (), CairoFormat.ARGB32, image.width, image.height, image.buffer.stride);
+ return createForData (#if nodejs lime_buffer_get_native_pointer (image.data) #else image.data.buffer.__getNativePointer () #end, CairoFormat.ARGB32, image.width, image.height, image.buffer.stride);
#else
return null;
#end
@@ -72,7 +72,7 @@ abstract CairoSurface(Dynamic) {
- private function get_height ():Int {
+ @:noCompletion private function get_height ():Int {
#if lime_cairo
return lime_cairo_image_surface_get_height (this);
@@ -83,7 +83,7 @@ abstract CairoSurface(Dynamic) {
}
- private function get_width ():Int {
+ @:noCompletion private function get_width ():Int {
#if lime_cairo
return lime_cairo_image_surface_get_width (this);
@@ -108,6 +108,7 @@ abstract CairoSurface(Dynamic) {
private static var lime_cairo_image_surface_get_width = System.load ("lime", "lime_cairo_image_surface_get_width", 1);
private static var lime_cairo_surface_destroy = System.load ("lime", "lime_cairo_surface_destroy", 1);
private static var lime_cairo_surface_flush = System.load ("lime", "lime_cairo_surface_flush", 1);
+ private static var lime_buffer_get_native_pointer = System.load ("lime", "lime_buffer_get_native_pointer", 1);
#end
diff --git a/lime/graphics/utils/ImageDataUtil.hx b/lime/graphics/utils/ImageDataUtil.hx
index 522aeb5bd..b1c120700 100644
--- a/lime/graphics/utils/ImageDataUtil.hx
+++ b/lime/graphics/utils/ImageDataUtil.hx
@@ -806,7 +806,7 @@ class ImageDataUtil {
public static function multiplyAlpha (image:Image):Void {
var data = image.buffer.data;
- if (data == null) return;
+ if (data == null || !image.buffer.transparent) return;
#if ((cpp || neko) && !disable_cffi)
if (!System.disableCFFI) lime_image_data_util_multiply_alpha (image); else
diff --git a/lime/math/Matrix4.hx b/lime/math/Matrix4.hx
index 499f6c875..a704b7b1b 100644
--- a/lime/math/Matrix4.hx
+++ b/lime/math/Matrix4.hx
@@ -828,7 +828,7 @@ abstract Matrix4(Float32Array) from Float32Array to Float32Array {
- public function get_determinant ():Float {
+ private function get_determinant ():Float {
return 1 * ((this[0] * this[5] - this[4] * this[1]) * (this[10] * this[15] - this[14] * this[11])
- (this[0] * this[9] - this[8] * this[1]) * (this[6] * this[15] - this[14] * this[7])
@@ -840,14 +840,14 @@ abstract Matrix4(Float32Array) from Float32Array to Float32Array {
}
- public function get_position ():Vector4 {
+ private function get_position ():Vector4 {
return new Vector4 (this[12], this[13], this[14]);
}
- public function set_position (val:Vector4):Vector4 {
+ private function set_position (val:Vector4):Vector4 {
this[12] = val.x;
this[13] = val.y;
diff --git a/lime/math/Rectangle.hx b/lime/math/Rectangle.hx
index fa0b6f3b5..d6a39485d 100644
--- a/lime/math/Rectangle.hx
+++ b/lime/math/Rectangle.hx
@@ -189,7 +189,7 @@ class Rectangle {
var tx0 = m.a * x + m.c * y;
var tx1 = tx0;
var ty0 = m.b * x + m.d * y;
- var ty1 = tx0;
+ var ty1 = ty0;
var tx = m.a * (x + width) + m.c * y;
var ty = m.b * (x + width) + m.d * y;
diff --git a/lime/math/Vector4.hx b/lime/math/Vector4.hx
index 73ea3e4ce..a7f5c10ee 100644
--- a/lime/math/Vector4.hx
+++ b/lime/math/Vector4.hx
@@ -192,35 +192,35 @@ class Vector4 {
- inline public function get_length ():Float {
+ inline private function get_length ():Float {
return Math.sqrt (x * x + y * y + z * z);
}
- inline public function get_lengthSquared ():Float {
+ inline private function get_lengthSquared ():Float {
return x * x + y * y + z * z;
}
- inline public static function get_X_AXIS ():Vector4 {
+ inline private static function get_X_AXIS ():Vector4 {
return new Vector4 (1, 0, 0);
}
- inline public static function get_Y_AXIS ():Vector4 {
+ inline private static function get_Y_AXIS ():Vector4 {
return new Vector4 (0, 1, 0);
}
- inline public static function get_Z_AXIS ():Vector4 {
+ inline private static function get_Z_AXIS ():Vector4 {
return new Vector4 (0, 0, 1);
diff --git a/lime/net/URLLoader.hx b/lime/net/URLLoader.hx
index 5822c0c7b..3794e11a9 100644
--- a/lime/net/URLLoader.hx
+++ b/lime/net/URLLoader.hx
@@ -336,6 +336,7 @@ class URLLoader {
CURLEasy.setopt(__curl, SSL_VERIFYPEER, false);
CURLEasy.setopt(__curl, SSL_VERIFYHOST, false);
CURLEasy.setopt(__curl, USERAGENT, "libcurl-agent/1.0");
+ CURLEasy.setopt(__curl, CONNECTTIMEOUT, 30);
var result = CURLEasy.perform(__curl);
diff --git a/lime/project/ProjectXMLParser.hx b/lime/project/ProjectXMLParser.hx
index fbb6c1bd9..9692dda16 100644
--- a/lime/project/ProjectXMLParser.hx
+++ b/lime/project/ProjectXMLParser.hx
@@ -1394,6 +1394,18 @@ class ProjectXMLParser extends HXProject {
}
+ var i = dependencies.length;
+
+ while (i-- > 0) {
+
+ if ((name != "" && dependencies[i].name == name) || (path != "" && dependencies[i].path == path)) {
+
+ dependencies.splice (i, 1);
+
+ }
+
+ }
+
dependencies.push (new Dependency (name, path));
case "android":
diff --git a/lime/text/Font.hx b/lime/text/Font.hx
index 3ef10ad73..8a358d497 100644
--- a/lime/text/Font.hx
+++ b/lime/text/Font.hx
@@ -174,7 +174,7 @@ class Font {
return null;
}
-
+
public function renderGlyphs (glyphs:Array, fontSize:Int):Map {
@@ -339,8 +339,7 @@ class Font {
return null;
}
-
-
+
@:noCompletion private function __fromBytes (bytes:ByteArray):Void {
__fontPath = null;
diff --git a/lime/text/TextLayout.hx b/lime/text/TextLayout.hx
index 5e19d8151..c85f5af4f 100644
--- a/lime/text/TextLayout.hx
+++ b/lime/text/TextLayout.hx
@@ -15,11 +15,13 @@ class TextLayout {
public var font (default, set):Font;
public var glyphs (get, null):Array;
public var language (get, set):String;
- public var positions (default, null):Array;
+ @:isVar public var positions (get, null):Array;
public var script (get, set):TextScript;
public var size (default, set):Int;
public var text (default, set):String;
+ private var __dirty:Bool;
+
@:noCompletion private var __buffer:ByteArray;
@:noCompletion private var __direction:TextDirection;
@:noCompletion private var __handle:Dynamic;
@@ -36,12 +38,12 @@ class TextLayout {
__script = script;
__language = language;
+ positions = [];
+ __dirty = true;
+
#if (cpp || neko || nodejs)
__handle = lime_text_layout_create (__direction, __script, __language);
#end
-
- __position ();
-
}
@@ -81,8 +83,7 @@ class TextLayout {
}
- }
-
+ }
}
#end
@@ -97,6 +98,17 @@ class TextLayout {
+ @:noCompletion private function get_positions ():Array {
+
+ if ( __dirty )
+ {
+ __dirty = false;
+ __position();
+ }
+
+ return positions;
+ }
+
@:noCompletion private function get_direction ():TextDirection {
return __direction;
@@ -114,7 +126,7 @@ class TextLayout {
lime_text_layout_set_direction (__handle, value);
#end
- __position ();
+ __dirty = true;
return value;
@@ -126,7 +138,7 @@ class TextLayout {
if (value == this.font) return value;
this.font = value;
- __position ();
+ __dirty = true;
return value;
}
@@ -164,7 +176,7 @@ class TextLayout {
lime_text_layout_set_language (__handle, value);
#end
- __position ();
+ __dirty = true;
return value;
@@ -188,7 +200,7 @@ class TextLayout {
lime_text_layout_set_script (__handle, value);
#end
- __position ();
+ __dirty = true;
return value;
@@ -200,7 +212,7 @@ class TextLayout {
if (value == this.size) return value;
this.size = value;
- __position ();
+ __dirty = true;
return value;
}
@@ -211,7 +223,7 @@ class TextLayout {
if (value == this.text) return value;
this.text = value;
- __position ();
+ __dirty = true;
return value;
}
diff --git a/lime/tools/helpers/DeploymentHelper.hx b/lime/tools/helpers/DeploymentHelper.hx
index 89ff5ef96..82c8a359e 100644
--- a/lime/tools/helpers/DeploymentHelper.hx
+++ b/lime/tools/helpers/DeploymentHelper.hx
@@ -24,19 +24,27 @@ class DeploymentHelper {
var parent = targetFlags.get ("parent");
- if (parent != null && parent != "") {
-
- ProcessHelper.runCommand ("", "drive", [ "upload", "-f", targetPath, "-p", parent ]);
-
- } else {
-
- ProcessHelper.runCommand ("", "drive", [ "upload", "-f", targetPath ]);
+ var args = ["upload" , "-f" , targetPath];
+
+ if (targetFlags.exists("config")) {
+
+ args.push("--config");
+ args.push(targetFlags.get("config"));
}
+ if (parent != null && parent != "") {
+
+ args.push("-p");
+ args.push(parent);
+
+ }
+
+ ProcessHelper.runCommand("","drive",args);
+
}
}
-}
\ No newline at end of file
+}
diff --git a/lime/tools/helpers/IconHelper.hx b/lime/tools/helpers/IconHelper.hx
index 8e28383c7..af6f82972 100644
--- a/lime/tools/helpers/IconHelper.hx
+++ b/lime/tools/helpers/IconHelper.hx
@@ -79,9 +79,15 @@ class IconHelper {
if (image != null) {
- PathHelper.mkdir (Path.directory (targetPath));
- File.saveBytes (targetPath, image.encode ("png"));
- return true;
+ var bytes = image.encode ("png");
+
+ if (bytes != null) {
+
+ PathHelper.mkdir (Path.directory (targetPath));
+ File.saveBytes (targetPath, bytes);
+ return true;
+
+ }
}
@@ -147,12 +153,16 @@ class IconHelper {
if (image != null) {
- for (c in 0...4) out.writeByte (code.charCodeAt(c));
-
var bytes = image.encode ("png");
- out.writeInt32 (bytes.length + 8);
- out.writeBytes (bytes, 0, bytes.length);
+ if (bytes != null) {
+
+ for (c in 0...4) out.writeByte (code.charCodeAt(c));
+
+ out.writeInt32 (bytes.length + 8);
+ out.writeBytes (bytes, 0, bytes.length);
+
+ }
}
diff --git a/lime/tools/platforms/EmscriptenPlatform.hx b/lime/tools/platforms/EmscriptenPlatform.hx
index 2521a90b3..8ed80341a 100644
--- a/lime/tools/platforms/EmscriptenPlatform.hx
+++ b/lime/tools/platforms/EmscriptenPlatform.hx
@@ -226,7 +226,7 @@ class EmscriptenPlatform extends PlatformTarget {
public override function rebuild ():Void {
- CPPHelper.rebuild (project, [[ "-Demscripten" ]]);
+ CPPHelper.rebuild (project, [[ "-Demscripten", "-Dstatic_link" ]]);
}
diff --git a/lime/tools/platforms/WindowsPlatform.hx b/lime/tools/platforms/WindowsPlatform.hx
index 0fcdbdfce..60d85a3d9 100644
--- a/lime/tools/platforms/WindowsPlatform.hx
+++ b/lime/tools/platforms/WindowsPlatform.hx
@@ -148,7 +148,7 @@ class WindowsPlatform extends PlatformTarget {
var iconPath = PathHelper.combine (applicationDirectory, "icon.ico");
- if (IconHelper.createWindowsIcon (project.icons, iconPath)) {
+ if (IconHelper.createWindowsIcon (project.icons, iconPath) && PlatformHelper.hostPlatform == WINDOWS) {
var templates = [ PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates" ].concat (project.templatePaths);
ProcessHelper.runCommand ("", PathHelper.findTemplate (templates, "bin/ReplaceVistaIcon.exe"), [ executablePath, iconPath, "1" ], true, true);
diff --git a/project/Build.xml b/project/Build.xml
index d56b804e1..7f7e95501 100644
--- a/project/Build.xml
+++ b/project/Build.xml
@@ -48,6 +48,7 @@
+
diff --git a/project/include/app/Application.h b/project/include/app/Application.h
index 9439bf8f5..395ba9a47 100644
--- a/project/include/app/Application.h
+++ b/project/include/app/Application.h
@@ -18,6 +18,7 @@ namespace lime {
virtual int Exec () = 0;
virtual void Init () = 0;
virtual int Quit () = 0;
+ virtual void SetFrameRate (double frameRate) = 0;
virtual bool Update () = 0;
diff --git a/project/lib/cairo b/project/lib/cairo
index eb462ba87..2fd93965a 160000
--- a/project/lib/cairo
+++ b/project/lib/cairo
@@ -1 +1 @@
-Subproject commit eb462ba875ed3572cf6e83769bc240614f3e183c
+Subproject commit 2fd93965af0d7d55bc060a5b5108e4b1dfbb8a4e
diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp
index f357cd8f6..2387e4fb2 100644
--- a/project/src/ExternalInterface.cpp
+++ b/project/src/ExternalInterface.cpp
@@ -74,6 +74,15 @@ namespace lime {
}
+ value lime_application_set_frame_rate (value application, value frameRate) {
+
+ Application* app = (Application*)(intptr_t)val_float (application);
+ app->SetFrameRate (val_number (frameRate));
+ return alloc_null ();
+
+ }
+
+
value lime_application_update (value application) {
Application* app = (Application*)(intptr_t)val_float (application);
@@ -993,6 +1002,7 @@ namespace lime {
DEFINE_PRIM (lime_application_exec, 1);
DEFINE_PRIM (lime_application_init, 1);
DEFINE_PRIM (lime_application_quit, 1);
+ DEFINE_PRIM (lime_application_set_frame_rate, 2);
DEFINE_PRIM (lime_application_update, 1);
DEFINE_PRIM (lime_audio_load, 1);
DEFINE_PRIM (lime_font_get_ascender, 1);
diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp
index 38a765aae..f2f1c1742 100644
--- a/project/src/backend/sdl/SDLApplication.cpp
+++ b/project/src/backend/sdl/SDLApplication.cpp
@@ -27,6 +27,8 @@ namespace lime {
currentApplication = this;
+ framePeriod = 1000.0 / 60.0;
+
#ifdef EMSCRIPTEN
emscripten_cancel_main_loop ();
emscripten_set_main_loop (UpdateFrame, 0, 0);
@@ -203,7 +205,6 @@ namespace lime {
void SDLApplication::Init () {
- framePeriod = 1000.0 / 60.0;
active = true;
lastUpdate = SDL_GetTicks ();
nextUpdate = lastUpdate;
@@ -441,6 +442,21 @@ namespace lime {
}
+ void SDLApplication::SetFrameRate (double frameRate) {
+
+ if (frameRate > 0) {
+
+ framePeriod = 1000.0 / frameRate;
+
+ } else {
+
+ framePeriod = 1000.0;
+
+ }
+
+ }
+
+
static SDL_TimerID timerID = 0;
bool timerActive = false;
bool firstTime = true;
diff --git a/project/src/backend/sdl/SDLApplication.h b/project/src/backend/sdl/SDLApplication.h
index de48a7e0f..29e1640d2 100644
--- a/project/src/backend/sdl/SDLApplication.h
+++ b/project/src/backend/sdl/SDLApplication.h
@@ -28,6 +28,7 @@ namespace lime {
virtual int Exec ();
virtual void Init ();
virtual int Quit ();
+ virtual void SetFrameRate (double frameRate);
virtual bool Update ();
void RegisterWindow (SDLWindow *window);
diff --git a/project/src/graphics/cairo/CairoBindings.cpp b/project/src/graphics/cairo/CairoBindings.cpp
index 8a9791e3a..09b2d63ef 100644
--- a/project/src/graphics/cairo/CairoBindings.cpp
+++ b/project/src/graphics/cairo/CairoBindings.cpp
@@ -1,11 +1,14 @@
#include
+#include
#include