source: abuse/trunk/src/dev.h @ 682

Last change on this file since 682 was 643, checked in by Sam Hocevar, 9 years ago

imlib: refactor Event and EventHandler?.

  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef __DEV_HPP_
12#define __DEV_HPP_
13
14#include "game.h"
15#include "light.h"
16#include "console.h"
17#include "timing.h"
18
19/* Cleaned-up externs */
20extern int confirm_quit();
21
22
23extern int scale_mult,scale_div;
24extern char level_file[100];
25extern image *small_render;
26
27void dev_init(int argc, char **argv);
28void dev_cleanup();
29void toggle_edit_mode();
30char const *symbol_str(char const *name);
31
32class pal_win
33{
34  int32_t scale,w,h,x,y,last_selected;
35  unsigned short *pat;
36  void draw();
37
38public :
39  Jwindow *me;
40  void close_window();
41  void open_window();
42  char *name;
43  void handle_event(Event &ev);
44  pal_win(void *args);
45  void resize(int xa, int ya);
46  int get_pat(int x, int y) { return pat[y*w+x]; }
47  int width() { return w; }
48  int height() { return h; }
49  void save(FILE *fp);
50  ~pal_win();
51} ;
52
53enum dev_state { DEV_CREATE_OBJECT,
54         DEV_MOVE_OBJECT,
55         DEV_SELECT,
56         DEV_MOUSE_RELEASE,
57         DEV_MOVE_LIGHT,
58         DEV_CREATE_LIGHT,
59             DEV_DRAG_AREA_TOP,
60             DEV_DRAG_AREA_BOTTOM };
61
62extern char backw_on,forew_on,show_menu_on,ledit_on,pmenu_on,omenu_on,commandw_on,tbw_on,searchw_on,
63            small_render_on,interpolate_draw,disable_autolight,fps_on,profile_on,show_names,fg_reversed,
64        raise_all;
65
66
67class dev_controll
68{
69  game_object *edit_object,*selected_object,*ai_object,*search_object,
70              *link_object;
71  light_source *edit_light,*selected_light;
72  pal_win **pal_wins;
73  char **pwin_list;
74  int total_pals;
75  dev_state state;
76  int area_x1,area_y1,area_x2,area_y2;
77  area_controller *current_area;
78  time_marker last_area_click;
79public :
80  Jwindow *backw,*forew,*commandw,*modew,*omenu,*oedit,*ledit,
81          *music_window,*pmenu,*show_menu,*lightw,*aiw,*ambw,*tbw,*area_win,
82          *search_window;
83
84  int fg_w,bg_w,fg_scale,bg_scale,yellow;
85  void save();
86  void fg_fill(int color, int x, int y, pal_win *p);
87  void add_palette(void *args);
88  void search_forward();
89  void search_backward();
90  void toggle_toolbar();
91  void toggle_fgw();
92  void toggle_bgw();
93  void toggle_omenu();
94  void toggle_music_window();
95  void toggle_pmenu();
96  void toggle_show_menu();
97  void toggle_light_window();
98  void toggle_search_window();
99  void show_char_mem(char const *name);
100  void close_oedit_window();
101  void show_mem();
102  dev_controll();
103  void handle_event(Event &ev);
104  void do_command(char const *st, Event &ev);
105  int is_pal_win(Jwindow *win);
106  void dev_draw(view *v);
107  void load_stuff();
108  int repeat_key_mode();
109  int need_plus_minus();
110  int need_arrows();
111  void make_ai_window(game_object *o);
112  void close_ai_window();
113  void make_ambient();
114  int ok_to_scroll();
115  int32_t snap_x(int32_t x);
116  int32_t snap_y(int32_t y);
117  void area_handle_input(Event &ev);
118  void pick_handle_input(Event &ev);
119  void close_area_win(int read_values);
120  void notify_deleted_object(game_object *o);
121  void notify_deleted_light(light_source *l);
122  void set_state(int new_state);
123  ~dev_controll();
124} ;
125
126class dev_term : public shell_term
127{
128  dev_controll *dv;
129  public :
130  dev_term(int width, int height, dev_controll *dev) : shell_term(console_font, width, height, "dev")
131  {
132    dv = dev;
133  }
134  virtual ~dev_term() { };
135  virtual void execute(char *st);
136} ;
137
138extern dev_term *dev_console;
139
140extern dev_controll *dev_cont;
141
142
143#endif
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
Note: See TracBrowser for help on using the repository browser.