Simple2D 1.13 now available
A new major release of Simple2D is now available (the download link can be found at the bottom of the page).
Version 1.13 is a small update with the following main changes:
- Visual Studio 2013 compatibility and pre-compiled binaries
- Significant usability updates to the Animation class
- A small number of new math & time functions
- Some bug fixes
- Windows 7 Service Pack 1 with Platform Update for Windows 7
- Windows Server 2008 R2 Service Pack 1 with Platform Update for Windows 7
- Windows 8
The installer will download and install Platform Update for Windows 7 for you if you don’t have it already.
Migrating your libraries from Simple2D 1.06 or later
Simply run the new installer. Your Simple2D installation will be upgraded automatically to the latest version.
Migrating your libraries from Simple2D 1.05 or earlier
- Uninstall Simple2D from Add/Remove Programs in Control Panel
- Run the new installer
Migrating your applications from Simple2D 1.10-1.12
The default library install paths have changed in Simple2D 1.13. The ‘d’ suffix is removed from both Simple2D.lib and Effects11.lib debug builds and the libraries are separated into Debug and Release folders instead. Separate library folders are included for Visual C++ 11 (Visual Studio 2012) and Visual C++ 12 (Visual Studio 2013). To ensure you use the correct libraries, include the following library paths:
C:\Program Files (x86)\DJKaty.com\Simple2D\lib\vc11\$(Configuration) (for Visual Studio 2012)
C:\Program Files (x86)\DJKaty.com\Simple2D\lib\vc12\$(Configuration) (for Visual Studio 2013)
Shader compilation: If you use DirectX shader compilation via the Effects11 framework, note that Visual Studio 2013 uses D3DCompiler_47.lib by default which generates a run-time warning when you attempt to compile a shader. See below for more information and a workaround.
Simple2D::TextWidth: This function now takes into account the width trailing whitespace by design (the previous trimming behaviour was a bug). If this behaviour is undesired in your application, be sure to trim the text argument to TextWidth.
Null function arguments: If you pass a function to another function as an argument, and the passed function is empty, you must now pass nullptr instead of NULL.
Migration from Simple2D 1.11: See the Simple2D 1.12 Release Notes.
Migration from Simple2D 1.10: See the Simple2D 1.11 Release Notes.
Migration your applications from Simple2D 1.07 or earlier
Please see the section entitled Code Migration from Simple2D 1.07 and earlier in the Simple2D 1.10 Release Notes.
Improvements and bug fixes
Compiler and library changes:
- Simple2D can now be compiled with Boost 1.55 in Visual Studio 2013 (builds in Visual Studio 2012 use Boost 1.53 and are known to be compatible with Boost 1.47).
- Visual Studio 2013 binaries are now provided for Simple2D and Effects11 in both Debug and Release configurations.
- BREAKING CHANGE: The library folder structure has changed: include lib\vc11\$(Configuration) for Visual Studio 2012 builds or lib\vc12\$(Configuration) for Visual Studio 2013 builds, where $(Configuration) is either Debug or Release. The ‘d’ suffix on Debug library builds is no longer used for either Simple2D.lib or Effects11.lib.
- BREAKING CHANGE: The Effects11 libraries have been moved from ‘redist’ to ‘lib\vcXX\$(Configuration)’.
- The ‘redist’ folder now includes D3DCompiler_47.dll for applications using DirectX shader compilation built with Visual Studio 2013 (builds for Visual Studio 2012 should use the already included D3DCompiler_46.dll).
- The Simple2D 1.07 compatibility libraries (Simple2D_compat107.lib and Simple2Dd_compat107.lib) have been removed. Please migrate your applications to Simple2D 1.10 or later. NOTE: You can still build these libraries by creating a new Build Configuration in Visual Studio and defining SIMPLE2D_COMPAT_107 in the Preprocessor Definitions configuration section.
- WARNING REGARDING Effects11.lib IN VISUAL STUDIO 2013: Visual Studio 2013 ships with D3DCompiler_47.DLL (Visual Studio 2012 ships with D3DCompiler_46.DLL which generates the following warning when compiling shaders using the Effects11 framework: “warning X4717: Effects deprecated for D3DCompiler_47”. Be sure to ensure your shader compilation code deals with this warning gracefully. The Simple3DBoxDemo and Simple3DBoxSceneDemo shipping with this version of Simple2D have compilation error checking commented out so that they run correctly.
- Dependencies on boost::shared_ptr and boost::function have been removed and replaced with std::shared_ptr and std::function. BREAKING CHANGE: Note that empty function arguments must now be passed as nullptr instead of NULL.
- ‘const’ was added to some function declarations.
- A new virtual function Simple2D::OnResize(int width, int height) can be overrided to perform post-processing after the render target has been re-sized and when it first becomes visible. The function is only called if ResizeBehaviour == RB_Resize (particularly useful for setting the projection matrix according to the render target’s aspect ratio in 3D applications)
- The Animation class is now templated in the return type of the result of an animation function. Use TypedAnimation<T> to instantiate a templated animation (Animation is a specialization using TypedAnimation<double>, preserving the existing behaviour so no code changes are required). The idea of this is if you want to use an int or float instead of a double for the return type, to avoid having to use static casts in your code. Note that AnimationChains must still use doubles and attempting to cast any TypedAnimation other than TypedAnimation<double> to AnimationChain will throw an exception.
- You can now get the current animation function result by just using the object variable name instead of object.Get() or object.GetAnimOffset() (implicit cast conversion to type T).
- const has been added to all the relevant function definitions in TypedAnimation.
- You can now get the current animation result + sepcified % offset by using the function object operator object(offset) instead of object.GetAnimOffset(offset).
- The animation factory functions WaitAt, FromTo and FromPlus now return a TypedAnimation<T>.
- The animation factory functions WaitAt, FromTo and FromPlus have an additional optional bool argument which you can set to false to start the animation immediately, negating the need to call Reset() immediately after the factory call.
- The new animation factory function Fixed(T value) creates an animation with a fixed, clamped value which starts immediately.
- The new animation factory functions FromToAndClamp and FromPlusAndClamp mirror FromTo and FromPlus but don’t repeat the animation from the beginning when it completes, instead holding it at the final value.
- TypedAnimation<T> has a new constructor taking a single value, the behaviour is equivalent to Fixed(T value). This also allows you to write code such as myAnimation = 123;
- Bug fix: Simple2D::TextWidth did not correctly include the width of trailing whitespace when calculating the pixel width of an entire string (Note: it is the caller’s responsibility to ensure whitespace is trimmed from the input string if it should not be counted in the pixel width).
- Bug fix: when the caret was placed adjacent to whitespace in a text box, or when a selection in a text box contained whitespace at its start or end, the whitespace was not rendered, causing an apparent whitespace truncation in the entered text. The actual text as stored by the application was unaffected – this was a rendering bug only.
Math & Time:
- Simple2D::Random() now has an overload for generating and returning floats as well as ints. Usage: float r = Simple2D::Random(1.0f, 5.0f);
- The new function float Simple2D::GetLastFrameTime() gets the time elapsed in seconds between the start of the last frame and the start of the current frame. It is equivalent to Simple2D::LinearMovement(1.0f);
- The new templated function T Clamp(T v, T a1, T a2) returns v bounded between a1 and a2 inclusive.
- The new function Simple2D::GetAspectRatio() returns a float with the render target’s current aspect ratio
- RenderTargetView and DepthStencilView are now public members of Simple2D (instead of protected).
Changes to example applications:
- AnimationAndGlyphMetricsDemo, PathGeometryDemo, Simple3DBoxSceneDemo – now show how to use the simplified animation overloads and TypedAnimation<T>.
- Simple3DBoxDemo, Simple3DBoxSceneDemo – now show how to use the overrideable OnResize() function and GetAspectRatio() to set the projection matrix.
- CollisionDemo3 – more comments have been added to clarify the collision detection code
Known issues in Simple2D 1.13
No known issues.
Download link (always download the latest version)
Please be aware that Simple2D is very much a work in progress, and that changes from version to version can break older code, although I try to maintain backwards compatibility as much as possible. The code is currently undergoing significant re-factoring with each new version.
I hope you find Simple2D useful!
For setup and installation instructions, follow the Simple2D Installation Tutorial.