source: abuse/trunk/src/imlib/tools.cpp @ 106

Last change on this file since 106 was 106, checked in by Sam Hocevar, 11 years ago
  • Rename the "eh" variable to "wm" because it's a window manager, not an event handler.
  • No longer pass the window manager to functions, there's only one.

Inspired by Win32 Abuse changelog for January 28, 2001:

  • Starting work on singleton code; will get rid of all

references to an arbitrary window_manager* because
there's only going to be one, and it's not ever
going to change.

File size: 1.3 KB
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#include "config.h"
11
[2]12#include "tools.hpp"
13
14
15
16tool_picker::~tool_picker()
17{ delete old_pal;
18  delete map;
19  for (int i=0;i<total_icons;i++)
20    delete icons[i];                   // delete visual object, which should be a "shell" 
21}
22
[106]23void tool_picker::remap(palette *pal, image *screen)
[2]24{
25  delete map;
26  map=new filter(old_pal,pal);
[106]27  draw_first(screen);
[2]28}
29
30tool_picker::tool_picker(int X, int Y, int ID,
31              int show_h, visual_object **Icons, int *Ids, int total_ic,
[106]32                         palette *icon_palette, palette *pal, ifield *Next) :
[2]33  spicker(X,Y,ID,show_h,1,1,0,Next)
34{
35  iw=ih=0;
36  icons=Icons;
37  ids=Ids;
38  total_icons=total_ic;
39  for (int i=0;i<total_ic;i++)
40  {
[106]41    if (icons[i]->width()>iw) iw=icons[i]->width();
42    if (icons[i]->height()>ih) ih=icons[i]->height();
[2]43  }
44  map=new filter(icon_palette,pal);
45  old_pal=icon_palette->copy();
46  reconfigure();
47}
48
[106]49void tool_picker::draw_item(image *screen, int x, int y, int num, int active)
[2]50{
51  if (!active)
52    screen->bar(x,y,x+iw-1,y+ih-1,wm->black());
53  else
54    screen->bar(x,y,x+iw-1,y+ih-1,wm->bright_color());
[106]55  icons[num]->draw(screen,x,y,map);
[2]56}
57
Note: See TracBrowser for help on using the repository browser.