• Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

About this blog

Getting started in game development.

Entries in this blog

I've spent the last week or so on vacation away from home, but I have managed to get some more work done on the highlight menu classes. The menus have come along nicely and seem to work well so far.

Some changes since last journal entry:
-Added HorizontalMenu class
-Added MenuOption abstract class
-Added some error/exception handling
-Refactored code into the abstract class
-Fixed some bugs, probably added more [smile]
-Modified the test program to use a polymorphic approach (I think)

You can see the Highlight Menu code here and the test program here. You'll probably need to use the Save As option to download it.

Areas For Improvement

Error handling has been somewhat "iffy" for me. I know how to throw/catch exceptions, but I lack an understanding of general error handling theory such as when and where to use it. I just toss in some code in places that seem obvious such as setting an X value beyond the width of the window.

Comments seem rather sparse, but this isn't exactly complex code. Nevertheless, I'm sure it could use more. We'll see what happens when I try to read this a few weeks after not looking at it.

C# Workshop

I've been keeping up with some of the reading using my phone. The .NET Book Zero displays fairly well on my T-Mobile Dash and I can read it when the fish aren't biting at the cabin. With such little time to spend at a computer I haven't done much with week 2 exercises yet; I worked on the menu instead. I'll still have a little catching up to do next week (vacation ends) and the first project will start soon.

Highlight Menu

I created this menu as a personal exercise to dive into C# a little farther during the first two weeks of the workshop. I hope to be able to use this somewhere in the text game we'll be working on. I've always liked these types of menus.

Some features:
- Text alignment (Left, Center, Right) within the highlighted area
- Add/Remove any object to/from the menu
- Console Colors
- Menu X, Y placement
- Other misc stuff

The testing code:

using System;
using MenuSelection;

class TestMenuSelection
static void Main(string[] args)
int fieldWidth = 25;
int numOptions = 5;

MenuColors menuColors = new MenuColors();
menuColors.SelectionBackgroundColor = ConsoleColor.Blue;
menuColors.SelectionForegroundColor = ConsoleColor.White;

VerticalMenuBar mainMenu = new VerticalMenuBar(fieldWidth, menuColors, TextAlignment.CENTER);
mainMenu.MenuWrapAround = true;

for (int i = 0; i < numOptions; i++)
mainMenu.AddOption("Option " + (i + 1));

mainMenu.X = (Console.WindowWidth - fieldWidth) / 2; // center
mainMenu.Y = (Console.WindowHeight - numOptions) / 2; // center

string opt;
opt = mainMenu.DoMenu().ToString();
Console.WriteLine("\nYou selected {0}.\nSlap a key to continue.", opt);
} while (opt != "Quit");

I'll post the source to the rest later after I add a horizontal menu class and clean it up. [smile]

One thing that is missing is quick-key selection, such as pressing F1 or ESC to select an option. I may or may not add that feature. I really don't have any idea yet how I would implement that. I'm sure something in the next few weeks of the workshop will help.
Oh yeah! I'm so l33t I got the first post on my own journal. Owned.

Anyway, hello GDNet journal world. Allow me to quickly introduce myself. My name is Brandon and I'm a 25-year-old dude in Fort Collins, Colorado, USA. Last year I graduated as a computer support specialist and I'm starting school again this fall to get a computer science degree.

I quickly realized supporting computers, networks, and people's failing mice was not my ideal job. After spending some time reflecting on my past and looking towards the future, I chose to continue my education and give it a focus that I'm passionate about. That focus brings me to GDNet; can you guess what it might be?

The C# Workshop is where I'm starting my adventures. I decided I should learn a language and learn it well. I blogged about other reasons for joining the workshop at my website. I think this journal will also be very beneficial.

I used a journal during a networking capstone class where I learned about its value. We used it to analyze our learning, reflect on our experiences, and evaluate our progress. This online journaling seems to offer much more, such as feedback and the ability to share ideas, code, and etc with others.

An applicable quote to begin this journal: "Nothing is as empowering as real-world validation, even if it's for failure." - Steven Pressfield

First up on the agenda: an old school menu selection (think highlighting text) prototype for the SUD (single user dungeon) we'll be working on during the workshop.
Sign in to follow this  
  • Advertisement