Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,31 @@
module winapp ;
import dfl.all ;
import std.string ;
class MainForm: Form {
Label label ;
Button button ;
this() {
width = 240 ;
with(label = new Label) {
text = "There have been no clicks yet" ;
dock = DockStyle.TOP ;
parent = this ;
}
with(button = new Button) {
dock = DockStyle.BOTTOM ;
text = "Click Me" ;
parent = this ;
click ~= &onClickButton ;
}
height = label.height + button.height + 36 ;
}
private void onClickButton(Object sender, EventArgs ea) {
static int count = 0 ;
label.text = "You had been clicked me " ~ std.string.toString(++count) ~ " times." ;
}
}
void main() {
Application.run(new MainForm);
}

View file

@ -0,0 +1,36 @@
module SimpleWindow;
import tango.text.convert.Integer;
import tango.core.Thread; // For Thread.yield
import xf.hybrid.Hybrid; //For widgets and general API
import xf.hybrid.backend.GL; // For OpenGL Renderer
void main() {
//load config file
scope cfg = loadHybridConfig(`./SimpleWindow.cfg`);
scope renderer = new Renderer;
auto counter = 0;
bool programRunning = true;
while (programRunning) {
// Tell Hybrid what config to use
gui.begin(cfg);
// Exit program if user clicks the Close button
if (gui().getProperty!(bool)("main.frame.closeClicked")) {
programRunning = false;
}
// Update text on the label
if (counter != 0)
Label("main.label").text = toString(counter);
// Increment counter if the button has been clicked
if (Button("main.button").clicked) {
counter++;
}
// Finalize. Prepare to render
gui.end();
// Render window using OpenGL Renderer
gui.render(renderer);
Thread.yield();
}
}