Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * OpenTyrian: A modern cross-platform port of Tyrian
  3.  * Copyright (C) 2007-2009  The OpenTyrian Development Team
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU General Public License
  7.  * as published by the Free Software Foundation; either version 2
  8.  * of the License, or (at your option) any later version.
  9.  *
  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.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  18.  */
  19. #include "nortvars.h"
  20.  
  21. #include "file.h"
  22. #include "joystick.h"
  23. #include "keyboard.h"
  24. #include "opentyr.h"
  25. #include "vga256d.h"
  26. #include "video.h"
  27.  
  28. #include <assert.h>
  29. #include <ctype.h>
  30.  
  31. JE_boolean inputDetected;
  32.  
  33. JE_boolean JE_anyButton( void )
  34. {
  35.         poll_joysticks();
  36.         service_SDL_events(true);
  37.         return newkey || mousedown || joydown;
  38. }
  39.  
  40. void JE_dBar3( SDL_Surface *surface, JE_integer x,  JE_integer y,  JE_integer num,  JE_integer col )
  41. {
  42.         JE_byte z;
  43.         JE_byte zWait = 2;
  44.  
  45.         col += 2;
  46.  
  47.         for (z = 0; z <= num; z++)
  48.         {
  49.                 JE_rectangle(surface, x, y - 1, x + 8, y, col); /* <MXD> SEGa000 */
  50.                 if (zWait > 0)
  51.                 {
  52.                         zWait--;
  53.                 } else {
  54.                         col++;
  55.                         zWait = 1;
  56.                 }
  57.                 y -= 2;
  58.         }
  59. }
  60.  
  61. void JE_barDrawShadow( SDL_Surface *surface, JE_word x, JE_word y, JE_word res, JE_word col, JE_word amt, JE_word xsize, JE_word ysize )
  62. {
  63.         xsize--;
  64.         ysize--;
  65.  
  66.         for (int z = 1; z <= amt / res; z++)
  67.         {
  68.                 JE_barShade(surface, x+2, y+2, x+xsize+2, y+ysize+2);
  69.                 fill_rectangle_xy(surface, x, y, x+xsize, y+ysize, col+12);
  70.                 fill_rectangle_xy(surface, x, y, x+xsize, y, col+13);
  71.                 JE_pix(surface, x, y, col+15);
  72.                 fill_rectangle_xy(surface, x, y+ysize, x+xsize, y+ysize, col+11);
  73.                 x += xsize + 2;
  74.         }
  75.  
  76.         amt %= res;
  77.         if (amt > 0)
  78.         {
  79.                 JE_barShade(surface, x+2, y+2, x+xsize+2, y+ysize+2);
  80.                 fill_rectangle_xy(surface, x,y, x+xsize, y+ysize, col+(12 / res * amt));
  81.         }
  82. }
  83.  
  84. void JE_wipeKey( void )
  85. {
  86.         // /!\ Doesn't seems to affect anything.
  87. }
  88.  
  89.