source: abuse/trunk/src/help.cpp @ 494

Last change on this file since 494 was 494, checked in by Sam Hocevar, 11 years ago

style: remove trailing spaces, fix copyright statements.

File size: 1.4 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com or
8 *  Jonathan Clark.
9 */
10
11#include "config.h"
12
13#include "help.h"
14#include "game.h"
15#include "netcfg.h"
16
17int total_help_screens;
18int *help_screens;
19static int help_page=0;
20
21void fade_in(image *im, int steps);
22void fade_out(int steps);
23
24void draw_help()
25{
26  image *im=cache.img(help_screens[help_page]);
27  int x1=xres/2-im->width()/2,y1=yres/2-im->height()/2;
28  int x2=x1+im->width(),y2=y1+im->height();
29  im->put_image(screen,x1,y1);
30  screen->bar(0,0,x1-1,yres,0);
31  screen->bar(0,0,xres,y1-1,0);
32  screen->bar(x2,y1,xres,yres,0);
33  screen->bar(x1,y2,x2,yres,0);
34}
35
36void help_handle_event(event &ev)
37{
38  if (ev.window!=NULL) return ;
39
40  if (the_game->state!=HELP_STATE)
41  {
42    if (ev.type==EV_KEY && (ev.key=='h' || ev.key=='?' || ev.key==JK_F1) && help_screens)
43    {
44      if (!main_net_cfg || (main_net_cfg->state!=net_configuration::SERVER && main_net_cfg->state!=net_configuration::CLIENT))
45      {
46    the_game->state=HELP_STATE;
47    help_page=0;
48      }
49    }
50  } else if (ev.type==EV_KEY)
51  {
52    if (ev.key==JK_ESC || help_page>=total_help_screens-1)
53    {
54      the_game->state=RUN_STATE;
55      the_game->draw(0);
56    }
57    else
58      help_page++;
59  }
60}
Note: See TracBrowser for help on using the repository browser.