source: golgotha/src/golg/editor/dialogs/tile_picker.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.6 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "editor/e_state.hh"
10#include "gui/scroll_bar.hh"
11#include "editor/dialogs/tile_picker.hh"
12#include "window/style.hh"
13#include "gui/button.hh"
14#include "editor/dialogs/tile_win.hh"
15#include "tmanage.hh"
16#include "r1_api.hh"
17#include "tile.hh"
18#include "g1_render.hh"
19#include "editor/mode/e_tile.hh"
20
21g1_tile_picker_class::g1_tile_picker_class(i4_graphical_style_class *style,
22                                           g1_scroll_picker_info *info,
23                                           i4_image_class *active_back,
24                                           i4_image_class *passive_back)
25  :
26    g1_scroll_picker_class(style,
27                           (1<<ROTATE) | (1<<MIRROR) | (1<<GROW) | (1<<SHRINK) | (1<<SCROLL),
28                           info,
29                           g1_tile_man.remap_size()
30                           ),
31    active_back(active_back),
32    passive_back(passive_back)
33   
34{
35
36}
37 
38int g1_tile_picker_class::total_objects()
39{
40  return g1_tile_man.remap_size();
41}
42
43i4_window_class *g1_tile_picker_class::create_window(w16 w, w16 h, int scroll_object_num)
44{
45  int t=g1_tile_man.remap_size();
46  if (scroll_object_num>=t)
47    return 0;
48
49  g1_3d_pick_window::camera_struct tile_state;
50
51  return new g1_3d_tile_window(w,h, scroll_object_num, tile_state,
52                               active_back, passive_back, 0);
53}
54
55
56void g1_tile_picker_class::change_window_object_num(i4_window_class *win,
57                                                    int new_scroll_object_num)
58{
59  g1_3d_tile_window *twin=((g1_3d_tile_window *)win);
60
61  g1_3d_pick_window::camera_struct old_camera=twin->camera;
62  int old_num=twin->tile_num;
63
64  twin->set_tile_num(new_scroll_object_num);
65
66}
67
68
69void g1_tile_picker_class::rotate()
70{
71  if (g1_e_tile.get_cell_rotation()==G1_ROTATE_270)
72    g1_e_tile.set_cell_rotation(G1_ROTATE_0);
73  else     
74    g1_e_tile.set_cell_rotation((g1_rotation_type)(g1_e_tile.get_cell_rotation()+1));
75
76
77}
78
79void g1_tile_picker_class::mirror()
80{
81  g1_e_tile.set_mirrored((i4_bool)(!g1_e_tile.get_mirrored()));
82}
83
Note: See TracBrowser for help on using the repository browser.