Browse Source

added better buttons

meemknight 2 years ago
parent
commit
2401e6bb8a
2 changed files with 41 additions and 3 deletions
  1. 31 1
      Pika/pluggins/pluggins/sushiViewer/sushiViewer.cpp
  2. 10 2
      Pika/resources/logs.txt

+ 31 - 1
Pika/pluggins/pluggins/sushiViewer/sushiViewer.cpp

@@ -54,6 +54,37 @@ void SushiViewer::displaySushiTransformImgui(::sushi::Transform & e, glm::vec4 p
 			"\0bottom Right"
 			"\0absolute\0");
 
+		const char *names[] = {
+			"topLeft", "top Middle", "top Right", "middle Left", "center", "middle Right", 
+			"bottom Left", "bottom Middle", "bottom Right", "absolute",
+		};
+
+		{
+			bool selected[3 * 3 + 1] = {};
+			for (int y = 0; y < 3; y++)
+			{
+				for (int x = 0; x < 3; x++)
+				{
+					ImVec2 alignment = ImVec2((float)x, (float)y);
+				
+					if (x > 0) ImGui::SameLine();
+					ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, alignment);
+					if (ImGui::Button(names[x + y * 3], ImVec2(40, 40)))
+					{
+						copy.anchorPoint = x + y * 3;
+					}
+					ImGui::PopStyleVar();
+				}
+			}
+
+			ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {1,3});
+			if (ImGui::Button(names[sushi::Transform::absolute], ImVec2(40, 40)))
+			{
+				copy.anchorPoint = sushi::Transform::absolute;
+			}
+			ImGui::PopStyleVar();
+		}
+
 		ImGui::DragFloat2("Pos pixels", &e.positionPixels[0]);
 		ImGui::DragFloat2("Pos percentage", &e.positionPercentage[0], 0.01);
 
@@ -535,7 +566,6 @@ bool SushiViewer::update(pika::Input input, pika::WindowState windowState, Reque
 		img.dragBegin = {};
 	}
 
-
 	renderer.flush();
 
 	return true;

+ 10 - 2
Pika/resources/logs.txt

@@ -1,2 +1,10 @@
-#2023-09-09 21:29:34: Created container: SushiViewer
-#2023-09-09 21:31:38: Destroyed continer: SushiViewer #1
+#2023-09-09 21:32:24: Created container: SushiViewer
+#2023-09-09 21:37:11[warning]: Couldn't reloaded dll
+#2023-09-09 21:37:12: Reloaded dll
+#2023-09-09 21:38:23: Reloaded dll
+#2023-09-09 21:38:40: Reloaded dll
+#2023-09-09 21:45:04: Reloaded dll
+#2023-09-09 21:47:01: Reloaded dll
+#2023-09-09 21:47:59: Reloaded dll
+#2023-09-09 21:48:08: Reloaded dll
+#2023-09-09 21:48:43: Destroyed continer: SushiViewer #1