104 |
Rect oldarea(oldx, oldy, m_area.w, m_area.h); |
Rect oldarea(oldx, oldy, m_area.w, m_area.h); |
105 |
Rect common = intersect(newarea, oldarea); |
Rect common = intersect(newarea, oldarea); |
106 |
|
|
107 |
|
GC screengc (m_screen->get_surface()); |
108 |
|
|
109 |
Rect blitrect(common.x-oldx+m_area.x, |
Rect blitrect(common.x-oldx+m_area.x, |
110 |
common.y-oldy+m_area.y, |
common.y-oldy+m_area.y, |
111 |
common.w, common.h); |
common.w, common.h); |
112 |
m_screen->blit(common.x-newx+m_area.x, |
blit (screengc, |
113 |
common.y-newy+m_area.y, |
common.x-newx+m_area.x, |
114 |
m_screen, |
common.y-newy+m_area.y, |
115 |
blitrect); |
m_screen->get_surface(), |
116 |
|
blitrect); |
117 |
|
|
118 |
blitrect.x = common.x-newx+m_area.x; |
blitrect.x = common.x-newx+m_area.x; |
119 |
blitrect.y = common.y-newy+m_area.y; |
blitrect.y = common.y-newy+m_area.y; |
120 |
m_screen->update_rect(blitrect); |
m_screen->update_rect(blitrect); |
234 |
void |
void |
235 |
DisplayEngine::update_layer (DisplayLayer *l, WorldArea wa) |
DisplayEngine::update_layer (DisplayLayer *l, WorldArea wa) |
236 |
{ |
{ |
237 |
GC gc(m_screen); |
GC gc(m_screen->get_surface()); |
238 |
|
|
239 |
int x2 = wa.x+wa.w; |
int x2 = wa.x+wa.w; |
240 |
int y2 = wa.y+wa.h; |
int y2 = wa.y+wa.h; |
257 |
void |
void |
258 |
DisplayEngine::update_screen() |
DisplayEngine::update_screen() |
259 |
{ |
{ |
260 |
GC gc(m_screen); |
GC gc(m_screen->get_surface()); |
261 |
|
|
262 |
Rect area=get_area(); |
Rect area=get_area(); |
263 |
clip(gc, area); |
clip(gc, area); |
639 |
{ |
{ |
640 |
DisplayEngine *engine = get_engine(); |
DisplayEngine *engine = get_engine(); |
641 |
|
|
642 |
// clip (gc, engine->world_to_screen(a)); |
set_color (gc, 240, 140, 20, 255); |
643 |
|
set_flags (gc.flags, GS_ANTIALIAS); |
|
SDL_Surface *surf = video::GetScreen()->get_surface(); |
|
|
|
|
|
Rect r = engine->get_area(); //world_to_screen (a); |
|
|
SDL_Rect s; |
|
|
sdl::copy_rect(s, r); |
|
|
SDL_SetClipRect (surf, &s); |
|
644 |
|
|
645 |
for (LineMap::iterator i=m_rubbers.begin(); i!= m_rubbers.end(); ++i) |
for (LineMap::iterator i=m_rubbers.begin(); i!= m_rubbers.end(); ++i) |
646 |
{ |
{ |
647 |
int x1, y1, x2, y2; |
int x1, y1, x2, y2; |
648 |
engine->world_to_screen (i->second.start, &x1, &y1); |
engine->world_to_screen (i->second.start, &x1, &y1); |
649 |
engine->world_to_screen (i->second.end, &x2, &y2); |
engine->world_to_screen (i->second.end, &x2, &y2); |
650 |
aalineRGBA(surf, x1, y1, x2, y2, 240,140,20,255); |
|
651 |
//lineRGBA(surf, x1, y1, x2, y2, 240,140,20,255); |
line (gc, x1, y1, x2, y2); |
652 |
} |
} |
|
SDL_SetClipRect (surf, NULL); |
|
653 |
} |
} |
654 |
|
|
655 |
/* Mark the screen region occupied by a rubber band for redraw. |
/* Mark the screen region occupied by a rubber band for redraw. |
1014 |
SDL_Surface *ss = SDL_CreateRGBSurface(SDL_SWSURFACE|SDL_RLEACCEL, |
SDL_Surface *ss = SDL_CreateRGBSurface(SDL_SWSURFACE|SDL_RLEACCEL, |
1015 |
m_tilew, m_tileh, 16, |
m_tilew, m_tileh, 16, |
1016 |
0,0,0,0); |
0,0,0,0); |
1017 |
s = new Surface(SDL_DisplayFormat(ss)); |
s = Surface::make_surface (SDL_DisplayFormat(ss)); |
1018 |
SDL_FreeSurface(ss); |
SDL_FreeSurface(ss); |
1019 |
} else { |
} else { |
1020 |
s = m_surface_avail.back(); |
s = m_surface_avail.back(); |
1040 |
SDL_SetColorKey(ss, SDL_SRCCOLORKEY, |
SDL_SetColorKey(ss, SDL_SRCCOLORKEY, |
1041 |
SDL_MapRGB(ss->format, 255,255,255)); |
SDL_MapRGB(ss->format, 255,255,255)); |
1042 |
SDL_SetAlpha(ss, SDL_SRCALPHA, 128); |
SDL_SetAlpha(ss, SDL_SRCALPHA, 128); |
1043 |
buffer = new Surface(ss); |
buffer = Surface::make_surface(ss); |
1044 |
} |
} |
1045 |
|
|
1046 |
DL_Shadows::~DL_Shadows() |
DL_Shadows::~DL_Shadows() |
1572 |
void |
void |
1573 |
GameDisplay::redraw(px::Screen *screen) |
GameDisplay::redraw(px::Screen *screen) |
1574 |
{ |
{ |
1575 |
GC gc(screen); |
GC gc(screen->get_surface()); |
1576 |
CommonDisplay::redraw(); |
CommonDisplay::redraw(); |
1577 |
if (status_bar->has_changed() || redraw_everything) { |
if (status_bar->has_changed() || redraw_everything) { |
1578 |
status_bar->redraw (gc, inventoryarea); |
status_bar->redraw (gc, inventoryarea); |
1584 |
last_frame_time = SDL_GetTicks(); |
last_frame_time = SDL_GetTicks(); |
1585 |
Font *f = enigma::GetFont("levelmenu"); |
Font *f = enigma::GetFont("levelmenu"); |
1586 |
|
|
1587 |
gc.noclip(); |
clip(gc); |
1588 |
Rect area (0,0,80,20); |
Rect area (0,0,80,20); |
1589 |
set_color (gc, 0,0,0); |
set_color (gc, 0,0,0); |
1590 |
box (gc, area); |
box (gc, area); |
1610 |
GameDisplay::draw_borders (GC &gc) |
GameDisplay::draw_borders (GC &gc) |
1611 |
{ |
{ |
1612 |
RectList rl; |
RectList rl; |
1613 |
gc.noclip(); |
rl.push_back (gc.drawable->size()); |
|
rl.push_back (gc.get_cliprect()); // HACK, really want gc.size() |
|
1614 |
rl.sub (get_engine()->get_area()); |
rl.sub (get_engine()->get_area()); |
1615 |
rl.sub (inventoryarea); |
rl.sub (inventoryarea); |
1616 |
|
clip(gc); |
1617 |
set_color (gc, 0, 0, 0); |
set_color (gc, 0, 0, 0); |
1618 |
for (RectList::iterator i=rl.begin(); i!=rl.end(); ++i) { |
for (RectList::iterator i=rl.begin(); i!=rl.end(); ++i) { |
1619 |
box (gc, *i); |
box (gc, *i); |