1 | // MIT License |
2 | |
3 | // Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com |
4 | |
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy |
6 | // of this software and associated documentation files (the "Software"), to deal |
7 | // in the Software without restriction, including without limitation the rights |
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
9 | // copies of the Software, and to permit persons to whom the Software is |
10 | // furnished to do so, subject to the following conditions: |
11 | |
12 | // The above copyright notice and this permission notice shall be included in all |
13 | // copies or substantial portions of the Software. |
14 | |
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
21 | // SOFTWARE. |
22 | |
23 | #pragma once |
24 | |
25 | #include "api.h" |
26 | #include "version.h" |
27 | |
28 | #if defined(TIC80_PRO) |
29 | #define TIC_VERSION_POST " Pro" |
30 | #else |
31 | #define TIC_VERSION_POST "" |
32 | #endif |
33 | |
34 | #define TIC_VERSION DEF2STR(TIC_VERSION_MAJOR) "." DEF2STR(TIC_VERSION_MINOR) "." DEF2STR(TIC_VERSION_REVISION) TIC_VERSION_STATUS TIC_VERSION_BUILD TIC_VERSION_POST " (" TIC_VERSION_HASH ")" |
35 | #define TIC_PACKAGE "com.nesbox.tic" |
36 | #define TIC_NAME "TIC-80" |
37 | #define TIC_NAME_FULL TIC_NAME " tiny computer" |
38 | #define TIC_TITLE TIC_NAME_FULL " " TIC_VERSION |
39 | #define TIC_HOST "tic80.com" |
40 | #define TIC_WEBSITE "https://" TIC_HOST |
41 | #define TIC_COPYRIGHT TIC_WEBSITE " (C) 2017-" TIC_VERSION_YEAR |
42 | |
43 | #define TICNAME_MAX 256 |
44 | |
45 | #ifdef __cplusplus |
46 | extern "C" { |
47 | #endif |
48 | |
49 | void tic_sys_clipboard_set(const char* text); |
50 | bool tic_sys_clipboard_has(); |
51 | char* tic_sys_clipboard_get(); |
52 | void tic_sys_clipboard_free(const char* text); |
53 | bool tic_sys_fullscreen_get(); |
54 | void tic_sys_fullscreen_set(bool value); |
55 | void tic_sys_message(const char* title, const char* message); |
56 | void tic_sys_title(const char* title); |
57 | void tic_sys_open_path(const char* path); |
58 | void tic_sys_open_url(const char* path); |
59 | void tic_sys_preseed(); |
60 | bool tic_sys_keyboard_text(char* text); |
61 | void tic_sys_update_config(); |
62 | void tic_sys_default_mapping(tic_mapping* mapping); |
63 | |
64 | #define CODE_COLORS_LIST(macro) \ |
65 | macro(BG) \ |
66 | macro(FG) \ |
67 | macro(STRING) \ |
68 | macro(NUMBER) \ |
69 | macro(KEYWORD) \ |
70 | macro(API) \ |
71 | macro() \ |
72 | macro(SIGN) |
73 | |
74 | typedef struct |
75 | { |
76 | struct |
77 | { |
78 | struct |
79 | { |
80 | #define CODE_COLOR_DEF(VAR) u8 VAR; |
81 | CODE_COLORS_LIST(CODE_COLOR_DEF) |
82 | #undef CODE_COLOR_DEF |
83 | |
84 | u8 select; |
85 | u8 cursor; |
86 | bool shadow; |
87 | bool altFont; |
88 | bool matchDelimiters; |
89 | bool autoDelimiters; |
90 | |
91 | } code; |
92 | |
93 | struct |
94 | { |
95 | struct |
96 | { |
97 | u8 alpha; |
98 | } touch; |
99 | |
100 | } gamepad; |
101 | |
102 | } theme; |
103 | |
104 | s32 gifScale; |
105 | s32 gifLength; |
106 | |
107 | bool checkNewVersion; |
108 | bool cli; |
109 | bool soft; |
110 | |
111 | #if defined(CRT_SHADER_SUPPORT) |
112 | struct |
113 | { |
114 | const char* vertex; |
115 | const char* pixel; |
116 | } shader; |
117 | #endif |
118 | |
119 | struct StudioOptions |
120 | { |
121 | #if defined(CRT_SHADER_SUPPORT) |
122 | bool crt; |
123 | #endif |
124 | |
125 | bool fullscreen; |
126 | bool vsync; |
127 | s32 volume; |
128 | tic_mapping mapping; |
129 | |
130 | #if defined(BUILD_EDITORS) |
131 | bool devmode; |
132 | #endif |
133 | } options; |
134 | |
135 | const tic_cartridge* cart; |
136 | |
137 | s32 uiScale; |
138 | |
139 | } StudioConfig; |
140 | |
141 | typedef struct Studio Studio; |
142 | |
143 | const tic_mem* studio_mem(Studio* studio); |
144 | void studio_tick(Studio* studio, tic80_input input); |
145 | void studio_sound(Studio* studio); |
146 | void studio_load(Studio* studio, const char* file); |
147 | bool studio_alive(Studio* studio); |
148 | void studio_exit(Studio* studio); |
149 | void studio_delete(Studio* studio); |
150 | const StudioConfig* studio_config(Studio* studio); |
151 | |
152 | Studio* studio_create(s32 argc, char **argv, s32 samplerate, tic80_pixel_color_format format, const char* appFolder); |
153 | |
154 | #ifdef __cplusplus |
155 | } |
156 | #endif |
157 | |