Mercurial > molko
view libmlk-example/mlk/example/example.c @ 507:d49a05e7a5b5
ui: separate delegate/style
Now UI elements do have different styling properties:
- _delegate: functions used to update, draw or perform specific actions on the
UI element.
- _style: basic properties that the delegate should support if possible.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 02 Mar 2023 21:36:43 +0100 |
parents | d7855791a2b8 |
children | c32d7a98bde1 |
line wrap: on
line source
/* * example.c -- libmlk-example entry point * * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <assert.h> #include <mlk/core/core.h> #include <mlk/core/err.h> #include <mlk/core/window.h> #include <mlk/ui/ui.h> #include <mlk/rpg/rpg.h> #include "example.h" #include "registry.h" int mlk_example_init(const char *name) { assert(name); int err; if ((err = mlk_core_init("fr.malikania", name)) < 0) return err; if ((err = mlk_ui_init()) < 0) return err; if ((err = rpg_init()) < 0) return err; if (mlk_window_open(name, MLK_EXAMPLE_W, MLK_EXAMPLE_H) < 0) return err; mlk_registry_init(); return 0; } void mlk_example_finish(void) { mlk_window_finish(); rpg_finish(); mlk_ui_finish(); mlk_core_finish(); }