[英]HaxePunk: Nothing is rendering when exporting to C++
So I'm making a game with Haxe and Haxepunk. 所以我正在与Haxe和Haxepunk进行一场比赛。 Fine.
精细。 Except that when I export to C++, nothing is rendering!
除了当我导出到C ++时,没有任何东西呈现! I posted this previously on the Haxepunk boards, so more info can be found here .
我之前在Haxepunk板上发布了这个,所以可以在这里找到更多信息。 Here's an excerpt from the Haxepunk thread;
这是Haxepunk线程的摘录;
I can still compile it just fine, but nothing in the game is actually rendering except for the background color I defined. 我仍然可以很好地编译它,但除了我定义的背景颜色外,游戏中没有任何东西实际渲染。 The console still works and renders fine, though.
然而,控制台仍然可以正常工作。 The HaxePunk console tells me
Atlases using BitmapData will not be managed
. HaxePunk控制台告诉我
Atlases using BitmapData will not be managed
的Atlases Atlases using BitmapData will not be managed
。
I'm using Ash's component-entity system, and I'm not using Haxe's Entities. 我正在使用Ash的组件实体系统,而我没有使用Haxe的实体。 The relevant objects have a
Visible
component attached to them, which looks like this; 相关对象附有一个
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);
}
}
And this is the associated rendering system; 这是相关的渲染系统;
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);
}
}
Any tips? 有小费吗?
If you are using buffer rendering in C++ you'll need to set the render mode inside the constructor. 如果您在C ++中使用缓冲区渲染,则需要在构造函数中设置渲染模式。 This is because the Engine constructor is the only place a screen buffer is created.
这是因为Engine构造函数是创建屏幕缓冲区的唯一位置。 Unfortunately the API docs don't clearly explain this.
不幸的是,API文档没有明确解释这一点。
class Main extends Engine
{
public function new()
{
super(0, 0, 60, false, RenderMode.BUFFER);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.