Skip navigation

Monthly Archives: February 2016

Loading .gif’s in Win32 is really easy through a GDI+ pathway.

The short of it is something like this:

#include <windows.h>
#include <gdiplus.h>
using namespace Gdiplus;
// .. main()
Image *image = new Image( "image.gif" );

Functions are located here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms534462(v=vs.85).aspx

An example is here: https://github.com/superwills/eternity/blob/master/eternity/GDIPlusTexture.cpp#L133, or here.

You have to do File | Save As… then hit the Attributes button at the bottom

downmix

There’s a really simple dialog in File | Batch Processing… / Convert which lets you downmix a bunch of files at once also.

 

 

A bit of a weird issue, when you declare a static variable in VS 2015 you can initialize it in the member declaration:

// Unit.h
struct Unit
{
  static const char Character = 'P'; // class-level var
  char symbol; // member var
  Unit()
  {
    symbol = Character; // init with static var
  }
};

Something weird happens with the compiler sometimes however. On multiple compile/runs, the variable of the static const char Character, when changed, doesn’t bake properly into the exe.

To fix this, just split the declaration and initialization into a corresponding .cpp,

// Unit.h:
struct Unit
{
  static const char Character; // class-level var, init in .cpp
  char symbol; // member var
  Unit()
  {
    symbol = Character; // init with static var
  }
};

// Unit.cpp
const char Unit::Character = 'P';

There’s an odd thing that can happen in Windows 10 when you try to change your monitor settings with the NVIDIA Control Panel. When you try to change some multi-display settings, you may get the following dialog, stating:

“Your changes cannot be applied right now. This may be due to any of the following reasons:

  • A video is playing or a video application is running
  • A game or 3D application is running in full-screen mode
  • A command prompt window is running in full-screen mode
  • You have rotated your desktop with the Rotate Display page
  • The Display Optimization Wizard is running

You can try to apply your changes again after resolving the conflict.”

Screenshot 2016-02-06 09.03.05

I resolved this by closing Skype of all things. Even though you wouldn’t suspect a program like Skype would violate the above constraints, it does.