diff --git a/dlangui.sln b/dlangui.sln index 5bba1782..49686615 100644 --- a/dlangui.sln +++ b/dlangui.sln @@ -38,6 +38,11 @@ Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "dmledit", "examples\dmledit {5FF17402-9997-4D0E-8068-6D84B8769D98} = {5FF17402-9997-4D0E-8068-6D84B8769D98} EndProjectSection EndProject +Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "d3d", "examples\d3d\d3d.visualdproj", "{55B79469-E5D8-4B58-89BD-5A3E11A696B0}" + ProjectSection(ProjectDependencies) = postProject + {5FF17402-9997-4D0E-8068-6D84B8769D98} = {5FF17402-9997-4D0E-8068-6D84B8769D98} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug COFF32|Any CPU = Debug COFF32|Any CPU @@ -390,6 +395,42 @@ Global {06D73450-2919-48A8-B2C3-738B12505D74}.TestDebug|Win32.ActiveCfg = Debug|Win32 {06D73450-2919-48A8-B2C3-738B12505D74}.TestDebug|Win32.Build.0 = Debug|Win32 {06D73450-2919-48A8-B2C3-738B12505D74}.TestDebug|x64.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug COFF32|Any CPU.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug COFF32|Mixed Platforms.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug COFF32|Mixed Platforms.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug COFF32|Win32.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug COFF32|Win32.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug COFF32|x64.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug GDC|Any CPU.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug GDC|Mixed Platforms.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug GDC|Mixed Platforms.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug GDC|Win32.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug GDC|Win32.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug GDC|x64.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug LDC|Any CPU.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug LDC|Mixed Platforms.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug LDC|Mixed Platforms.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug LDC|Win32.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug LDC|Win32.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug LDC|x64.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug|Win32.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug|Win32.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Debug|x64.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Release|Any CPU.ActiveCfg = Release|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Release|Mixed Platforms.Build.0 = Release|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Release|Win32.ActiveCfg = Release|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Release|Win32.Build.0 = Release|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.Release|x64.ActiveCfg = Release|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.TestDebug|Any CPU.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.TestDebug|Mixed Platforms.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.TestDebug|Mixed Platforms.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.TestDebug|Win32.ActiveCfg = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.TestDebug|Win32.Build.0 = Debug|Win32 + {55B79469-E5D8-4B58-89BD-5A3E11A696B0}.TestDebug|x64.ActiveCfg = Debug|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/dub.json b/dub.json index 730852ad..fa967163 100644 --- a/dub.json +++ b/dub.json @@ -33,6 +33,7 @@ "./examples/helloworld/", "./examples/example1/", "./examples/dmledit/", + "./examples/d3d/", "./examples/tetris/" ], @@ -63,6 +64,7 @@ "derelict-sdl2": "~>1.9.1", "gl3n": "~>1.0.1" } + "copyFiles-windows": ["lib/SDL2.dll"], }, { "name": "sfml", diff --git a/examples/d3d/d3d.visualdproj b/examples/d3d/d3d.visualdproj new file mode 100644 index 00000000..05d50817 --- /dev/null +++ b/examples/d3d/d3d.visualdproj @@ -0,0 +1,208 @@ + + {55B79469-E5D8-4B58-89BD-5A3E11A696B0} + + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2.043 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + $(DMDInstallDir)windows\bin\dmd.exe + $(SolutionDir)/src $(SolutionDir)/3rdparty $(SolutionDir)/3rdparty/libpng/source $(SolutionDir)/../DerelictGL3/source $(SolutionDir)/../DerelictUtil/source $(SolutionDir)/../DerelictFT/source $(SolutionDir)/../DerelictSDL2/source $(SolutionDir)/../de_image/source/interfaces $(SolutionDir)/../de_image/source/png $(SolutionDir)/../dlib + views views/res views/res/i18n views/res/mdpi + $(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(TargetName).json + 0 + + 0 + Unicode USE_OPENGL USE_FREETYPE USE_SDL EmbedStandardResources + 0 + 0 + 0 + + + + 0 + + 1 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib + + + + $(OutDir)\$(ProjectName).exe + 1 + 2 + + + + *.obj;*.cmd;*.build;*.json;*.dep + + + 0 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2.043 + 0 + 0 + 0 + 0 + 0 + $(CC) -c + 1 + $(DMDInstallDir)windows\bin\dmd.exe + + + $(ConfigurationName) + $(OutDir) + + + 0 + + + + + 0 + + + 1 + $(IntDir)\$(TargetName).json + 0 + + 0 + + 0 + 0 + 0 + + + + 0 + + 0 + $(VisualDInstallDir)cv2pdb\cv2pdb.exe + 0 + 0 + 0 + + + + ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib + + + + $(OutDir)\$(ProjectName).exe + 1 + 1 + + + + *.obj;*.cmd;*.build;*.json;*.dep + + + + + diff --git a/examples/d3d/dub.json b/examples/d3d/dub.json new file mode 100644 index 00000000..39b6f270 --- /dev/null +++ b/examples/d3d/dub.json @@ -0,0 +1,17 @@ +{ + "name": "d3d", + "description": "dlangui library example 3D Application", + "homepage": "https://github.com/buggins/dlangui", + "license": "Boost", + "authors": ["Vadim Lopatin"], + + "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi"], + + "targetPath": "bin", + "targetName": "d3d", + "targetType": "executable", + + "dependencies": { + "dlangui": "*", + } +} diff --git a/examples/d3d/src/d3d.d b/examples/d3d/src/d3d.d new file mode 100644 index 00000000..4d3f96a2 --- /dev/null +++ b/examples/d3d/src/d3d.d @@ -0,0 +1,54 @@ +module d3d; + +import dlangui; + +mixin APP_ENTRY_POINT; + +/// entry point for dlangui based application +extern (C) int UIAppMain(string[] args) { + // create window + Window window = Platform.instance.createWindow("DlangUI example - 3D Application", null); + + // create some widget to show in window + //window.mainWidget = (new Button()).text("Hello, world!"d).margins(Rect(20,20,20,20)); + window.mainWidget = parseML(q{ + VerticalLayout { + margins: 10 + padding: 10 + backgroundColor: "#C0E0E070" // semitransparent yellow background + // red bold text with size = 150% of base style size and font face Arial + TextWidget { text: "Hello World example for DlangUI"; textColor: "red"; fontSize: 150%; fontWeight: 800; fontFace: "Arial" } + // arrange controls as form - table with two columns + TableLayout { + colCount: 2 + TextWidget { text: "param 1" } + EditLine { id: edit1; text: "some text" } + TextWidget { text: "param 2" } + EditLine { id: edit2; text: "some text for param2" } + TextWidget { text: "some radio buttons" } + // arrange some radio buttons vertically + VerticalLayout { + RadioButton { id: rb1; text: "Item 1" } + RadioButton { id: rb2; text: "Item 2" } + RadioButton { id: rb3; text: "Item 3" } + } + TextWidget { text: "and checkboxes" } + // arrange some checkboxes horizontally + HorizontalLayout { + CheckBox { id: cb1; text: "checkbox 1" } + CheckBox { id: cb2; text: "checkbox 2" } + } + } + HorizontalLayout { + Button { id: btnOk; text: "Ok" } + Button { id: btnCancel; text: "Cancel" } + } + } + }); + + // show window + window.show(); + + // run message loop + return Platform.instance.enterMessageLoop(); +} diff --git a/examples/d3d/views/res/i18n/en.ini b/examples/d3d/views/res/i18n/en.ini new file mode 100644 index 00000000..576671ef --- /dev/null +++ b/examples/d3d/views/res/i18n/en.ini @@ -0,0 +1,40 @@ +EXIT=Exit +MENU_FILE=&File +MENU_FILE_NEW=&New +MENU_FILE_OPEN=&Open +MENU_FILE_OPEN_RECENT=Open recent +MENU_FILE_SAVE=&Save +MENU_FILE_EXIT=E&xit +MENU_EDIT=&Edit +MENU_EDIT_COPY=&Copy +MENU_EDIT_PASTE=&Paste +MENU_EDIT_CUT=Cu&t +MENU_EDIT_UNDO=&Undo +MENU_EDIT_REDO=&Redo +MENU_EDIT_INDENT=Indent block +MENU_EDIT_UNINDENT=Unindent block +MENU_EDIT_TOGGLE_LINE_COMMENT=Toggle line comment +MENU_EDIT_TOGGLE_BLOCK_COMMENT=Toggle block comment +MENU_EDIT_PREFERENCES=&Preferences +MENU_VIEW=&View +MENU_VIEW_LANGUAGE=Interface &Language +MENU_VIEW_LANGUAGE_EN=English +MENU_VIEW_LANGUAGE_RU=Русский +MENU_VIEW_THEME=&Theme +MENU_VIEW_THEME_DEFAULT=Default +MENU_VIEW_THEME_DARK=Dark +MENU_VIEW_THEME_CUSTOM1=Custom 1 +MENU_WINDOW=&Window +MENU_WINDOW_PREFERENCES=&Preferences +MENU_HELP=&Help +MENU_HELP_VIEW_HELP=&View help +MENU_HELP_ABOUT=&About +MENU_DEBUG_UPDATE_PREVIEW=Update Preview + +TAB_LONG_LIST=Long list +TAB_BUTTONS=Buttons +TAB_ANIMATION=Animation +TAB_TABLE_LAYOUT=Table layout +TAB_EDITORS=Editors +TAB_CANVAS=Canvas + diff --git a/examples/d3d/views/res/i18n/ru.ini b/examples/d3d/views/res/i18n/ru.ini new file mode 100644 index 00000000..ab52d3d0 --- /dev/null +++ b/examples/d3d/views/res/i18n/ru.ini @@ -0,0 +1,34 @@ +EXIT=Выход +MENU_FILE=&Файл +MENU_FILE_OPEN=&Открыть +MENU_FILE_OPEN_RECENT=Открыть из последних +MENU_FILE_SAVE=&Сохранить +MENU_FILE_EXIT=Вы&ход +MENU_EDIT=&Правка +MENU_EDIT_COPY=&Копировать +MENU_EDIT_PASTE=&Вставить +MENU_EDIT_CUT=Вырезать +MENU_EDIT_UNDO=&Отмена +MENU_EDIT_REDO=&Повторить +MENU_EDIT_PREFERENCES=&Настройки +MENU_VIEW=&Вид +MENU_VIEW_LANGUAGE=&Язык интерфейса +MENU_VIEW_LANGUAGE_EN=English +MENU_VIEW_LANGUAGE_RU=Русский +MENU_VIEW_THEME=&Тема +MENU_VIEW_THEME_DEFAULT=Стандартная +MENU_VIEW_THEME_DARK=Тёмная +MENU_VIEW_THEME_CUSTOM1=Пример 1 +MENU_WINDOW=&Окно +MENU_WINDOW_PREFERENCES=&Настройки +MENU_HELP=&Справка +MENU_HELP_VIEW_HELP=&Просмотр справки +MENU_HELP_ABOUT=&О программе + +TAB_LONG_LIST=Длинный список +TAB_BUTTONS=Кнопки +TAB_ANIMATION=Анимация +TAB_TABLE_LAYOUT=Табличный layout +TAB_EDITORS=Редакторы + + diff --git a/examples/d3d/views/res/mdpi/cr3_logo.png b/examples/d3d/views/res/mdpi/cr3_logo.png new file mode 100644 index 00000000..6e0d94ea Binary files /dev/null and b/examples/d3d/views/res/mdpi/cr3_logo.png differ diff --git a/examples/d3d/views/res/mdpi/tx_fabric.jpg b/examples/d3d/views/res/mdpi/tx_fabric.jpg new file mode 100644 index 00000000..6c33894a Binary files /dev/null and b/examples/d3d/views/res/mdpi/tx_fabric.jpg differ diff --git a/examples/d3d/views/resources.list b/examples/d3d/views/resources.list new file mode 100644 index 00000000..0abcf429 --- /dev/null +++ b/examples/d3d/views/resources.list @@ -0,0 +1,4 @@ +res/i18n/en.ini +res/i18n/ru.ini +res/mdpi/cr3_logo.png +res/mdpi/tx_fabric.jpg