1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +00:00

list of colors and brush sizes

This commit is contained in:
Zeno Rogue 2017-12-22 22:34:01 +01:00
parent 0803082c87
commit 8c7abbc33e
3 changed files with 40 additions and 21 deletions

View File

@ -100,7 +100,7 @@ namespace dialog {
addSelItem(body, ONOFF(value), key); addSelItem(body, ONOFF(value), key);
} }
int displaycolor(int col) { int displaycolor(unsigned col) {
int c = col >> 8; int c = col >> 8;
if(!c) return 0x181818; if(!c) return 0x181818;
return c; return c;

View File

@ -1177,6 +1177,7 @@ namespace dialog {
extern bool sidedialog; extern bool sidedialog;
extern int dialogflags; extern int dialogflags;
extern int dcenter; extern int dcenter;
int displaycolor(unsigned col);
void openFileDialog(string& filename, string fcap, string ext, bool_reaction_t action); void openFileDialog(string& filename, string fcap, string ext, bool_reaction_t action);

View File

@ -864,6 +864,25 @@ namespace mapeditor {
void drawHandleKey(int sym, int uni); void drawHandleKey(int sym, int uni);
static ld brush_sizes[10] = {
0.001, 0.002, 0.005, 0.0075, 0.01, 0.015, 0.02, 0.05, 0.075, 0.1};
static unsigned texture_colors[] = {
11,
0x000000FF,
0xFFFFFFFF,
0xFF0000FF,
0xFFFF00FF,
0x00FF00FF,
0x00FFFFFF,
0x0000FFFF,
0xFF00FFFF,
0xC0C0C0FF,
0x808080FF,
0x404040FF,
0x804000FF
};
void showDrawEditor() { void showDrawEditor() {
cmode = sm::DRAW; cmode = sm::DRAW;
gamescreen(0); gamescreen(0);
@ -969,7 +988,7 @@ namespace mapeditor {
else if(texture::tstate == texture::tsActive) { else if(texture::tstate == texture::tsActive) {
displayButton(8, 8+fs*2, XLAT(texture::texturesym ? "0 = symmetry" : "0 = asymmetry"), '0', 0); displayButton(8, 8+fs*2, XLAT(texture::texturesym ? "0 = symmetry" : "0 = asymmetry"), '0', 0);
displayButton(8, 8+fs*3, XLAT("p = color"), 'p', 0); displayButton(8, 8+fs*3, XLAT("p = color"), 'p', 0);
displayButton(8, 8+fs*4, XLAT("w = pen size: %1", fts4(texture::penwidth)), 'w', 0); displayButton(8, 8+fs*4, XLAT("b = brush size: %1", fts4(texture::penwidth)), 'b', 0);
displayButton(8, 8+fs*5, XLAT("u = undo"), 'u', 0); displayButton(8, 8+fs*5, XLAT("u = undo"), 'u', 0);
} }
#endif #endif
@ -984,6 +1003,14 @@ namespace mapeditor {
displayButton(vid.xres-8, 8+fs*3, XLAT("z = zoom in"), 'z', 16); displayButton(vid.xres-8, 8+fs*3, XLAT("z = zoom in"), 'z', 16);
displayButton(vid.xres-8, 8+fs*2, XLAT("o = zoom out"), 'o', 16); displayButton(vid.xres-8, 8+fs*2, XLAT("o = zoom out"), 'o', 16);
if(intexture) for(int i=0; i<10; i++) {
if(8 + fs * (6+i) < vid.yres - 8 - fs * 7)
displayColorButton(vid.xres-8, 8+fs*(6+i), "###", 1000 + i, 16, 1, dialog::displaycolor(texture_colors[i+1]));
if(displayfr(vid.xres-8 - fs * 3, 8+fs*(6+i), 0, vid.fsize, its(i+1), texture::penwidth == brush_sizes[i] ? 0xFF8000 : 0xC0C0C0, 16))
getcstat = 2000+i;
}
#if CAP_TEXTURE #if CAP_TEXTURE
if(texture::tstate != texture::tsActive) if(texture::tstate != texture::tsActive)
displaymm('e', vid.xres-8, 8+fs, 2, vid.fsize, XLAT("e = edit this"), 16); displaymm('e', vid.xres-8, 8+fs, 2, vid.fsize, XLAT("e = edit this"), 16);
@ -1380,6 +1407,12 @@ namespace mapeditor {
holdmouse = true; holdmouse = true;
} }
if(uni >= 1000 && uni < 1010)
texture::paint_color = texture_colors[uni - 1000 + 1];
if(uni >= 2000 && uni < 2010)
texture::penwidth = brush_sizes[uni - 2000];
if(uni == '0') if(uni == '0')
texture::texturesym = !texture::texturesym; texture::texturesym = !texture::texturesym;
@ -1388,26 +1421,11 @@ namespace mapeditor {
} }
if(uni == 'p') { if(uni == 'p') {
static unsigned texture_colors[] = {
11,
0x000000FF,
0xFFFFFFFF,
0xFF0000FF,
0xFFFF00FF,
0x00FF00FF,
0x00FFFFFF,
0x0000FFFF,
0xFF00FFFF,
0xC0C0C0FF,
0x808080FF,
0x404040FF,
0x804000FF
};
dialog::openColorDialog(texture::paint_color, texture_colors); dialog::openColorDialog(texture::paint_color, texture_colors);
} }
if(uni == 'w') if(uni == 'b')
dialog::editNumber(texture::penwidth, 0, 0.1, 0.005, 0.02, XLAT("pen width"), XLAT("pen width")); dialog::editNumber(texture::penwidth, 0, 0.1, 0.005, 0.02, XLAT("brush size"), XLAT("brush size"));
} }
#else #else
if(0); if(0);