Detecting C++ memory leaks in Visual Studio - again

I made a small post about detecting C++ memory leaks in Visual Studio in 2010. At the time that seemed to suffice, but some months ago someone told me about Visual Leak Detector and boy does it work. According to the website itself Visual Leak Detector is a free, robust, open-source memory leak detection system for Visual C++. It’s pretty easy to use. After installing it, you just need to tell Visual C++ where to find the included header and library file....

June 3, 2012 · 1 min · 154 words · David Amador

Find/Replace in Visual Studio using regular expressions

Usually Find/Replace gets the job done for what I need, although sometimes using “Replace All” can break more stuff that it fixes. But today I had this function I wanted to get rid of and simple change it with a public variable. So I had something like this. object->setLayer(/*BLABAL BLA CODE, */); I want to replace it with something more simple object->Z = /*BLABAL BLA CODE, */; So using Visual Studio Find/Replace in regular expressions mode I used this as a search string...

January 14, 2012 · 1 min · 207 words · David Amador

Basalt code swarm

I discovered code swarm a while ago and decided to test on my own repositories. This is a test on Basalt, and although I’ve been working on the engine since January 2010, only in 2011 did I placed in on a repository so a bunch of stuff is added right on the beginning. This is the result.

December 23, 2011 · 1 min · 57 words · David Amador

Blog new look

Spent a little time giving my blog a new look. It’s not that I didn’t like the old one but sometimes it was a bit of a mess, I’ve been getting many new readers so it was time for a cleaner look. My main concern was getting all code posts to be readable but I think they are class XPTO { public: XPTO(); }; Let me know if you find any errors, since I’m not going to dig up the whole blog finding errors =P...

March 22, 2011 · 2 min · 249 words · David Amador

So where is that motivation?

I follow a couple of dev blogs, some are game developers, others make websites or software. In the last couple of months I’ve been reading a lot of them complaining about lack of motivation to develop their idea of the lack of motivation for development in general. Happens to me too, heck it happens to everyone once in a while… It’s something that happens usually half way though or after you get the initial prototype running....

March 9, 2011 · 3 min · 527 words · David Amador

Viewing Windows Phone 7 Marketplace on the simulator

Since I’m out of the countries where WP7 Marketplace is available it’s been a real pain to check out new games and most of all if Vizati was already available. Btw it’s out there, go give it a try, there’s a trial mode. It’s great fun 🙂 So searching some forums I found a neat code to check this on the simulator. Basically create a new WP7 Silverlight App and write this main page code...

November 17, 2010 · 1 min · 129 words · David Amador

Tracking memory leaks in Visual Studio

I just discovered this useful piece of code for all who don’t have (including me) any memory leaks tracking code or software. I know there are other and better solution but this can be handy for quick findings without much hassle. First place this code in your entry point file, generally main.cpp inside your main() function #ifdef _DEBUG int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit _CrtSetDbgFlag(flag); #endif Now just run you game/program as you would normally, in debug mode of course....

October 19, 2010 · 1 min · 165 words · David Amador

Using Isolated Storage to save/load files on Windows Phone 7

I’m seeing a lot of forum threads with people asking how to save/load files on Windows Phone 7, well for XNA 4 in general. You can use IsolatedStorage for that using System.IO.IsolatedStorage; Both save and load can be done by creating a IsolatedStorageFile, I then use a Filestream and write with a binaryWriter IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); // grab the storage FileStream stream = store.OpenFile("test.txt", FileMode.Create); // Open a file in Create mode BinaryWriter writer = new BinaryWriter(stream); float myvar = 5....

October 10, 2010 · 1 min · 153 words · David Amador

Instance based Callbacks in C++

One of the things that was probably forgotten but the dudes who made C++ standard were callbacks, there’s no out of the box solution for Instance based Callbacks, just for functions. When I moved to C# I was really happy with the way delegates work, it’s simple, easy and most of all, it works. On game development one of the things callbacks are usually used is for Buttons, you have a menu and want to attribute a function to each button....

July 14, 2010 · 2 min · 296 words · David Amador

Testing the new Visual Studio 2010 features

Yesterday was an exciting one for all sorts of developers around the world. Visual Studio 2010 got available for both MSDN and DreamSpark subscribers. First time I installed VS2010 was in the RC form mainly because of WP7 Developer’s Tools and XNA4.0 but haven’t made many investment in searching for new features. But being available at Dreamspark I downloaded the Professional version and decided to try it out a bit....

April 13, 2010 · 2 min · 340 words · David Amador

Write better code using FxCop

Microsoft FxCop, know what this is all about? Good for you, keep using it, It’s a valuable tool. For those who don’t know you can download it here and read the MSDN documentation here. FxCop is a is an application that analyzes managed code assemblies and reports information about the assemblies, such as possible design, localization, performance, and security improvements. I decided to make a profile of my current working project and it reported tons of stuff....

March 18, 2010 · 1 min · 107 words · David Amador

C# foreach VS for loop

When I started using C#, mainly because of XNA one of the things I got used to write is foreach loops instead of for, seemed easier and it’s a much cleaner code. Doing almost the same thing as a for loop I never really bother to see the differences, almost everyone in their XNA examples used it instead. Today I decided to see the differences between them: FOR int[] values = new int[1]; int total = 0; for(int i = 0; i < values....

December 12, 2009 · 2 min · 312 words · David Amador