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
19 #include "sjme/error.h"
24 #ifndef SJME_CXX_IS_EXTERNED
25 #define SJME_CXX_IS_EXTERNED
26 #define SJME_CXX_SQUIRRELJME_MODELESSSTARS_H
28 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
29 #endif /* #ifdef __cplusplus */
31 /*--------------------------------------------------------------------------*/
33 /** Modeless color info. */
34 typedef struct sjme_modelessStarColor
38 } sjme_modelessStarColor
;
41 * Keeps track of modeless stars.
45 typedef struct sjme_modelessStar
47 /** Is this star shining? */
48 sjme_jboolean shining
: 1;
50 /** The X coordinate. */
53 /** The Y coordinate. */
56 /** The speed of the star. */
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
,
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
;
86 * Contains the state of modeless stars.
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.
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 /*--------------------------------------------------------------------------*/
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 */