Coder Social home page Coder Social logo

scalaui's Introduction

scalaui

Scala Native GUI framework based on libui

Example text editor

How it looks like in elementary

scalaui-texteditor

Getting Started

Once you have setup your Scala Native project and enviroment, you have to compile libui and, on linux, copy the libui.so.0 and libui.so files to /usr/lib (probably you need to change their permissions too).

Then you have to add the following to your build.sbt:

libraryDependencies += "it.lolgab" %%% "scalaui" % "0.0.1"

(there is no release yet, you have to publishLocal the library to let it work!)

Then you can import scalaui:

import scalaui._

We want to create a simple window with a button that prints "Hello World!" on the console when clicked.

First you have to define a method which will be executed everytime the button is clicked:

def greeting(): Unit = println("Hello World!")

Then you create a button in your Main object, passing a name and the method name followed by a _:

val button = new Button("My Button", greeting _)

Then you create a window passing the button as content:

val window = new Window("My Window", width = 200, height = 200, content = button)

Then you can actually trigger the creation of the window with all its components in your main method:

def main(args: Array[String]) = {
  scalaui.render(window)
}

You now should see a nice window with a button, let's click it:

It works! ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

scalaui's People

Contributors

densh avatar lolgab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.