所以我和Haxe和Haxepunk做了一个游戏。很好。除了当我导出到C++时,没有任何东西被渲染!我之前在Haxepunk的论坛上发布了这篇文章,所以更多的信息可以在here上找到。以下是Haxepunk线程的摘录;
我仍然可以很好地编译它,但是除了我定义的背景色之外,游戏中实际上没有任何东西是渲染的。尽管如此,控制台仍然可以正常工作,渲染效果也很好。HaxePunk控制台告诉我Atlases using BitmapData will not be managed。
我使用的是Ash的组件-实体系统,而不是Haxe的实体。相关对象有一个附加到它们的Visible组件,如下所示;
package game.component;
import com.haxepunk.Graphic;
import com.haxepunk.graphics.Image;
class Visible {
public var image(default, default) : Graphic;
public function new() {
this.image = Image.createRect(16, 16, 0xFF0000);
}
}这是相关的渲染系统;
package game.system;
import ash.core.Engine;
import ash.core.Entity;
import ash.core.System;
import ash.tools.ListIteratingSystem;
import com.haxepunk.HXP;
import Constants;
import game.component.Positionable;
import game.component.Visible;
import game.node.RenderNode;
class RenderingSystem extends ListIteratingSystem<RenderNode> {
public function new() {
super(RenderNode, this.updateNode);
}
private function updateNode(node:RenderNode, time:Float) : Void {
node.renderable.image.render(HXP.buffer, node.position.position, Constants.ORIGIN);
}
}有什么建议吗?
发布于 2013-07-12 22:00:29
如果在C++中使用缓冲区渲染,则需要在构造函数中设置渲染模式。这是因为引擎构造函数是创建屏幕缓冲区的唯一位置。不幸的是,API文档没有清楚地解释这一点。
class Main extends Engine
{
public function new()
{
super(0, 0, 60, false, RenderMode.BUFFER);
}
}https://stackoverflow.com/questions/17538567
复制相似问题