This commit is contained in:
@@ -1,25 +1,44 @@
|
||||
package gui;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import imgui.ImGui;
|
||||
import imgui.ImVec2;
|
||||
import imgui.app.Application;
|
||||
import imgui.app.Configuration;
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
// temp thing
|
||||
private static int[] values = new int[9 * 9];
|
||||
|
||||
@Override
|
||||
protected void configure(Configuration config) {
|
||||
config.setTitle("Let's play sudoku!");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initImGui(Configuration config) {
|
||||
super.initImGui(config);
|
||||
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
|
||||
public void process() {
|
||||
ImGui.begin("Window");
|
||||
ImGui.text("Hello, World!");
|
||||
ImGui.begin("Sudoku Window");
|
||||
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.showDemoWindow();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user