WPF Style GUI Library for Monogame Framework

Total Page:16

File Type:pdf, Size:1020Kb

WPF Style GUI Library for Monogame Framework Charles University in Prague Faculty of Mathematics and Physics BACHELOR THESIS Vítězslav Imrýšek WPF Style GUI Library for MonoGame Framework Department of Distributed and Dependable Systems Bachelor thesis supervisor: Mgr. Pavel Ježek, Ph.D. Study program: Computer Science Specialization: General Computer Science Prague 2015 Special thanks to Mgr. Pavel Ježek Ph.D. for supervising this thesis, and most of all for his patience and all his invaluable advices. I declare that I carried out this bachelor thesis independently, and only with the cited sources, literature and other professional sources. I understand that my work relates to the rights and obligations under the Act No. 121/2000 Coll., the Copyright Act, as amended, in particular the fact that the Charles University in Prague has the right to conclude a license agreement on the use of this work as a school work pursuant to Section 60 paragraph 1 of the Copyright Act. In Prague, date 3.12.2015 signature Název práce: MonoGame knihovna pro tvorbu GUI ve stylu WPF Autor: Vítězslav Imrýšek Katedra / Ústav: Katedra distribuovaných a spolehlivých systémů Vedoucí bakalářské práce: Mgr. Pavel Ježek, Ph.D., Katedra distribuovaných a spolehlivých systémů Abstrakt: MonoGame je populární multi-platformní open-source framework používaný pro vývoj her a dalších grafických aplikací. Nicméně tento framework samotný neposkytuje žádnou implicitní podporu pro vytváření uživatelských prostředí. A zatímco existuje řada knihoven třetích stran, které se tuto podporu snaží poskytnout, žádná z nich nemá za svůj cíl implementaci nějakého existujícího a hojně využívaného frameworku pro tvorbu uživatelských rozhraní. Tato práce se zaměřuje na tento nedostatek a poskytuje reimplementaci Windows Presentation Foundation (WPF) frameworku ve formě knihovny pro MonoGame. V rámci této práci jsme vybrali vhodnou podmnožinu vlastností, které budou implementovány a rovněž jsme vyřešili i řadu technických problémů, jako jakým způsobem renderovat naše geometrická primitiva, či jak implementovat podporu pro neobdélníkové ořezávání. V průběhu této práce byl kladen velký důraz na co nejpřesnější dodržování existujícího WPF API a jeho chování. Klíčová slova: MonoGame, WPF, Knihovna pro tvorbu uživatelských rozhraní Title: WPF Style GUI Library for MonoGame Framework Author: Vítězslav Imrýšek Department: Department of Distributed and Dependable Systems Supervisor of the bachelor thesis: Mgr. Pavel Ježek, Ph.D., Department of Distributed and Dependable Systems Abstract: MonoGame is a popular cross-platform open-source framework used for developing games and other graphical applications. However, this framework has no out-of-box support for user interface creation. And while there exist many third party UI libraries, none of them has the goal of implementing some existing, widely used user interface framework. For this thesis, we decided to target this shortcoming and reimplement the Windows Presentation Foundation framework, in form of a library, to MonoGame. As part of this work, we chosen a viable feature subset that is going to be implemented and solved many technical issues. Issues like how to render our graphical primitives or how to implement a non- rectangular clipping. The emphasis of the thesis was to follow the well-known WPF API and its behavior during the implementation process as closely as possible. Keywords: MonoGame, WPF, Library for creation of user interfaces Contents Graphical User Interface...................................................................... 4 GUIs in games ..................................................................................... 6 The API choice .................................................................................... 7 Windows Forms ............................................................................ 7 Windows Presentation Foundation ............................................... 8 Conclusion .................................................................................... 9 Thesis goals ......................................................................................... 9 Appearance and logic code ................................................................ 11 Controls ............................................................................................. 12 Input ................................................................................................... 13 Layout ................................................................................................ 14 UIElement ................................................................................... 14 FrameworkElement ..................................................................... 15 Containers ................................................................................... 16 Dependency properties ...................................................................... 17 Dependency objects .................................................................... 18 Data Binding ...................................................................................... 19 Graphics ............................................................................................. 20 2D geometrical shapes ................................................................ 20 3D geometrical shapes ................................................................ 22 Visual .......................................................................................... 22 Clipping ...................................................................................... 23 Text ............................................................................................. 24 Animations .................................................................................. 24 Custom controls ................................................................................. 24 UIElement and FrameworkElement model ................................ 24 User Control model ..................................................................... 25 Control model ............................................................................. 25 Existing projects ................................................................................ 27 Feature set .......................................................................................... 28 XAML markup code ................................................................... 29 Stock controls ............................................................................. 29 Stock controls customization ...................................................... 29 Custom controls .......................................................................... 30 Shapes and brushes ..................................................................... 31 Clipping ...................................................................................... 31 Data Bindings ............................................................................. 32 Handling user input ..................................................................... 32 Technical issues ................................................................................. 33 Drawing user interface ...................................................................... 33 Drawing geometrical shapes ....................................................... 33 Rendering the fill of graphical shapes ........................................ 34 Rendering the stroke of graphical shapes ................................... 39 Vertex buffer ............................................................................... 41 Text rendering ............................................................................. 41 Clipping ...................................................................................... 42 Optimizing the rendering ............................................................ 44 Processing user input ......................................................................... 45 Handling input ............................................................................ 45 Hit Testing .................................................................................. 46 Partial XAML markup support .......................................................... 47 Structure of the library....................................................................... 49 Overview of the rendering system ..................................................... 49 Class PresentationManager ......................................................... 52 Class Window ............................................................................. 53 Class Visual ................................................................................ 53 Class RenderDataDrawingContext ............................................. 54 Class RenderObject..................................................................... 55 Class RenderObjectLine ............................................................. 56 Class RenderObjectEllipse ......................................................... 57 Class RenderObjectRectangle..................................................... 58 Class RenderObjectRoundedRectangle ...................................... 59 Class RenderObjectText ........................................................... 59 Class Geometry ......................................................................... 60 Class RenderContext................................................................. 60 Class Brush ..............................................................................
Recommended publications
  • Blotch3d User Manual with Just a Few Lines Code You Can Create Real-Time 3D Apps for Multiple Platforms
    Blotch3D User Manual With just a few lines code you can create real-time 3D apps for multiple platforms. QUICK START INTRODUCTION PROJECT STRUCTURE DEVELOPMENT MAKING 3D MODELS DYNAMICALLY CHANGING A SPRITE’S ORIENTATION AND POSITION MATRIX INTERNALS A SHORT GLOSSARY OF 3D GRAPHICS TERMS TROUBLESHOOTING RIGHTS Quick start (This quick start section is for Windows. See below for other platforms, like Android, etc.) 1. Get the installer for the latest release of MonoGame from http://www.monogame.net/downloads/ and run it. (Do NOT get the current development version nor the NuGet package.) 2. Get the Blotch3D repository zip from https://github.com/Blotch3D/Blotch3D and unzip it. 3. Open the Visual Studio solution file. 4. Build and run the example projects. 5. See IntelliSense comments for reference documentation. Introduction Blotch3D is a C# library that vastly simplifies many of the fundamental tasks in development of 3D applications and games. Examples are provided that show how with just a few lines of code you can… • Load standard file types of 3D models as “sprites” and display and move them in 3D with real- time performance. • Set a model’s material, texture, and how it responds to lighting. • Load textures from standard image files. • Show 2D and in-world (as a texture) text in any font, size, color, etc. at any 2D or 3D position, and make text follow a sprite in 2D or 3D. • Attach sprites to other sprites to create associated structures of sprite trees as large as you want. Child sprite orientation and position is relative to its parent sprite’s orientation and position, and can be changed dynamically.
    [Show full text]
  • Projects on the Move
    :FDDLE@KP Free Software Projects 8elg$kf$[Xk\fm\im`\nf]]i\\jf]knXi\Xe[`kjdXb\ij GIFA<:KJFEK?<DFM< Finally there’s a free alternative to the proprietary Flash on the web. Unfortunately, it implements Microsoft technology whose software patents might render the free Moonlight license useless. BY CARSTEN SCHNOBER Microsoft and Novell formed an alliance Flash format as a global standard for problems to newcomers because you can with the aim of establishing a Flash al- complex, interactive web content. The download a prebuilt version of the pl- ternative for Linux. After one year of co- proprietary browser plugin by Adobe is ugin from the project website and click operation between developers from both like a red flag to a bull for many Linux to install (Figure 1). Thus far, Moonlight companies, a beta version of the Silve- users. Because the source code is not supports only Linux systems using Fire- light free implementation, Moonlight, is available, developers and users of the fox, although the makers claim that it now available. Many members of the free operating system have been forced will support OpenSolaris and the Kon- Linux community suspect that the to rely on Adobe providing updates. In queror and Opera browsers in the near Moonlight Linux implementation [1] is the past, Adobe has been reticent with future. being used to establish Microsoft's Sil- respect to timeliness and completeness. For licensing reasons, the binary pack- verlight [2] technology on a cross-plat- age leaves out all multimedia codecs, form basis, thereby infiltrating the soft- ;Xe^\ijXe[9\e\]`kj thus seriously limiting its own function- ware freedom fighters’ fortress.
    [Show full text]
  • JOE LAM Website: | E-Mail: [email protected] | Phone: (201) 887-7588
    JOE LAM Website: http://joe-lam.com | E-mail: [email protected] | Phone: (201) 887-7588 SUMMARY Microsoft Build Hackathon winner with 9+ years’ professional experience in software development. Ample Experience in managing development teams in various sizes, including project planning, scheduling, and resource allocation. Providing technical guidance and designing system/application architectures on mission critical enterprise projects. Responsible for all aspects of the software development lifecycle and deliver innovative solutions for business needs. TECHNOLOGIES Microsoft Application Development with .Net Framework 4.5.2 in C# ASP.Net (WebAPI, SignalR, MVC, Web Service), WPF (Telerik, DevExpress), Windows Service, Silverlight, WCF, WF, MSMQ, LINQ, Expression Tree, Lambda Expression, RegEx, MEF, TPL, GDI+, Serialization Enterprise Library, Prism, Unity, Reactive Extensions, PostSharp, MS Build, MS Test, NUnit, moq, Protocol Buffers Web Application Development with HTML5, CSS3 and JavaScript ES5 in W3C Standards React, TypeScript, AngularJS, Knockout, jQuery, RequireJS, Lo-Dash, toastr, Bootstrap, Ajax, HighCharts, Google Charts Database Development with SQL Server in T-SQL and MDX ADO.Net, Entity Framework, Sync Framework, SSIS, SSAS, SSRS TECHNIQUES Multi-paradigm programming (OOP, AOP, Functional, Concurrent, EDP, Data-driven, Generic, Reflective, Dynamic), Design Principles (SOILD, SoC, DRY, KISS), IoC, Design Patterns, Data Structures, System & Application Architectures, UI/UX Design, Single Page Application, Responsive Web Design,
    [Show full text]
  • Rich Internet Applications
    Rich Internet Applications (RIAs) A Comparison Between Adobe Flex, JavaFX and Microsoft Silverlight Master of Science Thesis in the Programme Software Engineering and Technology CARL-DAVID GRANBÄCK Department of Computer Science and Engineering CHALMERS UNIVERSITY OF TECHNOLOGY UNIVERSITY OF GOTHENBURG Göteborg, Sweden, October 2009 The Author grants to Chalmers University of Technology and University of Gothenburg the non-exclusive right to publish the Work electronically and in a non-commercial purpose make it accessible on the Internet. The Author warrants that he/she is the author to the Work, and warrants that the Work does not contain text, pictures or other material that violates copyright law. The Author shall, when transferring the rights of the Work to a third party (for example a publisher or a company), acknowledge the third party about this agreement. If the Author has signed a copyright agreement with a third party regarding the Work, the Author warrants hereby that he/she has obtained any necessary permission from this third party to let Chalmers University of Technology and University of Gothenburg store the Work electronically and make it accessible on the Internet. Rich Internet Applications (RIAs) A Comparison Between Adobe Flex, JavaFX and Microsoft Silverlight CARL-DAVID GRANBÄCK © CARL-DAVID GRANBÄCK, October 2009. Examiner: BJÖRN VON SYDOW Department of Computer Science and Engineering Chalmers University of Technology SE-412 96 Göteborg Sweden Telephone + 46 (0)31-772 1000 Department of Computer Science and Engineering Göteborg, Sweden, October 2009 Abstract This Master's thesis report describes and compares the three Rich Internet Application !RIA" frameworks Adobe Flex, JavaFX and Microsoft Silverlight.
    [Show full text]
  • Sandcastle Kingdoms Free Download Document Your C# Code with XML Comments
    sandcastle kingdoms free download Document your C# code with XML comments. XML documentation comments are a special kind of comment, added above the definition of any user-defined type or member. They are special because they can be processed by the compiler to generate an XML documentation file at compile time. The compiler-generated XML file can be distributed alongside your .NET assembly so that Visual Studio and other IDEs can use IntelliSense to show quick information about types or members. Additionally, the XML file can be run through tools like DocFX and Sandcastle to generate API reference websites. XML documentation comments, like all other comments, are ignored by the compiler. You can generate the XML file at compile time by doing one of the following: If you are developing an application with .NET Core from the command line, you can add a GenerateDocumentationFile element to the <PropertyGroup> section of your .csproj project file. You can also specify the path to the documentation file directly using DocumentationFile element. The following example generates an XML file in the project directory with the same root filename as the assembly: This is equivalent to the following: If you are developing an application using Visual Studio, right-click on the project and select Properties . In the properties dialog, select the Build tab, and check XML documentation file . You can also change the location to which the compiler writes the file. If you are compiling a .NET application from the command line, add the DocumentationFile compiler option when compiling. XML documentation comments use triple forward slashes ( /// ) and an XML formatted comment body.
    [Show full text]
  • Aplicaciones Enriquecidas Para Internet: Estado Actual Y Tendencias
    Universidad de San Carlos de Guatemala Facultad de Ingeniería Escuela de Ciencias y Sistemas APLICACIONES ENRIQUECIDAS PARA INTERNET: ESTADO ACTUAL Y TENDENCIAS Miguel Alejandro Catalán López Asesorado por la Inga. Erika Yesenia Corado Castellanos de Lima Guatemala, enero de 2012 UNIVERSIDAD DE SAN CARLOS DE GUATEMALA FACULTAD DE INGENIERÍA APLICACIONES ENRIQUECIDAS PARA INTERNET: ESTADO ACTUAL Y TENDENCIAS TRABAJO DE GRADUACIÓN PRESENTADO A JUNTA DIRECTIVA DE LA FACULTAD DE INGENIERÍA POR MIGUEL ALEJANDRO CATALÁN LÓPEZ ASESORADO POR LA INGA. YESENIA CORADO CASTELLANOS DE LIMA AL CONFERÍRSELE EL TÍTULO DE INGENIERO EN CIENCIAS Y SISTEMAS GUATEMALA, ENERO DE 2012 UNIVERSIDAD DE SAN CARLOS DE GUATEMALA FACULTAD DE INGENIERÍA NÓMINA DE JUNTA DIRECTIVA DECANO Ing. Murphy Olympo Paiz Recinos VOCAL I Ing. Enrique Alfredo Beber Aceituno VOCAL II Ing. Pedro Antonio Aguilar Polanco VOCAL III Ing. Miguel Ángel Dávila Calderón VOCAL IV Br. Juan Carlos Molina Jiménez VOCAL V Br. Mario Maldonado Muralles SECRETARIO Ing. Hugo Humberto Rivera Pérez TRIBUNAL QUE PRACTICÓ EL EXAMEN GENERAL PRIVADO DECANO Ing. Murphy Olympo Paiz Recinos EXAMINADOR Ing. Juan Álvaro Díaz Ardavin EXAMINADOR Ing. Edgar Josué González Constanza EXAMINADOR Ing. José Ricardo Morales Prado SECRETARIO Ing. Hugo Humberto Rivera Pérez HONORABLE TRIBUNAL EXAMINADOR En cumplimiento con los preceptos que establece la ley de la Universidad de San Carlos de Guatemala, presento a su consideración mi trabajo de graduación titulado: APLICACIONES ENRIQUECIDAS PARA INTERNET: ESTADO ACTUAL
    [Show full text]
  • Metadefender Core V4.13.1
    MetaDefender Core v4.13.1 © 2018 OPSWAT, Inc. All rights reserved. OPSWAT®, MetadefenderTM and the OPSWAT logo are trademarks of OPSWAT, Inc. All other trademarks, trade names, service marks, service names, and images mentioned and/or used herein belong to their respective owners. Table of Contents About This Guide 13 Key Features of Metadefender Core 14 1. Quick Start with Metadefender Core 15 1.1. Installation 15 Operating system invariant initial steps 15 Basic setup 16 1.1.1. Configuration wizard 16 1.2. License Activation 21 1.3. Scan Files with Metadefender Core 21 2. Installing or Upgrading Metadefender Core 22 2.1. Recommended System Requirements 22 System Requirements For Server 22 Browser Requirements for the Metadefender Core Management Console 24 2.2. Installing Metadefender 25 Installation 25 Installation notes 25 2.2.1. Installing Metadefender Core using command line 26 2.2.2. Installing Metadefender Core using the Install Wizard 27 2.3. Upgrading MetaDefender Core 27 Upgrading from MetaDefender Core 3.x 27 Upgrading from MetaDefender Core 4.x 28 2.4. Metadefender Core Licensing 28 2.4.1. Activating Metadefender Licenses 28 2.4.2. Checking Your Metadefender Core License 35 2.5. Performance and Load Estimation 36 What to know before reading the results: Some factors that affect performance 36 How test results are calculated 37 Test Reports 37 Performance Report - Multi-Scanning On Linux 37 Performance Report - Multi-Scanning On Windows 41 2.6. Special installation options 46 Use RAMDISK for the tempdirectory 46 3. Configuring Metadefender Core 50 3.1. Management Console 50 3.2.
    [Show full text]
  • Introducing Silverlight From?
    02_0672330148_ch01.qxd 9/25/08 2:23 PM Page 3 Silverlight 2 Unleashed, published by SAMS, Copyright 2009 Pearson Education, Inc. ISBN 0672330148 CHAPTER 1 IN THIS CHAPTER . Where Does Silverlight Come Introducing Silverlight From? . Using Third-Party Plug-Ins . Running on Multiple Platforms . Making the Web Application Secure t all started when Microsoft presented its revolutionary I . Introducing Silverlight.net user interface (UI) framework, Windows Presentation Foundation, to an enthusiastic crowd of graphics designers, . What Do You Need to Run software developers, and businessmen in March 2006 at the Silverlight? new MIX conference in Las Vegas. Microsoft also added . Updating Your Runtime— one session about a lesser-known technology with the Automatically rather barbarian name Windows Presentation Foundation . Trying Silverlight Demos Everywhere, or WPF/E. There was nothing much to see yet, but the abstract was enticing: “With WPF/E you’ll be able . What Do You Need to Develop to build rich, interactive experiences that run in major Web Silverlight? browsers on major platforms as well as on mobile devices.” . Reading the Documentation A little more than a year later, at the second edition of the . Looking into Silverlight’s same MIX conference, Scott Guthrie (general manager at Future Microsoft, responsible for most of the .NET teams) climbed on stage and gave the crowd an amazing software demon- stration. The barbarian WPF/E was gone; in its place was Silverlight (see Figure 1.1). A bright new logo revolved on the screens. Gradients and animations were all over the place. Planes flew over the web browser’s window, connecting US cities while Scott was planning his next trips; a chess application let the browser’s JavaScript engine play against .NET, demonstrat- ing without any doubt the superior power of the compiled .NET application over JavaScript’s interpreted code.
    [Show full text]
  • Futurism-Anthology.Pdf
    FUTURISM FUTURISM AN ANTHOLOGY Edited by Lawrence Rainey Christine Poggi Laura Wittman Yale University Press New Haven & London Disclaimer: Some images in the printed version of this book are not available for inclusion in the eBook. Published with assistance from the Kingsley Trust Association Publication Fund established by the Scroll and Key Society of Yale College. Frontispiece on page ii is a detail of fig. 35. Copyright © 2009 by Yale University. All rights reserved. This book may not be reproduced, in whole or in part, including illustrations, in any form (beyond that copying permitted by Sections 107 and 108 of the U.S. Copyright Law and except by reviewers for the public press), without written permission from the publishers. Designed by Nancy Ovedovitz and set in Scala type by Tseng Information Systems, Inc. Printed in the United States of America by Sheridan Books. Library of Congress Cataloging-in-Publication Data Futurism : an anthology / edited by Lawrence Rainey, Christine Poggi, and Laura Wittman. p. cm. Includes bibliographical references and index. ISBN 978-0-300-08875-5 (cloth : alk. paper) 1. Futurism (Art) 2. Futurism (Literary movement) 3. Arts, Modern—20th century. I. Rainey, Lawrence S. II. Poggi, Christine, 1953– III. Wittman, Laura. NX456.5.F8F87 2009 700'.4114—dc22 2009007811 A catalogue record for this book is available from the British Library. This paper meets the requirements of ANSI/NISO Z39.48–1992 (Permanence of Paper). 10 9 8 7 6 5 4 3 2 1 CONTENTS Acknowledgments xiii Introduction: F. T. Marinetti and the Development of Futurism Lawrence Rainey 1 Part One Manifestos and Theoretical Writings Introduction to Part One Lawrence Rainey 43 The Founding and Manifesto of Futurism (1909) F.
    [Show full text]
  • Visual Build Help
    Visual Build Professional User's Manual Copyright © 1999-2021 Kinook Software, Inc. Contents I Table of Contents Part I Introduction 1 1 Overview ................................................................................................................................... 1 2 Why Visual................................................................................................................................... Build? 1 3 New Features................................................................................................................................... 2 Version 4 .......................................................................................................................................................... 2 Version 5 .......................................................................................................................................................... 3 Version 6 .......................................................................................................................................................... 4 Version 7 .......................................................................................................................................................... 7 Version 8 .......................................................................................................................................................... 9 Version 9 .........................................................................................................................................................
    [Show full text]
  • Silverlight Interview Questions
    By OnlineInterviewQuestions.com Silverlight Interview Questions Silverlight is a very powerful development tool that has been used by many organizations in order to create engaging content for effective user experiences for both the web as well as mobile applications. It is a very popular web-based knowledge that was launched by Microsoft for individuals in the design world. It has also been considered as a competition to the famous Adobe’s Flash. Some of the big organization using Silverlight include Yahoo!, NASA, Indian Premier League (IPL), Continental Airlines, etc. These organizations have been using Silverlight to enhance their business manifolds. Thus, many companies have recently started to incorporate Silverlight into their systems for effective and efficient handling of their business. In lieu of which many organizations are looking for candidates that can provide adequate solutions to increase their market presence. Such organizations are looking for candidates with adequate theoretical knowledge in addition to good hands-on-training skills. This field also requires candidates to have excellent communication as well as presentation skills. Therefore, some basic, as well as advanced Silverlight interview questions, have been asked in order to scrutinize the perfect candidate that can make the cut. Read below some of the frequently asked Silverlight interview questions, if you either a fresher or an experienced individual to gain insight on the topic or brush up your past knowledge to land your dream job! Q1. What is the use of Silverlight? Silverlight is an open – source development tool manufactured by Microsoft, which is essentially used to create and deploy interactive user experiences along with media and internet applications for various internet and mobile applications.
    [Show full text]
  • Game-Based Learning
    Game-based Learning Motion-based Educational Game Per Olav Flaten Henrik Reitan Master of Science in Informatics Submission date: June 2016 Supervisor: Alf Inge Wang, IDI Norwegian University of Science and Technology Department of Computer and Information Science Problem Description Title: Game-based Learning Sub-title: Motion-based Educational Game This project focuses on the development, testing and experimentation with motion-based educational games. The games will use body movement as input to provide a natural user interface and will provide learning through gesture based movement. The project consists of a state-of the-art study, prototyping and develop- ment, testing and experimentation with real users, and analysis of the ex- perimental data. The project will utilize technology like Kinect or similar. Assignment given: 13:01.2015 Supervisor: Alf Inge Wang Abstract This master's project is dedicated to investigate the potential for educa- tional games with a motion controller based interface. Through professor Alf Inge Wang at NTNU we were assigned the task of brainstorming and developing a concept that would utilize motion controllers, more speci- cally the Microsoft Kinect, and investigate if it could be useful outside of a traditional game setting. Additionally it was expressed a desire to have em- phasis on reusable software that would benet future projects investigating the same area or using the same technology. Throughout our research period we have discovered several interesting things. We found that although the Kinect failed to gain any traction on its in- tended area of use, it is a very impressive piece of aordable technology that is worth investigating further.
    [Show full text]