Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue