1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

color dialog uses reactions now

This commit is contained in:
Zeno Rogue 2017-12-19 14:34:38 +01:00
parent 168d35cb17
commit 37cc910031
2 changed files with 8 additions and 7 deletions

View File

@ -449,8 +449,10 @@ namespace dialog {
unsigned char* pts = (unsigned char*) &color; unsigned char* pts = (unsigned char*) &color;
pts[colorp] += abs(shiftmul) < .6 ? 1 : 17; pts[colorp] += abs(shiftmul) < .6 ? 1 : 17;
} }
else if(doexiton(sym, uni)) else if(doexiton(sym, uni)) {
if(reaction) reaction();
popScreen(); popScreen();
}
return false; return false;
} }
@ -516,6 +518,7 @@ namespace dialog {
colorPointer = &col; palette = pal; colorPointer = &col; palette = pal;
dialogflags = 0; dialogflags = 0;
pushScreen(drawColorDialog); pushScreen(drawColorDialog);
reaction = reaction_t();
} }
struct numberEditor { struct numberEditor {

View File

@ -836,7 +836,6 @@ namespace mapeditor {
int dslayer; int dslayer;
bool coloring; bool coloring;
unsigned int colortouse = 0xC0C0C0FFu; unsigned int colortouse = 0xC0C0C0FFu;
bool colorkey = false;
// fake key sent to change the color // fake key sent to change the color
static const int COLORKEY = (-10000); static const int COLORKEY = (-10000);
@ -881,7 +880,6 @@ namespace mapeditor {
void drawHandleKey(int sym, int uni); void drawHandleKey(int sym, int uni);
void showDrawEditor() { void showDrawEditor() {
if(colorkey) drawHandleKey(COLORKEY, COLORKEY), colorkey = false;
cmode = sm::DRAW; cmode = sm::DRAW;
gamescreen(0); gamescreen(0);
drawGrid(); drawGrid();
@ -1342,9 +1340,7 @@ namespace mapeditor {
0x404040FF, 0x404040FF,
0x804000FF 0x804000FF
}; };
dialog::openColorDialog(colortouse, texture_colors); dialog::openColorDialog(texture::paint_color, texture_colors);
dialog::openColorDialog(texture::paint_color);
colorkey = true;
} }
if(uni == 'w') if(uni == 'w')
@ -1387,7 +1383,9 @@ namespace mapeditor {
if(uni == 'p') { if(uni == 'p') {
dialog::openColorDialog(colortouse); dialog::openColorDialog(colortouse);
colorkey = true; dialog::reaction = [] () {
drawHandleKey(COLORKEY, COLORKEY);
};
} }
if(sym == SDLK_F2) if(sym == SDLK_F2)