view OSInfo.h @ 2327:5e4d90305d06

EventCastSpell removing duplicate code for handling empty pObjectList->pObjects array or not finding the correct value + moving everything into the main switch
author Grumpy7
date Tue, 01 Apr 2014 23:20:15 +0200
parents d44b7775fc06
children
line wrap: on
line source

#pragma once
#include "OSAPI.h"

class OSInfo
{
  public:
    inline static bool CanUseDirectDraw4()
    {
      if (Ready())
        return info.dwPlatformId != VER_PLATFORM_WIN32_NT || info.dwMajorVersion >= 4;
      return false;
    }

    inline static bool CanUseDirectDraw2()
    {
      return true;
    }


  private:
    static bool           initialized;
    static OSVERSIONINFOA info;

    static bool Ready()
    {
      if (!initialized)
      {
        info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
        if (GetVersionExA(&info))
          initialized = true;
      }
      return initialized;
    }
};