24 SDL_Event event; |
24 SDL_Event event; |
25 Drawable *d[MAX]; |
25 Drawable *d[MAX]; |
26 |
26 |
27 int height; |
27 int height; |
28 |
28 |
|
29 surface = new Surface (0, 0, 32); |
|
30 |
29 if (argc != 2) { |
31 if (argc != 2) { |
30 fprintf (stderr, "Usage: %s <HEIGHT>\n", argv[0]); |
32 fprintf (stderr, "Usage: %s <HEIGHT>\n", argv[0]); |
31 height = 250; |
33 height = surface->getHeight () / 2; |
32 } else |
34 } else |
33 height = atoi (argv[1]); |
35 height = atoi (argv[1]); |
34 |
36 |
35 if ((height < 10) || (height >= 360)) |
|
36 height = 200; |
|
37 |
|
38 Vector p1 (0, 0); |
37 Vector p1 (0, 0); |
39 Vector p2 (height, 0); |
38 Vector p2 (height, 0); |
40 Vector p3 (height + 100, height + 100); |
39 Vector p3 (height, height); |
41 Vector p4 (100, height + 100); |
40 Vector p4 (0, height); |
42 |
41 |
43 surface = new Surface (1024, 768, 32); |
|
44 SDL_WM_SetCaption ("Pimp my Cube", NULL); |
42 SDL_WM_SetCaption ("Pimp my Cube", NULL); |
45 |
43 |
46 d[0] = new Rectangle (surface, p1, p2, p3, p4); |
44 d[0] = new Cube (surface, p1, p2, p3, p4, height); |
47 d[1] = new Cube (surface); |
|
48 d[2] = new Cube (surface, p1, p2, p3, p4, height); |
|
49 |
45 |
50 bool running = true; |
46 bool running = true; |
51 int i, x, y; |
47 int i, x, y; |
52 |
48 |
53 x = y = 0; |
49 x = y = 0; |
54 |
|
55 d[1]->move (Vector (3 * height, 25)); |
|
56 d[2]->move (Vector (290, 0)); |
|
57 |
50 |
58 while (running) { |
51 while (running) { |
59 SDL_PollEvent (&event); |
52 SDL_PollEvent (&event); |
60 |
53 |
61 if (event.type == SDL_QUIT) |
54 if (event.type == SDL_QUIT) |