changes to ellipse filenames
This commit is contained in:
parent
1c10f5f2d6
commit
51e4856b66
7 changed files with 55 additions and 18 deletions
Binary file not shown.
Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 614 B |
BIN
images/misc/ellipse-1-top.png
Normal file
BIN
images/misc/ellipse-1-top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 B |
Binary file not shown.
|
@ -61,6 +61,7 @@ cursor::CURSOR_TYPE current_cursor = cursor::NUM_CURSORS;
|
|||
|
||||
int cursor_x = -1, cursor_y = -1;
|
||||
SDL_Surface* cursor_buf = NULL;
|
||||
bool have_focus = true;
|
||||
|
||||
SDL_Cursor* get_cursor(cursor::CURSOR_TYPE type)
|
||||
{
|
||||
|
@ -123,6 +124,11 @@ void set(CURSOR_TYPE type)
|
|||
}
|
||||
}
|
||||
|
||||
void set_focus(bool focus)
|
||||
{
|
||||
have_focus = focus;
|
||||
}
|
||||
|
||||
setter::setter(CURSOR_TYPE type) : old_(current_cursor)
|
||||
{
|
||||
set(type);
|
||||
|
@ -143,6 +149,12 @@ void draw(SDL_Surface* screen)
|
|||
return;
|
||||
}
|
||||
|
||||
if(have_focus == NULL) {
|
||||
SDL_FreeSurface(cursor_buf);
|
||||
cursor_buf = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
int new_cursor_x, new_cursor_y;
|
||||
SDL_GetMouseState(&new_cursor_x,&new_cursor_y);
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ void set(CURSOR_TYPE type);
|
|||
void draw(SDL_Surface* screen);
|
||||
void undraw(SDL_Surface* screen);
|
||||
|
||||
void set_focus(bool focus);
|
||||
|
||||
struct setter
|
||||
{
|
||||
setter(CURSOR_TYPE type);
|
||||
|
|
|
@ -1185,11 +1185,16 @@ void display::draw_unit_on_tile(int x, int y, SDL_Surface* unit_image_override,
|
|||
if(loc != hiddenUnit_) {
|
||||
//the circle around the base of the unit
|
||||
if(preferences::show_side_colours() && !fogged(x,y) && it != units_.end()) {
|
||||
const SDL_Color& col = font::get_side_colour(it->second.side());
|
||||
const Uint16 colour = SDL_MapRGB(dst->format,col.r,col.g,col.b);
|
||||
SDL_Rect clip = {xpos,ypos,unit_image->w,unit_image->h};
|
||||
char buf[50];
|
||||
sprintf(buf,"misc/ellipse-%d-top.png",it->second.side());
|
||||
const scoped_sdl_surface surf(image::get_image(buf));
|
||||
|
||||
draw_unit_ellipse(dst,colour,energy_uses_alpha ? Uint8(highlight_ratio*255) : SDL_ALPHA_OPAQUE,clip,xpos,ypos-height_adjust,unit_image,!face_left,ELLIPSE_TOP);
|
||||
if(surf != NULL) {
|
||||
SDL_Surface* const dst = screen_.getSurface();
|
||||
SDL_Rect rect = {xpos,ypos - height_adjust,surf->w,surf->h};
|
||||
|
||||
SDL_BlitSurface(surf,NULL,dst,&rect);
|
||||
}
|
||||
}
|
||||
|
||||
draw_unit(xpos,ypos - height_adjust,unit_image,face_left,false,
|
||||
|
@ -1224,11 +1229,17 @@ void display::draw_unit_on_tile(int x, int y, SDL_Surface* unit_image_override,
|
|||
|
||||
//the bottom half of the circle around the base of the unit
|
||||
if(loc != hiddenUnit_ && preferences::show_side_colours() && !fogged(x,y) && it != units_.end()) {
|
||||
const SDL_Color& col = font::get_side_colour(it->second.side());
|
||||
const Uint16 colour = SDL_MapRGB(dst->format,col.r,col.g,col.b);
|
||||
SDL_Rect clip = {xpos,ypos,unit_image->w,unit_image->h};
|
||||
|
||||
draw_unit_ellipse(dst,colour,energy_uses_alpha ? Uint8(highlight_ratio*255) : SDL_ALPHA_OPAQUE,clip,xpos,ypos-height_adjust,unit_image,!face_left,ELLIPSE_BOTTOM);
|
||||
char buf[50];
|
||||
sprintf(buf,"misc/ellipse-%d-bottom.png",it->second.side());
|
||||
const scoped_sdl_surface surf(image::get_image(buf));
|
||||
|
||||
if(surf != NULL) {
|
||||
SDL_Surface* const dst = screen_.getSurface();
|
||||
SDL_Rect rect = {xpos,ypos - height_adjust,surf->w,surf->h};
|
||||
|
||||
SDL_BlitSurface(surf,NULL,dst,&rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "cursor.hpp"
|
||||
#include "events.hpp"
|
||||
#include "mouse.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
@ -89,18 +90,18 @@ void pump()
|
|||
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event)) {
|
||||
if(event_contexts.empty() == false) {
|
||||
|
||||
const std::vector<handler*>& event_handlers = event_contexts.top();
|
||||
|
||||
//events may cause more event handlers to be added and/or removed,
|
||||
//so we must use indexes instead of iterators here.
|
||||
for(size_t i1 = 0, i2 = event_handlers.size(); i1 != i2 && i1 < event_handlers.size(); ++i1) {
|
||||
event_handlers[i1]->handle_event(event);
|
||||
}
|
||||
}
|
||||
|
||||
switch(event.type) {
|
||||
|
||||
case SDL_APPMOUSEFOCUS: {
|
||||
SDL_ActiveEvent& ae = reinterpret_cast<SDL_ActiveEvent&>(event);
|
||||
if(ae.state == SDL_APPMOUSEFOCUS) {
|
||||
cursor::set_focus(ae.gain == 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//if the window must be redrawn, update the entire screen
|
||||
case SDL_VIDEOEXPOSE: {
|
||||
update_whole_screen();
|
||||
break;
|
||||
|
@ -157,6 +158,17 @@ void pump()
|
|||
throw CVideo::quit();
|
||||
}
|
||||
}
|
||||
|
||||
if(event_contexts.empty() == false) {
|
||||
|
||||
const std::vector<handler*>& event_handlers = event_contexts.top();
|
||||
|
||||
//events may cause more event handlers to be added and/or removed,
|
||||
//so we must use indexes instead of iterators here.
|
||||
for(size_t i1 = 0, i2 = event_handlers.size(); i1 != i2 && i1 < event_handlers.size(); ++i1) {
|
||||
event_handlers[i1]->handle_event(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(resize_dimensions.first > 0 && disallow_resize == 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue