~ubuntu-branches/ubuntu/edgy/xbill/edgy

« back to all changes in this revision

Viewing changes to Bucket.c

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Bridgett
  • Date: 2004-09-07 09:52:14 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040907095214-d0m46ojc8f7upuqm
Tags: 2.1-4
maintainer upload of NMU - many thanks Tollef (closes: #268885) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <util.h>
 
2
 
 
3
#include "Bucket.h"
 
4
#include "Cable.h"
 
5
#include "Game.h"
 
6
#include "Network.h"
 
7
#include "UI.h"
 
8
 
 
9
static Picture *picture;
 
10
static MCursor *cursor;
 
11
static int grabbed;
 
12
 
 
13
void
 
14
Bucket_load_pix() {
 
15
        UI_load_picture("bucket", 1, &picture);
 
16
        UI_load_cursor("bucket", CURSOR_OWN_MASK, &cursor);
 
17
}
 
18
 
 
19
int
 
20
Bucket_clicked(int x, int y) {
 
21
        return (x > 0 && x < UI_picture_width(picture) &&
 
22
                y > 0 && y < UI_picture_height(picture));
 
23
}
 
24
 
 
25
void
 
26
Bucket_draw() {
 
27
        if (!grabbed)
 
28
                UI_draw(picture, 0, 0);
 
29
}
 
30
 
 
31
void
 
32
Bucket_grab(int x, int y) {
 
33
        UNUSED(x);
 
34
        UNUSED(y);
 
35
 
 
36
        UI_set_cursor(cursor);
 
37
        grabbed = 1;
 
38
}
 
39
 
 
40
void
 
41
Bucket_release(int x, int y) {
 
42
        int i;
 
43
        for (i = 0; i < Network_num_cables(); i++) {
 
44
                Cable *cable = Network_get_cable(i);
 
45
                if (Cable_onspark(cable, x, y))
 
46
                        Cable_reset(cable);
 
47
        }
 
48
        grabbed = 0;
 
49
}