view include/App.h @ 8:4a0062095c37

fixed line spacing
author Eris Caffee <discordia@eldalin.com>
date Mon, 15 Nov 2010 23:13:35 -0600
parents 104dff305563
children 00de693e73be
line source
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Fracter - A simple Mandelbrot Set viewer.
4 //
5 // Copyright (C) 2010 Sarah Eris Horsley Caffee
6 //
7 // This file is part of Fracter.
8 //
9 // Fracter is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 //
22 //
23 // App.h
24 // Application class definition
25 //
26 ////////////////////////////////////////////////////////////////////////////////
28 #ifndef APP_H
29 #define APP_H
31 #include <vector>
33 #include "SDL.h"
35 #include "EventHandler.h"
36 #include "Fractal.h"
38 class App : public EventHandler
39 {
40 public:
42 App();
43 ~App();
45 int run();
48 private:
49 // Disallow copy constructor and operator=
50 App(const App &);
51 App & operator=(const App &);
54 // main loop functions
55 bool init();
56 void update();
57 void render();
58 void cleanup();
61 // Overrides of EventHandler:
62 void on_InputFocus();
63 void on_InputBlur();
64 void on_KeyDown(SDL_KeyboardEvent key);
65 void on_KeyUp(SDL_KeyboardEvent key);
66 void on_MouseMove(SDL_MouseMotionEvent motion);
67 void on_LButtonDown(SDL_MouseButtonEvent button);
68 void on_LButtonUp(SDL_MouseButtonEvent button);
69 void on_Resize(SDL_ResizeEvent resize);
70 void on_Expose();
71 void on_Quit();
74 // utility functions
75 int mouse_move_width(int mx, int my);
76 bool create_new_surface(SDL_Surface * &surface);
77 void set_julia_k(int x, int y);
78 void restore_view();
79 void save_view();
80 void set_caption();
81 bool save_image();
83 static Uint32 timer_callback(Uint32 interval, void *param);
85 int get_next_file_num();
87 #if !defined(WIN32)
88 static int scandir_filter(const struct dirent * d);
89 #endif
92 // data members
93 bool running;
94 bool redraw;
96 SDL_Surface * surf_display;
97 SDL_Surface * surf_selection;
98 SDL_Surface * surf_fractal;
100 int selection_x, selection_y, selection_width;
101 bool setting_zoom;
102 bool can_set_julia_k;
103 bool setting_julia_k;
105 static std::vector<View *> old_views;
107 Fractal * fractal;
108 };
110 #endif