src/ascension/ui.h

Mon, 16 Jun 2025 20:24:47 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 16 Jun 2025 20:24:47 +0200
changeset 155
b598b4eb4b44
parent 154
4dff9cc488fe
permissions
-rw-r--r--

add new ui.c where several UI functions are now moved to

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 * Copyright 2024 Mike Becker. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef ASCENSION_UI_H
#define ASCENSION_UI_H

#ifndef ASCENSION_UI_IMPLEMENTATION
#include "ui/text.h"
#endif

/**
 * Sets the UI scaling factor for the active window.
 *
 * @param scale the scaling factor
 */
void asc_ui_scale(float scale);

/**
 * Returns the current UI scaling factor for the active window.
 *
 * @return the scaling factor
 */
float asc_ui_get_scale(void);

/**
 * Automatically chooses a UI scaling factor depending on display resolution.
 *
 * @note you need to call this function again when the window changes the display
 * // TODO: check if there is an SDL event when the window changes the display and implement a reaction
 */
void asc_ui_scale_auto(void);

/**
 * Adds a node to the active window's UI.
 *
 * @param node the node to add
 */
void asc_ui_add_node(AscSceneNode *node);

#endif /* ASCENSION_UI_H */

mercurial