Jo Engine  2020.06.22
Jo Sega Saturn Engine
colors.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2020, Johannes Fetz (johannesfetz@gmail.com)
4 ** All rights reserved.
5 **
6 ** Redistribution and use in source and binary forms, with or without
7 ** modification, are permitted provided that the following conditions are met:
8 ** * Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** * Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** * Neither the name of the Johannes Fetz nor the
14 ** names of its contributors may be used to endorse or promote products
15 ** derived from this software without specific prior written permission.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 ** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
35 #ifndef __JO_COLORS_H__
36 # define __JO_COLORS_H__
37 
38 /*
39 ** MACROS
40 */
41 
42 /*
43 ** for jo_set_printf_color_index
44 */
45 #define JO_COLOR_INDEX_White (0)
46 #define JO_COLOR_INDEX_Black (1)
47 #define JO_COLOR_INDEX_Red (2)
48 #define JO_COLOR_INDEX_Green (3)
49 #define JO_COLOR_INDEX_Yellow (4)
50 #define JO_COLOR_INDEX_Blue (5)
51 #define JO_COLOR_INDEX_Purple (6)
52 
53 /*
54 ** jo_color constants
55 */
56 # define JO_COLOR_White (65535)
57 # define JO_COLOR_Black (32768)
58 # define JO_COLOR_Red (32799)
59 # define JO_COLOR_Green (33760)
60 # define JO_COLOR_Yellow (33791)
61 # define JO_COLOR_Blue (64512)
62 # define JO_COLOR_Purple (64543)
63 # define JO_COLOR_Cyan (65504)
64 # define JO_COLOR_Gray (58136)
65 # define JO_COLOR_DarkRed (32776)
66 # define JO_COLOR_DarkGreen (33024)
67 # define JO_COLOR_DarkYellow (33032)
68 # define JO_COLOR_DarkBlue (40960)
69 # define JO_COLOR_DarkPurple (40968)
70 # define JO_COLOR_DarkCyan (41216)
71 # define JO_COLOR_DarkGray (41224)
72 # define JO_COLOR_MediumRed (32784)
73 # define JO_COLOR_MediumGreen (33280)
74 # define JO_COLOR_MediumYellow (33296)
75 # define JO_COLOR_MediumBlue (49152)
76 # define JO_COLOR_MediumPurple (49168)
77 # define JO_COLOR_MediumCyan (49664)
78 # define JO_COLOR_MediumWhite (49680)
79 # define JO_COLOR_SemiRed (32792)
80 # define JO_COLOR_SemiGreen (33536)
81 # define JO_COLOR_SemiYellow (33560)
82 # define JO_COLOR_SemiBlue (57344)
83 # define JO_COLOR_SemiPurple (57368)
84 # define JO_COLOR_SemiCyan (58112)
85 
87 # define JO_COLOR_Transparent (0)
88 
90 # define JO_COLOR_SATURN(C) (JO_DIV_BY_8(C) & 0x1f)
91 
92 # define JO_COLOR_SATURN_RGB(R,G,B) ((jo_color)(0x8000 | ((B) << 10) | ((G) << 5) | (R)))
93 
100 # define JO_COLOR_RGB(R,G,B) JO_COLOR_SATURN_RGB(JO_COLOR_SATURN(R), JO_COLOR_SATURN(G), JO_COLOR_SATURN(B))
101 
108 static __jo_force_inline void jo_set_screen_color_filter_a(jo_scroll_screen screens, short r, short g, short b)
109 {
110  slColOffsetA(r, g, b);
111  slColOffsetAUse(screens);
112 }
113 
120 static __jo_force_inline void jo_set_screen_color_filter_b(jo_scroll_screen screens, short r, short g, short b)
121 {
122  slColOffsetB(r, g, b);
123  slColOffsetBUse(screens);
124 }
125 
130 {
131  slColOffsetOff(screens);
132 }
133 
137 {
139 }
140 
141 #endif /* !__JO_COLORS_H__ */
142 
143 /*
144 ** END OF FILE
145 */
jo_disable_all_screen_color_filter
static __jo_force_inline void jo_disable_all_screen_color_filter(void)
Disable color filter for all scroll screen.
Definition: colors.h:136
__jo_force_inline
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition: conf.h:154
jo_set_screen_color_filter_a
static __jo_force_inline void jo_set_screen_color_filter_a(jo_scroll_screen screens, short r, short g, short b)
Set color filter A for scroll screen.
Definition: colors.h:108
JO_ALL_SCROLL_SCREEN
@ JO_ALL_SCROLL_SCREEN
Definition: types.h:310
jo_set_screen_color_filter_b
static __jo_force_inline void jo_set_screen_color_filter_b(jo_scroll_screen screens, short r, short g, short b)
Set color filter A for scroll screen.
Definition: colors.h:120
jo_disable_screen_color_filter
static __jo_force_inline void jo_disable_screen_color_filter(jo_scroll_screen screens)
Disable color filter for scroll screen.
Definition: colors.h:129
jo_scroll_screen
jo_scroll_screen
Sega Saturn Scroll Screen Ids.
Definition: types.h:297