0.9.7:FAQ

From DXFWiki

Jump to: navigation, search

Contents

General

Do I have to use DXFramework for my arcade game?

  • (For UM EECS 494 2006 students.)

No, but its use is recommended unless you know exactly what you are doing. I (Jonathan) may not be able to provide support for other solutions.

The program complains about a missing DirectX DLL.

First, make sure the executable you are trying to run was built in the Release configuration. If you didn't change anything, you are likely working with an executable built in the Debug configuration and need to go back. Change the active configuration by selecting the drop down near the top of the Visual Studio IDE window.

Second, make sure the computer you are running DXFramework on has the latest DirectX runtime update on it. The latest update is always available here:

The program still complains about a missing DirectX DLL

Maybe you have not applied the new linker input bug workaround to the template project?

What kinds of image file types are acceptable?

In theory, many many types. In practice, JPEG, PNG, BMP are all sure to work. Try loading it and if it doesn't load, convert it to one of the types above.

What kinds of music or sound effects are acceptable?

In theory, any format accepted by DirectShow via the dxf::Music class. In practice, only MP3 and Midi file types have been tested to work.

For sound effects, use the wave format with the dxf::Sound class, it is much more responsive than dxf::Music.

Check out Audacity if you need a sound editor.

Programming Issues

Can I use C++ Exceptions?

No, apparently they are a huge performance hit even if you never throw an exception because of the bookkeeping involved.

I'm getting many compile-time DirectX errors.

Make sure Visual Studio is configured properly.

What about different screen resolutions?

This is a very difficult topic. It is OK to simply pick 800x600 or 1024x768 for simple 2D games. See dxf::Game::Load()

Can I go full-screen?

Yes, ALT-Enter to toggle on the fly. To start full-screen, see the function prototype for dxf::Game::Load()

How do I exit the program?

Call PostQuitMessage(0) anywhere. Change 0 to your favorite exit code if you want.

How do I shut off the mouse cursor?

There doesn't seem to be an easy reliable way to do this in windowed mode, so just leave it on, it shouldn't hurt anything. If this is not acceptable for you, Google around for a solution.

If you would like to control the cursor in full screen mode, use this function:

void    DXUTSetCursorSettings( bool bShowCursorWhenFullScreen, bool bClipCursorWhenFullScreen );

It is defined in DXUT.h. Call that function in the state's Load() function and remember that the setting will persist across state changes.

How do I play MP3 files?

Use the dxf::Music class (not dxf::Sound)

What are precompiled headers?

The DXUT and engine components use precompiled headers to increase compile time. Long story short, every file includes the same header file (such as dxstdafx.h or dxframework.h) and some special settings precompile this code to minimize rebuild times. This is best for code that doesn't change often. A simple search for precompiled headers reveals a lot more information on the topic.

Although the engine and dxut components use precompiled headers, the other components do not by default in an attempt to not confuse those unfamiliar with the topic. Feel free to use them if you are comfortable.

What is this Instance() function? (Singletons)

With 0.9.7 comes a refactoring of DXFramework's singletons Game, Model, View, Controller among others. It is legal for only one instance of each of these classes to exist, the Instance() function both creates and retrieves this instance. The first time it is called, the instance is created, each additional time it is called, the address of the instance is retrieved. The instance is deleted when the program is shut down. If Instance() is not called, the instance of the class is never created.

I get an include error in my .rc file using Visual C++ Express

If you are getting an error similar to this and are using Visual C++ Express:

.\demo.rc(10) : fatal error RC1015: cannot open include file 'winres.h'.

This is caused because Express does not ship with the files required for resources. The workaround is described here.

Visual Studio

When I hit F5 to debug, I get a weird dialog, "Executable for Debug Session"

You likely have the dxf-engine project selected as your startup project. Right click on a different project (like dxpong or your game's project) and select "Set as Start Up Project".

Bugs

I found a bug!

Report bugs here if you find one.

Linker input bug

Personal tools