1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
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 // -------------------------------------------------------------------------*/
11 * Modeless Star Screen.
16 #ifndef SQUIRRELJME_MODELESSSTARS_H
17 #define SQUIRRELJME_MODELESSSTARS_H
23 #ifndef SJME_CXX_IS_EXTERNED
24 #define SJME_CXX_IS_EXTERNED
25 #define SJME_CXX_SQUIRRELJME_MODELESSSTARS_H
27 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
28 #endif /* #ifdef __cplusplus */
30 /*--------------------------------------------------------------------------*/
32 /** Modeless color info. */
33 typedef struct sjme_modelessStarColor
37 } sjme_modelessStarColor
;
40 * Keeps track of modeless stars.
44 typedef struct sjme_modelessStar
46 /** Is this star shining? */
47 sjme_jboolean shining
;
49 /** The X coordinate. */
52 /** The Y coordinate. */
55 /** The speed of the star. */
60 #define SJME_MODELESS_STAR_COLOR_SHIFT 16
62 /** Number of modeless stars. */
63 #define SJME_MODELESS_STAR_COUNT 128
65 /** Modeless color options. */
66 typedef enum sjme_modelessStarColorId
68 /** Starting color. */
69 SJME_MODELESS_STAR_COLOR_ID_START
,
72 SJME_MODELESS_STAR_COLOR_ID_END
,
74 /** Current color at. */
75 SJME_MODELESS_STAR_COLOR_ID_AT
,
77 /** The slice addition. */
78 SJME_MODELESS_STAR_COLOR_ID_SLICE
,
80 /** The number of color IDs. */
81 SJME_NUM_MODELESS_STAR_COLOR_IDS
82 } sjme_modelessStarColorId
;
85 * Contains the state of modeless stars.
89 typedef struct sjme_modelessStarState
91 /** The modeless stars. */
92 sjme_modelessStar modelessStars
[SJME_MODELESS_STAR_COUNT
];
94 /** Is star creation locked? */
95 sjme_jint lockStarCreation
;
97 /** The last @c lockStarCreation value. */
98 sjme_jint lockStarCreationLast
;
100 /** First go latched? */
101 sjme_jboolean latchedFirstGo
;
102 } sjme_modelessStarState
;
105 * Draws modeless stars into the buffer.
107 * @param state The modeless star state.
108 * @param buf The buffer to draw into.
109 * @param width The width of the buffer.
110 * @param height The height of the buffer.
111 * @param pitch The pitch of the buffer.
112 * @param tick The current tick.
113 * @return Returns @c SJME_JNI_FALSE if there are issues with inputs.
116 sjme_jboolean
sjme_modelessStars(
117 sjme_attrInOutNotNull sjme_modelessStarState
* state
,
118 sjme_attrInNotNull
uint32_t* buf
,
119 sjme_attrInPositiveNonZero sjme_jint width
,
120 sjme_attrInPositiveNonZero sjme_jint height
,
121 sjme_attrInPositiveNonZero sjme_jint pitch
,
122 sjme_attrInValue sjme_jint tick
);
124 /*--------------------------------------------------------------------------*/
128 #ifdef SJME_CXX_SQUIRRELJME_MODELESSSTARS_H
130 #undef SJME_CXX_SQUIRRELJME_MODELESSSTARS_H
131 #undef SJME_CXX_IS_EXTERNED
132 #endif /* #ifdef SJME_CXX_SQUIRRELJME_MODELESSSTARS_H */
133 #endif /* #ifdef __cplusplus */
135 #endif /* SQUIRRELJME_MODELESSSTARS_H */