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

Last change on this file since 56 was 56, checked in by Sam Hocevar, 12 years ago
  • Add licensing terms to most C / C++ files (Ref #5).
File size: 1.4 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
23void tool_picker::remap(palette *pal, window_manager *wm, image *screen)
24{
25  delete map;
26  map=new filter(old_pal,pal);
27  draw_first(screen,wm);
28}
29
30tool_picker::tool_picker(int X, int Y, int ID,
31              int show_h, visual_object **Icons, int *Ids, int total_ic,
32                         palette *icon_palette, palette *pal, window_manager *wm, ifield *Next) :
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  {
41    if (icons[i]->width(wm)>iw) iw=icons[i]->width(wm);
42    if (icons[i]->height(wm)>ih) ih=icons[i]->height(wm);
43  }
44  map=new filter(icon_palette,pal);
45  old_pal=icon_palette->copy();
46  reconfigure();
47}
48
49void tool_picker::draw_item(window_manager *wm, image *screen, int x, int y, int num, int active)
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());
55  icons[num]->draw(screen,x,y,wm,map);
56}
57
Note: See TracBrowser for help on using the repository browser.