瀏覽代碼

big button

Laserlicht 2 月之前
父節點
當前提交
da1deef563
共有 3 個文件被更改,包括 28 次插入1 次删除
  1. 1 1
      client/lobby/SelectionTab.cpp
  2. 26 0
      client/render/AssetGenerator.cpp
  3. 1 0
      client/render/AssetGenerator.h

+ 1 - 1
client/lobby/SelectionTab.cpp

@@ -1189,7 +1189,7 @@ void CampaignSetSelector::update(int to)
 		if(i>=texts.size())
 			continue;
 
-		auto button = std::make_shared<CToggleButton>(Point(0, 10 + (i - to) * 40), AnimationPath::builtin("GSPBUTT"), CButton::tooltip(), [this, i](bool on){ close(); cb(i); });
+		auto button = std::make_shared<CToggleButton>(Point(0, 10 + (i - to) * 40), AnimationPath::builtin("GSPButtonClear"), CButton::tooltip(), [this, i](bool on){ close(); cb(i); });
 		button->setTextOverlay(texts[i], EFonts::FONT_SMALL, Colors::WHITE);
 		buttons.emplace_back(button);
 	}

+ 26 - 0
client/render/AssetGenerator.cpp

@@ -58,6 +58,8 @@ void AssetGenerator::initialize()
 		imageFiles[ImagePath::builtin("CampaignHc" + std::to_string(i) + "Image.png")] = [this, i](){ return createChroniclesCampaignImages(i);};
 	
 	animationFiles[AnimationPath::builtin("SPRITES/adventureLayersButton")] = createAdventureMapButton(ImagePath::builtin("adventureLayers.png"));
+	
+	animationFiles[AnimationPath::builtin("SPRITES/GSPButtonClear")] = createGSPButtonClear();
 
 	createPaletteShiftedSprites();
 }
@@ -535,3 +537,27 @@ AssetGenerator::AnimationLayoutMap AssetGenerator::createAdventureMapButton(cons
 
 	return layout;
 }
+
+AssetGenerator::AnimationLayoutMap AssetGenerator::createGSPButtonClear()
+{
+	auto baseImg = ENGINE->renderHandler().loadAnimation(AnimationPath::builtin("GSPBUTT"), EImageBlitMode::OPAQUE);
+	auto overlayImg = ENGINE->renderHandler().loadAnimation(AnimationPath::builtin("GSPBUT2"), EImageBlitMode::OPAQUE);
+
+	AnimationLayoutMap layout;
+	for(int i = 0; i < 4; i++)
+	{
+		ImagePath spriteName = ImagePath::builtin("GSPButtonClear" + std::to_string(i) + ".png");
+
+		imageFiles[spriteName] = [baseImg, overlayImg, i](){
+			auto newImg = ENGINE->renderHandler().createImage(baseImg->getImage(i)->dimensions(), CanvasScalingPolicy::IGNORE);
+			auto canvas = newImg->getCanvas();
+			canvas.draw(baseImg->getImage(i), Point(0, 0));
+			canvas.draw(overlayImg->getImage(i), Point(0, 0), Rect(0, 0, 20, 20));
+			return newImg;
+		};
+
+		layout[0].push_back(ImageLocator(spriteName, EImageBlitMode::SIMPLE));
+	}
+
+	return layout;
+}

+ 1 - 0
client/render/AssetGenerator.h

@@ -55,6 +55,7 @@ private:
 	CanvasPtr createPaletteShiftedImage(const AnimationPath & source, const std::vector<PaletteAnimation> & animation, int frameIndex, int paletteShiftCounter) const;
 	CanvasPtr createAdventureMapButtonClear(const PlayerColor & player) const;
 	AnimationLayoutMap createAdventureMapButton(const ImagePath & overlay);
+	AnimationLayoutMap createGSPButtonClear();
 
 	void createPaletteShiftedSprites();
 	void generatePaletteShiftedAnimation(const AnimationPath & source, const std::vector<PaletteAnimation> & animation);