source: abuse/tags/pd/abuse/src/help.c @ 49

Last change on this file since 49 was 49, checked in by Sam Hocevar, 12 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1#include "help.hpp"
2#include "game.hpp"
3#include "netcfg.hpp"
4
5int total_help_screens;
6int *help_screens;
7static int help_page=0;
8
9void fade_in(image *im, int steps);
10void fade_out(int steps);
11
12void draw_help()
13{
14  image *im=cash.img(help_screens[help_page]);
15  int x1=xres/2-im->width()/2,y1=yres/2-im->height()/2;
16  int x2=x1+im->width(),y2=y1+im->height();
17  im->put_image(screen,x1,y1);
18  screen->bar(0,0,x1-1,yres,0);
19  screen->bar(0,0,xres,y1-1,0);
20  screen->bar(x2,y1,xres,yres,0);
21  screen->bar(x1,y2,x2,yres,0);
22}
23
24void help_handle_event(event &ev)
25{
26  if (ev.window!=NULL) return ;
27 
28  if (the_game->state!=HELP_STATE)
29  {
30    if (ev.type==EV_KEY && (ev.key=='h' || ev.key=='?' || ev.key==JK_F1) && help_screens)
31    {
32      if (!main_net_cfg || (main_net_cfg->state!=net_configuration::SERVER && main_net_cfg->state!=net_configuration::CLIENT))
33      {
34        the_game->state=HELP_STATE;
35        help_page=0;
36      }
37    }
38  } else if (ev.type==EV_KEY)
39  {
40    if (ev.key==JK_ESC || help_page>=total_help_screens-1)
41    {
42      the_game->state=RUN_STATE;   
43      the_game->draw(0);
44    }
45    else
46      help_page++;
47  }   
48}
Note: See TracBrowser for help on using the repository browser.