Author: Slobodan Pavkov

Marbles game for Windows 8

Finally my first Windows 8 game called Marbles is finished and available in the Windows Store! That partially explains why i did not wrote any posts on this blog for almost a year 🙂 It’s been emotional! Seriously, it has been quite a journey. First i was learning XNA, then Monogame, and then game development in general. I always wanted to write a game (aren’t we all?) so finally i decided to really do it! At first i started very enthusiastically and tried building a 2d platformer game, and after solving most of technical problems like character and level rendering…

Dot Net Gotcha #2 – Loop variables and Closures

This one is my favorite. Can you guess the output of this simple console application: One would expect to see numbers from 0 to 9 but here is the actual output of the app: OK that’s strange right? It turns out its like that by design. What you have there is a Closure over the loop variable. And closures in C# are done around variables and not around specific values of those variables – so that means that lambda expression gets to use the actual reference to the closed variable. Let me explain in little bit more detail: In first loop…

Dot Net Gotcha #1 – List versus Collection constructor

Don’t Google it! Do you know (without Googling it) what will this console application display when executed? If you try to think logically, you expect that both List and Collection will contain numbers from 1 to 6 when they are displayed, right? Wrong, otherwise this would not be a proper gotcha 😉 Here is the actual output of the application (surprise, surprise): Do you know why? Answer is actually very simple. If you check the MSDN documentation for Collection constructor that accepts generic IList you will see this text: Initializes a new instance of the Collection class as a wrapper for…

Another way to close Windows Phone application from code

Correction In my previous post on how to terminate the Windows Phone application i proposed a solution that is not really in accordance with Windows Phone Marketplace Technical Cerification Requirements (see requirement 5.1.2): ” An application that closes unexpectedly fails certification. ” Even though I’m pretty sure that this requirement is not enforced since my apps use this approach and they were never rejected i decided to present another way. Some good people suggested in comments of my previous post that you can terminate current application  simply by calling the XNA Game class Exit method like this: The downside of this is…