mirror of https://github.com/buggins/dlangui.git
45 lines
1.7 KiB
D
45 lines
1.7 KiB
D
module app;
|
|
|
|
import dlangui.all;
|
|
import std.stdio;
|
|
import std.conv;
|
|
|
|
|
|
mixin APP_ENTRY_POINT;
|
|
|
|
/// entry point for dlangui based application
|
|
extern (C) int UIAppMain(string[] args) {
|
|
// resource directory search paths
|
|
string[] resourceDirs = [
|
|
appendPath(exePath, "../../../res/"), // for Visual D and DUB builds
|
|
appendPath(exePath, "../../../res/mdpi/"), // for Visual D and DUB builds
|
|
appendPath(exePath, "../../../../res/"),// for Mono-D builds
|
|
appendPath(exePath, "../../../../res/mdpi/"),// for Mono-D builds
|
|
appendPath(exePath, "res/"), // when res dir is located at the same directory as executable
|
|
appendPath(exePath, "../res/"), // when res dir is located at project directory
|
|
appendPath(exePath, "../../res/"), // when res dir is located at the same directory as executable
|
|
appendPath(exePath, "res/mdpi/"), // when res dir is located at the same directory as executable
|
|
appendPath(exePath, "../res/mdpi/"), // when res dir is located at project directory
|
|
appendPath(exePath, "../../res/mdpi/") // when res dir is located at the same directory as executable
|
|
];
|
|
|
|
// setup resource directories - will use only existing directories
|
|
Platform.instance.resourceDirs = resourceDirs;
|
|
// select translation file - for english language
|
|
Platform.instance.uiLanguage = "en";
|
|
// load theme from file "theme_default.xml"
|
|
Platform.instance.uiTheme = "theme_default";
|
|
|
|
// create window
|
|
Window window = Platform.instance.createWindow("My Window", null);
|
|
|
|
// create some widget to show in window
|
|
window.mainWidget = (new Button()).text("Hello world"d).margins(Rect(20,20,20,20));
|
|
|
|
// show window
|
|
window.show();
|
|
|
|
// run message loop
|
|
return Platform.instance.enterMessageLoop();
|
|
}
|