src/ascension/context.h

changeset 16
c5dde81b6fb2
parent 14
9dbfc0031887
child 28
8acde7d27904
     1.1 --- a/src/ascension/context.h	Wed Nov 08 23:17:07 2023 +0100
     1.2 +++ b/src/ascension/context.h	Wed Nov 15 22:51:40 2023 +0100
     1.3 @@ -28,6 +28,7 @@
     1.4  #ifndef ASCENSION_CONTEXT_H
     1.5  #define ASCENSION_CONTEXT_H
     1.6  
     1.7 +#include "datatypes.h"
     1.8  #include "window.h"
     1.9  #include "font.h"
    1.10  
    1.11 @@ -50,8 +51,13 @@
    1.12      unsigned int flags;
    1.13      CxBuffer error_buffer;
    1.14      AscWindow windows[ASC_MAX_WINDOWS];
    1.15 +    AscWindow const *active_window;
    1.16      AscFont fonts[ASC_MAX_FONTS];
    1.17      unsigned int fonts_loaded;
    1.18 +    AscFont const *active_font;
    1.19 +    asc_col4i ink;
    1.20 +    unsigned int elapsed_millis;
    1.21 +    float elapsed;
    1.22  } AscContext;
    1.23  
    1.24  /** Global ascension context. */
    1.25 @@ -60,5 +66,25 @@
    1.26  void asc_context_initialize(void);
    1.27  void asc_context_destroy(void);
    1.28  
    1.29 +
    1.30 +/**
    1.31 + * Dispatches events and synchronizes all initialized windows.
    1.32 + *
    1.33 + * @return false, if the application wants to quit, true otherwise
    1.34 + */
    1.35 +bool asc_loop_next(void);
    1.36 +
    1.37 +/**
    1.38 + * Sets the active drawing color.
    1.39 + */
    1.40 +#define asc_ink(color) asc_context.ink = (color)
    1.41 +#define asc_ink_rgba(r,g,b,a) asc_context.ink = (asc_col4i){(r),(g),(b),(a)}
    1.42 +#define asc_ink_rgb(r,g,b) asc_context.ink = (asc_col4i){(r),(g),(b),255u}
    1.43 +
    1.44 +/**
    1.45 + * Sets the active drawing font.
    1.46 + */
    1.47 +#define asc_set_font(font) asc_context.active_font = (font)
    1.48 +
    1.49  #endif /* ASCENSION_CONTEXT_H */
    1.50  

mercurial