home *** CD-ROM | disk | FTP | other *** search
- #include "../../manic.h"
- #include "common.h"
- #include "../gfx.h"
- #include <unistd.h>
-
- #define DELAY 17500
-
- void
- mm_gfx_putpixel2 (uint_fast16_t x, uint_fast16_t y, uint_fast8_t data)
- {
- gl_setpixel (x, y, data);
- }
-
- void
- mm_gfx_putpixel (uint_fast16_t x, uint_fast16_t y, uint_fast8_t data)
- {
- gl_setpixel (x + xoffset, y + yoffset, data);
- }
-
- uint_fast8_t
- mm_gfx_getpixel (uint_fast16_t x, uint_fast16_t y)
- {
- return (gl_getpixel (x + xoffset, y + yoffset));
- }
-
- uint_fast8_t
- mm_gfx_getpixel2 (uint_fast16_t x, uint_fast16_t y)
- {
- return (gl_getpixel (x, y));
- }
-
- void
- mm_gfx_cls (uint_fast8_t col)
- {
- gl_clearscreen (col);
- }
-
- void
- mm_gfx_flush (void)
- {
- mm_gfx_waitvr ();
- gl_copyscreen (&physicalscreen);
- }
-
- void
- mm_gfx_waitvr (void)
- {
- #ifdef WAITVR
- vga_waitretrace ();
- if (vert_frequency == 120)
- vga_waitretrace ();
- #else
- struct timeval tv2;
- int l;
-
- gettimeofday (&tv2, NULL);
- frame_num++;
- l = (tv2.tv_sec - tv.tv_sec) * 1000000 +
- tv2.tv_usec - tv.tv_usec - frame_num * DELAY;
- if (l > 0)
- frame_num += l / DELAY;
- else if (l > -DELAY)
- usleep (-l);
- #endif
- }
-
- void
- mm_gfx_fillbox (uint_fast16_t xpos, uint_fast16_t ypos,
- uint_fast16_t width, uint_fast16_t height, uint_fast8_t col)
- {
- uint_fast16_t x, y;
- uint_fast16_t origx = xpos;
-
- for (y = 0; y < height; y++, ypos++) {
- for (x = 0; x < width; x++)
- gl_setpixel (xpos++ + xoffset, ypos + yoffset, col);
- xpos = origx;
- }
- }
-
- void
- mm_gfx_fillbox2 (uint_fast16_t xpos, uint_fast16_t ypos,
- uint_fast16_t width, uint_fast16_t height, uint_fast8_t col)
- {
- uint_fast16_t x, y;
- uint_fast16_t origx = xpos;
-
- for (y = 0; y < height; y++, ypos++) {
- for (x = 0; x < width; x++, xpos++)
- gl_setpixel (xpos, ypos, col);
- xpos = origx;
- }
- }
-
- void
- mm_gfx_palset (uint_least8_t * palette)
- {
- int_fast16_t i;
- int_least8_t svgapal[256][3];
-
- for (i = 0; i < 256; i++) {
- svgapal[i][0] = palette[(i * 3)];
- svgapal[i][1] = palette[(i * 3) + 1];
- svgapal[i][2] = palette[(i * 3) + 2];
- }
- gl_setpalette (&svgapal);
- }
-