Browse Source

If themes only use RGBA images, the systax can be closer to assigning images in layout files.

David Piuva 3 years ago
parent
commit
e6808a18ef

+ 4 - 5
Source/DFPSR/gui/VisualTheme.cpp

@@ -223,12 +223,11 @@ struct ClassSettings {
 			// Key = "text"
 			this->strings.pushConstruct(key, string_unmangleQuote(value));
 		} else {
-			int64_t pipeIndex = string_findFirst(value, U'|');
-			if (pipeIndex > -1 && string_caseInsensitiveMatch(string_before(value, pipeIndex), U"ImageRgbaU8")) {
-				// Key = ImageRgbaU8|File:Path
-				// Key = ImageRgbaU8|WxH:Hexadecimals
+			if (string_findFirst(value, U':') > -1) {
+				// Key = File:Path
+				// Key = WxH:Hexadecimals
 				PersistentImage newImage;
-				newImage.assignValue(string_after(value, pipeIndex), fromPath);
+				newImage.assignValue(value, fromPath);
 				this->colorImages.pushConstruct(key, newImage);
 			} else {
 				// Key = Integer

+ 13 - 1
Source/DFPSR/gui/VisualTheme.h

@@ -28,7 +28,19 @@
 
 namespace dsr {
 
-// TODO: Move to the API folder once themes are easy to create.
+
+
+// ---------------------------------------- WARNING! ----------------------------------------
+//
+//    This API is not yet finished and may break backwards compatibility before completed.
+//    It is not yet decided if the media machine will expose virtual assembly code,
+//    which syntax to define themes using or if themes should be bundled together into archives.
+//
+// ------------------------------------------------------------------------------------------
+
+
+
+// TODO: Move to the API folder once complete.
 
 // Create a theme using a virtual machine with functions to call, style settings telling which functions to call with what arguments, and a path to load any non-embedded images from.
 VisualTheme theme_createFromText(const MediaMachine &machine, const ReadableString &styleSettings, const ReadableString &fromPath);

+ 1 - 1
Source/tools/wizard/media/Theme.ini

@@ -1,5 +1,5 @@
 border = 2
-atlas = ImageRgbaU8|File:Style.png
+atlas = File:Style.png
 ; Image location in the atlas
 sourceLeft = 0
 sourceTop = 0