Thread overview | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 20, 2014 DlangUI | ||||
---|---|---|---|---|
| ||||
Hello! I would like to announce my project, DlangUI library - cross-platform GUI for D. https://github.com/buggins/dlangui License: Boost License 1.0 Native library written in D (not a wrapper to other GUI library) - easy to extend. As a backend, uses SDL2 on any platform, Win32 API on Windows, XCB on Linux. Other backends can be added easy. Tested on Windows and Linux. Supports hardware acceleration - drawing using OpenGL when built with version=USE_OPENGL. Unicode support. Internationalization support. Uses Win32 API fonts on Windows, and FreeType on other platforms. Same look and feel can be achieved on all platforms. Flexible look and feel - themes and styles. API is a bit similar to Android UI. Flexible layout, support of different screen DPI, scaling. Uses two phase layout like in Android. Supports drawable resources in .png and .jpeg, nine-patch pngs and state drawables like in Android. Single threaded. Use other threads for performing slow tasks. Mouse oriented. Actually, it's a port (with major redesign) of my library used for cross-platform version of my application CoolReader from C++. State of project: alpha. But, already can be used for simple 2D games and simple GUI apps. I'm keeping in mind a goal to write D language IDE based on dlangui. :) Adding support of 3D graphics is planned. Currently implemented widgets: TextWidget - simple static text (TODO: implement multiline formatting) ImageWidget - static image Button - simple button with text label ImageButton - image only button TextImageButton - button with icon and label CheckBox - check button with label RadioButton - radio button with label EditLine - single line edit EditBox - multiline editor VSpacer - vertical spacer - just an empty widget with layoutHeight == FILL_PARENT, to fill vertical space in layouts HSpacer - horizontal spacer - just an empty widget with layoutWidth == FILL_PARENT, to fill horizontal space in layouts ScrollBar - scroll bar TabControl - tabs widget, allows to select one of tabs TabHost - container for pages controlled by TabControl TabWidget - combination of TabControl and TabHost Layouts - Similar to layouts in Android LinearLayout - layout children horizontally or vertically depending on orientation VerticalLayout - just a LinearLayout with vertical orientation HorizontalLayout - just a LinearLayout with vertical orientation FrameLayout - all children occupy the same place; usually onle one of them is visible TableLayout - children are aligned into rows and columns of table List Views - similar to lists in Android UI API. ListWidget - layout dynamic items horizontally or vertically (one in row/column) with automatic scrollbar; can reuse widgets for similar items ListAdapter - interface to provide data and widgets for ListWidget WidgetListAdapter - simple implementation of ListAdapter interface - just a list of widgets (one per list item) to show Sample project, example1 contains demo code for most of dlangui API. Try it using DUB: git clone https://github.com/buggins/dlangui.git cd dlangui dub run dlangui:example1 Fonts note: on Linux, several .TTFs are loaded from hardcoded paths (suitable for Ubuntu). TODO: add fontconfig support to access all available system fonts. Helloworld: // main.d import dlangui.all; mixin DLANGUI_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/") // for Mono-D builds ]; // 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).textColor(0xFF0000); // red text // show window window.show(); // run message loop return Platform.instance.enterMessageLoop(); } DDOC generated documentation can be found there: https://github.com/buggins/dlangui/tree/master/docs For more info see readme and example1 code. I would be glad to see any feedback. Can this project be useful for someone? What features/widgets are must have for you? Best regards, Vadim <coolreader.org@gmail.com> |
May 20, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vadim Lopatin | Nice work. As a guy who has worked on trying to get bindings for existing GUI libraries to work and noting all of the issues, I appreciate any effort in writing native libraries. The way I see it, wrapper libraries might possibly be as good as using the libraries from the native language some day, but they will never be better. Native D GUI libraries hold more potential for the future. |
May 20, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vadim Lopatin | Awesome! I can't wait to try it out. Some screenshots in the README would be much appreciated, though |
May 20, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vadim Lopatin | On Tuesday, 20 May 2014 at 18:13:36 UTC, Vadim Lopatin wrote:
> Hello!
>
> I would like to announce my project, DlangUI library - cross-platform GUI for D.
> https://github.com/buggins/dlangui
> License: Boost License 1.0
>
> Native library written in D (not a wrapper to other GUI library) - easy to extend.
> As a backend, uses SDL2 on any platform, Win32 API on Windows, XCB on Linux. Other backends can be added easy.
> Tested on Windows and Linux.
> Supports hardware acceleration - drawing using OpenGL when built with version=USE_OPENGL.
> Unicode support.
> Internationalization support.
> Uses Win32 API fonts on Windows, and FreeType on other platforms.
> Same look and feel can be achieved on all platforms.
> Flexible look and feel - themes and styles.
> API is a bit similar to Android UI.
> Flexible layout, support of different screen DPI, scaling.
> Uses two phase layout like in Android.
> Supports drawable resources in .png and .jpeg, nine-patch pngs and state drawables like in Android.
> Single threaded. Use other threads for performing slow tasks.
> Mouse oriented.
>
> Actually, it's a port (with major redesign) of my library used for cross-platform version of my application CoolReader from C++.
>
>
> State of project: alpha. But, already can be used for simple 2D games and simple GUI apps.
> I'm keeping in mind a goal to write D language IDE based on dlangui. :)
> Adding support of 3D graphics is planned.
>
>
> Currently implemented widgets:
>
> TextWidget - simple static text (TODO: implement multiline formatting)
> ImageWidget - static image
> Button - simple button with text label
> ImageButton - image only button
> TextImageButton - button with icon and label
> CheckBox - check button with label
> RadioButton - radio button with label
> EditLine - single line edit
> EditBox - multiline editor
> VSpacer - vertical spacer - just an empty widget with layoutHeight == FILL_PARENT, to fill vertical space in layouts
> HSpacer - horizontal spacer - just an empty widget with layoutWidth == FILL_PARENT, to fill horizontal space in layouts
> ScrollBar - scroll bar
> TabControl - tabs widget, allows to select one of tabs
> TabHost - container for pages controlled by TabControl
> TabWidget - combination of TabControl and TabHost
>
> Layouts - Similar to layouts in Android
>
> LinearLayout - layout children horizontally or vertically depending on orientation
> VerticalLayout - just a LinearLayout with vertical orientation
> HorizontalLayout - just a LinearLayout with vertical orientation
> FrameLayout - all children occupy the same place; usually onle one of them is visible
> TableLayout - children are aligned into rows and columns of table
>
> List Views - similar to lists in Android UI API.
> ListWidget - layout dynamic items horizontally or vertically (one in row/column) with automatic scrollbar; can reuse widgets for similar items
> ListAdapter - interface to provide data and widgets for ListWidget
> WidgetListAdapter - simple implementation of ListAdapter interface - just a list of widgets (one per list item) to show
>
>
> Sample project, example1 contains demo code for most of dlangui API.
>
> Try it using DUB:
>
> git clone https://github.com/buggins/dlangui.git
> cd dlangui
> dub run dlangui:example1
>
> Fonts note: on Linux, several .TTFs are loaded from hardcoded paths (suitable for Ubuntu).
> TODO: add fontconfig support to access all available system fonts.
>
> Helloworld:
>
> // main.d
> import dlangui.all;
> mixin DLANGUI_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/") // for Mono-D builds
> ];
>
> // 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).textColor(0xFF0000); // red text
> // show window
> window.show();
> // run message loop
> return Platform.instance.enterMessageLoop();
> }
>
> DDOC generated documentation can be found there: https://github.com/buggins/dlangui/tree/master/docs
> For more info see readme and example1 code.
>
> I would be glad to see any feedback.
> Can this project be useful for someone? What features/widgets are must have for you?
>
>
> Best regards,
> Vadim <coolreader.org@gmail.com>
>
Awesome.
Does this work like a conventional GUI toolkit (Gtk/Qt) or could I integrate this in an OpenGL game? (or would I have to integrate the game in it?)
|
May 20, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kiith-Sa | On Tuesday, 20 May 2014 at 20:06:12 UTC, Kiith-Sa wrote:
> Awesome.
>
> Does this work like a conventional GUI toolkit (Gtk/Qt) or could I integrate this in an OpenGL game? (or would I have to integrate the game in it?)
Both ways available.
But I think, it's better to integrate game into it.
Otherwise you have to write more code.
|
May 20, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vadim Lopatin |
> Helloworld:
>
> // main.d
> import dlangui.all;
> mixin DLANGUI_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/") // for Mono-D builds
> ];
>
> // 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).textColor(0xFF0000); // red text
> // show window
> window.show();
> // run message loop
> return Platform.instance.enterMessageLoop();
> }
>
> DDOC generated documentation can be found there: https://github.com/buggins/dlangui/tree/master/docs
> For more info see readme and example1 code.
>
> I would be glad to see any feedback.
> Can this project be useful for someone? What features/widgets are must have for you?
>
>
> Best regards,
> Vadim <coolreader.org@gmail.com>
>
Nice work.
Some days ago,I test the hello world ,it need 19M Memory Usage,but now,it's 31M,maybe have some error?
Thank you.
Nice work.
|
May 21, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to FrankLike | On Tuesday, 20 May 2014 at 22:18:14 UTC, FrankLike wrote:
> Nice work.
> Some days ago,I test the hello world ,it need 19M Memory Usage,but now,it's 31M,maybe have some error?
> Thank you.
> Nice work.
:)
Not as bad as you expected.
Tried win32 release build w/o USE_SDL and USE_OPENGL version
constants (using win32 API only).
helloworld.exe executable size 813k, memory 6.6M on start
example1.exe executable size 847k, memory 6.7M on start
As I see, memory consumption grows while app is working.
Probably, extra GC allocations, or some resources leaking.
Can be reduced a bit, e.g. by moving to libpng from libfreeimage.
Main limitation here - app needs buffer for 32bit RGBA bitmap
buffer to draw into.
|
May 22, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vadim Lopatin | Nice to hear ! Will definitely try it out ! Regarding documentation, just some notes: > DDOC generated documentation can be found there: https://github.com/buggins/dlangui/tree/master/docs > For more info see readme and example1 code. You might want to store them in the "gh-pages" branch (https://pages.github.com/). That will provide you a website where you can host your pages (as versioning them will soon be very impractical to anyone cloning your repository). Also, you may be interested by DDOX (dub --build=ddox). |
May 22, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias LANG | On Thursday, 22 May 2014 at 04:32:27 UTC, Mathias LANG wrote: > Nice to hear ! Will definitely try it out ! > > Regarding documentation, just some notes: > >> DDOC generated documentation can be found there: https://github.com/buggins/dlangui/tree/master/docs >> For more info see readme and example1 code. > > You might want to store them in the "gh-pages" branch (https://pages.github.com/). That will provide you a website where you can host your pages (as versioning them will soon be very impractical to anyone cloning your repository). > Also, you may be interested by DDOX (dub --build=ddox). Thank you! Docs moved to gh-pages: http://buggins.github.io/dlangui/index.html |
May 22, 2014 Re: DlangUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vadim Lopatin | Some screenshots added: http://buggins.github.io/dlangui/screenshots.html |
Copyright © 1999-2021 by the D Language Foundation