Consume libakgl 0.3.0: every workaround deleted, two capabilities gained
0.3.0 closed all ten API gaps this port had filed. The four workarounds go with them: the CMake block that declared libakgl's vendored dependencies by hand, the akgl/actor.h include in three files, and the six vtable pointers assigned by hand in two more, now akgl_render_bind2d(). Two gaps were capabilities rather than inconveniences, and both are now real: The line editor takes the composed UTF-8 text the ring carries in preference to the keycode, so shifted characters, keyboard layouts, compose keys and dead keys all work. A double quote can be typed, which means a BASIC string literal can be typed -- the sharp end of the old limitation. Letters are no longer folded to upper case. SOUND's dir/min/step reach akgl_audio_sweep instead of being refused. dir 3 sweeps once rather than oscillating and TODO.md section 5 says so. A backend with no sweep still refuses the swept note and plays the held one. The adaptors now carry an AKGL_VERSION_AT_LEAST(0, 3, 0) floor, verified by temporarily demanding 0.4.0 and watching it fire. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,13 +27,6 @@
|
||||
|
||||
#include <akerror.h>
|
||||
|
||||
/*
|
||||
* akgl/actor.h before akgl/controller.h: controller.h declares two handler
|
||||
* function pointers taking an akgl_Actor * and includes nothing that declares
|
||||
* the type, so on its own it does not compile. Filed upstream against libakgl;
|
||||
* see the same note in src/input_akgl.c, which is where it turned up first.
|
||||
*/
|
||||
#include <akgl/actor.h>
|
||||
#include <akgl/controller.h>
|
||||
#include <akgl/error.h>
|
||||
/*
|
||||
@@ -49,28 +42,6 @@
|
||||
#include <akbasic/error.h>
|
||||
#include <akbasic/frontend.h>
|
||||
|
||||
/** @brief Fill in the 2D backend's six vtable entries against an existing renderer.
|
||||
*
|
||||
* akgl_render_init2d() installs exactly these, but it also creates its own
|
||||
* window from the game properties and writes to the `camera` global, which makes
|
||||
* it part of the akgl_game_init() path -- and a host that already has a renderer
|
||||
* is not on that path. Without them akgl_text_rendertextat() dereferences a NULL
|
||||
* draw_texture and the first PRINT segfaults.
|
||||
*
|
||||
* Filed upstream: what is wanted is the vtable half of init2d on its own.
|
||||
* tests/akgl_backends.c carries the identical six lines for the identical
|
||||
* reason; delete both when it lands.
|
||||
*/
|
||||
static void install_2d_vtable(akgl_RenderBackend *backend)
|
||||
{
|
||||
backend->shutdown = &akgl_render_2d_shutdown;
|
||||
backend->frame_start = &akgl_render_2d_frame_start;
|
||||
backend->frame_end = &akgl_render_2d_frame_end;
|
||||
backend->draw_texture = &akgl_render_2d_draw_texture;
|
||||
backend->draw_mesh = &akgl_render_2d_draw_mesh;
|
||||
backend->draw_world = &akgl_render_2d_draw_world;
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akbasic_frontend_akgl_init(akbasic_AkglFrontend *obj, const char *title, int w, int h, const char *fontpath, int fontsize, FILE *mirror, FILE *in)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
@@ -106,7 +77,15 @@ akerr_ErrorContext *akbasic_frontend_akgl_init(akbasic_AkglFrontend *obj, const
|
||||
&obj->window, &obj->renderer->sdl_renderer),
|
||||
AKGL_ERR_SDL, "Couldn't create the window: %s", SDL_GetError());
|
||||
window = obj->window;
|
||||
install_2d_vtable(obj->renderer);
|
||||
/*
|
||||
* Bind the 2D methods onto the renderer we just made. akgl_render_init2d()
|
||||
* would do this too, but it creates its own window from the game properties
|
||||
* first, which is the akgl_game_init() path a host with its own window is
|
||||
* not on. libakgl 0.3.0 split the vtable half out for exactly this caller --
|
||||
* it was API-gap item 7, and until it landed these six pointers were
|
||||
* assigned by hand here and in tests/akgl_backends.c.
|
||||
*/
|
||||
PASS(errctx, akgl_render_bind2d(obj->renderer));
|
||||
|
||||
obj->font = TTF_OpenFont(fontpath, (float)fontsize);
|
||||
FAIL_ZERO_RETURN(errctx, (obj->font != NULL), AKGL_ERR_SDL,
|
||||
|
||||
Reference in New Issue
Block a user