Frequently asked questions

This FAQ tries to answer the most commonly asked questions.about Minueto. It will be updated as we receive more questions.

General

Who built Minueto? Where does it come from?

Minueto is a component of Alexandre Denault's master thesis. He is currently researching "Game Frameworks for Undergraduate Studies". When not working/playing on his computer, he can be found on the McGill squash courts.

Why did you build it in Java?

Undergraduate students at McGill are heavily exposed to Java in their early course. Since Minueto's goal is to make game programming more accessible to them, it would have been counter productive to choose another programming language.

Where does the name Minueto come from?

When we first started working on Minueto, Alexandre Denault was shopping for a newer and  quieter computer casing. At the time, he was hesitating between Antec's Sonata and Antec's Minuet. Although he choose the Sonata in the end, he thought that a variation of Minuet would make a cool project name.

Can you add feature X to Minueto?

We are always happy to hear suggestions for Minueto. If you have any ideas for Minueto, please send an email at alexandre.denault@adinfo.qc.ca . Some people have even taken the source code to Minueto and added the features themselves. If this the case, we would like to see your modification. We might even add it to the main release.

Why does my Minueto application no longer compile (since 0.8.0)?

Minueto 0.8.0, 1.0.0 and 2.0.0 introduced many changes, some of which broke compatibility which previous Minueto application.  The chances required to use this new version of Minueto are relatively minor and show not require you to modify more than a few lines of code. Exact detail on these changes can be found in the changelog.

Graphics

Is there a problem with Minueto and Swing? When I try to open a Minueto window from a Swing button, it does not work. However, the same code when not used with Swing works.

What is probably happening is that you are trying to create a Minueto window from an Swing/AWT thread (i.e. in response to the press of a button). Since Minueto window's requires some special graphic acceleration attribute, it cannot be created from a Swing/AWT thread.

Fortunately, the solution is pretty easy. All you need to do is to create the window from another thread. You can either do this from your main thread or you can spawn a new thread, allowing it to create the window and let it the swing process terminate. The new Minueto 1.1 package available from the download section here provides an example of this.

Why does my application freeze when I switch in/out of fullscreen mode?

This is a known problem. Some JVM react badly to been switch from/to fullscreen mode. We have had problems with both Sun's and Apple's Java 1.4.2. However, Java 5.0 seems to be perfectly stable. My suggestions are:

Why can't I change into fullscreen mode under Linux?

Fullscreen mode doesn't work under Linux. Sun plans to add it to it's next release of 5.x, but no promise have been made. If you have problems under Windows, it's possible you don't have sufficient access rights to change the display mode.

Why do I have to redraw the whole image every frame?

Minueto uses Java2D's hardware acceleration features to accelerate drawing speed. Depending on the Java Virtual Machine used, Minueto might or might not be able to conserve the previous frame. Since Minueto's goal is to be easy to learn, we have decided to only offer one model of double-buffering.

Advanced users of Minueto can bypass this limitation by using their own double-buffering technique. To do this, the programmer must create a blank MinuetoImage of the same size as the screen. Instead of drawing to the screen, the programmer draws to that MinuetoImage. When the programmer is ready to display the next frame, he only needs to draw this MinuetoImage to the MinuetoWindow and call the render method. The content of the MinuetoImage will not lost.

The performance impact of this technique depends on the amount of changes done to the MinuetoImage at each frames. Tests have shown that drawing multiple small images is slower than drawing a large image.

Is drawing to a MinuetoImage faster than drawing to a MinuetoWindow?

Depending on which JVM is used, Minueto objects can be stored in main memory or in video memory. However,  tests have shown that there is very little speed difference between drawing to a MinuetoWindow and drawing to another MinuetoImage.

When I rotate a figure, why does the size of the rotated image differ from the original image?

Depending on the angle of the image, the size of the returned image might have been increased. This prevents the rotated image from being clipped. Also, the returned image might be smaller on one axis (either width or height) as unused space is cropped off.

What is the difference between getWidth() and getWindowWidth()?

As explained in the API, getWidth() returns the width of the area are allowed to draw in, as opposed to getWindowWidth() which returns the actually width of the window. The value return by getWidth() will always correspond to the width specified to the MinuetoWindow constructor. With a MinuetoFrame, the value returned by getWindowWidth() is slightly higher since it takes into account the width of the border added by the operating system.

When I run a Minueto application under Linux, sometimes, the coordinate system seems shifted by a few pxels (up, down, left and/or right)?

This is a known bug in Minueto and we are currently working to fx it. It is caused by a timing issue in the JVM and several window managers not correctly reporting the size of their borders. Some window managers, such as Fluxbox and WindowMaker seem less affected by this problem. This problem only occurs under Linux.

When I run my Minueto application, I get an OutOfMemoryError exception.

An OutOfMemoryError exception is thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. The culprit in a Minueto application is often found in the rendering loop. If a particular image must be drawn in several frame, it should not be initialized in the rendering loop. For example,

MinuetoImage rectangle;

while(true) {

    rectangle = new MinuetoRectangle(200,100,MinuetoColor.BLACK,false);
    window.draw(rectangle, 10, 10);
    window.render();
    Thread.yield();
}
    

will produce an OutOfMemoryError exception because the image of a rectangle is created at each frame. An application running at 60 frames per second will allocate 3600 image buffers after a minute, thus requiring an estimated 68 megabytes of memory per minute. A simple solution would be to move the rectangle constructor out of the rendering loop.

MinuetoImage rectangle;

rectangle = new MinuetoRectangle(200,100,MinuetoColor.BLACK,false);

while(true) {
    window.draw(rectangle, 10, 10);
    window.render();
    Thread.yield();
}
    

Initializing the rectangle once would only require an estimated 19 kilobytes of memory.

What happened to MinuetoWindow? Why can't I create a MinuetoWindow anymore?

In version of 1.0.0 of Minueto Core, MinuetoWindow is now an abstract class. To create a full screen window, you need to use MinuetoFullscreen. To create a normal windowed frame, you need to use MinuetoFrame. Note that both of these classes are subtypes of MinuetoWindow, so you don't need to change all your application.

As of Minueto 1.1, MinuetoWindow has been converted to an interface; however, this shouldn't affect any code that works with Minueto 1.0.0.

How can I draw alpha transparencies?

As of version 1.0.0, Minueto now supports Alpha transparencies. Be warn that this is an experimental feature. Check out the MinuetoOptions class for information on how to activate alpha transparencies.

How can I make Minueto faster?

As of version 1.0.0, Minueto now supports options to force hardware acceleration. Be warn that this is an experimental feature. Check out the MinuetoOptions class for information on how to activate hardware acceleration.

Input/Output

Why is key X not availible in MinuetoKeyboard?

The constants in MinuetoKeyboard enumerate the most commonly used keys on the Keyboard. However, you can still capture a keystroke, even if it's not listen in MinuetoKeyboard. Keys are described as integer values. You simply need to find the value of the key you want to use.

What is the different between the Key Press, Key Release and Key Typed event? Which one do I use?

A key press event is generated when a user presses a key on the key board. A key release event is generated when the user removes his finger from a key and the key returns to its original position. A key press event is always eventually followed by a key release event.

Depending on the situation, you might need both. For example, some games determine the lenght of a throw depending on the amount of time the space bar was pressed. In that case, you need to measure the time between the key press and the key release events.

The Key Type is rarely used in game development. However, it is offered as a feature to make implementing text boxes easier. If you don't need to manipulate text, I suggest you stick with Key Press and Key Release.