src/ascension/context.h

Tue, 07 Nov 2023 21:24:06 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 07 Nov 2023 21:24:06 +0100
changeset 11
d83af80eb09b
parent 7
9dd76cbd6c90
child 14
9dbfc0031887
permissions
-rw-r--r--

add font management

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 * Copyright 2023 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_CONTEXT_H
#define ASCENSION_CONTEXT_H

#include "window.h"
#include "font.h"

#include <cx/buffer.h>
#include <cx/list.h>

#ifdef __cplusplus
extern "C" {
#endif

/** The flag for the overall initialized state. */
#define ASC_FLAG_INITILIZED  0x01u

/** Flag is set, when error buffer contains new error information. */
#define ASC_FLAG_HAS_ERROR  0x02u

/** Flag is set, when SDL wants to quit the application. */
#define ASC_FLAG_QUIT 0x80000000u

/**
 * The global ascension context.
 */
typedef struct AscContext {
    unsigned int flags;
    CxBuffer error_buffer;
    AscWindow windows[ASC_MAX_WINDOWS];
    AscFont fonts[ASC_MAX_FONTS];
    unsigned int fonts_loaded;
} AscContext;

/** Global ascension context. */
extern AscContext asc_context;

void asc_context_initialize(void);
void asc_context_destroy(void);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* ASCENSION_CONTEXT_H */

mercurial