UFCFSU-30-13D Technologies for the Web Creating and Using GUI Components.

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
1 Lesson 5 Introduction to Cascading Style Sheets HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
UFCFSU-30-13D Technologies for the Web Creating and Updating a Graphical Heads-Up Display (HUD)
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
Flowchart Start Input weight and height
Computing Concepts Advanced HTML: Tables and Forms.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
3D Game Programming All in One By Kenneth C. Finney.
Customizing Outlook. Forms Window in which you enter and view information in Outlook Outlook Form Designer The environment in which you create and customize.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
Session 2 Tables and forms in HTML Adapted by Sophie Peter from original document by Charlie Foulkes.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Getting Started with Expression Web 3
 2D (not 3D) display or interface elements  GUI = Graphical User Interface  HUD = Heads Up Display  ex. player’s health, lives remaining, number of.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
Chapter 2 Developing a Web Page. A web page is composed of two distinct sections: –The head content –The body Creating Head Content and Setting Page Properties.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
Intro to Dreamweaver Web Design Section 7-1 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
GUI development with Matlab: GUI Front Panel Components 1 GUI front panel components In this section, we will look at -GUI front panel components -Programming.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Adobe Dreamweaver CS3 Revealed CHAPTER THREE: WORKING WITH TEXT AND IMAGES.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
UFCFS D Technologies for the Web Unity 3D: Review of Topics and Related Concepts.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Designer Basics.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Topics Introduction Scene Graphs
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
UFCEK-20-3Web Games Programming Unity 3D: Review of Topics Publishing for the Web.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Introduction to GUI in 1 Graphical User Interface 2 Nouf Almunyif.
Unity GUI Creating and Using GUI Components. Agenda GUI Components GUI Layout Using Styles and Skins for Design ‘Look and Feel’ Scripting GUI Communication.
Macromedia Dreamweaver 8 Revealed AND GRAPHICS WORKING WITH TEXT.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Macromedia Dreamweaver 8 Revealed WEB PAGE DEVELOPING A.
Problem Solving Methodology Rachel Gauci. Problem Solving Methodology Development Design Analysis Evaluation Solution requirements and constraints. Scope.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Creating a Java Application and Applet
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
Microsoft Expression Web - Illustrated Unit A: Getting Started With Microsoft Expression Web.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 Event-Driven Programming and Basic GUI Objects.
Laying out Elements with CSS
Java FX: Scene Builder.
Positioning Objects with CSS and Tables
Chap 7. Building Java Graphical User Interfaces
Chapter 13: Advanced GUIs and Graphics
Graphical User Interfaces -- Introduction
Tutorial 6 Creating Dynamic Pages
Week 6: Time and triggers!
Chapter 15: GUI Applications & Event-Driven Programming
Positioning Objects with CSS and Tables
Advanced GUIs and Graphics
Presentation transcript:

UFCFSU-30-13D Technologies for the Web Creating and Using GUI Components

UFCFSU-30-23D Technologies for the Web Agenda GUI Components GUI Layout Using Styles and Skins for Design ‘Look and Feel’ Scripting GUI Communication with World Objects

UFCFSU-30-23D Technologies for the Web Unity GUI Components The Unity Graphical User Interface (GUI) component library includes all the typical elements for building interfaces Buttons, Check Boxes, Radio Buttons, Text Fields, Edit Fields, Scroll Bars Unity also features horizontal and vertical sliders for controlling continuous value based data Components are positioned on a coordinate grid that relates to the current screen size of the deployed project Components can be grouped so that there screen position may be declared or modified collectively

UFCFSU-30-23D Technologies for the Web GUI Basics void OnGUI () { // Make a background box GUI.Box (new Rect (10,10,100,90), "Loader Menu"); // Make the first button. When pressed,load a scene if (GUI.Button (new Rect (20,40,80,20), "Level 1")) { Application.LoadLevel (1); } // Make the second button. if (GUI.Button (new Rect (20,70,80,20), "Level 2")) { Application.LoadLevel (2); }

UFCFSU-30-23D Technologies for the Web Example of GUI Box and Buttons

UFCFSU-30-23D Technologies for the Web Declaring GUI Controls Type (Position, Content) – Type is the control type e.g. Button, Label etc. The Position is the first argument in any GUI Control function. The argument itself is provided with a Rect() function. Rect() defines four properties: left-most position, top-most position, total width, total height. All of these values are provided in integers, which correspond to pixel values. All Unity GUI controls work in Screen Space, which is the resolution of the published player in pixels.

UFCFSU-30-23D Technologies for the Web Declaring GUI Controls Content - The second argument for a GUI Control is the actual content to be displayed with the Control. Most often you will want to display some text or an image on your Control. To display text, pass a string as the Content argument like this: void OnGUI () { GUI.Label (new Rect (0,0,100,50), ”Hello World"); } Thus GUI.Label is the Type, Rect (0,0,100, 50) is the Position (x=0, y=0, width of 100 (pixels), height of 50 (pixels)) Content is “Hello World” The keyword ‘new’ is required for C#

UFCFSU-30-23D Technologies for the Web GUI Styles and GUI Skins GUI Control appearances are dictated with GUIStyles. By default, when you create a Control without defining a GUIStyle, Unity's default GUIStyle is applied. GUIStyles are designed to mimic Cascading Style Sheets (CSS) for web browsers. Where the Control defines the content, the Style defines the appearance. This allows you to create combinations like a functional Toggle which looks like a normal Button. GUISkins are a collection of GUIStyles. Styles define the appearance of a GUI Control. You do not have to use a Skin if you want to use a Style.

UFCFSU-30-23D Technologies for the Web GUI Skins GUI Control appearances are dictated with GUIStyles. By default, when you create a Control without defining a GUIStyle, Unity's default GUIStyle is applied. GUIStyles are designed to mimic Cascading Style Sheets (CSS) for web browsers. Many different CSS methodologies have been adapted, including differentiation of individual state properties for styling, and separation between the content and the appearance. Where the Control defines the content, the Style defines the appearance. This allows you to create combinations like a functional Toggle which looks like a normal Button.

UFCFSU-30-23D Technologies for the Web Example GUIStyle

UFCFSU-30-23D Technologies for the Web Example GUISkin

UFCFSU-30-23D Technologies for the Web The OnGUI () method void OnGUI () { if (GUI.Button (new Rect (25, 25, 100, 30), "Button")) { // code here is executed when the Button is clicked }

UFCFSU-30-23D Technologies for the Web GUI Communication with another Script Game Object GUIControl.cs void OnGui(){ Button with code to handle event and communicate with aScript.cs aScript.cs Code to handle message sent by GUIControl.cs attached to dummy object

UFCFSU-30-23D Technologies for the Web GUI to Script Example Number of Missiles (Text Field) Fire! (Button) 16 (1 x 1) Cube Physics Wall

UFCFSU-30-23D Technologies for the Web Wall After Missile Launched via Fire Button

UFCFSU-30-23D Technologies for the Web OnGui() method to send message to function in launchMissile script “Launcher” Game Object GUIControl.cs void OnGui(){ Button with code to handle event and communicate with function in launchMissile.cs launchMissile.cs Code to handle message sent by GUIControl.cs

UFCFSU-30-23D Technologies for the Web The OnGUI () method in GUIControl.js // declare a variable of type GameObject public GameObject cannon; void OnGUI () { // assign the game object with the name //”Launcher” to the variable cannon = GameObject.Find("Launcher");

UFCFSU-30-23D Technologies for the Web The OnGUI () method if (GUI.Button (new Rect (10,10,50,40), "Fire!")) { /* get the component (script) called launchMissile and call the method it contains called fireMissile() */ cannon.GetComponent.fireMissile(); }

UFCFSU-30-23D Technologies for the Web method in launchMissile.js // this function is called when the fire button is pressed //in GUIControl.js public void fireMissile(){ Instantiate(aMissile, transform.position, transform.rotation); }

UFCFSU-30-23D Technologies for the Web Updating the TextField in GUIControl.js int numberOfMissiles = 0; String missileCount; GUI.TextField (new Rect (400, 30, 50, 20), missileCount, 25); void Update () { // convert the numberOfMissiles to a String Type // then assign value to missile count variable missileCount = numberOfMissiles.ToString(); }

UFCFSU-30-23D Technologies for the Web Summary The Unity Graphical User Interface (GUI) component library includes all the typical elements for building interfaces GUIStyles are designed to mimic Cascading Style Sheets (CSS) for web browsers. GUISkins are a collection of styles. By default, when you create a Control without defining a GUIStyle, Unity's default GUIStyle is applied. The method OnGUI() is used to include components that provide the interface look and feel. Communication to other scripts from OnGUI is achieved by using code which finds game objects that have named scripts attached, then reference the required method in that script. GameObject variableName; variableName = GameObject.Find(”GameObjectName"); variableName.GetComponent(scriptNameAttachedToGameObject).methodName();