Work on render context

This commit is contained in:
Joshua Granick
2014-06-12 11:08:16 -07:00
parent 9003204e5b
commit 9ab066c4db
6 changed files with 1384 additions and 3 deletions

View File

@@ -92,7 +92,7 @@ class Application implements IKeyEventListener implements IMouseEventListener im
public function onWindowDeactivate (event:WindowEvent):Void { }
public function render ():Void {
public function render (context:RenderContext):Void {
@@ -135,12 +135,11 @@ private class EventDelegate implements IRenderEventListener implements IUpdateEv
public function onRender (event:RenderEvent):Void {
application.render ();
for (window in application.windows) {
if (window.currentRenderer != null) {
application.render (window.currentRenderer.context);
window.currentRenderer.flip ();
}

View File

@@ -0,0 +1,16 @@
package lime.graphics;
import lime.graphics.canvas.CanvasRenderContext;
import lime.graphics.dom.DOMRenderContext;
import lime.graphics.opengl.GLRenderContext;
enum RenderContext {
OPENGL (gl:GLRenderContext);
CANVAS (context:CanvasRenderContext);
DOM (element:DOMRenderContext);
CUSTOM (context:Dynamic);
}

View File

@@ -1,6 +1,7 @@
package lime.graphics;
import lime.graphics.opengl.GLRenderContext;
import lime.system.System;
import lime.ui.Window;
@@ -8,6 +9,7 @@ import lime.ui.Window;
class Renderer {
public var context:RenderContext;
public var handle:Dynamic;
private var window:Window;
@@ -25,6 +27,7 @@ class Renderer {
#if (cpp || neko)
handle = lime_renderer_create (window.handle);
context = OPENGL (new GLRenderContext ());
#end
}

View File

@@ -0,0 +1,20 @@
package lime.graphics.canvas;
#if js
typedef CanvasRenderContext = js.html.CanvasRenderContext2D;
#else
class CanvasRenderContext {
public function new () {
}
}
#end

View File

@@ -0,0 +1,20 @@
package lime.graphics.dom;
#if js
typedef DOMRenderContext = js.html.HtmlElement;
#else
class DOMRenderContext {
public function new () {
}
}
#end

File diff suppressed because it is too large Load Diff