Cleanup and moving of NanoCoat VM specific headers to their own include directory...
[SquirrelJME.git] / nanocoat / include / sjme / nvm / modelessStars.h
blobf8a1ebf62da42c3d77b949235d0b37ace386d3cd
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 /**
11 * Modeless Star Screen.
13 * @since 2023/11/28
16 #ifndef SQUIRRELJME_MODELESSSTARS_H
17 #define SQUIRRELJME_MODELESSSTARS_H
19 #include "sjme/error.h"
20 #include "sjme/nvm/nvm.h"
22 /* Anti-C++. */
23 #ifdef __cplusplus
24 #ifndef SJME_CXX_IS_EXTERNED
25 #define SJME_CXX_IS_EXTERNED
26 #define SJME_CXX_SQUIRRELJME_MODELESSSTARS_H
27 extern "C" {
28 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
29 #endif /* #ifdef __cplusplus */
31 /*--------------------------------------------------------------------------*/
33 /** Modeless color info. */
34 typedef struct sjme_modelessStarColor
36 /** XRGB. */
37 sjme_jint xrgb[4];
38 } sjme_modelessStarColor;
40 /**
41 * Keeps track of modeless stars.
43 * @since 2023/11/22
45 typedef struct sjme_modelessStar
47 /** Is this star shining? */
48 sjme_jboolean shining : 1;
50 /** The X coordinate. */
51 sjme_jint x;
53 /** The Y coordinate. */
54 sjme_jint y;
56 /** The speed of the star. */
57 sjme_jint speed;
58 } sjme_modelessStar;
60 /** Color shift. */
61 #define SJME_MODELESS_STAR_COLOR_SHIFT 16
63 /** Number of modeless stars. */
64 #define SJME_MODELESS_STAR_COUNT 128
66 /** Modeless color options. */
67 typedef enum sjme_modelessStarColorId
69 /** Starting color. */
70 SJME_MODELESS_STAR_COLOR_ID_START,
72 /** Ending color. */
73 SJME_MODELESS_STAR_COLOR_ID_END,
75 /** Current color at. */
76 SJME_MODELESS_STAR_COLOR_ID_AT,
78 /** The slice addition. */
79 SJME_MODELESS_STAR_COLOR_ID_SLICE,
81 /** The number of color IDs. */
82 SJME_NUM_MODELESS_STAR_COLOR_IDS
83 } sjme_modelessStarColorId;
85 /**
86 * Contains the state of modeless stars.
88 * @since 2023/11/28
90 typedef struct sjme_modelessStarState
92 /** The modeless stars. */
93 sjme_modelessStar modelessStars[SJME_MODELESS_STAR_COUNT];
95 /** Is star creation locked? */
96 sjme_jint lockStarCreation;
98 /** The last @c lockStarCreation value. */
99 sjme_jint lockStarCreationLast;
101 /** First go latched? */
102 sjme_jboolean latchedFirstGo : 1;
103 } sjme_modelessStarState;
106 * Draws modeless stars into the buffer.
108 * @param state The modeless star state.
109 * @param buf The buffer to draw into.
110 * @param width The width of the buffer.
111 * @param height The height of the buffer.
112 * @param pitch The pitch of the buffer.
113 * @param tick The current tick.
114 * @return Returns @c SJME_JNI_FALSE if there are issues with inputs.
115 * @since 2023/11/22
117 sjme_errorCode sjme_modelessStars(
118 sjme_attrInOutNotNull sjme_modelessStarState* state,
119 sjme_attrInNotNull uint32_t* buf,
120 sjme_attrInPositiveNonZero sjme_jint width,
121 sjme_attrInPositiveNonZero sjme_jint height,
122 sjme_attrInPositiveNonZero sjme_jint pitch,
123 sjme_attrInValue sjme_jint tick);
125 /*--------------------------------------------------------------------------*/
127 /* Anti-C++. */
128 #ifdef __cplusplus
129 #ifdef SJME_CXX_SQUIRRELJME_MODELESSSTARS_H
131 #undef SJME_CXX_SQUIRRELJME_MODELESSSTARS_H
132 #undef SJME_CXX_IS_EXTERNED
133 #endif /* #ifdef SJME_CXX_SQUIRRELJME_MODELESSSTARS_H */
134 #endif /* #ifdef __cplusplus */
136 #endif /* SQUIRRELJME_MODELESSSTARS_H */