view include/App.h @ 2:0684158d38a8

Before cleanup. Still has experimental code in it.
author Eris Caffee <discordia@eldalin.com>
date Fri, 22 Oct 2010 02:21:52 -0500
parents 455406f5f021
children 0f4ad525f49a
line source
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) 2010 Sarah Eris Horsley Caffee
4 //
5 // mandelbrot - A simple Mandelbrot Set viewer.
6 //
7 // App.h
8 // Application class definition
9 //
10 ////////////////////////////////////////////////////////////////////////////////
12 #ifndef APP_H
13 #define APP_H
15 #include <vector>
17 #include "png.h"
18 #include "SDL.h"
20 #include "EventHandler.h"
21 #include "Mandelbrot.h"
24 class App : public EventHandler
25 {
26 public:
28 App();
29 ~App();
31 int run();
33 private:
35 bool init();
36 void update();
37 void render();
38 void cleanup();
40 // Overrides of EventHandler:
41 void on_event(SDL_Event * event);
42 void on_KeyDown(SDLKey sym, SDLMod mod, Uint16 unicode);
43 void on_KeyUp(SDLKey sym, SDLMod mod, Uint16 unicode);
44 void on_Exit();
45 void on_LButtonDown(int mx, int my);
46 void on_LButtonUp(int mx, int my);
47 void on_MouseMove(int mx, int my,
48 int relx, int rely,
49 bool left, bool right, bool middle);
50 void on_Resize(int w, int h);
51 void on_Expose();
54 int mouse_move_width(int mx, int my);
55 bool create_new_surface(SDL_Surface * &surface);
56 void restore_view();
57 void set_caption();
58 bool save_image();
60 static Uint32 timer_callback(Uint32 interval, void *param);
63 bool running;
64 bool redraw;
66 SDL_Surface * surf_display;
67 SDL_Surface * surf_selection;
68 SDL_Surface * surf_fractal;
70 int selection_x, selection_y, selection_width;
71 bool setting_zoom;
72 bool can_set_julia_k;
73 bool setting_julia_k;
75 struct view
76 {
77 double re_min, im_max, size;
78 };
79 static std::vector<view *> old_views;
81 Fractal * fractal;
82 };
84 #endif