2 RetroRay - integrated standalone vintage modeller/renderer
3 Copyright (C) 2023 John Tsiombikas <nuclear@mutantstargoat.com>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
31 static uint32_t *vmem;
32 static int quit, disp_pending;
34 int main(int argc, char **argv)
38 int mx, my, bnstate, bndiff;
39 static int prev_mx, prev_my, prev_bnstate;
42 __djgpp_nearptr_enable();
47 if(read_cpuid(&cpuid) == 0) {
54 fprintf(stderr, "No mouse detected. Make sure the mouse driver is installed\n");
57 set_mouse_limits(0, 0, 639, 479);
60 add_log_file("retroray.log");
62 if(init_video() == -1) {
66 if((vmidx = match_video_mode(640, 480, 32)) == -1) {
69 if(!(vmem = set_video_mode(vmidx, 1))) {
75 win_aspect = (float)win_width / (float)win_height;
77 if(app_init() == -1) {
84 while((key = kb_getkey()) != -1) {
86 if(quit) goto break_evloop;
89 bnstate = read_mouse(&mx, &my);
90 bndiff = bnstate ^ prev_bnstate;
92 if(bndiff & 1) app_mouse(0, bnstate & 1, mx, my);
93 if(bndiff & 2) app_mouse(1, bnstate & 2, mx, my);
94 if(bndiff & 4) app_mouse(3, bnstate & 4, mx, my);
110 long app_getmsec(void)
112 return time(0) * 1000; /* TODO */
115 void app_redisplay(void)
120 void app_swap_buffers(void)
122 blit_frame(framebuf, opt.vsync);
130 void app_resize(int x, int y)
134 void app_fullscreen(int fs)
138 void app_vsync(int vsync)