Commit f9f6e20c authored by mercury233's avatar mercury233

Merge branch 'resize' into test

parents 5dc3b379 5326648a
...@@ -13,6 +13,8 @@ bool ImageManager::Initial() { ...@@ -13,6 +13,8 @@ bool ImageManager::Initial() {
if(!tCover[3]) if(!tCover[3])
tCover[3] = tCover[2]; tCover[3] = tCover[2];
tUnknown = NULL; tUnknown = NULL;
tUnknownFit = NULL;
tUnknownThumb = NULL;
tAct = driver->getTexture("textures/act.png"); tAct = driver->getTexture("textures/act.png");
tAttack = driver->getTexture("textures/attack.png"); tAttack = driver->getTexture("textures/attack.png");
tChain = driver->getTexture("textures/chain.png"); tChain = driver->getTexture("textures/chain.png");
...@@ -78,6 +80,11 @@ void ImageManager::RemoveTexture(int code) { ...@@ -78,6 +80,11 @@ void ImageManager::RemoveTexture(int code) {
void ImageManager::ResizeTexture() { void ImageManager::ResizeTexture() {
irr::s32 imgWidth = CARD_IMG_WIDTH * mainGame->xScale; irr::s32 imgWidth = CARD_IMG_WIDTH * mainGame->xScale;
irr::s32 imgHeight = CARD_IMG_HEIGHT * mainGame->yScale; irr::s32 imgHeight = CARD_IMG_HEIGHT * mainGame->yScale;
irr::s32 imgWidthThumb = CARD_THUMB_WIDTH * mainGame->xScale;
irr::s32 imgHeightThumb = CARD_THUMB_HEIGHT * mainGame->yScale;
float mul = (mainGame->xScale > mainGame->yScale) ? mainGame->yScale : mainGame->xScale;
irr::s32 imgWidthFit = CARD_IMG_WIDTH * mul;
irr::s32 imgHeightFit = CARD_IMG_HEIGHT * mul;
irr::s32 bgWidth = 1024 * mainGame->xScale; irr::s32 bgWidth = 1024 * mainGame->xScale;
irr::s32 bgHeight = 640 * mainGame->yScale; irr::s32 bgHeight = 640 * mainGame->yScale;
driver->removeTexture(tCover[0]); driver->removeTexture(tCover[0]);
...@@ -87,7 +94,11 @@ void ImageManager::ResizeTexture() { ...@@ -87,7 +94,11 @@ void ImageManager::ResizeTexture() {
if(!tCover[1]) if(!tCover[1])
tCover[1] = tCover[0]; tCover[1] = tCover[0];
driver->removeTexture(tUnknown); driver->removeTexture(tUnknown);
tUnknown = GetTextureFromFile("textures/unknown.jpg", imgWidth, imgHeight); driver->removeTexture(tUnknownFit);
driver->removeTexture(tUnknownThumb);
tUnknown = GetTextureFromFile("textures/unknown.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT);
tUnknownFit = GetTextureFromFile("textures/unknown.jpg", imgWidthFit, imgHeightFit);
tUnknownThumb = GetTextureFromFile("textures/unknown.jpg", imgWidthThumb, imgHeightThumb);
driver->removeTexture(tBackGround); driver->removeTexture(tBackGround);
tBackGround = GetTextureFromFile("textures/bg.jpg", bgWidth, bgHeight); tBackGround = GetTextureFromFile("textures/bg.jpg", bgWidth, bgHeight);
driver->removeTexture(tBackGround_menu); driver->removeTexture(tBackGround_menu);
...@@ -194,7 +205,7 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3 ...@@ -194,7 +205,7 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
} }
irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) { irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
if(code == 0) if(code == 0)
return tUnknown; return fit ? tUnknownFit : tUnknown;
int width = CARD_IMG_WIDTH; int width = CARD_IMG_WIDTH;
int height = CARD_IMG_HEIGHT; int height = CARD_IMG_HEIGHT;
if(fit) { if(fit) {
...@@ -218,16 +229,16 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) { ...@@ -218,16 +229,16 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
return GetTextureThumb(code); return GetTextureThumb(code);
} }
tMap[fit ? 1 : 0][code] = img; tMap[fit ? 1 : 0][code] = img;
return (img == NULL) ? tUnknown : img; return (img == NULL) ? (fit ? tUnknownFit : tUnknown) : img;
} }
if(tit->second) if(tit->second)
return tit->second; return tit->second;
else else
return mainGame->gameConf.use_image_scale ? tUnknown : GetTextureThumb(code); return mainGame->gameConf.use_image_scale ? (fit ? tUnknownFit : tUnknown) : GetTextureThumb(code);
} }
irr::video::ITexture* ImageManager::GetTextureThumb(int code) { irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if(code == 0) if(code == 0)
return tUnknown; return tUnknownThumb;
auto tit = tThumb.find(code); auto tit = tThumb.find(code);
int width = CARD_THUMB_WIDTH * mainGame->xScale; int width = CARD_THUMB_WIDTH * mainGame->xScale;
int height = CARD_THUMB_HEIGHT * mainGame->yScale; int height = CARD_THUMB_HEIGHT * mainGame->yScale;
...@@ -248,12 +259,12 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) { ...@@ -248,12 +259,12 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
} }
} }
tThumb[code] = img; tThumb[code] = img;
return (img == NULL) ? tUnknown : img; return (img == NULL) ? tUnknownThumb : img;
} }
if(tit->second) if(tit->second)
return tit->second; return tit->second;
else else
return tUnknown; return tUnknownThumb;
} }
irr::video::ITexture* ImageManager::GetTextureField(int code) { irr::video::ITexture* ImageManager::GetTextureField(int code) {
if(code == 0) if(code == 0)
......
...@@ -26,6 +26,8 @@ public: ...@@ -26,6 +26,8 @@ public:
irr::video::IVideoDriver* driver; irr::video::IVideoDriver* driver;
irr::video::ITexture* tCover[4]; irr::video::ITexture* tCover[4];
irr::video::ITexture* tUnknown; irr::video::ITexture* tUnknown;
irr::video::ITexture* tUnknownFit;
irr::video::ITexture* tUnknownThumb;
irr::video::ITexture* tAct; irr::video::ITexture* tAct;
irr::video::ITexture* tAttack; irr::video::ITexture* tAttack;
irr::video::ITexture* tNegated; irr::video::ITexture* tNegated;
......
...@@ -132,6 +132,7 @@ ...@@ -132,6 +132,7 @@
!system 569 请选择[%ls]的位置 !system 569 请选择[%ls]的位置
!system 570 请选择要变成不能使用的卡片区域 !system 570 请选择要变成不能使用的卡片区域
!system 571 请选择要移动到的位置 !system 571 请选择要移动到的位置
!system 572 请选择要放置指示物的卡
!system 1000 卡组 !system 1000 卡组
!system 1001 手卡 !system 1001 手卡
!system 1002 怪兽区 !system 1002 怪兽区
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment