Skip to content
Newer
Older
100644 157 lines (129 sloc) 4.5 KB
847b6cf initial checkin
davewx7 authored Jun 26, 2008
1
2 /*
29eac01 Corrected Dave's email in the copyright in a bunch of files.
crimson_penguin authored Apr 4, 2010
3 Copyright (C) 2007 by David White <dave@whitevine.net>
847b6cf initial checkin
davewx7 authored Jun 26, 2008
4 Part of the Silver Tree Project
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 or later.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY.
10
11 See the COPYING file for more details.
12 */
13 #ifndef RASTER_HPP_INCLUDED
14 #define RASTER_HPP_INCLUDED
15
753e1e0 major improvements to water
davewx7 authored Jan 24, 2009
16 #include <vector>
17
e3ef4fb @sweetkristas Some bug fixes, changed the way the OpenGL/SDL headers are handled to…
sweetkristas authored Mar 10, 2012
18 #include "graphics.hpp"
847b6cf initial checkin
davewx7 authored Jun 26, 2008
19
fe5af7a @sweetkristas Added a few more c++ color options and moved the existing ones from r…
sweetkristas authored Jun 18, 2012
20 #include "color_chart.hpp"
d887eb2 Added a bunch of functionality to the color class and wired it into t…
kettering.richard authored Apr 24, 2009
21 #include "color_utils.hpp"
753e1e0 major improvements to water
davewx7 authored Jan 24, 2009
22 #include "geometry.hpp"
847b6cf initial checkin
davewx7 authored Jun 26, 2008
23 #include "texture.hpp"
24
1ae912e Fixed up some on-screen artifacts
davewx7 authored Dec 24, 2009
25 namespace preferences
26 {
27 extern int xypos_draw_mask;
28 }
29
847b6cf initial checkin
davewx7 authored Jun 26, 2008
30 namespace graphics
31 {
32
b7685ab fixes to resizing window behavior in the editor
Sirp authored Mar 7, 2011
33 SDL_Surface* set_video_mode(int w, int h, int bitsperpixel, int flags);
d0f5484 made it so the coin race switches the resolution to 1024x768 when pla…
Sirp authored Mar 8, 2011
34 bool set_video_mode(int w, int h);
635ff82 @sweetkristas Port of Frogatto to android, currently tested on a GT-I9000 at 800x48…
sweetkristas authored Mar 19, 2012
35 void reset_opengl_state();
f483573 hacky nasty code to make window resizing work okay.
Sirp authored Jul 17, 2010
36
a29945e Converted more places to array drawing.
karmosinroda authored Dec 7, 2009
37 std::vector<GLfloat>& global_vertex_array();
38 std::vector<GLfloat>& global_texcoords_array();
8839089 Upgraded the smoke particle system to look good again.
jetrel authored Mar 4, 2010
39 std::vector<GLbyte>& global_vertex_color_array();
a29945e Converted more places to array drawing.
karmosinroda authored Dec 7, 2009
40
847b6cf initial checkin
davewx7 authored Jun 26, 2008
41 void prepare_raster();
42 void blit_texture(const texture& tex, int x=0, int y=0, GLfloat rotate=0.0);
50561a8 added documentation to blit_texture
davewx7 authored Dec 2, 2008
43
44 //Function to blit a texture to the screen. Parameters:
45 //x, y: target on-screen location.
f001f80 added documentation to blit_texture
davewx7 authored Dec 2, 2008
46 //w, h: dimensions of the on-screen area that will be filled by the
47 //blit.
50561a8 added documentation to blit_texture
davewx7 authored Dec 2, 2008
48 //rotate: the number of degrees to rotate by when blitting
49 //x1, y1, x2, y2: the area of the texture to blit onto the screen. The
50 //defaults are to blit the entire texture. Note that these values can be
51 // < 0.0 or > 1.0 and the texture will wrap, but *only* if the texture's
52 //dimensions are powers of two. Otherwise they must be in the range [0,1]
847b6cf initial checkin
davewx7 authored Jun 26, 2008
53 void blit_texture(const texture& tex, int x, int y, int w, int h, GLfloat rotate=0.0, GLfloat x1=0.0, GLfloat y1=0.0, GLfloat x2=1.0, GLfloat y2=1.0);
753e1e0 major improvements to water
davewx7 authored Jan 24, 2009
54
9404267 Optimization to tile and gui drawing
davewx7 authored Dec 20, 2009
55 void queue_blit_texture(const texture& tex, int x, int y, int w, int h,
56 GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
a139f1a initial implementation of decimal variants, and used this implementat…
Sirp authored Jan 12, 2011
57 void queue_blit_texture(const texture& tex, int x, int y, int w, int h, GLfloat rotate,
94c2dbb Integrated the rectangle rotation code into the blitting routines to …
kettering.richard authored Feb 8, 2010
58 GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
9404267 Optimization to tile and gui drawing
davewx7 authored Dec 20, 2009
59 void flush_blit_texture();
60
c8c9a91 refactored a bunch of drawing code
davewx7 authored Dec 23, 2009
61 class blit_queue
62 {
63 public:
64 blit_queue() : texture_(0)
65 {}
66 void set_texture(GLuint id) {
67 texture_ = id;
68 }
eb83134 test code to see if rendering all tiles in one blit operation is faster
davewx7 authored Dec 23, 2009
69 GLuint texture() const { return texture_; }
c8c9a91 refactored a bunch of drawing code
davewx7 authored Dec 23, 2009
70 void clear();
de79183 made opaque tiles avoid using alpha blending when blitting
Sirp authored Mar 5, 2010
71 bool empty() const { return vertex_.empty(); }
708c8c4 made it so only the non-alpha area of tiles gets drawn
Sirp authored Mar 5, 2010
72 size_t size() const { return vertex_.size(); }
c8c9a91 refactored a bunch of drawing code
davewx7 authored Dec 23, 2009
73 void do_blit() const;
74 void do_blit_range(short begin, short end) const;
7c615e3 improvements to blitting efficiency
davewx7 authored Dec 23, 2009
75 void add(GLshort x, GLshort y, GLfloat u, GLfloat v) {
1ae912e Fixed up some on-screen artifacts
davewx7 authored Dec 24, 2009
76 vertex_.push_back(x&preferences::xypos_draw_mask);
77 vertex_.push_back(y&preferences::xypos_draw_mask);
c8c9a91 refactored a bunch of drawing code
davewx7 authored Dec 23, 2009
78 uv_.push_back(u);
79 uv_.push_back(v);
80 }
81
82 void repeat_last() {
83 if(!vertex_.empty()) {
eb83134 test code to see if rendering all tiles in one blit operation is faster
davewx7 authored Dec 23, 2009
84 vertex_.push_back(vertex_[vertex_.size()-2]);
85 vertex_.push_back(vertex_[vertex_.size()-2]);
86 uv_.push_back(uv_[uv_.size()-2]);
87 uv_.push_back(uv_[uv_.size()-2]);
c8c9a91 refactored a bunch of drawing code
davewx7 authored Dec 23, 2009
88 }
89 }
90
91 short position() const { return vertex_.size(); }
eb83134 test code to see if rendering all tiles in one blit operation is faster
davewx7 authored Dec 23, 2009
92
93 bool merge(const blit_queue& q, short begin, short end);
46e76c4 some optimizations to loading levels
davewx7 authored Dec 29, 2009
94
95 void reserve(size_t n) {
96 vertex_.reserve(n);
97 uv_.reserve(n);
98 }
c8c9a91 refactored a bunch of drawing code
davewx7 authored Dec 23, 2009
99 private:
100 GLuint texture_;
7c615e3 improvements to blitting efficiency
davewx7 authored Dec 23, 2009
101 std::vector<GLshort> vertex_;
c8c9a91 refactored a bunch of drawing code
davewx7 authored Dec 23, 2009
102 std::vector<GLfloat> uv_;
103 };
104
753e1e0 major improvements to water
davewx7 authored Jan 24, 2009
105 //function which sets a rectangle where we want to detect if pixels are written.
106 //buf must point to a buffer with a size of rect.w*rect.h. Whenever a pixel
107 //is blitted within rect, the corresponding pixel in buf will be set. buf
108 //must remain valid until another call to set_draw_detection_rect() or a
109 //call to clear_draw_detection_rect().
110 void set_draw_detection_rect(const rect& rect, char* buf);
111 void clear_draw_detection_rect();
112
7acca9a added new water distortion effects
davewx7 authored Feb 1, 2009
113 class raster_distortion;
114 void add_raster_distortion(const raster_distortion* distortion);
115 void remove_raster_distortion(const raster_distortion* distortion);
a632c8c added cool new distortion effects to fire frogatto
davewx7 authored Feb 2, 2009
116 void clear_raster_distortion();
7acca9a added new water distortion effects
davewx7 authored Feb 1, 2009
117
6bd3d59 fixed water in front of parallax backgrounds distorting incorrectly
davewx7 authored Sep 10, 2009
118 //a class that translates distortions within its scope.
119 class distortion_translation {
120 int x_, y_;
121 public:
122 distortion_translation();
123 ~distortion_translation();
124 void translate(int x, int y);
125 };
126
847b6cf initial checkin
davewx7 authored Jun 26, 2008
127 void draw_rect(const SDL_Rect& rect, const SDL_Color& color,
128 unsigned char alpha=0xFF);
d887eb2 Added a bunch of functionality to the color class and wired it into t…
kettering.richard authored Apr 24, 2009
129 void draw_rect(const rect& rect, const graphics::color& color);
847b6cf initial checkin
davewx7 authored Jun 26, 2008
130 void draw_hollow_rect(const SDL_Rect& rect, const SDL_Color& color,
131 unsigned char alpha=0xFF);
4dcda70 added draw_circle function
Sirp authored Mar 15, 2010
132 void draw_circle(int x, int y, int radius);
847b6cf initial checkin
davewx7 authored Jun 26, 2008
133 int screen_width();
134 int screen_height();
ecedcdd fixed various problems with wall jumping not working etc. Oh, and add…
davewx7 authored May 11, 2009
135 void zoom_in();
136 void zoom_out();
137 void zoom_default();
847b6cf initial checkin
davewx7 authored Jun 26, 2008
138
adb3daf Some changes for iPhone compatibility.
karmosinroda authored Dec 8, 2009
139 void coords_to_screen(GLfloat sx, GLfloat sy, GLfloat sz,
140 GLfloat* dx, GLfloat* dy, GLfloat* dz);
847b6cf initial checkin
davewx7 authored Jun 26, 2008
141 void push_clip(const SDL_Rect& rect);
142 void pop_clip();
143
ac43e3c @davewx7 initial version of animation preview widget for the editor, and fix t…
davewx7 authored Apr 15, 2012
144 struct clip_scope {
145 clip_scope(const SDL_Rect& rect) {
146 push_clip(rect);
147 }
148
149 ~clip_scope() {
150 pop_clip();
151 }
152 };
153
847b6cf initial checkin
davewx7 authored Jun 26, 2008
154 }
155
156 #endif
Something went wrong with that request. Please try again.