mirror of https://github.com/auygun/kaliber.git
Update hello world
This commit is contained in:
parent
0b1220c114
commit
ba7c823c91
12
README.md
12
README.md
|
@ -54,23 +54,21 @@ devenv out\vs\all.sln
|
||||||
|
|
||||||
## Hello World example:
|
## Hello World example:
|
||||||
|
|
||||||
Shows a smoothly rotating "Hello World!".
|
Shows a smoothly rotating "Hello World".
|
||||||
```cpp
|
```cpp
|
||||||
class HelloWorld final : public eng::Game {
|
class HelloWorld final : public eng::Game {
|
||||||
public:
|
public:
|
||||||
~HelloWorld() final = default;
|
|
||||||
|
|
||||||
bool Initialize() final {
|
bool Initialize() final {
|
||||||
eng::Engine::Get().SetImageSource(
|
eng::Engine::Get().SetImageSource(
|
||||||
"hello_world_image",
|
"hello_world_image",
|
||||||
std::bind(&eng::Engine::Print, &eng::Engine::Get(), "Hello World!",
|
std::bind(&eng::Engine::Print, &eng::Engine::Get(), "Hello World",
|
||||||
base::Vector4f(1, 1, 1, 0)));
|
/*bg_color*/ base::Vector4f(1, 1, 1, 0)));
|
||||||
|
|
||||||
hello_world_.Create("hello_world_image").SetVisible(true);
|
hello_world_.Create("hello_world_image").SetVisible(true);
|
||||||
animator_.Attach(&hello_world_);
|
animator_.Attach(&hello_world_);
|
||||||
animator_.SetRotation(base::PI2f, 3,
|
animator_.SetRotation(base::PI2f, /*duration*/ 3,
|
||||||
std::bind(base::SmootherStep, std::placeholders::_1));
|
std::bind(base::SmootherStep, std::placeholders::_1));
|
||||||
animator_.Play(eng::Animator::kRotation, true);
|
animator_.Play(eng::Animator::kRotation, /*loop*/ true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "base/interpolation.h"
|
#include "base/interpolation.h"
|
||||||
|
#include "base/vecmath.h"
|
||||||
#include "engine/animator.h"
|
#include "engine/animator.h"
|
||||||
#include "engine/asset/image.h"
|
#include "engine/asset/image.h"
|
||||||
#include "engine/engine.h"
|
#include "engine/engine.h"
|
||||||
|
@ -8,19 +9,17 @@
|
||||||
|
|
||||||
class HelloWorld final : public eng::Game {
|
class HelloWorld final : public eng::Game {
|
||||||
public:
|
public:
|
||||||
~HelloWorld() final = default;
|
|
||||||
|
|
||||||
bool Initialize() final {
|
bool Initialize() final {
|
||||||
eng::Engine::Get().SetImageSource(
|
eng::Engine::Get().SetImageSource(
|
||||||
"hello_world_image",
|
"hello_world_image",
|
||||||
std::bind(&eng::Engine::Print, &eng::Engine::Get(), "Hello World!",
|
std::bind(&eng::Engine::Print, &eng::Engine::Get(), "Hello World",
|
||||||
base::Vector4f(1, 1, 1, 0)));
|
/*bg_color*/ base::Vector4f(1, 1, 1, 0)));
|
||||||
|
|
||||||
hello_world_.Create("hello_world_image").SetVisible(true);
|
hello_world_.Create("hello_world_image").SetVisible(true);
|
||||||
animator_.Attach(&hello_world_);
|
animator_.Attach(&hello_world_);
|
||||||
animator_.SetRotation(base::PI2f, 3,
|
animator_.SetRotation(base::PI2f, /*duration*/ 3,
|
||||||
std::bind(base::SmootherStep, std::placeholders::_1));
|
std::bind(base::SmootherStep, std::placeholders::_1));
|
||||||
animator_.Play(eng::Animator::kRotation, true);
|
animator_.Play(eng::Animator::kRotation, /*loop*/ true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue