]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/colorpicker_string.c
Colorpickers now load and remember (when they get re-enabled) the color position
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / colorpicker_string.c
index f56cc74661bbb6ab75c677d66b9d2e7e80467446..fd411d54572a896d385cf27eb3cb348626b9e709 100644 (file)
@@ -28,7 +28,7 @@ void XonoticColorpickerString_configureXonoticColorpickerString(entity me, strin
 {
        me.cvarName = theCvar;
        me.configureImage(me, me.image);
-       me.prevcoords = '1 1 0';
+       me.prevcoords = color_hslimage(stov(cvar_string(theCvar)), me.imagemargin);
 }
 
 float XonoticColorpickerString_mousePress(entity me, vector coords)
@@ -70,10 +70,12 @@ void XonoticColorpickerString_draw(entity me)
 
        SUPER(XonoticColorpickerString).draw(me);
 
-       if(me.disabled)
-               me.prevcoords = '1 1 0';
-       else
-               draw_Picture(me.imgOrigin + me.prevcoords - '0.05 0.125 0', strcat(me.src, "_selected"), '0.1 0.25 0', '1 1 1', 1);
+       vector sz;
+       sz = draw_PictureSize(strcat(me.src, "_selected"));
+       sz = globalToBoxSize(sz, draw_scale);
+
+       if(!me.disabled)
+               draw_Picture(me.imgOrigin + me.prevcoords - 0.5 * sz, strcat(me.src, "_selected"), sz, '1 1 1', 1);
        draw_alpha = save;
 }
 #endif