Releases: cemderv/cerlib
Releases · cemderv/cerlib
v0.4.0
What's Changed
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:
- Compatibility with newer Emscripten versions
- Make OpenGL context forward-compatible for Apple platforms
- Improved CMake presets (
wasm
,wasm-debug
)
Full Changelog: v0.3.0...v0.4.0
v0.3.0
What's Changed
- Added Text input API (#35)
- New type:
cer::TextInputEvent
- New virtual method:
cer::Game::on_text_input()
- New method:
cer::Window::activate_onscreen_keyboard()
- New method:
cer::Window::deactivate_onscreen_keyboard()
- New type:
- Changed built-in colors to constexpr variables
- Example:
cer::Color::white()
->cer::white
- Example:
- Take parameters as
const&
inGame::update()
andGame::draw()
- Added the ability to query the current target platform
- New enum:
cer::TargetPlatform
- New function:
cer::target_platform()
- New function:
cer::is_desktop_platform()
- New function:
cer::is_mobile_platform()
- New enum:
- Fixed case style of various parameters
- Replaced
<format>
byfmtlib
in order to allow compilation with older compilers that do not support<format>
- cerlib now builds with GCC 13, Clang 16 and on macOS 13
- cerlib now builds with Clang on Windows
- Removed
type_name
property from cerlib objects - Fixed
mygame
template on Android - New function:
cer::random_color()
- Improved platform check for multi-window detection
- Implemented proper Windows and Android logging
- On Windows, the logging functions now write using the
OutputDebugString
Windows function - On Android, the logging functions now write to the Logcat output
- On Windows, the logging functions now write using the
- Improved API documentation
Full Changelog: v0.2.0...v0.3.0