The Dot Docs

DotUtils

DotUtils.pas contains various utility functions that didn't quite fit into any other file.

Timing functions

  function dotTime: Int64;
  function dotTimeSince(start: Int64): Single;
  procedure dotStartTiming;
  function dotTimeElapsed: Single;

These functions can be used for timing, e.g. to measure your application's framerate. They are wrappers around the QueryPerformanceCounter() API function. The dotTime() function returns the current time, and dotTimeSince() returns the time elapsed since a given start time. The elapsed time is measured in seconds. The dotStartTiming() and dotTimeElapsed() functions are convenience functions that work like a stopwatch, and for which you don't need to store the starting time yourself.

Debugging functions

  function dotWin32ErrorString(code: Integer): String;

This function returns a "friendly" error message for a given Win32 error code, e.g. as returned by the GetLastError() API function. You can use this string in error dialogs or when raising exceptions.

  function dotReadVersionInfo(filename: String): String;

This function reads the version info resource from the given file and returns the version number as a formatted string. The version number this function reads back is the one you can set in Delphi under Project > Options > Version info.

  procedure dotGLAssert(const cause: TObject; const location, msg: String);

This function is similar to the well-known assert() function, but detects OpenGL errors instead of testing a user-specified condition. If glGetError() does not return GL_NO_ERROR at the time dotGLAssert() is called, an error message is displayed and the application is terminated. The error message contains the OpenGL error string (e.g. "invalid enumerant"), the class name of the cause argument, and the location and msg arguments. Just like the regular assert(), dotGLAssert() does not do anything if assertions are disabled in your project's compiler settings.

File utility functions

  function dotFindFiles(const mask: String; attrib: Integer): TStringList;

This function returns the names of all files which match the given filename mask and attributes. For example, passing in "C:\*.bat" would return all ".bat" files in the root of your hard drive. The attribute mask should be one of the faAnyFile, faDirectory, ... constants. Documentation for these can be found with the FindFirst() RTL function.

The Delphi OpenGL Toolkit was written by Tom Nuydens.
See main page for disclaimer. For updates, visit Delphi3D.