14 #include "../include/tscope5/system.h"
15 #include "../include/tscope5/system_internal.h"
25 { 0, 640, 360, 0, 0, 60, 0.0, TS5_WINDOWED, TS5_VSYNC_ON};
51 setvbuf(stdout, 0, _IONBF, 0);
57 _ts5_status.loglevel = TS5_LOGLEVEL_3;
58 _ts5_data.textlog = NULL;
62 _ts5_data.randomizer = NULL;
66 if (!al_install_system(ALLEGRO_VERSION_INT, NULL)) {
67 ts5_fatal(
"%s: could not install Tscope5\n", calling_function);
70 ts5_log(TS5_LOGLEVEL_1,
"%s: Installing Tscope5\n", calling_function);
71 al_inhibit_screensaver(1);
72 al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA,
73 ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE);
75 al_add_new_bitmap_flag(ALLEGRO_NO_PRESERVE_TEXTURE);
81 _ts5_status.num_display_adapters = al_get_num_video_adapters();
83 _ts5_status.display_adapter =
84 al_malloc(_ts5_status.num_display_adapters
85 *
sizeof(TS5_DISPLAY_ADAPTER_STATUS));
87 for (i = 0; i < _ts5_status.num_display_adapters; i++) {
89 ALLEGRO_MONITOR_INFO monitorinfo;
90 al_get_monitor_info(i, &monitorinfo);
91 _ts5_status.display_adapter[i].x1 = monitorinfo.x1;
92 _ts5_status.display_adapter[i].x2 = monitorinfo.x2;
93 _ts5_status.display_adapter[i].y1 = monitorinfo.y1;
94 _ts5_status.display_adapter[i].y2 = monitorinfo.y2;
95 _ts5_status.display_adapter[i].w = monitorinfo.x2 - monitorinfo.x1;
96 _ts5_status.display_adapter[i].h = monitorinfo.y2 - monitorinfo.y1;
104 _ts5_status.num_displays = 0;
105 _ts5_status.active_display = -1;
106 _ts5_status.display = NULL;
107 _ts5_data.display = NULL;
108 _ts5_data.target = NULL;
112 _ts5_status.graphics.coordinate_system = TS5_CARTESIAN_COORDINATES;
113 _ts5_status.graphics.coordinate_scale = TS5_ABSOLUTE_COORDINATES;
115 _ts5_status.graphics.foreground_color =
116 al_map_rgba_f(1.0, 1.0, 1.0, 1.0);
118 _ts5_status.graphics.background_color =
119 al_map_rgba_f(0.0, 0.0, 0.0, 1.0);
121 _ts5_status.graphics.drawing_thickness = 0.0;
122 _ts5_status.graphics.fill_mode = TS5_FILL_OFF;
124 _ts5_status.graphics.font_type = TS5_COURIER;
125 _ts5_status.graphics.font_style = TS5_BOLD;
126 _ts5_status.graphics.font_size = 20;
128 _ts5_status.graphics.font_index =
129 _ts5_status.graphics.font_type * TS5_FONTSTYLES * TS5_FONTSIZES +
130 _ts5_status.graphics.font_style * TS5_FONTSIZES +
131 _ts5_status.graphics.font_size - 8;
133 _ts5_status.graphics.text_alignment = TS5_ALIGN_CENTER;
135 for (i=0; i<TS5_NFONTS; i++) {
136 _ts5_status.graphics.fonts[i] = NULL;
138 _ts5_status.graphics.font = NULL;
142 _ts5_status.audio.samplerate = TS5_44100;
143 _ts5_status.audio.channels = TS5_STEREO;
144 _ts5_status.audio.depth = TS5_FLOAT;
145 _ts5_status.audio.gain = 1.0;
147 _ts5_data.audio.voice = NULL;
148 _ts5_data.audio.mixer = NULL;
152 _ts5_status.timer.priority = TS5_NORMAL_PRIORITY;
153 _ts5_status.timer.num_defined_buttons = 0;
154 _ts5_status.timer.num_active_buttons = 0;
156 _ts5_status.timer.voicekey_is_response_device = 0;
158 _ts5_status.timer.mouse_is_response_device = 0;
160 _ts5_status.timer.keyboard_is_response_device = 0;
162 _ts5_status.timer.num_joysticks = 0;
163 _ts5_status.timer.joystick_is_response_device = 0;
164 _ts5_status.timer.joystick = NULL;
166 _ts5_status.timer.num_cedrusboxes = 0;
167 _ts5_status.timer.cedrusbox_is_response_device = 0;
168 _ts5_status.timer.cedrusbox_is_trigger_device = 0;
169 _ts5_status.timer.cedrusbox = NULL;
170 _ts5_data.timer.cedrusbox_thread = NULL;
172 _ts5_status.timer.num_parports = 3;
173 _ts5_status.timer.parport_base_address[0] = TS5_PARPORT_1_BASE;
174 _ts5_status.timer.parport_base_address[1] = TS5_PARPORT_2_BASE;
175 _ts5_status.timer.parport_base_address[2] = TS5_PARPORT_3_BASE;
177 for (i=0; i<_ts5_status.timer.num_parports; i++) {
179 _ts5_status.timer.parport_data_register[i] =
180 _ts5_status.timer.parport_base_address[i];
182 _ts5_status.timer.parport_status_register[i] =
183 _ts5_status.timer.parport_base_address[i]+1;
185 _ts5_status.timer.parport_control_register[i] =
186 _ts5_status.timer.parport_base_address[i]+2;
189 _ts5_status.timer.parport_is_response_device = 0;
190 _ts5_status.timer.parport_is_trigger_device = 0;
191 _ts5_status.timer.parport = NULL;
192 _ts5_data.timer.parport_thread = NULL;
194 _ts5_status.timer.num_serialports = 0;
195 _ts5_status.timer.serialport_is_trigger_device = 0;
196 _ts5_status.timer.serialport = NULL;
197 _ts5_data.timer.serialport_thread = NULL;
199 _ts5_data.timer.response_queue = NULL;
200 _ts5_data.timer.trigger_queue = NULL;
201 _ts5_data.timer.trigger_log = NULL;
220 ts5_log(TS5_LOGLEVEL_1,
"Uninstalling Tscope5\n");
221 al_inhibit_screensaver(0);
224 fflush(_ts5_data.textlog);
225 fclose(_ts5_data.textlog);
229 al_free(_ts5_status.display_adapter);
int _ts5_is_tscope5_installed
Is Tscope5 installed?
TS5_DISPLAY_STATUS ts5_nextdisplay
Settings for the next display that will be opened.
void ts5_log(const unsigned int level, const char *format,...)
Send info to a logging window.
void ts5_install_tscope5(char *calling_function)
Install Tscope5.
int _ts5_is_textlog_installed
Is text log installed?
void ts5_fatal(const char *format,...)
Exit safely with an error message.
void ts5_uninstall_tscope5()
Uninstall Tscope5.