h1

Setting Up SFML.NET 2.0 to Work With Visual Studio 2012 C# Projects

May 12, 2013

(For those of you unfamiliar, SFML is one of the best alternative libraries to SDL and provides high-level access to graphics, sound, input and networking. It’s perfect for 2D games and other multimedia applications. You can check it out over at their website)

Special thanks to LA and Tyson for pointing out some details in the comments! 🙂

So SFML 2.0 recently went out of RC and is now the official stable version. As I found out about the news I decided to try it out, and since I just installed Visual Studio 2012 I also wanted to see if SFML would work on such an IDE. I saw that the SFML library also had updated bindings for the .NET languages (Visual C++/Basic, C#, etc.) and wanted to take my hand at getting SFML to work with it. It was a bit of a hassle since the tutorials at the main website only listed instructions for getting SFML to work with C++ projects, so I had to do some fuddling around to get it to work with a C# project (it should, since it’s a .NET binding for the library)

Anyway, for those of you still having trouble adding SFML to your C# projects in Visual Studio 2012, here are the steps to get you up and running (before anything else, make sure to download the SFML.Net binaries here (make sure to download the right version for your project, as there are both 32 and 64-bit versions), and extract them somewhere on your drive–it doesn’t matter where.):

  1. Create a new C# project in Visual Studio 2012. It can either be a Console or Windows Forms project– the difference is that a Console project displays a console when you run the application. If you create a new Windows Forms project, you can safely remove the pre-generated Form1 item in the project.
  2. Right-click your project in the Solution Explorer and click on ‘Add Reference…’
  3. When the Reference Manager window appears, browse to the folder where you extracted the SFML.net archive and go to the ‘bin’ ‘lib’ folder. Select the .dll files in the ‘lib’ folder and Click on ‘OK’ in the Reference Manager window to add them to your project.
  4. Once the .dll files appear in the References section of your project, right-click your project again and click on ‘Add’ > ‘Existing Item…’ Navigate to the ‘extlibs’ folder this time and add the .dll files there (you may have to select .dll files as file filter in the Open dialog box).
  5. Once these .dll files appear on your Solution Explorer, right-click on them and select ‘Properties’ (or press Alt-Enter). In the Copy to Output Directory property, set it to ‘Copy if newer’.
  6. That’s it! SFML.net is now set-up for your project.

To test if SFML.net has been fully set up for your project, you can try to run this code snippet (add it to your project’s main file):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using SFML;
using SFML.Graphics;
using SFML.Window;

namespace SFML_Test {
   static class Program {

   static void OnClose(object sender, EventArgs e) {
      // Close the window when OnClose event is received
      RenderWindow window = (RenderWindow)sender;
      window.Close();
   }

   static void Main() {
      // Create the main window
      RenderWindow app = new RenderWindow(new VideoMode(800, 600), "SFML Works!");
      app.Closed += new EventHandler(OnClose);

      Color windowColor = new Color(0, 192, 255);

      // Start the game loop
      while (app.IsOpen()) {
         // Process events
         app.DispatchEvents();

         // Clear screen
         app.Clear(windowColor);

         // Update the window
         app.Display();
      } //End game loop
    } //End Main()
  } //End Program
}

When you run your project the output should be similar to this (see screenshot):

Visual Studio 2012 running test C# code with SFML.net 2.0

Visual Studio 2012 running test C# code with SFML.net 2.0

For those of you who still need help, feel free to ask in the comments! 🙂

h1

Well this is surprising

April 21, 2013

I come back after almost a year and find that my blog’s hits have skyrocketed to 10K. All without me posting new content since last year. LOL.

Well, at least that has further motivated me to write for this blog more (also because I am in need of a new hobby)

Segue: If you’re interested in some old school gaming, or general gaming videos, head on to my YouTube page. My current project is uploading some Crash Team Racing videos, so if that’s your thing, go watch my new videos, and subscribe if you would so like. Thanks! 🙂
h1

The problem with an overactive mind

June 1, 2012

A wild blog post appears! (For those of you who are still irate over my blogging schedule, read my previous post.)

So what are we talking about today? Nothing much, really. I just wanted to transfer a couple of thoughts in text form so I can reread them later and laugh at my immature writing style. Just me blogging while listening to my obscure music tastes.

I lied. That is the problem, and the topic of this blog post. There is too much to talk about. I didn’t want to transfer a couple of thoughts in text form. Well, no, not that I didn’t want to; the problem is I can’t. Allow me to elaborate.

The main crux of the problem lies in the fact that I have an overactive mind. No I don’t do any substances–or vices for that matter–so I’m clear there. See, it took me an hour to write the next sentence. I have a short attention span, and that’s dangerous if you have a lot of ideas. The ideas go to waste because you forget about them or aren’t interested in them anymore–I nearly threw away this idea of a blog because I was bored writing it. I see blogging, and writing in general, as a way to “preserve” the ideas in my mind before I throw them away. And I need to finish writing this one before my mind drifts away again.

Focus and discipline are needed, to a degree, when thinking of ideas. Short attention spans and overactivity don’t help. If you have an idea–for a writeup, a story, a painting, a game, anything–write it down. Take care to highlight and visualize the idea entirely. At least preserve the idea permanently and only then can you set it aside before moving on to your next idea. Don’t get bored too easily for that wastes valuable thoughts. Focus and discipline.

So I guess I’m focused now on finishing up this blog post, however I’m out of ideas now. I suppose this is where I’m supposed to end the writeup now. Sure, I expected a better (and longer) post, but with elusive ideas jumping in my mind within microseconds, it can’t be helped that a few paragraphs is all I can spew out about the overactivity.

Either that or I seriously need to cut down on caffeine and get more regular sleep.

h1

How your schedule affects your blog

May 13, 2012

Well, I decided to have a different topic today and write something related to general blog writing. I try to make this blog cover a variety of topics that interest me and I try to write about stuff that I actually know about. I know the content I write about like the back of my hand, though I don’t really have a definite schedule of when I post, which I believe somehow affects the quality of The Ultimate Nerd. But, meh, I promised to myself that this would be a laid-back blog and I’d only write quality stuff when I feel like it.

My blog is an example of a website that has no concrete, recurring schedule of when content is updated or added. Most personal blogs seem to fall into this category, when its authors are laid-back, busy with more important priorities or simply lazy (i.e., me). There are many reasons why blog owners choose to update their blogs whenever they want. Perhaps it is a personal choice of the writer (usually connected to the reasons stated above) or maybe there are limitations, technical or otherwise, that hinders the writer (e.g., limited Internet connectivity). Personally, I don’t feel like sticking to a set schedule, so I only write when I feel like it. While my content is very limited and scarce, it allows me to write with quality. Because I only write when I feel like it, I am motivated to write blog posts with great quality, rather than being stressed and pressured to write with a schedule. This is the option that I believe is a good choice for personal blogs, or RL-busy bloggers.

Of course, there are a lot of blogs (and websites, in general) that do stick to a schedule. These schedules are either daily, weekly or monthly (who writes blog posts once a year?) depending on the topic, genre and interest in the niche of the blog. Writing with a schedule entails discipline. You are responsible for updating the blog for the designated schedule. A well-followed and consistent update schedule generally invites more interested followers, as they know when to come back to your blog in case they want to see something new (keep in mind you need to let your readers know when the blog actually updates, usually in the home or about page of your blog). Still, I believe that a schedule pressures the writer into churning out content. There are moments of last-minute write-ups to meet schedule deadlines. Thus, the quality of the articles is compromised. Well, maybe there are people who tend to write better under pressure, but whatever floats your boat I guess.

Well, that outlines what I believe to be the pros and cons of a blog schedule. With a free update schedule, the blog generally has better content. With a consistent one, on the other hand, the blog has more followers. As the blog author, you decide which option to follow, and you should stick to it. Consistency definitely invites readers, knowing that the writer is a responsible one. Maybe my blog visitors think I’m a lazy bum, but when I feel like writing, I make sure to write the best content. 🙂

h1

2,000 hits after a long while

May 13, 2012

2,000 hits. Wow, that’s a lot of legit traffic, and very amazed that I achieved this after, um, 2 years after I opened the blog. Judging from my statistics, the programming posts seem to be popular (especially to the searchers) so maybe I should put more stuff like that if I want more hits.

 

Anyways, I just wanted to dedicate a little post to thank all those who visited my blog so far, and I hope that more and more people would read and subscribe (it helps because you get all the new content!) to this blog in the future.