Work on render context
This commit is contained in:
@@ -92,7 +92,7 @@ class Application implements IKeyEventListener implements IMouseEventListener im
|
|||||||
public function onWindowDeactivate (event:WindowEvent):Void { }
|
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 {
|
public function onRender (event:RenderEvent):Void {
|
||||||
|
|
||||||
application.render ();
|
|
||||||
|
|
||||||
for (window in application.windows) {
|
for (window in application.windows) {
|
||||||
|
|
||||||
if (window.currentRenderer != null) {
|
if (window.currentRenderer != null) {
|
||||||
|
|
||||||
|
application.render (window.currentRenderer.context);
|
||||||
window.currentRenderer.flip ();
|
window.currentRenderer.flip ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
lime/graphics/RenderContext.hx
Normal file
16
lime/graphics/RenderContext.hx
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package lime.graphics;
|
package lime.graphics;
|
||||||
|
|
||||||
|
|
||||||
|
import lime.graphics.opengl.GLRenderContext;
|
||||||
import lime.system.System;
|
import lime.system.System;
|
||||||
import lime.ui.Window;
|
import lime.ui.Window;
|
||||||
|
|
||||||
@@ -8,6 +9,7 @@ import lime.ui.Window;
|
|||||||
class Renderer {
|
class Renderer {
|
||||||
|
|
||||||
|
|
||||||
|
public var context:RenderContext;
|
||||||
public var handle:Dynamic;
|
public var handle:Dynamic;
|
||||||
|
|
||||||
private var window:Window;
|
private var window:Window;
|
||||||
@@ -25,6 +27,7 @@ class Renderer {
|
|||||||
|
|
||||||
#if (cpp || neko)
|
#if (cpp || neko)
|
||||||
handle = lime_renderer_create (window.handle);
|
handle = lime_renderer_create (window.handle);
|
||||||
|
context = OPENGL (new GLRenderContext ());
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
20
lime/graphics/canvas/CanvasRenderContext.hx
Normal file
20
lime/graphics/canvas/CanvasRenderContext.hx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package lime.graphics.canvas;
|
||||||
|
#if js
|
||||||
|
typedef CanvasRenderContext = js.html.CanvasRenderContext2D;
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
class CanvasRenderContext {
|
||||||
|
|
||||||
|
|
||||||
|
public function new () {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#end
|
||||||
20
lime/graphics/dom/DOMRenderContext.hx
Normal file
20
lime/graphics/dom/DOMRenderContext.hx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package lime.graphics.dom;
|
||||||
|
#if js
|
||||||
|
typedef DOMRenderContext = js.html.HtmlElement;
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
class DOMRenderContext {
|
||||||
|
|
||||||
|
|
||||||
|
public function new () {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#end
|
||||||
1323
lime/graphics/opengl/GLRenderContext.hx
Normal file
1323
lime/graphics/opengl/GLRenderContext.hx
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user