Lightweight, cross-platform 2D game library for C++
APACHE-2.0 License
Bot releases are visible (Hide)
This release focuses on integrating ImGui into cerlib.
The integration is configurable via the CERLIB_ENABLE_IMGUI
CMake option, and is ON
by default.
When the integration is activated, ImGui is built together with and embedded directly into cerlib.
Users of cerlib automatically get access to the ImGui API, thus can #include <imgui.h>
in their code.
A new method in the Game class called draw_imgui
was introduced where users can draw their ImGui stuff as usual.
Example:
#include <cerlib.hpp>
#include <imgui.h> // Automatically available
struct MyGame : cer::Game {
// ...
void draw(const cer::Window& window) override {
cer::draw_sprite(img,
(window.size_px() - img.size()) / 2 + img_offset,
img_color);
}
// This is automatically called by cerlib when ImGui contents should be drawn.
void draw_imgui(const cer::Window& window) override {
ImGui::Begin("My ImGui Window");
ImGui::Text("Hello, ImGui! %d", 123);
if (ImGui::Button("Randomize offset"))
img_offset = cer::random_vector2(-200, 200);
if (ImGui::Button("Randomize color"))
img_color = cer::random_color();
ImGui::ColorEdit4("Image color", &img_color.r);
ImGui::End();
}
cer::Image img;
cer::Color img_color = cer::white;
cer::Vector2 img_offset;
};
The integration is not exclusive to any platform, it works on all target platforms. Have fun!
Other changes include:
wasm
, wasm-debug
)Full Changelog: https://github.com/cemderv/cerlib/compare/v0.3.0...v0.4.0
Published by cemderv 25 days ago
cer::TextInputEvent
cer::Game::on_text_input()
cer::Window::activate_onscreen_keyboard()
cer::Window::deactivate_onscreen_keyboard()
cer::Color::white()
-> cer::white
const&
in Game::update()
and Game::draw()
cer::TargetPlatform
cer::target_platform()
cer::is_desktop_platform()
cer::is_mobile_platform()
<format>
by fmtlib
in order to allow compilation with older compilers that do not support <format>
type_name
property from cerlib objectsmygame
template on Androidcer::random_color()
OutputDebugString
Windows functionFull Changelog: https://github.com/cemderv/cerlib/compare/v0.2.0...v0.3.0
Published by cemderv 30 days ago