授权 | 开源 |
大小 | 24.14MB |
语言 | Objective-C |
#include "assets/Bundle.hpp"
#include "core/Engine.hpp"
#include "scene/Camera.hpp"
#include "scene/Layer.hpp"
#include "scene/Scene.hpp"
#include "scene/SpriteRenderer.hpp"
class Example: public ouzel::Application
{
public:
Example():
assets(ouzel::engine->getCache(),
ouzel::engine->getFileSystem())
{
assets.loadAsset(ouzel::assets::Loader::Image, "player", "player.png");
ouzel::engine->getSceneManager().setScene(&scene);
scene.addLayer(&layer);
cameraActor.addComponent(&camera);
layer.addChild(&cameraActor);
playerSprite.init("player");
player.addComponent(&playerSprite);
layer.addChild(&player);
}
private:
ouzel::scene::Scene scene;
ouzel::scene::Layer layer;
ouzel::scene::Camera camera;
ouzel::scene::Actor cameraActor;
ouzel::scene::SpriteRenderer playerSprite;
ouzel::scene::Actor player;
ouzel::assets::Bundle assets;
};
std::unique_ptr<ouzel::Application> ouzel::main(const std::vector<std::string>& args)
{
return std::make_unique<Example>();
}
$ make PLATFORM=emscripten
您可以通过在“ samples / android”目录中执行以下命令来构建Android示例并在Android设备上运行它们(必须安装Android SDK和NDK并将其添加到PATH):$ gradle assembleDebug
$ gradle installDebug
$ adb shell am start -n org.ouzel/org.ouzel.MainActivity
要在Raspberry Pi上构建Ouzel,您将必须安装Raspberry Pi开发库(libraspberrypi-dev)和内核头文件(raspberrypi-kernel-headers)。$ sudo ln -s /opt/vc/lib/libEGL.so /opt/vc/lib/libbrcmEGL.so
$ sudo ln -s /opt/vc/lib/libGLESv2.so /opt/vc/lib/libbrcmGLESv2.so
相关软件