22 #ifndef AGS_ENGINE_AC_DRAW_H 23 #define AGS_ENGINE_AC_DRAW_H 25 #include "common/std/memory.h" 26 #include "ags/shared/core/types.h" 27 #include "ags/shared/ac/common_defines.h" 28 #include "ags/shared/gfx/gfx_def.h" 29 #include "ags/shared/gfx/allegro_bitmap.h" 30 #include "ags/shared/gfx/bitmap.h" 31 #include "ags/shared/game/room_struct.h" 32 #include "ags/engine/ac/runtime_defines.h" 33 #include "ags/engine/ac/walk_behind.h" 42 class IDriverDependantBitmap;
48 #define IS_ANTIALIAS_SPRITES _GP(usetup).enable_antialiasing && (_GP(play).disable_antialiasing == 0) 53 #define RENDER_BATCH_ENGINE_OVERLAY 0x0001 54 #define RENDER_BATCH_MOUSE_CURSOR 0x0002 55 #define RENDER_SHOT_SKIP_ON_FADE (RENDER_BATCH_ENGINE_OVERLAY | RENDER_BATCH_MOUSE_CURSOR) 72 typedef int32_t sprkey_t;
79 bool SoftwareRender =
false;
81 bool FullFrameRedraw =
false;
83 WalkBehindMethodEnum WalkBehindMethod = DrawAsSeparateSprite;
85 bool ScreenIsDirty =
false;
107 uint32_t SpriteID = UINT32_MAX;
124 : SpriteID(sprite_id), Bmp(bmp), Ddb(ddb), Pos(x, y), Off(xoff, yoff) {
132 inline bool IsChangeNotified()
const {
133 return SpriteNotify && (*SpriteNotify != SpriteID);
143 short tintr = 0, tintg = 0, tintb = 0, tintamnt = 0, tintlight = 0;
144 short lightlev = 0, zoom = 0;
149 ObjectCache(
int pic_,
int tintr_,
int tintg_,
int tintb_,
int tint_amnt_,
int tint_light_,
150 int light_,
int zoom_,
bool mirror_,
int posx_,
int posy_)
151 : sppic(pic_), tintr(tintr_), tintg(tintg_), tintb(tintb_), tintamnt(tint_amnt_), tintlight(tint_light_)
152 , lightlev(light_), zoom(zoom_), mirrored(mirror_), x(posx_), y(posy_) {}
162 int MakeColor(
int color_index);
168 void init_draw_method();
170 void init_game_drawdata();
172 void init_room_drawdata();
174 void dispose_draw_method();
176 void dispose_game_drawdata();
178 void dispose_room_drawdata();
180 void clear_drawobj_cache();
182 void on_mainviewport_changed();
184 void on_roomviewport_created(
int index);
186 void on_roomviewport_deleted(
int index);
188 void on_roomviewport_changed(
Viewport *view);
190 void detect_roomviewport_overlaps(
size_t z_index);
192 void on_roomcamera_changed(
Camera *cam);
194 void mark_object_changed(
int objid);
197 void reset_drawobj_for_overlay(
int objnum);
199 void notify_sprite_changed(
int sprnum,
bool deleted);
202 void mark_screen_dirty();
203 bool is_screen_dirty();
206 void invalidate_screen();
208 void invalidate_camera_frame(
int index);
211 void invalidate_rect(
int x1,
int y1,
int x2,
int y2,
bool in_room);
213 void mark_current_background_dirty();
220 return recycle_ddb_sprite(ddb, UINT32_MAX, source, has_alpha, opaque);
225 void construct_game_scene(
bool full_redraw =
false);
227 void construct_game_screen_overlay(
bool draw_mouse =
true);
229 void construct_engine_overlay();
231 void clear_letterbox_borders();
233 void debug_draw_room_mask(RoomAreaMask mask);
234 void debug_draw_movelist(
int charnum);
235 void update_room_debug();
239 Shared::BlendMode blend_mode = Shared::kBlendMode_Alpha,
int alpha = 0xFF);
240 void draw_sprite_slot_support_alpha(
Shared::Bitmap *ds,
bool ds_has_alpha,
int xpos,
int ypos,
int src_slot,
241 Shared::BlendMode blend_mode = Shared::kBlendMode_Alpha,
int alpha = 0xFF);
242 void draw_gui_sprite(
Shared::Bitmap *ds,
int pic,
int x,
int y,
bool use_alpha =
true, Shared::BlendMode blend_mode = Shared::kBlendMode_Alpha);
243 void draw_gui_sprite_v330(
Shared::Bitmap *ds,
int pic,
int x,
int y,
bool use_alpha =
true, Shared::BlendMode blend_mode = Shared::kBlendMode_Alpha);
244 void draw_gui_sprite(
Shared::Bitmap *ds,
bool use_alpha,
int xpos,
int ypos,
245 Shared::Bitmap *image,
bool src_has_alpha, Shared::BlendMode blend_mode = Shared::kBlendMode_Alpha,
int alpha = 0xFF);
248 void render_to_screen();
250 void draw_game_screen_callback();
251 void GfxDriverOnInitCallback(
void *data);
252 bool GfxDriverSpriteEvtCallback(
int evt,
int data);
253 void putpixel_compensate(
Shared::Bitmap *g,
int xx,
int yy,
int col);
263 bool construct_object_gfx(
int objid,
bool force_software);
264 bool construct_char_gfx(
int charid,
bool force_software);
271 void add_walkbehind_image(
size_t index,
Shared::Bitmap *bmp,
int x,
int y);
273 void draw_and_invalidate_text(
Shared::Bitmap *ds,
int x1,
int y1,
int font, color_t text_color,
const char *text);
283 int get_fixed_pixel_size(
int pixels);
285 extern int data_to_game_coord(
int coord);
286 extern void data_to_game_coords(
int *x,
int *y);
287 extern void data_to_game_round_up(
int *x,
int *y);
289 extern int game_to_data_coord(
int coord);
290 extern void game_to_data_coords(
int &x,
int &y);
291 extern int game_to_data_round_up(
int coord);
293 extern void ctx_data_to_game_coord(
int &x,
int &y,
bool hires_ctx);
294 extern void ctx_data_to_game_size(
int &x,
int &y,
bool hires_ctx);
295 extern int ctx_data_to_game_size(
int size,
bool hires_ctx);
296 extern int game_to_ctx_data_size(
int size,
bool hires_ctx);
298 extern void defgame_to_finalgame_coords(
int &x,
int &y);
302 Shared::Bitmap *CreateCompatBitmap(
int width,
int height,
int col_depth = 0);
315 Shared::Bitmap *CopyScreenIntoBitmap(
int width,
int height,
const Rect *src_rect =
nullptr,
316 bool at_native_res =
false, uint32_t batch_skip_filter = 0u);
Definition: achievements_tables.h:27
Definition: allegro_bitmap.h:44
Definition: geometry.h:87
Definition: viewport.h:128
Definition: viewport.h:63
Definition: geometry.h:219
Definition: display_client.h:113