Lecture 4 Using SpriteFonts

Slides:



Advertisements
Similar presentations
Create a Table of Contents Microsoft Word Help FAQ. How to create a table of contents in Microsoft Word Microsoft Word Help FAQ. How to create a table.
Advertisements

Word Tutorial 5 Working with Templates and Outlines
Internet Services and Web Authoring (CSET 226) Lecture # 5 HyperText Markup Language (HTML) 1.
Microsoft Word – Lesson 1
COMPUTER PROGRAMMING 2 Chapter 7 Sound. Objectives Find out how to prepare sounds for inclusion in Microsoft XNA projects. Incorporate sounds into XNA.
1 ADVANCED MICROSOFT POWERPOINT Lesson 5 – Using Advanced Text Features Microsoft Office 2003: Advanced.
Enhancing a Document. Objectives Change font and font size Change font color, style, and effects Change alignment and line spacing Change margin settings.
McGraw-Hill Career Education© 2008 by the McGraw-Hill Companies, Inc. All Rights Reserved. Office PowerPoint 2007 Lab 1 Creating a Presentation.
Whitmore/Stevenson: Strategies for Engineering Communication 1 of 9 Paper Résumés  Use white space effectively by providing adequate margins (about one.
Word Word Processing - typing, editing and formatting letters, reports, fax cover sheets, and so on- is perhaps the most common activity performed.
Microsoft Office 2003 Illustrated Brief Document Enhancing a.
Master Slide. Why Create a Master Slide Allows you to create slide layouts EXACTLY how you want it Keep things consistent from one slide to the next Save.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
Finishing 2D COSC 315 Fall 2014 Bridget M. Blodgett.
Display 480x800 QVGA 320x480 HVGA Capacitive touch 4 or more contact points Camera 5 mega pixels or more Dedicated camera button Hardware buttons.
CHAPTER 4 Images XNA Game Studio 4.0. Objectives Find out how the Content Manager lets you add pictures to Microsoft XNA games. Discover how pictures.
Advanced Lesson 4: Advanced Collaboration To prevent users from inserting, deleting, and renaming worksheets, protect the workbook. When you protect a.
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
Chapter 2 Developing a Web Page. Chapter 2 Lessons Introduction 1.Create head content and set page properties 2.Create, import, and format text 3.Add.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
Getting Started. XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to XNA Game.
Using Namepsaces  This section lists the namespaces that the application will be using frequently. Saves the programmer from specifying a fully qualified.
MSOffice WORD.
Developing the Game User Interface (UI) Lesson 5.
CREATING TEMPLATES CREATING CUSTOM CHARACTERS IMPORTING BATCH DATA SAVING DATA & TEMPLATES CREATING SERIES DATA PRINTING THE DATA.
IReport Demo Spring 2008 OEDSA Conference. Report Properties.
XNA Game Studio 4.0 Keyboard and Mouse Controls + more on Animated Sprites.
11 Making a Sprite Session 4.2. Session Overview  Describe the principle of a game sprite, and see how to create a sprite in an XNA game  Learn more.
Microsoft Office XP Illustrated Introductory, Enhanced Tables and Queries Using.
Rob Miles. How does an XNA game program work? Programs tell computers what to do A program is written in a programming language – C# is a programming.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 2 Modifying a Table and Creating.
Aaron Yuen 1 Outline 9.1Storyboarding & Charting Method for Game Design 9.2Game State in Game Development 9.3Game State Management 9.4GUI Assets for Gameplay.
 English follows the Modern Language Association (MLA) 7 th Edition format for documentation.  The final page of any sourced paper in the MLA style.
Designing a Web Page Layout Using a Professional Bitmap & Vector Graphic Editing Suite 1IT: Web Technologies – Design a Web Page Layout 2 Copyright © Texas.
Introduction to Microsoft Word Introduction to toolbars and buttons.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
11 Writing Text Session 5.1. Session Overview  Show how fonts are managed in computers  Discover the difference between bitmap fonts and vector fonts.
Playing with Sprites. XNA Game Lifecycle In the faceBall demo program we bounced a smiley face around the graphical display against a background image.
Google Presentations Create, Pictures, Animation, and More Holli Levy, 2013.
11 Using the Keyboard in XNA Session 9.1. Session Overview  Discover more detail on how the XNA keyboard is implemented  Find out how to use arrays.
XNA Tutorial 1 For CS134 Lecture. Overview Some of the hard work has already been done for you. If you build and run your game now, the GraphicsDeviceManager.
Rob Miles. Using data in an XNA game program An XNA game program Draw and Update methods that are called to run the game Colours are held in XNA as four.
Rob Miles. Creating a Broken MoodLight An XNA game contains game data which is used by the Draw and Update methods – Update updates the game data – Draw.
Unit 2 Software exploitation Part A: Word Processing.
MS Word Taking It To A New Level. You Think You Know Word You all use Word You know common functions: –Select typefaces and sizes –Bold, italics –Save.
2D Graphics CMT3311. This covers... How to make a transparent sprite How to add a sprite to your project and draw it Properties of sprites and how to.
CHAPTER 5 Text XNA Game Studio 4.0. Objectives Discover how text is drawn using Microsoft XNA. Add some font resources to your XNA program. Draw some.
XNA 4.0 Side Scrolling.
Week 2 - Monday CS361.
Creating Oracle Business Intelligence Interactive Dashboards
Using and Creating Sprites
Lesson 16 Enhancing Documents
Using a template to create a document
Microsoft Word Illustrated
Layout - you need to understand that a simple navigation bar:
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Collision Detection.
Side Scrolling Game Development.
B Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
H Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
B Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
MTA-4201 Game Programming Chapter 8 : Scrolling Background & Font
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Welcome To Microsoft Word 2016
Microsoft Excel 2007 – Level 2
W Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Collisions with Static Objects
H Customize this banner with your own message! Select the letter and add your own text. Use one character per slide.
Presentation transcript:

Lecture 4 Using SpriteFonts SpriteFontDemo

Creating SpriteFonts using the Content Manager 1. Open the MonoGame Content Manager and choose Add New Item. 2. Select SpriteFont Description and give this file an appropriate name. 1 3. After Saving, find the spritefont file and open it with a text editor. ..........next slide.......... 2 3

Setting the Font Properties <?xml version="1.0" encoding="utf-8"?> <!-- This file contains an xml description of a font, and will be read by the XNA Framework Content Pipeline. Follow the comments to customize the appearance of the font in your game, and to change the characters which are available to draw with. --> <XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics"> <Asset Type="Graphics:FontDescription"> <!-- Modify this string to change the font that will be imported. --> <FontName>SegoeUImono</FontName> <!-- Size is a float value, measured in points. Modify this value to change the size of the font. --> <Size>12</Size> <!-- Spacing is a float value, measured in pixels. Modify this value to change the amount of spacing in between characters. --> <Spacing>0</Spacing> <!-- UseKerning controls the layout of the font. If this value is true, kerning information will be used when placing characters. --> <UseKerning>true</UseKerning> <!-- Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic", and "Bold, Italic", and are case sensitive. --> <Style>Regular</Style> <!-- If you uncomment this line, the default character will be substituted if you draw or measure text that contains characters which were not included in the font. --> <!-- <DefaultCharacter>*</DefaultCharacter> --> <!-- CharacterRegions control what letters are available in the font. Every character from Start to End will be built and made available for drawing. The default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin character set. The characters are ordered according to the Unicode standard. See the documentation for more information. --> <CharacterRegions> <CharacterRegion> <Start> </Start> <End>~</End> </CharacterRegion> </CharacterRegions> </Asset> </XnaContent> spritefont files are writting in XML Open Office Word or any application that uses TrutType fonts to see the FontName to use. Set the Font Size Extra spacing between letters Whether Kerning is used. Set the Font Style Regular, Bold, Italic, or Bold Italic Save the edited file. If you mistype the FontName the SpriteFont will not create the .xnb file you need but, as with most XML files you wil not get much debugging help.

Class-Level Variables GraphicsDeviceManager graphics; SpriteBatch spriteBatch; SpriteFont BWayFont; SpriteFont BSMTFont; SpriteFont JJFont; SpriteFont ChFont; Vector2 fontPos1 = new Vector2(60,40); Vector2 fontPos2 = new Vector2(60, 80); Vector2 fontPos3 = new Vector2(60, 140); Vector2 fontPos4 = new Vector2(60, 180); SpriteFont is a pre-defined object type in MonoGame give SpriteFonts appropriate names. The upper left corner of the beginning of a text string is defined using a Vector2 data type.

LoadContent( ) Method SpriteFonts are loaded into named instances protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); BWayFont = Content.Load<SpriteFont>("Broadway"); BSMTFont = Content.Load<SpriteFont>("BrushScriptMT"); JJFont = Content.Load<SpriteFont>("JingJing"); ChFont = Content.Load<SpriteFont>("Chiller"); } SpriteFonts are loaded into named instances you defined in the class-level variables list. The name of the SpriteFont instance in Game1 and the name of the SpritFont file can be anything. It is suggested that name be chosen that make it easy to determine which Fonts are being used. The FontName you use in the XML (i.e. SpriteFont) document must EXACTLY match the TrueType name of the font.

the Draw( ) Method protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); spriteBatch.DrawString(BWayFont, "I never saw a purple cow", fontPos1, Color.White); spriteBatch.DrawString(BSMTFont, "I hope to never see one", fontPos2, Color.Yellow); spriteBatch.DrawString(JJFont, "but I can tell you this right now", fontPos3, Color.LightBlue); spriteBatch.DrawString(ChFont, "I'd rather see than be one.", fontPos4, Color.DeepPink); spriteBatch.End(); base.Draw(gameTime); }