1 // Written in the D programming language. 2 3 /** 4 This app is a Tetris demo for DlangUI library. 5 6 Synopsis: 7 8 ---- 9 dub run dlangui:tetris 10 ---- 11 12 Copyright: Vadim Lopatin, 2014 13 License: Boost License 1.0 14 Authors: Vadim Lopatin, coolreader.org@gmail.com 15 */ 16 module main; 17 18 import dlangui; 19 import model; 20 import gui; 21 import std.stdio; 22 23 24 /// Required for Windows platform: DMD cannot find WinMain if it's in library 25 mixin APP_ENTRY_POINT; 26 27 long n; 28 29 /// entry point for dlangui based application 30 extern (C) int UIAppMain(string[] args) { 31 32 //auto power2 = delegate(int X) { return X * X; }; 33 auto power2 = (int X) => X * X; 34 35 // embed resources listed in views/resources.list into executable 36 embeddedResourceList.addResources(embedResourcesFromList!("resources.list")()); 37 38 // select translation file - for english language 39 Platform.instance.uiLanguage = "en"; 40 // load theme from file "theme_default.xml" 41 Platform.instance.uiTheme = "theme_default"; 42 43 int n = 20; 44 { 45 import std.conv; 46 int a = n + 25; 47 string s = to!string(n); 48 n++; 49 } 50 int ccc = n; 51 // create window 52 Window window = Platform.instance.createWindow("DLangUI: Tetris game example"d, null, WindowFlag.Modal); 53 54 window.mainWidget = new GameWidget(); 55 56 window.windowIcon = drawableCache.getImage("dtetris-logo1"); 57 58 window.show(); 59 60 // run message loop 61 return Platform.instance.enterMessageLoop(); 62 } 63