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/>.
29 static uint32_t *vmem;
30 static int quit, disp_pending;
32 int main(int argc, char **argv)
36 int mx, my, bnstate, bndiff;
37 static int prev_mx, prev_my, prev_bnstate;
40 __djgpp_nearptr_enable();
46 fprintf(stderr, "No mouse detected. Make sure the mouse driver is installed\n");
49 set_mouse_limits(0, 0, 639, 479);
52 if(init_video() == -1) {
56 if((vmidx = match_video_mode(640, 480, 32)) == -1) {
59 if(!(vmem = set_video_mode(vmidx, 1))) {
65 win_aspect = (float)win_width / (float)win_height;
67 if(app_init() == -1) {
74 while((key = kb_getkey()) != -1) {
76 if(quit) goto break_evloop;
79 bnstate = read_mouse(&mx, &my);
80 bndiff = bnstate ^ prev_bnstate;
82 if(bndiff & 1) app_mouse(0, bnstate & 1, mx, my);
83 if(bndiff & 2) app_mouse(1, bnstate & 2, mx, my);
84 if(bndiff & 4) app_mouse(3, bnstate & 4, mx, my);
100 long app_getmsec(void)
102 return time(0) * 1000; /* TODO */
105 void app_redisplay(void)
110 void app_swap_buffers(void)
112 blit_frame(framebuf, opt.vsync);
120 void app_resize(int x, int y)
124 void app_fullscreen(int fs)
128 void app_vsync(int vsync)