Re: [sdljava-users] SDLVideo and SDLVideoMode
Status: Beta
Brought to you by:
ivan_ganza
|
From: Ivan Z. G. <iva...@ya...> - 2005-02-21 01:41:31
|
I haven't had a chance to thinking about anything except doing the
release. This is on my list of things to do.
Thanks,
-Ivan/
Chris Dennett wrote:
> Did the mailing list send out a message with the same name with the
> .diff attached? I'm not sure if everyone got it or not, since I've had
> no confirmation, and there have been mailing list messages since then.
>
> The changes I made in it are quite useful, since it allows you to
> store and use video modes, and it also cleans up some javadoc
> comments, so please merge it with CVS if there are no problems.
> Anyway, I'll re-attach it to this message.
>
>------------------------------------------------------------------------
>
>Index: SDLVideo.java
>===================================================================
>RCS file: /cvsroot/sdljava/sdljava/src/sdljava/video/SDLVideo.java,v
>retrieving revision 1.20
>diff -u -r1.20 SDLVideo.java
>--- SDLVideo.java 25 Jan 2005 02:17:23 -0000 1.20
>+++ SDLVideo.java 20 Feb 2005 00:06:04 -0000
>@@ -25,7 +25,6 @@
>
> import sdljava.SDLMain;
> import sdljava.SDLException;
>-import java.util.List;
> import java.util.HashMap;
>
> /**
>@@ -45,61 +44,51 @@
> {
> /**
> * Transparency definitions: These define alpha as the opacity of a surface
>- *
> */
> public static final int SDL_ALPHA_OPAQUE = SWIG_SDLVideoConstants.SDL_ALPHA_OPAQUE;
>
> /**
> * Transparency definitions: These define alpha as the opacity of a surface
>- *
> */
> public static final int SDL_ALPHA_TRANSPARENT = SWIG_SDLVideoConstants.SDL_ALPHA_TRANSPARENT;
>
> /**
> * Surface is stored in system memory
>- *
> */
> public static final long SDL_SWSURFACE = SWIG_SDLVideoConstants.SDL_SWSURFACE;
>
> /**
> * Surface is stored in video memory
>- *
> */
> public static final long SDL_HWSURFACE = SWIG_SDLVideoConstants.SDL_HWSURFACE;
>
> /**
> * Surface uses asynchronous blits if possible
>- *
> */
> public static final long SDL_ASYNCBLIT = SWIG_SDLVideoConstants.SDL_ASYNCBLIT;
>
> /**
> * Allows any pixel-format (Display surface)
>- *
> */
> public static final long SDL_ANYFORMAT = SWIG_SDLVideoConstants.SDL_ANYFORMAT;
>
> /**
> * Surface has exclusive palette
>- *
> */
> public static final long SDL_HWPALETTE = SWIG_SDLVideoConstants.SDL_HWPALETTE;
>
> /**
> * Surface is double buffered (Display surface)
>- *
> */
> public static final long SDL_DOUBLEBUF = SWIG_SDLVideoConstants.SDL_DOUBLEBUF;
>
> /**
> * Surface is full screen (Display Surface)
>- *
> */
> public static final long SDL_FULLSCREEN = SWIG_SDLVideoConstants.SDL_FULLSCREEN;
>
> /**
> * Surface has an OpenGL context (Display Surface)
>- *
> */
> public static final long SDL_OPENGL = SWIG_SDLVideoConstants.SDL_OPENGL;
>
>@@ -107,74 +96,52 @@
> * Surface supports OpenGL blitting (Display Surface). NOTE: This
> * option is kept for compatibility only, and is not recommended
> * for new code.
>- *
> */
> public static final long SDL_OPENGLBLIT = SWIG_SDLVideoConstants.SDL_OPENGLBLIT;
>
> /**
> * Surface is resizable (Display Surface)
>- *
> */
> public static final long SDL_RESIZABLE = SWIG_SDLVideoConstants.SDL_RESIZABLE;
>
> /**
> * No window caption or edge frame
>- *
> */
> public static final long SDL_NOFRAME = SWIG_SDLVideoConstants.SDL_NOFRAME;
>
> /**
> * Surface blit uses hardware acceleration
>- *
> */
> public static final long SDL_HWACCEL = SWIG_SDLVideoConstants.SDL_HWACCEL;
>
> /**
> * Surface use colorkey blitting
>- *
> */
> public static final long SDL_SRCCOLORKEY = SWIG_SDLVideoConstants.SDL_SRCCOLORKEY;
>
> /**
> * Colorkey blitting is accelerated with RLE
>- *
> */
> public static final long SDL_RLEACCEL = SWIG_SDLVideoConstants.SDL_RLEACCEL;
>
> /**
> * Surface blit uses alpha blending
>- *
> */
> public static final long SDL_SRCALPHA = SWIG_SDLVideoConstants.SDL_SRCALPHA;
>
> /**
> * Surface uses preallocated memory
>- *
> */
> public static final long SDL_PREALLOC = SWIG_SDLVideoConstants.SDL_PREALLOC;
>
>-
>-
>-
>-
>-
>-
>-
>-
>-
>-
>-
>-
>-
>-
>-
>-
> /** Is the cursor visible?
> * @see #showCursor(int) */
> public static final int SDL_QUERY = -1;
>+
> /** Hide the cursor.
> * @see #showCursor(int) */
> public static final int SDL_DISABLE = 0;
>+
> /** Show the cursor
> * @see #showCursor(int) */
> public static final int SDL_ENABLE = 1;
>@@ -262,6 +229,25 @@
> public static int videoModeOK(int width, int height, int bpp, int flags) throws SDLException {
> return SWIG_SDLVideo.SDL_VideoModeOK(width, height, bpp, flags);
> }
>+
>+ /**
>+ * Same as the method in this class with the same name, but this gets the
>+ * width, height, BPP, and flag values from the SDLScreenMode instance
>+ * instead.
>+ *
>+ * @author <a href="Des...@nt...">Chris Dennett</a>
>+ * @param videoMode The video mode to test
>+ * @return Same as the method with the same name.
>+ * @exception SDLException If an error occurs
>+ */
>+ public static int videoModeOK(SDLVideoMode videoMode) throws SDLException {
>+ return videoModeOK(
>+ videoMode.getWidth(),
>+ videoMode.getHeight(),
>+ videoMode.getBpp(),
>+ videoMode.getFlags()
>+ );
>+ }
>
> /**
> * Set up a video mode with the specified width, height and bits-per-pixel.
>@@ -337,6 +323,25 @@
>
> return new SDLSurface(surface);
> }
>+
>+ /**
>+ * Same as the method in this class with the same name, but this gets the
>+ * width, height, BPP, and flag values from the SDLScreenMode instance
>+ * instead.
>+ *
>+ * @author <a href="Des...@nt...">Chris Dennett</a>
>+ * @param videoMode The video mode to set
>+ * @return The framebuffer surface
>+ * @throws SDLException If an error occurs
>+ */
>+ public static SDLSurface setVideoMode(SDLVideoMode videoMode) throws SDLException {
>+ return setVideoMode(
>+ videoMode.getWidth(),
>+ videoMode.getHeight(),
>+ videoMode.getBpp(),
>+ videoMode.getFlags()
>+ );
>+ }
>
> /**
> * Set the gamma correction for each of the color channels.
>@@ -362,9 +367,9 @@
> *
> * You must pass in valid pointers to arrays of 256 16-bit quantities.
> * Any of the pointers may be NULL to ignore that channel.
>- * If the call succeeds, it will return 0. If the display driver or
>- * hardware does not support gamma translation, or otherwise fails,
>- * this function will return -1.
>+ *
>+ * @return The current values of the gamma translation tables.
>+ *
> * @exception SDLException If an error occurs
> */
> public static GammaTable getGammaRamp() throws SDLException {
>@@ -388,13 +393,11 @@
> * gamma value at that index, scaled to the output color precision.
> *
> * You may pass NULL for any of the channels to leave it unchanged.
>- * If the call succeeds, it will return 0. If the display driver or
>- * hardware does not support gamma translation, or otherwise fails,
>- * this function will return -1.
>+ *
> * @param red an <code>int[]</code> value
> * @param green an <code>int[]</code> value
> * @param blue an <code>int[]</code> value
>- * @return a <code>boolean</code> value
>+ *
> * @exception SDLException If an error occurs
> */
> public static void setGammaRamp(int[] red, int[] green, int[] blue) throws SDLException {
>@@ -545,7 +548,7 @@
> * the SDL_HWSURFACE flag set, and will be created in system memory instead.
> *
> * @param flags Flags for this surface
>- * @param height Desired width
>+ * @param width Desired width
> * @param height Desired height
> * @param depth Desidred depth (bits per pixel)
> * @param rMask Red Mask
>@@ -600,8 +603,7 @@
>
> /**
> * Load a surface from a BMP file located at path.
>- *
>- * @parm The filesystem path of the file with the image data in BMP format
>+ * @param path The filesystem path of the file with the image data in BMP format
> * @return the new surface
> * @exception SDLException If an error occurs
> */
>Index: SDLVideoMode.java
>===================================================================
>RCS file: /cvsroot/sdljava/sdljava/src/sdljava/video/SDLVideoMode.java,v
>retrieving revision 1.3
>diff -u -r1.3 SDLVideoMode.java
>--- SDLVideoMode.java 24 Dec 2004 17:32:17 -0000 1.3
>+++ SDLVideoMode.java 20 Feb 2005 00:06:04 -0000
>@@ -24,7 +24,7 @@
> * Class to represent a possible SDL Video Mode (not part of SDL)
> *
> *
>- * @author Ivan Z. Ganza
>+ * @author Ivan Z. Ganza, <a href="mailto:Des...@nt...">Dessimat0r</a>
> * @version $Id: SDLVideoMode.java,v 1.3 2004/12/24 17:32:17 ivan_ganza Exp $
> */
> public class SDLVideoMode {
>@@ -32,40 +32,60 @@
> int height;
> int bpp;
> int flags;
>+
>+ /**
>+ * Creates a new SDLVideoMode object.
>+ * @param width The width of the screen.
>+ * @param height The height of the screen
>+ * @param bpp The bits per pixel.
>+ * @param flags The flags of the video mode.
>+ */
>+ public SDLVideoMode(int width, int height, int bpp, int flags) {
>+ this.width = width;
>+ this.height = height;
>+ this.bpp = bpp;
>+ this.flags = flags;
>+ }
>+
>+ /**
>+ * Creates a new SDLVideoMode object with no flags.
>+ * @param width The width of the screen.
>+ * @param height The height of the screen
>+ * @param bpp The bits per pixel.
>+ */
>+ public SDLVideoMode(int width, int height, int bpp) {
>+ this(width, height, bpp, 0);
>+ }
>
> /**
>- * Gets the value of width
>- *
>- * @return the value of width
>+ * The width of the screen
>+ * @return The screen width
> */
> public int getWidth() {
>- return this.width;
>+ return this.width;
> }
>
> /**
>- * Gets the value of height
>- *
>- * @return the value of height
>+ * The height of the screen
>+ * @return The screen height
> */
> public int getHeight() {
>- return this.height;
>+ return this.height;
> }
>
> /**
>- * Gets the value of bpp
>- *
>- * @return the value of bpp
>+ * The bits per pixel
>+ * @return The bits per pixel
> */
> public int getBpp() {
>- return this.bpp;
>+ return this.bpp;
> }
>
> /**
>- * Gets the value of flags
>- *
>- * @return the value of flags
>+ * The flags of the video mode
>+ * @return The flags of the video mode
> */
> public int getFlags() {
>- return this.flags;
>+ return this.flags;
> }
> } // class VideoMode
>\ No newline at end of file
>
>
|