Interno funkcioniranje modernog GUI-ja (korisničkog sučelja) na primjeru Unity 3D GUI frameworka Autor: Danko Kozar, 17.2.2010.

Slides:



Advertisements
Similar presentations
Flex Component Life-cycle. What is it? Sequence of steps that occur when you create a component object from a component class. As part of this process,
Advertisements

AS3: Events & Listeners eventListeners in ActionScript 3.
Chapter 9 Customizing Data with Web Controls. ASP.NET 2.0, Third Edition2.
® Copyright 2008 Adobe Systems Incorporated. All rights reserved. Flex Component Lifecycle: Halo and Spark Deepa Subramaniam Flex SDK
User Interface Programming in C#: Graphics
UFCFSU-30-13D Technologies for the Web Creating and Using GUI Components.
1 Silverlight Photography Website Framework Comparing Component-Based Designs in Adobe Flex and Microsoft Silverlight David Roossien For Prof. Robert Adams.
Advanced Java Class GUI – part 1. Intro to GUI GUI = Graphical User Interface -- “Gooey” Just because it’s “gooey” does not mean you may write messy code.
0 CS 160: Design Process: Implement Event-based UI Programming, Model-View-Controller, and the Web Jeffrey Nichols IBM Almaden Research Center
CS 112 GUI 06 May 2008 Bilkent. Java GUI API Containers: ◦ contain other GUI components. E.g, Window, Panel, Applet, Frame Dialog. Components: ◦ Buttons,
Canvas, SVG, Workers Doncho Minkov Telerik Corporation
Written by Liron Blecher
Izrada rješenja bez programiranja pomoću SharePoint Composites BORISLAV GRGIĆ, PERPETUUM MOBILE D.O.O.
Developing Flash MX 2004 Components Using the Version 2 Architecture CFUN-04 Chafic Kazoun, Senior Flash Developer B-Line Express:
ISP666 MVC & Design Patterns. Outline Review Event Programming Model Model-View-Controller Revisit Simple Calculator Break Design Patterns Exercise.
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.
Embedded Software SKKU 28 1 WebKit/EFL. Embedded Software SKKU 28 2 WebKit Parsing Layout and Painting WebKit and EFL Contents.
JavaScript Framework for Rich Apps in Every Browser Maura Wilder Joan Wortman
Accessible DOM scripting with ARIA Léonie Watson
SWING IF YOU GET LOST - IMPORTANT LINKS  Swing articles:
FLTK. Objectives Install and Use FLTK Widgets ◦Callbacks Handling event ◦System events ◦Mouse events ◦Keyboard events.
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
Events DOM Event Model. HTML Events "on" + event name attribute value is javascript javascript runs 1st return false to STOP browser event (if any)
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
Unity GUI Creating and Using GUI Components. Agenda GUI Components GUI Layout Using Styles and Skins for Design ‘Look and Feel’ Scripting GUI Communication.
The HotCiv GUI Instantiating the MiniDraw Framework.
Copyright© 2012 Microsoft Corporation Visio Services 2013 Mashup API Chris Hopkins Senior Consultant - Premier Developer Practice Microsoft.
Windows Forms in Visual Studio 2005: An in-depth look at key features Name: Joe Stegman Title: Lead Program Manager Session code.
Prof: doc.dr. Samir Lemeš student: Samir Hrnjić. System restore je komponenta Microsoftovih operativnih sistema Windows Serveri ne podržavaju opciju System.
Dependency injection Marko Tošić
® Copyright 2008 Adobe Systems Incorporated. All rights reserved. Creating New Components in Flex 3 and Beyond Deepa Subramaniam Flex SDK
Introduction to JavaScript Events Instructor: Sergey Goldman 1.
Release management na Azure platformi RENATO ŽELEZNJAK, Ekobit.
Instantiating the MiniDraw Framework
Immediate Mode GUI – Theory and Example
Petlje WHILE – WEND.
EE 422C Java FX.
William Roberts Ryan Hipple
Java Hello world !.
GUIs and Events CSE 3541/5541 Matt Boggus.
Nadgradnja klasa i nasljeđivanje – 3
CheckBox RadioButton RadioGroup
Naredbe ciklusa.
7. Rad sa AWT-komponentama
Petlje FOR - NEXT.
УБАЦИВАЊЕ ОКВИРА ЗА ДИЈАЛОГ И ТЕКСТ АПЛИКАЦИЈЕ
Komponente izbora i kontejnerske komponente
Java Klase (Classes).
Uvod u programiranje - matematika – X predavanje
Arrays and strings -2 (nizovi i znakovni nizovi)
Elektrotehnički fakultet – Podgorica Operativni sistemi
14 UNUTRAŠNJE I ANONIMNE KLASE
Arrays and strings -1 (nizovi i znakovni nizovi)
Android Lists and Fragments
Struktura MAC adrese i Ethernet okvira
Model-View-Controller (MVC) Pattern
M-datoteke.
Do While ... Loop struktura
Extend Text Editor to Draw shapes
EU Montenegro Inclusive Education Services Project (EU - MIESP)
Spajanje digitalnog prijamnika na video ili DVD snimač
BLOOMOVA TAKSONOMIJA I
Skup instrukcija procesora
Fakultet elektrotehnike i računarstva
Naredbe u php-u.
Programiranje - Naredbe za kontrolu toka programa – 3. dio
Getting Started with Milestone 2
Dvostruka autentifikacija
WEBASSEMBLY I .NET - WEB APLIKACIJE BUDUĆNOSTI
Presentation transcript:

Interno funkcioniranje modernog GUI-ja (korisničkog sučelja) na primjeru Unity 3D GUI frameworka Autor: Danko Kozar,

Unity = mlad proizvod, mali broj korisnika Javascript, C# 2.0, Mono Skripta Attachiranje skripte (kamera...) MonoBehaviour void Start() void Update() void OnGUI() Style

DEMO „native“ Unity GUI-ja

Krećete od onoga što imate (low level API) Gradite OOP „wrapper“ oko low level komponente IDrawable interface: public interface IDrawable { /// /// Draws stuff /// void Draw(); }

Pozicija, dimenzije Bounds => klasa Rectangle (struct Rect) Visible, Alpha, Color Eventi: EVENT_SHOW, EVENT_HIDE Draw(): PreRender() Render() PostRender()

DEMO: DisplayObject

Composite Singleton Intenzivno korištenje kompozicije Koristiti interfejse gdje god je moguće Invalidacija/validacija Klasa Rectangle Global, local, content (*) MVC (DataGrid + kolekcije)

UiComponent klasa ima tendenciju biti ogromna (gomila funkcionalnosti je u njoj) Razbiti UiComponent u hijerarhiju (EventDispatcher - DisplayObject – LifecycleComponent – InteractiveComponent) preglednosti radi Prednost: testiranje svakog dijela hijerarhije nezavisno Initialize() => invalidacija(*) propertyja, veličine i pozicije

Composite pattern Parent – child odnos AddChild(), RemoveChild() CreateChildren() => mjesto za kreiranje childova unutar containera Initialize(): Parent, Stage (propagacija) invalidacija(*) layouta Scrolling => global, local, content (*)

Konverzija koordinata: DisplayListMember: IGlobalLocal:  GlobalToLocal()  LocalToGlobal() Container: IGlobalContent:  GlobalToContent()  ContentToGlobal() ILocalContent:  LocalToContent()  ContentToLocal()

Kompozicija – Layout je child object od Containera Prednost: zamjena Layouta on-the-fly (Flex: OpenFlux) OpenFlux ILayout: Measure() LayoutChildren()

DEMO: Layout

IEventDispatcher AddEventListener() RemoveEventListener() DispatchEvent() „+=“ i „-=“ notacija

Top-most container „Srce krvotoka“ prema child komponenatama u hijerarhiji Update() Late event processing Validacija komponenti GuiStage => adapter za Stage na MonoBehaviour GuiApplication preko GuiStage pokreće Update() metodu u svakom frameu

InvalidateProperties() InvalidateSize() InvalidateLayout() InvalidatePosition() Osnovna ideja: Odgađa akcije do instanciranja childova u CreateChildren() metodi Agregiranje više identičnih promjena u jednu Update komponente jednom i to tik prije iscrtavanja

ValidateProperties() => CommitProperties() ValidateSize() => UpdateSize() [bottom-up!] ValidateLayout() => UpdateLayout() ValidatePosition() => UpdatePosition()

Ako propertyji parenta utječu na childove Ideja:  Odgađa akcije do nakon instanciranja childova u CreateChildren() metodi  Agregiranje više istih akcija u jednu  Update komponente tik prije iscrtavanja Primjer

SystemManager (mouse, key) ClickManager (traži kliknutu komponentu) ComponentManager (dohvat komponente po ID-ju) FocusManager (focus & blur) TabManager (tab => promjena fokusa) EventManager (event bubbling) Ideja: prebaciti često korištenu funkcionalnost na centralno mjesto Singleton ili statička klasa

DataGrid cell renderer => event dispatcher DataGrid => event listener GuiEvent (bubbles = true) Smanjuje broj potrebnih event listenera kod grafičkih komponenti DEMO: DataGrid + item editor

ListCollection Ispucavaju event u slučaju da: im je kompletni sadržaj promijenjen (EVENT_COLLECTION_CHANGE) je jedan item promijenjen (EVENT_ITEM_CHANGE) UpdateItem() Filter Sort

Model: EventDispatcher + Singleton Primjeri: ProductModel, CartModel View: DataList DataGrid IDataRenderer: object Data {get; set;} string DataField {get; set;}

 Happy coding!