This commit is contained in:
@@ -1,10 +1,17 @@
|
|||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import imgui.ImGui;
|
import imgui.ImGui;
|
||||||
|
import imgui.ImVec2;
|
||||||
import imgui.app.Application;
|
import imgui.app.Application;
|
||||||
import imgui.app.Configuration;
|
import imgui.app.Configuration;
|
||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
|
|
||||||
|
// temp thing
|
||||||
|
private static int[] values = new int[9 * 9];
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(Configuration config) {
|
protected void configure(Configuration config) {
|
||||||
config.setTitle("Let's play sudoku!");
|
config.setTitle("Let's play sudoku!");
|
||||||
@@ -14,12 +21,24 @@ public class Main extends Application {
|
|||||||
protected void initImGui(Configuration config) {
|
protected void initImGui(Configuration config) {
|
||||||
super.initImGui(config);
|
super.initImGui(config);
|
||||||
ImGui.getIO().getFonts().addFontFromFileTTF("comic.ttf", 50.0f);
|
ImGui.getIO().getFonts().addFontFromFileTTF("comic.ttf", 50.0f);
|
||||||
|
Random r = new Random();
|
||||||
|
for (int i = 0; i < 9 * 9; i++) {
|
||||||
|
values[i] = r.nextInt(9) + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process() {
|
public void process() {
|
||||||
ImGui.begin("Window");
|
ImGui.begin("Sudoku Window");
|
||||||
ImGui.text("Hello, World!");
|
for (int y = 0; y < 9; y++) {
|
||||||
|
for (int x = 0; x < 9; x++) {
|
||||||
|
if (x > 0)
|
||||||
|
ImGui.sameLine();
|
||||||
|
ImGui.pushID(y * 9 + x);
|
||||||
|
ImGui.selectable(Integer.toString(values[y * 9 + x]), false, 0, new ImVec2(50, 50));
|
||||||
|
ImGui.popID();
|
||||||
|
}
|
||||||
|
}
|
||||||
ImGui.end();
|
ImGui.end();
|
||||||
// ImGui.showDemoWindow();
|
// ImGui.showDemoWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user