The Slate UI Framework Architecture & Tools Gerke Max Preussner

Slides:



Advertisements
Similar presentations
Chapter 11 Designing the User Interface
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Epic’s Build Tools & Infrastructure
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Game Framework & Sample Projects
Extensibility in UE4 Customizing Your Games and the Editor Gerke Max Preussner
Concurrency & Parallelism in UE4
V0.1 Inclusive and Accessible Application Design June 21, 2012.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Integrating a Cloud Service Joe Overview Example from our games Support in UE4 to achieve that.
Engine Overview A Programmer’s Glimpse at UE4 Gerke Max Preussner
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
0 CS 160: Design Process: Implement Event-based UI Programming, Model-View-Controller, and the Web Jeffrey Nichols IBM Almaden Research Center
Game Framework & Sample Projects
The Slate UI Framework Part 1: Introduction Gerke Max Preussner
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Other Interaction Styles: Direct Manipulation, Haptic, Multimedia, Multimodal, Virtual Reality, Video Games Dr.s Barnes and Leventhal.
Chapter 13: Designing the User Interface
ICS 665 Jesse Abdul. jQuery UI Overview  jQuery UI javascript library Includes all UI component functionality  jQuery UI CSS framework Includes standard.
1 Introduction to Human Computer Interaction  Livecode Overview  Based on Livecode User Guide from RunRev Ltd. (2010) 
An Overview of Qt - asankar1. Agenda About Qt –A brief intro of Qt Qt development tools –Tools used for building Qt application Qt Architecture –The underlying.
Python for S60 SmartPhones PostPC Workshop Fall 2006 Amnon Dekel.
 jQuery Mobile An Introduction. What is jQuery Mobile  A framework built on top of jQuery, used for creating mobile web applications  Designed to make.
Niklas Smedberg Senior Engine Programmer, Epic Games
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
© 2008 IBM Corporation Emerging Internet Technologies Real World Accessibility with ARIA Becky Gibson Web Accessibility Architect.
Tutorial 6 Using Form Tools and Creating Custom Forms
Tutorial 4: Using CSS for Page Layout. 2 Objectives Session 4.1 Explore CSS layout Compare types of floating layouts Examine code for CSS layouts View.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
1 CA201 Word Application Increasing Efficiency Week # 13 By Tariq Ibn Aziz Dammam Community college.
Tutorial 1 Getting Started with Adobe Dreamweaver CS3
14 Chapter 11: Designing the User Interface. 14 Systems Analysis and Design in a Changing World, 3rd Edition 2 Identifying and Classifying Inputs and.
Image processing Gladys Nzita-Mak. Input devices A mouse is used to interact with your computer, the user is able to move the mouse, click and select.
IE 411/511: Visual Programming for Industrial Applications
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
JavaScript Framework for Rich Apps in Every Browser Maura Wilder Joan Wortman
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Android Boot Camp for Developers Using Java, 3E
JavaScript - A Web Script Language Fred Durao
INFO 355Week #71 Systems Analysis II User and system interface design INFO 355 Glenn Booker.
Lection №5 Modern integrated development environment.
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
Chapter 2 – Introduction to the Visual Studio .NET IDE
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Chapter 1 Getting Started With Dreamweaver. Exploring the Dreamweaver Workspace The Dreamweaver workspace is where you can find all the tools to create.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
1 Pertemuan 01 Explore state-of-the art tools Matakuliah: U0344 / DESKTOP 1 Tahun: 2006.
1 EiffelMedia. 2 Overview Features of the library Documentation Demos Community Stats Roadmap.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
LCG AA Meeting 30 June 2004 Ilka Antcheva Graphics User Interface in ROOT.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 6 1 Creating Dynamic Pages.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
Introducing Scratch Learning resources for the implementation of the scenario
Build Hybrid Mobile Apps with Ionic, Angular, & Cordova Brian
TIZEN Native UI Builder Fajri Koto
Java FX: Scene Builder.
Working in the Forms Developer Environment
Chapter 2 – Introduction to the Visual Studio .NET IDE
Program and Graphical User Interface Design
Chapter 2 – Introduction to the Visual Studio .NET IDE
Tutorial 6 Creating Dynamic Pages
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

The Slate UI Framework Architecture & Tools Gerke Max Preussner max.preussner@epicgames.com Prepared and presented by Gerke Max Preussner for East Coast MiniDevCon 2014, November 12-13th Email max.preussner@epicgames.com in case of comments, questions or suggestions or visit our AnswerHub at http://answers.unrealengine.com

UE1, UE2 and UE3 In previous versions of Unreal Engine we used different third party UI frameworks, such as MFC, wxWidgets, Windows Forms and WPF. All these user interfaces were complicated, cluttered and not very customizable. In Unreal Engine 4 we have drastically changed how we approach user interfaces. We want our programs to be more intuitive, customizable, extensible and modern.

The result of this effort is our own UI framework called Slate. Here you can see a screenshot of the latest Unreal Editor, which is entirely done in Slate. As you can see, there is now a common look and feel. Parts of the user interface can be separated and arranged in their own windows. We also tried to hide a lot the advanced features by default – of course, they are still available though.

Slate Design & Principles Overview Features Concepts Tools Architecture Written entirely in C++ Platform agnostic (works on mobile and consoles, too!) SlateCore module provides low-level functionality Slate module contains library of common UI widgets Does not require Engine or Editor modules Current Use Cases Unreal Editor Standalone desktop applications Mobile applications In-game UI Slate is written entirely in C++ and runs on all platforms supported by Unreal Engine 4. We used it for the Unreal Editor, standalone desktop applications and tools, as well mobile apps. It can also be used for in-game UI, but I will talk about that in the second part of this presentation. Slate used to be just one C++ module, but we recently split it into two, and we may split up further in the near future.

Slate Design & Principles Overview Features Concepts Tools Styling Customize the visual appearance of your UI Images (PNGs and Materials), Fonts, Paddings, etc. Customizable user-driven layouts Input Handling Keyboard, mouse, joysticks, touch Key bindings support Render Agnostic Supports both Engine renderer and standalone renderers Large Widget Library Layout primitives, text boxes, buttons, images, menus, dialogs, message boxes, navigation, notifications, dock tabs, list views, sliders, spinners, etc. The appearance of widgets can be styled with a C++ based style system. We are currently working on making it better as part of UMG. The core of Slate takes care of all user input and translates it into events that your application can consume. Slate can render its UI with the Engine and without. Of course, Slate also comes with a large library of common UI widgets.

Slate Design & Principles Overview Features Concepts Tools Declarative Syntax Set of macros for declaring widget attributes Avoids layers of indirection Composition Compose entire widget hierarchies in a few lines of code Uses fluent syntax for ease of use Preferred over widget inheritance Any child slot can contain any other widget type Makes it very easy to rearrange UIs in code The two main concepts in Slate programming are Declarative Syntax and Composition. Declarative syntax is our way for creating UI widgets in C++ code. It is very compact and easy to read. Other UI frameworks heavily rely on widget inheritance, but Slate uses composition instead.

// Example custom button (some details omitted) class STextButton : public SCompoundWidget { public: SLATE_BEGIN_ARGS(SMyButton ) { } // The label to display on the button. SLATE_ATTRIBUTE(FText, Text) // Called when the button is clicked. SLATE_EVENT(FOnClicked, OnClicked) SLATE_END_ARGS() // Construct this button void Construct( const FArguments& InArgs ); }; // Button implementation (some details omitted) void STextButton::Construct ( const FArguments& InArgs ) { ChildSlot [ SNew(SButton) .OnClicked(InArgs._OnClicked) SNew(STextBlock) .Font(FMyStyle::GetFontStyle(“TextButtonFont")) .Text(InArgs._Text) .ToolTipText(LOCTEXT(“TextButtonToolTip", “Click Me!")) ]; } Here is a simple contrived example of these two concepts. On the left we declare a new button widget using Slate’s declarative syntax. The first macro declares an attribute for the button text, and the second macro declares an event delegate for when the button is clicked. There are several other macros available for declaring other types of widget attributes. On the right we see the button’s construction code. Notice that STextButton inherits from SCompoundWidget, one of the fundamental widget types, and we use composition to populate the button’s content. In this case we are simply wrapping an SButton widget that contains an STextBlock as its content, and we forward any widget arguments that may have been passed in.

Slate Design & Principles Overview Features Concepts Tools Widget Gallery Demonstrates all available Slate widgets and layouts Widget Inspector Visually debug and analyze your UI Can jump directly to widget code in Visual Studio or XCode UDK Remote iOS app for simulating touch devices on your PC Remote server is a plug-in (enabled by default) Primarily used for game development We also have a couple tools to help you develop your Slate based user interfaces. Slate comes with a cool visual debugging tool called Widget Inspector – I will demo it shortly. There is also an app for iOS that allows you to simulate touch input while developing your game or application on a desktop PC.

[Widget Reflector Demo]

[Widget Reflector Demo]

With a little bit of practice you will be able to visualize in your mind what Slate code will look like when rendered. On the top left we see the Color Picker widget. Below is the Widget Reflector with focus on the Color Wheel widget inside the color picker. Notice how all three representations show the same hierarchical relationships (blue, red, green boxes). Demo

You can get the UDK Remote app for iOS on the Apple App Store. We will soon rewrite this app in Slate, so it also works on Android.

Going A Little Deeper State Updates Widget Roles Anatomy Attributes Polling instead of Invalidation Avoids duplicate state data Exception: Non-trivial data models (use caches instead) Performance depends on number of visible widgets For updating its UI, Slate uses Polling instead of Invalidation. This avoid duplication of UI state data. It also means you have to be careful about the amount of work you are doing inside callback delegates. You can see in example for the color wheel that all properties are bound to delegates. The non-event delegates will be executed every tick.

Going A Little Deeper State Updates Widget Roles Anatomy Attributes Fundamental Widget Types SCompoundWidget – Can have nested child widgets SLeafWidget – Does not contain child widgets SPanel – Base class for layout panels Special Widgets SWidget – Root base class for all widgets (do not inherit!) SNullWidget – Empty default widget User Widgets More efficient in terms of compile time Although we mostly use composition for creating new widgets, SlateCore defines three truly fundamental widget types that are meant to be inherited. Most of your custom widgets will inherit from SCompoundWidget, or SLeafWidget if they have no children. Child slots must always contain a valid widget. SNullWidget is used to fill empty slots. User widgets were recently added and are still somewhat experimental.

Going A Little Deeper State Updates Widget Roles Anatomy Attributes SNullWidget SCompoundWidget SLeafWidget SPanel SBorder SImage SBox SButton STextBlock SCanvas SViewport SVirtualJoystick SGridPanel Here you can see how the widget types relate to each other, including some of the widgets I mentioned earlier. SWidget in red, fundamental widget types in blue, and usable widgets in green. The vast majority of widgets in the Engine code base are compound widgets.

Going A Little Deeper State Updates Widget Roles Anatomy Attributes Common Interfaces Arguments – Widget parameters that do not change Attributes – Parameters that are polled Event handlers – Usually named ‘OnSomeEvent’ Common Internals ComputeDesiredSize() - Calculates widget’s desired size ArrangeChildren() - Arranges children within allotted area OnPaint() – Draws the widget Widgets share a common anatomy. A widget’s appearance is usually controlled with Arguments and Attributes. You can also use setter and getter functions if you prefer. All widgets contain functions to compute their desired size, arrange their child widgets (if any) and paint themselves.

Going A Little Deeper State Updates Widget Roles Anatomy Attributes Common Attributes Enabled state, Visibility, Hit testability Tooltip Widget, Tooltip Text, Cursor Style Horizontal & Vertical Alignment , Padding Attributes Can Be: Constants, i.e. IsEnabled(false) Delegate bindings, i.e. IsEnabled(this, &SMyWidget::HandleIsEnabled) Lambdas are now supported, too!

In-Game UI HUD Canvas VP Widgets Game Menus FCanvas Low-level C++ API for drawing directly to the screen Has been part of Unreal Engine for many years All functions are in FCanvas class DrawText(), DrawTexture(), DrawTile(), etc. Use AHUD.Canvas to access the canvas object HHitProxy Provides basic interaction support for FCanvas Create one hit proxy per interactive object Hit proxy ID is sent to GPU for per-pixel hit tests While our previous presentation mainly focused on building UI for the Editor and standalone applications, this talk will be about game UI. The most common type of in-game UI is the Head-Up Display. The Engine currently provides two mechanisms to generate HUDs: Canvas and HUD Widgets.

In-Game UI HUD Canvas VP Widgets Game Menus UGameViewportClient Allows usage of Slate widgets inside game view port Use all features of Slate (except SWindow) Add/RemoveViewportWidgetContent() Things to keep in mind All added widgets will be layered on top of each other (SOverlay) Widgets should use TWeakObjPtr for UObject references A better way for creating in-game UI is to use viewport widgets. The game’s viewport client has an API that allows for adding and removing regular Slate widgets. Since all UI is usualy displayed inside the game’s window, the use of SWindow is generally discouraged (unless you really want to open external windows from your game).

Here is some sample code from our PlayerController class that adds and removes a virtual joystick widget to/from the viewport client on demand.

And here is what the virtual joystick looks like in game. Notice the two circles at the bottom left and right, which can be used to control player movement on a mobile device.

In-Game UI HUD Canvas VP Widgets Game Menus The Hard Way Use FCanvas to draw your own menus Not recommended The Custom Way Use HUD Widgets to create any menu layout The Lazy Way Use GameMenuBuilder for paged menus FGameMenuPage - Single menu page FGameMenuItem - An option in a menu page Can be customized and styled Mostly used for settings screens Another important type of game UI are in-game menus for settings or game controls. You can use either of the two techniques just mentioned, or you can leverage the new GameMenuBuilder to get up and running quickly. Most of our own in-game Uis are currently built with viewport widgets.

What’s New in 4.6? Slate Improvements Decreased impact on compilation time Split built-in widget library into multiple modules Named slots Unreal Motion Graphics (UMG) Artist friendly WYSIWYG editor 2D transformation and animation with Sequencer Blueprint integration & scripting Better styling system (work in progress) We continue to make improvements to Slate. We are currently putting a lot of effort into improving compilation times and breaking out the many available widgets into to separate modules. Of course, we have also released Unreal Motion Graphics, which is a user interface editor built on top of Slate. UMG exposes powerful Slate features, such as 2D transformation and Blueprint scripting in designer friendly ways.

Questions? Documentation, Tutorials and Help at: AnswerHub: Engine Documentation: Official Forums: Community Wiki: YouTube Videos: Community IRC: Unreal Engine 4 Roadmap lmgtfy.com/?q=Unreal+engine+Trello+ http://answers.unrealengine.com http://docs.unrealengine.com http://forums.unrealengine.com http://wiki.unrealengine.com http://www.youtube.com/user/UnrealDevelopmentKit #unrealengine on FreeNode The easiest way to learn more about Slate is to check out our extensive online documentation, which is available for free to everyone. Are there any questions right now?