mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
CAP_TEXTURE without CAP_EDIT, CAP_CONFIG and CAP_PNG (still seems not correct, though)
This commit is contained in:
parent
825f1641da
commit
6a7a150028
@ -657,7 +657,7 @@ void showStartMenu() {
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CAP_TEXTURE
|
#if CAP_TEXTURE && CAP_EDIT
|
||||||
case 6:
|
case 6:
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
dialog::addBigItem(XLAT("texture mode"), 'T');
|
dialog::addBigItem(XLAT("texture mode"), 'T');
|
||||||
@ -719,7 +719,7 @@ void showStartMenu() {
|
|||||||
rug::init();
|
rug::init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if CAP_TEXTURE
|
#if CAP_TEXTURE && CAP_EDIT
|
||||||
else if(uni == 'T') {
|
else if(uni == 'T') {
|
||||||
popScreenAll();
|
popScreenAll();
|
||||||
resetModes('c');
|
resetModes('c');
|
||||||
|
18
textures.cpp
18
textures.cpp
@ -12,6 +12,7 @@ namespace texture {
|
|||||||
|
|
||||||
cpatterntype cgroup;
|
cpatterntype cgroup;
|
||||||
|
|
||||||
|
#if CAP_PNG
|
||||||
SDL_Surface *convertSurface(SDL_Surface* s) {
|
SDL_Surface *convertSurface(SDL_Surface* s) {
|
||||||
SDL_PixelFormat fmt;
|
SDL_PixelFormat fmt;
|
||||||
// fmt.format = SDL_PIXELFORMAT_BGRA8888;
|
// fmt.format = SDL_PIXELFORMAT_BGRA8888;
|
||||||
@ -36,6 +37,7 @@ SDL_Surface *convertSurface(SDL_Surface* s) {
|
|||||||
|
|
||||||
return SDL_ConvertSurface(s, &fmt, SDL_SWSURFACE);
|
return SDL_ConvertSurface(s, &fmt, SDL_SWSURFACE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct undo {
|
struct undo {
|
||||||
unsigned* pix;
|
unsigned* pix;
|
||||||
@ -97,6 +99,7 @@ bool texture_data::whitetexture() {
|
|||||||
|
|
||||||
bool texture_data::readtexture(string tn) {
|
bool texture_data::readtexture(string tn) {
|
||||||
|
|
||||||
|
#if CAP_SDL_IMG || CAP_PNG
|
||||||
undos.clear();
|
undos.clear();
|
||||||
texture_pixels.resize(twidth * twidth);
|
texture_pixels.resize(twidth * twidth);
|
||||||
|
|
||||||
@ -204,6 +207,9 @@ bool texture_data::readtexture(string tn) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void texture_data::saveRawTexture(string tn) {
|
void texture_data::saveRawTexture(string tn) {
|
||||||
@ -778,6 +784,7 @@ saverlist texturesavers;
|
|||||||
bool target_nonbitru;
|
bool target_nonbitru;
|
||||||
|
|
||||||
void init_textureconfig() {
|
void init_textureconfig() {
|
||||||
|
#if CAP_CONFIG
|
||||||
texturesavers = move(savers);
|
texturesavers = move(savers);
|
||||||
for(int i=0; i<3; i++)
|
for(int i=0; i<3; i++)
|
||||||
for(int j=0; j<3; j++)
|
for(int j=0; j<3; j++)
|
||||||
@ -820,9 +827,11 @@ void init_textureconfig() {
|
|||||||
addsaver(config.texture_tuner, "texture tuning", "");
|
addsaver(config.texture_tuner, "texture tuning", "");
|
||||||
|
|
||||||
swap(texturesavers, savers);
|
swap(texturesavers, savers);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool texture_config::save() {
|
bool texture_config::save() {
|
||||||
|
#if CAP_CONFIG
|
||||||
init_textureconfig();
|
init_textureconfig();
|
||||||
FILE *f = fopen(configname.c_str(), "wt");
|
FILE *f = fopen(configname.c_str(), "wt");
|
||||||
if(!f) return false;
|
if(!f) return false;
|
||||||
@ -845,10 +854,12 @@ bool texture_config::save() {
|
|||||||
fprintf(f, "%s=%s\n", s->name.c_str(), s->save().c_str());
|
fprintf(f, "%s=%s\n", s->name.c_str(), s->save().c_str());
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool texture_config::load() {
|
bool texture_config::load() {
|
||||||
|
#if CAP_CONFIG
|
||||||
init_textureconfig();
|
init_textureconfig();
|
||||||
|
|
||||||
FILE *f = fopen(configname.c_str(), "rt");
|
FILE *f = fopen(configname.c_str(), "rt");
|
||||||
@ -926,6 +937,7 @@ bool texture_config::load() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
finish_mapping();
|
finish_mapping();
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1033,7 +1045,9 @@ void showMenu() {
|
|||||||
dialog::addItem(XLAT("open PNG as texture"), 'o');
|
dialog::addItem(XLAT("open PNG as texture"), 'o');
|
||||||
dialog::addItem(XLAT("load texture config"), 'l');
|
dialog::addItem(XLAT("load texture config"), 'l');
|
||||||
dialog::addSelItem(XLAT("texture size"), its(config.data.twidth), 'w');
|
dialog::addSelItem(XLAT("texture size"), its(config.data.twidth), 'w');
|
||||||
|
#if CAP_EDIT
|
||||||
dialog::addItem(XLAT("paint a new texture"), 'n');
|
dialog::addItem(XLAT("paint a new texture"), 'n');
|
||||||
|
#endif
|
||||||
dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P');
|
dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,7 +1092,9 @@ void showMenu() {
|
|||||||
dialog::addColorItem(XLAT("mesh color"), config.mesh_color, 'm');
|
dialog::addColorItem(XLAT("mesh color"), config.mesh_color, 'm');
|
||||||
dialog::addSelItem(XLAT("color alpha"), its(config.color_alpha), 'c');
|
dialog::addSelItem(XLAT("color alpha"), its(config.color_alpha), 'c');
|
||||||
dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P');
|
dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P');
|
||||||
|
#if CAP_EDIT
|
||||||
dialog::addItem(XLAT("edit the texture"), 'e');
|
dialog::addItem(XLAT("edit the texture"), 'e');
|
||||||
|
#endif
|
||||||
dialog::addItem(XLAT("save the full texture image"), 'S');
|
dialog::addItem(XLAT("save the full texture image"), 'S');
|
||||||
dialog::addItem(XLAT("save texture config"), 's');
|
dialog::addItem(XLAT("save texture config"), 's');
|
||||||
}
|
}
|
||||||
@ -1149,6 +1165,7 @@ void showMenu() {
|
|||||||
config.tstate_max = tsOff;
|
config.tstate_max = tsOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CAP_EDIT
|
||||||
else if(uni == 'e' && config.tstate == tsActive) {
|
else if(uni == 'e' && config.tstate == tsActive) {
|
||||||
mapeditor::initdraw(cwt.c);
|
mapeditor::initdraw(cwt.c);
|
||||||
pushScreen(mapeditor::showDrawEditor);
|
pushScreen(mapeditor::showDrawEditor);
|
||||||
@ -1164,6 +1181,7 @@ void showMenu() {
|
|||||||
pushScreen(mapeditor::showDrawEditor);
|
pushScreen(mapeditor::showDrawEditor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
else if(uni == 't' && config.tstate == tsOff)
|
else if(uni == 't' && config.tstate == tsOff)
|
||||||
config.tstate = config.tstate_max;
|
config.tstate = config.tstate_max;
|
||||||
|
Loading…
Reference in New Issue
Block a user