Welcome to MSDN Blogs Sign in | Join | Help

Using Functions in C#

In the video that I have embedded in this blog post, I am restarting my blog and will work out the curriculum issues that I have been talking about.  Got caught up in the Imagine Cup, it all worked out really well for the team I am on, have to shout out for Cy Khormaee, Bradley Jensen and Krishna Kumar, these guys rocked the Software Design category in the US!

 

Anyway, back to Functions, what is a function, why are they important?  Functions allow you to write code once and then reuse it.  In the history of computers, functions have been around for most of the history of computers.  For instance the “bombs” used by the Enigma decoding system was a type of mechanical function that looked for likely pathways through the Enigma encoding/decoding machine.

Some languages treat functions and variables exactly the same, for example OCAML and F# (a new language in VS 2010) do this.

The video includes demonstrations on how to use the Functions, where to place them, and how to use functions with events.

The video is black due to a bug for some reason I haven’t figured out, but the video works if you click on the black square. 

Get Microsoft Silverlight

Brain Freeze: Thinking about beginning programming classes

So far in my previous blog posts, I talked about the following items:

  • Use of C, which is a requirement for the class
  1. Write and test your first program for security issues (Intro to C#)
  2. Use media in your programs (Designing Applications)   

3. Variables and types

  • Goal: Learn about variables and types
  • Outcome:
    • Student will be able to demonstrate:
      • How to create and use a variable in a program
      • How to what is the difference between value, nullable, reference types and generic types
      • A buffer and heap overrun condition caused by unchecked variables
  • Security: Students will create Buffer and Heap Overruns conditions, using checked and unchecked variables
  • Test: Write a test plan that will force the buffer and heap overrun to occur

4. Control structures

  • Goal: Students will design and create control structures
  • Outcome:
    • Student will be able to demonstrate:
      • How to design a loop that ends at a number entered by the end user, if/else statements, switch/case, and for, while, and do loopsimage
      • How to utilize user input
  • Security: Confirm that the input from the user is within the expected range
  • Test: Create and implement a test plan that checks the user input is within the expected range

 

Which leaves me with 10 modules to think about.  Umm, need to do the same for F# and VS 2010.

In the case of the use of VS 2010, I will need to demonstrate how to use VS 2010 with this beginning class.  Need something on Expression 3 as well.

Let me know what you think.  I do check the emails before exposing them, so it doesn’t do any good to spam me, I just delete them.

More coming up!

Brain Freeze: Rethinking curriculum for beginning programmers

Chapman University has handed me a challenge: Create a first programming class for students who are going to be part of a new minor in Game Design.  Ok, not bad, oh wait, it also needs to get the students to a point where they can write programs in C# in a game design class.  The audience is made up of “design” students as well as CS students, both are bright and motivated, but quite a bit different.

Usually as an adjunct in the 1980s or 1990s, I would usually get a call from a school stating that they needed a professor to do a class in programming or engineering, they would have a textbook selected and usually a syllabus that I would simply use in class.  Quite often the school would have foils (that’s what powerpoint slides were called, because they were acetate foils that you would place on a light table thingie).

This changed in the 21st century, my past three gigs of being an adjunct has been to create a new kind of class that stimulates excitement about software and the creation of media like games, etc.

  • Ok, I am going to assume for the moment that I don’t have to consider rubrics, ACM accreditation, only focus on the students and the needs of their potential employers.

Using Game Design in a beginning level class is a challenge, but the paradigm of games can be exciting and a focus for the student.  Of course, to do a fresh approach, the students would need to get experience with programming (coding), database, security, dealing with media, testing and deployment.  Also, to make sure that the small private college gets their 15 minutes of internet fame, the students will need to blog about their experiences and to demonstrate their work with little or no friction.  Philosophically, the class would never use a piece of paper, although, I would likely assign a book as some students like to have a book.  Ok, except for the design students, they can use paper to sketch out their ideas, but I wouldn’t need to see those, unless they want to show them to me, but they would have to scan them in for me to observe.

So what should the student have to produce to succeed at the end of class?  How to get the student to do teamwork?

Usually the students might produce the following:

  • 10 problem sets
  • 2 exams
  • 1 final project

The traditional, well as much a tradition might be for a young science like Computer Science (let’s face it, Civil Engineering is an example of a STEM curriculum with tradition):

  • Introduction to C#
  • Designing Applications.
  • Variables and types
  • Control structures
  • Object Oriented Programming
  • Exception Handling
  • Designing classes
  • Strings and arrays
  • Structures and Sequential file access
  • Multithreading
  • Database and ado.net
  • Interface Design
  • Graphics and Animation
  • Introduction to C in the Unix environment
  • Low level programming in C

And then there is usually a textbook, no comments on any of the textbooks, except that most students have no desire to have a book, at least till they take a class that doesn’t use a book.  Although the C# books by Dietel are pretty good.

First change would be to the last two items: Intro to C in the Unix environment and Low Level programming in C.  Boring.  I would change those to:

  • Playing games on the Unix Environment using CROBOTS and the C language, C language is only used to program the robots, the source code remains hidden from the students.  Make sure ask the students to pay for the use of the shareware.  That could be fun. 
    • Outcome: Students compete to get the best score in CROBOTS, which works on the Windows and Unix systems
    • Required: Students to do an eyeball threat analysis of the source code
    • Required: Students to do an eyeball for efficiency
    • Rubric:
      • Student that gets top score using their own code gets an A on the assignment
      • All students have to do 3 variations on the attack code.
    • Optional, software types: create a more fun game that allows non-programming users to create and play CROBOTS
    • Optional, design media: Using the limited tools, create more interesting images and play
  • Create a game that will run on a handheld device using C!
    • Outcome: Students create a simple game that runs in C that can be run on a smartphone
    • If using C#:
      • Using the VSTS environment, or the C# Express the students would write a program for the Zune.  This will force the students to use the XNA Game Studio.

Wow, that sounds unchallenging.  But what would the problem sets look like (remember I am not looking at the department rubric or anything, just doing what I think is cool):

  1. Write and test your first program for security issues (Intro to C#)
    • Goal: Introduce the students to the use of the IDE
      • Students will be required to install on their personal systems:
        • VSTS 2010
        • Expression 3 Studio
        • C# Express (and register their version)
        • XNA Game Studio
        • Download the “Program Now!” book on C#
    • Outcome:
      • Student will be able to demonstrate how to use an integrated development environment and how to use it to build a simple program.
      • Student will be able to discuss how test and security impact the development and architecture of web sites, databases and program development in general
    • Security: Discussion of the impact of security on society
    • Test: Discussion of the different types of test capabilities
  2. Use media in your programs (Designing Applications) 
    • Goal: Students will design and create a random number generator with images of 6-sided, 10-sided and 12-sided dice that stores the results of the roll of the dice in a file
    • Outcome:
      • Student will be able to demonstrate:
        • How to design a simple user interface.
        • How to write simple code that generates random numbers and accepts input from the user
        • How to utilize images and sou
    • Security: Random number generation is part of the System.Security.Authentication, examine the differences
    • Test: Introduce NUnit test and to implement a series of tests that force the dice to roll.  Students will then use a tool of their choice to determine the randomness of the dice throws
  3. TBD
  4. TBD
  5. TBD
  6. TBD
  7. TBD
  8. TBD
  9. TBD
  10. TBD
  11. TBD
  12. TBD
  13. TBD
  14. TBD
  15. TBD
  16. Final

Well got some more to think about.

Posted by SoCal Sam | 0 Comments

VSTS 2010: Using the Directed Graph Diagram part 1 of however many I do till I get distracted again

 

image

Now that VSTS 2010 is available through the CTP program, MSDNAA, BizSpark and MSDN, you can use it to deconstruct applications that you might need to take charge of.  My example is the XNA RPG.

The image at the top of the article is an example of the final result of the instructions in this blog.

If you are a student, professor or lecturer, then you can get the full version from your MSDNAA account, and if you don’t have MSDNAA, contact me through the comments below.

Now on to Using the Directed Graph Diagram, this is SOOOO, sweet.  As I said in my last blog, I am deconstructing the XNA RPG (Role Playing Game). 

In VSTS, you will need either the full version that you can get through MSDNAA or the CTP version.  It is a big download but worth it in so many ways.  UML, which we looked at briefly in my blogs during July and will visit again in other blogs.  But I want to focus on the deconstruction of the XNA RPG.

First you need to open the Architecture view, menu path shown below:

image 

Make sure you have built the XNA RPG, and added it to the VSTS 2010 IDE, you will need to add references, etc.  It won’t convert directly, you will need to add the projects and the related files separately, as well as the references.  That will be fixed prior to or at RTM, beta versions usually require some extra effort.  

Next add the Directed Graph Diagram:

image 

 

If you manipulate the Architectural View, you will see the following image, Select Solution View, then RolePlayingGame.cs, RolePlayingGame and then the components in the class, when you do you get the pretty picture shown at the top of this article.

image

This is a very cool feature that can help you understand code better, and is definitely work the FULL price for the Architect version, if you have access through MSDN, MSDNAA or Bizspark, then you are golden.  If you have to use the CTP, that is awesome as well, but you need to stay on top of when it is deactivated.

Give it a try, I am very impressed and will utilize this to explore the XNA RPG.

VS 2010 Game Design: For RPG with Deconstruction and Destruction

What’s a game without deconstruction and destruction? 

Back in the dark ages when I attended college, there was a concept of Critical Deconstruction, and I thought to take one of the classes on it for my liberal arts General Education credit, something required in the United States so that engineering and science students don’t take all technology classes and destroy their GPAs by getting good grades in the classes they are in college to take!  I dropped the Critical Deconstruction class after the first session and took Science Fiction, which had less girls (a major requirement for classes outside of engineering back in my youth), but I had already read most of the books.  The reason I dropped the class on Critical Deconstruction was that it seemed to be mostly blah, blah, blah about words with a focus on “The Raven”.  I didn’t want to write a bunch of papers repeatedly about “The Raven”.  I had already suffered through same “educational” process with respect to “From Esme with Love and Squalor” by J.D. Salinger, I really didn’t care to spend a quarter writing endlessly about a character in “The Raven” that was similar to the “Sergeant X” in “For Esme with Love and Squalor”.  In fact I said: “Nevermore”, get it, I said: “NEVERMORE”?  That’s what the Raven says in Poe short story.  Oh I crack me up.

I decided to deconstruct the XNA RPG game.  What if we were able to use the VS 2010 to analyze the XNA RPG game?

Visual Studio 2010 doesn’t directly upgrade the XNA RPG game, but with a little effort I have moved the folders, content and so forth into VS 2010.  Since it is Friday and I got a party to attend tonight (nothing exciting), I haven’t made any effort to make it work.  However,  I did experiment with the Architecture View and the Layer View.  Wow, the tools in Visual Studio 2010 are awesome and mindblowing, this goes way beyond UML.

Unlike the story “For Esme with Love and Squalor”, it looks like there is a great deal of material to deconstruct and to explore!  I had thought to start with UML and then work through the various tools, but now it looks like we will need to do a more disciplined approach to VS 2010.

And unfortunately, I will not be able to milk this blog for 50 years or more like J.D. Salinger, who is still alive and hasn’t written anything for years.  That’s great that J.D. Salinger was able to write a few stories and then live off his effort for the rest of his life.  Maybe I should have paid more attention in my literature classes.

Bottom line, I will be working through the XNA RPG Game using VS 2010. 

 

Well again I have lost focus, sort of.  This will be fun.  Make sure to get that XNA RPG game loaded, it really is better than the Racing game, and I think I will make sure to stick with it.

Posted by SoCal Sam | 0 Comments

Is software engineering dead?

Software Engineering: Dead? by Jeff Atwood, asks this question.  My question is this: Did anyone find that their software engineering courses in school mapped to what you actually do at work?  Doubtful in my opinion, unless you attended certain schools.

My series of articles that I am doing about engineering games is not about software engineering, which I consider to be important in many ways and certainly not dead, but definitely boring to creative people like Jeff Atwood.  The process outlined in the ITIL courses or on SEI are frankly mind numbing in nature to a person who really gets how to build and maintain code, for example, Clint Rutkas, a teammate of mine at Microsoft.  Clint gets it.

What about all of the other people in the world?  Not everyone is a Kenny Spade (another teammate), or a Clint Rutkas, and they will need proof that is understandable. 

Software provides services, and unless you want to have to be coding, maintenance or project reviews every minute of your waking life, then you need to figure out a way to do code releases, code reviews, reporting, project management and so forth.  Without the concepts of software engineering, how do you get your payouts in a contract?  How do you prove to a non-software knowledgeable auditor, manager, end user that you have completed what you said you would?

It isn’t like you put up a bunch of drywall that you can point to and say: “The drywall has been installed, taped, sanded and is ready to be primed, sign here, and give me the check.”

If you borrowed money from CIT for instances, and they just went out of business (likely by the way), how do you prove to the new investors that you will have product to pay off the loan at a certain time?  Whoever gets the assets of CIT will likely want their loan paid off in full, unless you can prove that you are on schedule.

With games, you have to be able to show managers, teammates and so forth that you are getting your work done.  Other people, who are not software savvy need to see progress in a manner that is understandable to them.  Those are the components of “software engineering”.

However, the boring approach that most people take with software engineering would dull anyone’s intellect. Using tools like Visual Studio 2010 Team Studio with TFS is a great way to end the boredom of software engineering.

As we move through my discussions about the art of software creation, architecture and management, I hope to show that software development requires many types of people, artistic, detailed oriented, creative science, and management working together.

UML: Software Engineering Institute, Game Design guidance

Interesting isn’t it that the game design discussion on the Software Engineering Institute site seems to end around 2005, just as life gets interesting for game design.  First of all the XBox team at Microsoft releases the XNA Game Studio, allowing for the first time for people, students, professors, hobbyists and others to build games that will work on a game console.  Flash games really took off.  Blizzard gets sold for 4 BILLION dollars to Activision.  WII comes into existence.

The basics are still there though, so I guess the SEI (Software Engineering Institute) is right in keeping the same guidance on their site.  To bad things aren’t more active, the game universe is certainly cooking these days.  Chris Satchell moves to ING (International Games) to work on improving their slot machines and so forth. 

Let’s now really start focusing on a step by step curriculum for Devschool.

Overall goal: Build a game from the ground up using a process that parallels Model Driven Design or Model Driven Architecture incorporating the tools built into the Visual Studio 2010 Team Systems.  There will be variations and since UML isn’t really a standard, just a standard that might have been. 

UML main failure has been “methodology above all else”. In the practical world of getting the job done, a philosophy of methodology above all else works when you need to:

  • Fill a government contract with paperwork
  • Burn customer money by creating paper deliverables that look nice
  • Confuse customers with lots of complex icons connected with very specific kinds of lines

UML is not meant to drive methodology above all else, it is suppose to allow you to have documentation, test and requirement tools that actually assist in the construction of software that is a service for customers.  If you produce software that only solves the immediate problem, then the software can’t adapt to the changing needs of customers, which should be the nature of software.

“Methodology above all else” leads to systems that have a great deal of paperwork trapped in file cabinets, directory folders and Sharepoint sites that no one looks at after the project reaches a certain point.  The SEI articles on Arcade Games certainly demonstrates that, 4 years since any new activity.   Microsoft’s discussions and guidance around Model driven development seems a little out of date as well.  This is not the glamour of Azure, XNA or Office, it is just the stuff that makes you a software or network architect, which pays good.  image

It is still important to review that work by SEI, but in the view of Visual Studio Team Systems CTP Modeling Projects, Team Foundation Server, and other integrated tools such as Microsoft Operational Management are important to building successful software, games as an example, that can thrive and adapt to the changing environment.

Using the SEI form, the Devschool blog will generally follow this curriculum (in the usual timeline followed by blogs):

The use of methodology is more to save you when dealing with customers, getting your invoices paid.  Appropriate use of methodology is a way to help you when your main developer has flown the coop, gotten sick or pregnant at a critical moment with respect to the project (I am reminded of a client who’s principle software architect died suddenly and they couldn’t get to his files).  An integrated methodology, like Visual Studio—Team Foundation Server—Microsoft Operational Management (MOM) can save you time when it really counts.

For the next few months, I will be reviewing how to build a game company using Visual Studio—Team Foundation Server—MOM/Azure, with the thread focused on real life use of methodology, not “methodology over all”.

If you need to get up to speed with UML, definitely visit the UML blog, in this case UML stands for Ulterior Motive Longue, who knew UML could be so much fun!

UML: OMG and SEI

OMG (really) is the Object Management Group that can be found at http://www.uml.org , fortunate for them that they got that URL for UML.  The site is filled with links that are not connected, you would think that someone every once in awhile would check for broken links.  The other site that I will seriously  be utilizing is the SEI, or Software Engineering Institute.  This site appears to be in good shape, and has a well written tutorial on game design.  I will make use of this site in this blog: Arcade Game Maker Pedagogical Product Line, the material was last updated in 2005, and a lot has gone on in game design.  Although, it is one of the first articles to mention model-view-controller.  Also, it is only article that I have been able to find that uses UML with respect to game design.

 

My plan now that I have captured you with the first few articles on UML in VS 2010 is to continue with this thread through all of UML, setting up tests and releasing a product.  Initially I will work with the games included in the SEI site, moving the concepts to the VS 2010 environment.

 

Then I may work on a product is might be one that is already made, like Terrarium or what the heck, maybe I’ll just develop mine own.  The nice thing about Terrarium is that there is an audience.  You can say the same about Allegiance and some other games out there.  Downside to Terrarium is that it is an autonomous game, and as a result interesting only to computer scientists and other hard core types.  I need something that breaks out of being a massively online single player game to multiple player.  It would be interesting to modify this to be something that more computer users would find that it is fun to play.  Well let me know what you think.

 

Here is a picture of Terrarium, imagestill not certain if I am going to use this, as I said, we will work with upgrading the SEI material (which for it’s time was very advanced).

UML: Use Cases, relationships Part 4

I have received a few comments about what happened with the DLL discussion I was having on this blog.  Well quite simply, I realized that I might be able to put together a coherent discussion about UML in VS 2010 and build back into the DLL discussion.  UML includes building Class Libraries using the Logical Class Diagrams, which is very similar to the Class Diagrams included in Visual Studio Professional and Visual Studio Team Systems, but not the Express products.

Let’s review Use Cases, since I would like to move this quick overview into activity cases within the next two blogs:

Use Cases are:

  1. Usually, although not always, the first step in designing your system
  2. High level specification of user goals
  3. Ways to how actors (or players) interact with each other
  4. Designed in collaboration with the non-developers such as game players, testers, graphic artists and especially the game story creator

In a Use Case there are relationships that are shown using a line:

image

 

Association is drawn between actors and use cases to show that an actor carries out a use case.

Dependency exists between two defined elements if a change one may result in a change to the other.

Include is used to avoid repetition of scenarios in multiple use cases.

Extend is used to describe a behavioral variation

Generalization is used to show a variation on another use case

UML: Use Case Part 3

The Use Case is simply a way for you to take your high level requirements and put them into an image form.  It might even be a good idea to use sticky notes to help you visualize the way that the different use case might be related.  Sticky notes are included with Win7 and an improved version is available for free from the Office Lab Sticky Notes page, I am impressed with the Sticky Notes and will be doing a blog about creating your own sticky notes projects through the API for Win7. 

Working directly with the Use Cases in Win7 is not a creative process, I find the interface with the VS 2010 a little clunky, and this goes for all of the UML editors ever created:

  • Rational Rose
  • Visual UML which is worth the price if you don’t want to use Microsoft products
  • and so forth.

I would use the flexibility of the StickySorter to organize your thoughts initially.  Likely the business partner in our example did it using paper post-its, but the problem I have with paper is that eventually I throw them away and lose the train of thought.  With StickySorter, which are completely free, I can share them with others through shared view for example, and connect with up to 15 people!  No cost, easy installation, your customers can use it to organize what they want you to do.

 

In our case of your business partner putting together the successful game Use Cases in college, they went naturally with the easiest process of organizing their thoughts and ideas: Post-its (tm) or similar would be easiest way to organize your use cases, back then.  Then to generate the use cases you like used the UML tool that was included with Visual Studio 6 as I recall, or Visio which has been free in MSDNAA for student and professors forever. 

Now with StickySorter, you can ask others to use this completely free tool to organize how the use cases inside of your new game should be organized.  You could use the old game use cases to illustrate how the new game will utilize the old material (good for investors to see) and to draw in new thinking in the design.  Of course as you do your design, some of your Use Cases will become Activity Cases.

 

image

Posted by SoCal Sam | 0 Comments
Filed under: ,

UML: Use Cases Part 2, utilizing <<include>>

In this blog post, no back story, just pure UML today.

In this case “Create an Account” is used by a Gamer coming to your site.  The “Create an Account” is included in the User Profile and Security Use Cases (at least at this point of analysis).  Now both the User Profile and Security, in a normally running business, would be used for many purposes.  For example the User Profile would used for the customers, like the Gamer, it would also be used for roles such as BackOffice worker (accountants, executives, etc.), Developer, and so forth.  With respect to security, the security model would function the same for the entire corporation, different security models are weaker.

 

UML with includes

Posted by SoCal Sam | 0 Comments
Filed under: , ,

UML: Use Case Models part 1

What are Use Case Models? First of all: They are simple visual specification of user goals at a high level.  They should be so simple that you can explain them to a manager suffering from serious attention span disorder, or a puppy.  Not all managers suffer from attention span disorder, and especially not mine, who is a kind and generous genius, especially at review time. :)  But you should get my meaning here.

When starting a use case model, it is very important to keep it simple.  The real reason is that you may need to refer to them at a later time, usually under deadline pressures or even legal reasons.

Often it is easiest to first determine the actors of the system, and then flush out the use cases that they perform. 

Your use case diagrams can be as simple or complex as you wish, however simpler, less cluttered diagrams are easier to understand, and are often more powerful in capturing the tasks of the system.  Which means: AVOID COMPLEXITY.  Stokes Theorem: You can create complexity out simplicity, but not simplicity out of complexity.  (Ok, that isn’t really Stokes Theorem, but… oh well.)

For example, the use case create account during the design or later modifications of the system, may require further specifications. 

Remember that a use case a microscopic (atomic) programming operation, it is a general case. 

Build your use cases to clarify the goals and expectations for the system’s users.

Returning to the back story:

In your proto-corporation you and your business partner had just completed a class that was heavy on UML in college, your business partner decided to work up a scenario around a game you two were working on.  You went on to take a game class from a professor like me, not all that good at showing you how to code, but good at the big picture.  Your business partner took charge of the Use Cases, in fact he owns the rights, which would be expected in a rational world.  Making intellectual rights a thread to this story as well. 

For now, we will walk through the initial use case your business partner and college buddy built. 

And it turns out now that you have need to upgrade your product, it is good thing he did.  But let’s go back to the beginning, his first thought was that the User will need to create an Account.

An actor, the gamer, is shown here as having a one to one association with “Create an Account”, I have used he drop down box to write a description of the association.  It is these descriptions that will provide you with the necessary information to determine what YOU were thinking about when you make this Use Diagram, you write these for the future, make sure you spend time doing the entries, for many people that causes a weird feeling in your brain and can be annoying, try to ignore that and do the writing.  On the other hand, some people really enjoy this, if you are one of them, KEEP UP THE GOOD WORK!  Everyone else, you have to do the descriptions.

image

In the next  blog we will go over how use cases combine with other use cases.

Posted by SoCal Sam | 1 Comments

UML IS BACK IN VISUAL STUDIO 2010

No more clunky interop with Visio like in VS 2005 and VS 2008.  UML is back in the Visual Studio Team Suite 2010 CTP.

You will need to install Visual Studio Team Suite 2010, which is all of the versions put together, Database, Developer, Architect and Test, then you will be able to view and experiment with the modeling projects component.

 

Utilizing UML in your game design can be a big benefit down the line, not so much when you do the initial effort, when you are all excited about your idea and everyone is in the groove.  But later, when you are successful, driving that expensive, high speed sports car, living large, you suddenly see the sales and traffic start to dip.  What to do, what to do?  Clearly you will need to hire consultants.  Why? Because your main developers are in rehab, the marketing team is lost in space, the graphic artists are off staring at their navels and your business partner just bought a seat on the Virgin Starship with a hot babe.  Well, if you kept your UML in tune with your design, this will save you enough money to pay for your next NetJet payment instead of giving to consultants.

 

In the UML tool you will see that, after opening a new modeling project, you can add one of the following to your project, normally you would start off by using the general Use Case Diagram, this is the highest level of diagrams:
image

In my next post, I will demonstrate the way to manipulate the Use Case Diagram. 

Posted by SoCal Sam | 0 Comments
Filed under: , ,

Have a happy 4th of July! Be Safe!

Fireworks were initially invented by the Chinese, and likely the medical protocol for missing hands from explosionsimage followed shortly. 

In the United States July the Fourth represents the date of the signing of the Declaration of Independence, although the real date might have been July 2 depending on your legal point of view.  The making of “joyous” noise and so forth slowly became a tradition, with the slow communications and independent nature of the US in the early years slowed the adoption of the fireworks and parades.

If you are going to the beach, make sure that you enter the water in a manner that allows you to check out the new environment, and all waters, except pools, are renewed everyday.  I surf quite often, but I always, and I mean always do a quick wade out to check for sandbars, etc.  Please do the same.

Treating burns, and helping young children get through the burn treatments is an art, why? Quite simply it is because of the inability of young children to handle painkillers during the stretching of their skin while being treated.  See: Snowy game, VR goggles take burn victims' minds off of pain, this is the type of game that you could easily build using the C# Express and XNA Game Studio, unfortunately, WII and Playstation would force you to pay $10,000 for their development tools, and then pay for access to the console.

 

Bottom line: Be safe, have fun, celebrate Independence! no matter where you are.

Posted by SoCal Sam | 1 Comments

XNA: Using Fonts in XNA 3.1

XNA 3.1

No difference in how to use Fonts in XNA 3.1 over XNA 2.0.  If you already know how to use text in your project, this won’t be a big help to you.  This article was written to try to look a little smarter than my previous blog may have made me look.

Using text in your XNA project

Using the previous Blog approach, was simple, but not elegant. 

It would be better to add text that indicates whether or not SpriteBatch is an abstract class or a base class.

In this case you will need to add an existing content resource to the project.  The image below shows you how to add the spritefont material to the content folder.  There is a link that gets you to a very clear way to implement text in your game project.  Over future blogs we will go over how to add text, scoring and so forth to your game. 

Follow the article on MSDN:

Use the diagram to the right to add the existing content templates, in this case Sprite Font.

image
Ok, now you have added the content resources what do you do?

First you have to construct the objects from the base or abstract classes, the objects need to build the fonts/letters and the location of the fonts/letters

construct/instantiate a SpriteFont object and in this case the object’s name is Font1

You will also need a way to place it on the gameboard. 

The way you put it on the game board is through the construction/instantiation of the class Vector2, and the object that is constructed is named FontPos.

SpriteFont is a sealed class which is a member of the Microsoft.Xna.Framework.Graphics, which is in the file named:
microsoft.xna.framework.dll



public class Game1 : Microsoft.Xna.Framework.Game
   {
       GraphicsDeviceManager graphics;
       SpriteBatch spriteBatch;

       //Add the two lines below


       SpriteFont Font1;
       Vector2 FontPos;

 

       //******************

Your code should look like:

image

Later in the code, the FontPos will be used to determine the HEIGHT and WIDTH of the pixels that make up the text that are being written on the screen

In your test of whether or not spriteBatch is abstract or a base class, this test will function to change the screen red if spriteBatch is a class, and it will stay blue if it isn’t and write the message on the screen.

image

More Posts Next page »
 
Page view tracker