Coder Social home page Coder Social logo

bryanchance / dlangui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from buggins/dlangui

0.0 1.0 0.0 43.82 MB

Cross Platform GUI for D programming language

License: Boost Software License 1.0

Shell 0.06% D 98.59% PowerShell 0.01% Makefile 0.41% GLSL 0.92% Batchfile 0.02%

dlangui's Introduction

Dlang UI

PayPayl donate button

Cross platform GUI for D. Widgets, layouts, styles, themes, unicode, i18n, OpenGL based acceleration.

screenshot

GitHub page: https://github.com/buggins/dlangui

Project site: http://buggins.github.io/dlangui

API Documentation: http://buggins.github.io/dlangui/ddox

Wiki: https://github.com/buggins/dlangui/wiki/Home

Getting Started Tutorial: https://github.com/buggins/dlangui/wiki/Getting-Started

Screenshots: http://buggins.github.io/dlangui/screenshots.html

Coding style: https://github.com/buggins/dlangui/blob/master/CODING_STYLE.md

Main features:

  • Crossplatform (Win32, OSX, Linux and Android are supported in current version)
  • Mostly inspired by Android UI API (layouts, styles, two phase layout, ...)
  • Supports highly customizable UI themes and styles
  • Supports internationalization
  • Hardware acceleration using OpenGL (when built with version USE_OPENGL)
  • Fallback to pure Win32 API / SDL / X11 when OpenGL is not available (e.g. opengl dynamic library cannot be loaded)
  • Actually it's a port (with major refactoring) of GUI library for cross platform OpenGL based implementation of Cool Reader app project from C++.
  • Non thread safe - all UI operations should be preformed in single thread
  • Simple 3d engine - allows to embed 3D scenes within GUI

D compiler versions supported

Needs DMD frontend 2.100.2 or newer to build

Widgets

List of widgets, layouts and other is available in the Wiki

Resources

Resources like fonts and images use reference counting. For proper resource freeing, always destroy widgets implicitly.

  • FontManager: provides access to fonts
  • Images: .png or .jpg images; if filename ends with .9.png, it's autodetected as nine-patch image (see Android drawables description)
  • StateDrawables: .xml file can describe list of other drawables to choose based on widget's State (.xml files from android themes can be used directly)
  • imageCache allows to cache unpacked images
  • drawableCache provides access by resource id (string, usually filename w/o extension) to drawables located in specified list of resource directories.

Styles and Themes

Styles and themes are a bit similar to ones in Android API.

  • Theme is a container for styles. Can be load from XML theme resource file.
  • Styles are accessible in theme by string ID.
  • Styles can be nested to form hierarchy - when some attribute is missing in style, value from base style will be used.
  • State substyles are supported: allow to change widget appearance dynamically based on its state.
  • Widgets use style attributes directly from assigned style. When some attribute is being changed in widget, it creates its own copy of base style, which allows to modify some of attributes, while getting base style attributes if they are not changed in widget. This trick can minimize memory usage for widget attributes when standard values are used.
  • Current default theme is similar to one in MS Visual Studio 2013
  • Resources can be either embedded into executable or loaded from external resource directory in runtime

Important notice

If build of your app is failed due to dlangui or its dependencies, probably you have not upgraded dependencies.

Try following:

dub upgrade --force-remove
dub build --force

As well, sometimes removing of dub.json.selections can help.

Win32 builds

  • Under windows, uses SDL2 or Win32 API as backend.
  • Optionally, may use OpenGL acceleration
  • Uses Win32 API for font rendering.
  • Optinally can use FreeType for font rendering.
  • Executable size for release Win32 API based build is 830K.

Build and run demo app using DUB:

git clone --recursive https://github.com/buggins/dlangui.git
cd dlangui/examples/example1
dub run --build=release

To avoid showing console window add win_app.def file to your package source directory and add line to your dub.json.

win_app.def:

"sourceFiles": ["$PACKAGE_DIR/src/win_app.def"]

dub.json:

"sourceFiles-windows": ["$PACKAGE_DIR/src/win_app.def"],

Linux builds (DUB)

  • Uses SDL2 as a backend.

  • Uses FreeType for font rendering.

  • Uses FontConfig to get list of available fonts.

  • OpenGL can be optionally used for better drawing performance.

      libsdl2, libfreetype, libfontconfig
    

E.g. in Ubuntu, you can use following command to enable SDL2 backend builds:

sudo apt-get install libsdl2-dev

In runtime, .so for following libraries are being loaded (binary packages required):

freetype, opengl, fontconfig

Build and run on Linux using DUB:

cd examples/example1
dub run dlangui:example1

MacOS builds (DUB)

DlangUI theoretically supports MacOS, but I have no way of testing if it actually work. The support is not guaranteed.

Other platforms

  • Other platforms support may be added easy

Third party components used

  • binbc-opengl - for OpenGL support
  • bindbc-freetype + FreeType library support under linux and optionally under Windows.
  • bindbc-sdl + SDL2 for cross platform support
  • WindowsAPI bindings from http://www.dsource.org/projects/bindings/wiki/WindowsApi (patched)
  • X11 binding when SDL2 is not used
  • PNG and JPEG reading code is based on dlib sources

Hello World

Please refer to the Wiki for a hello world example.

DlangIDE project

It is a project to build D language IDE using DlangUI library.

But it already can open DUB based projects, edit, build and run them.

Simple syntax highlight.

DCD integration: go to definition and autocompletion for D source code.

Project page: https://github.com/buggins/dlangide

How to build and run using DUB:

git clone https://github.com/buggins/dlangide.git
cd dlangide
dub run

dlangui's People

Contributors

aferust avatar alphakai avatar and3md avatar buggins avatar dayllenger avatar default0 avatar denizzzka avatar disco1267 avatar doado avatar fr86 avatar freakazo avatar freeslave avatar gizmomogwai avatar grimmaple avatar hdon avatar john-colvin avatar keywan-ghadami avatar lastin avatar lemming-life avatar mrsmith33 avatar notspooky avatar seoyoungjin avatar shiche avatar superbelko avatar thedeemon avatar thegag96 avatar theyamo avatar tom-tan avatar triplejam avatar vennos5 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.