Commit 738954d3 authored by bitplane's avatar bitplane

Renamed setResizeable to setResizable (!)

Tidied the Xcode project some more and fixed compiling. Didn't implement CIrrDeviceOSX::minimizeWindow yet

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2264 dfc29bdd-3216-0410-991c-e03cc46cb475
parent bee75f48
...@@ -2,7 +2,7 @@ Changes in 1.6 ...@@ -2,7 +2,7 @@ Changes in 1.6
- Added SGI RGB file reader by Gary Conway, for loading Silicon Graphics .rgb, .rgba, .sgi, .int and .inta textures - Added SGI RGB file reader by Gary Conway, for loading Silicon Graphics .rgb, .rgba, .sgi, .int and .inta textures
- Renamed setResizeAble to setResizeable - Renamed setResizeAble to setResizable
- Added new device method minimizeWindow which minimizes the window (just as if the minimize button has been clicked). - Added new device method minimizeWindow which minimizes the window (just as if the minimize button has been clicked).
......
// Copyright (C) 2002-2009 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_IRRLICHT_DEVICE_H_INCLUDED__ #ifndef __I_IRRLICHT_DEVICE_H_INCLUDED__
#define __I_IRRLICHT_DEVICE_H_INCLUDED__ #define __I_IRRLICHT_DEVICE_H_INCLUDED__
#include "IReferenceCounted.h" #include "IReferenceCounted.h"
#include "dimension2d.h" #include "dimension2d.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "EDriverTypes.h" #include "EDriverTypes.h"
#include "IEventReceiver.h" #include "IEventReceiver.h"
#include "ICursorControl.h" #include "ICursorControl.h"
#include "IVideoModeList.h" #include "IVideoModeList.h"
#include "ITimer.h" #include "ITimer.h"
#include "IOSOperator.h" #include "IOSOperator.h"
namespace irr namespace irr
{ {
class ILogger; class ILogger;
class IEventReceiver; class IEventReceiver;
namespace io { namespace io {
class IFileSystem; class IFileSystem;
} // end namespace io } // end namespace io
namespace gui { namespace gui {
class IGUIEnvironment; class IGUIEnvironment;
} // end namespace gui } // end namespace gui
namespace scene { namespace scene {
class ISceneManager; class ISceneManager;
} // end namespace scene } // end namespace scene
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx(). //! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
/** This is the most important class of the Irrlicht Engine. You can access everything /** This is the most important class of the Irrlicht Engine. You can access everything
in the engine if you have a pointer to an instance of this class. in the engine if you have a pointer to an instance of this class.
There should be only one instance of this class at any time. There should be only one instance of this class at any time.
*/ */
class IrrlichtDevice : public virtual IReferenceCounted class IrrlichtDevice : public virtual IReferenceCounted
{ {
public: public:
//! Runs the device. //! Runs the device.
/** Also increments the virtual timer by calling /** Also increments the virtual timer by calling
ITimer::tick();. You can prevent this ITimer::tick();. You can prevent this
by calling ITimer::stop(); before and ITimer::start() after by calling ITimer::stop(); before and ITimer::start() after
calling IrrlichtDevice::run(). Returns false if device wants calling IrrlichtDevice::run(). Returns false if device wants
to be deleted. Use it in this way: to be deleted. Use it in this way:
\code \code
while(device->run()) while(device->run())
{ {
// draw everything here // draw everything here
} }
\endcode \endcode
If you want the device to do nothing if the window is inactive If you want the device to do nothing if the window is inactive
(recommended), use the slightly enhanced code shown at isWindowActive(). (recommended), use the slightly enhanced code shown at isWindowActive().
Note if you are running Irrlicht inside an external, custom Note if you are running Irrlicht inside an external, custom
created window: Calling Device->run() will cause Irrlicht to created window: Calling Device->run() will cause Irrlicht to
dispatch windows messages internally. dispatch windows messages internally.
If you are running Irrlicht in your own custom window, you can If you are running Irrlicht in your own custom window, you can
also simply use your own message loop using GetMessage, also simply use your own message loop using GetMessage,
DispatchMessage and whatever and simply don't use this method. DispatchMessage and whatever and simply don't use this method.
But note that Irrlicht will not be able to fetch user input But note that Irrlicht will not be able to fetch user input
then. See irr::SIrrlichtCreationParameters::WindowId for more then. See irr::SIrrlichtCreationParameters::WindowId for more
informations and example code. informations and example code.
*/ */
virtual bool run() = 0; virtual bool run() = 0;
//! Cause the device to temporarily pause execution and let other processes run. //! Cause the device to temporarily pause execution and let other processes run.
/** This should bring down processor usage without major /** This should bring down processor usage without major
performance loss for Irrlicht */ performance loss for Irrlicht */
virtual void yield() = 0; virtual void yield() = 0;
//! Pause execution and let other processes to run for a specified amount of time. //! Pause execution and let other processes to run for a specified amount of time.
/** It may not wait the full given time, as sleep may be interrupted /** It may not wait the full given time, as sleep may be interrupted
\param timeMs: Time to sleep for in milisecs. \param timeMs: Time to sleep for in milisecs.
\param pauseTimer: If true, pauses the device timer while sleeping \param pauseTimer: If true, pauses the device timer while sleeping
*/ */
virtual void sleep(u32 timeMs, bool pauseTimer=false) = 0; virtual void sleep(u32 timeMs, bool pauseTimer=false) = 0;
//! Provides access to the video driver for drawing 3d and 2d geometry. //! Provides access to the video driver for drawing 3d and 2d geometry.
/** \return Pointer the video driver. */ /** \return Pointer the video driver. */
virtual video::IVideoDriver* getVideoDriver() = 0; virtual video::IVideoDriver* getVideoDriver() = 0;
//! Provides access to the virtual file system. //! Provides access to the virtual file system.
/** \return Pointer to the file system. */ /** \return Pointer to the file system. */
virtual io::IFileSystem* getFileSystem() = 0; virtual io::IFileSystem* getFileSystem() = 0;
//! Provides access to the 2d user interface environment. //! Provides access to the 2d user interface environment.
/** \return Pointer to the gui environment. */ /** \return Pointer to the gui environment. */
virtual gui::IGUIEnvironment* getGUIEnvironment() = 0; virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;
//! Provides access to the scene manager. //! Provides access to the scene manager.
/** \return Pointer to the scene manager. */ /** \return Pointer to the scene manager. */
virtual scene::ISceneManager* getSceneManager() = 0; virtual scene::ISceneManager* getSceneManager() = 0;
//! Provides access to the cursor control. //! Provides access to the cursor control.
/** \return Pointer to the mouse cursor control interface. */ /** \return Pointer to the mouse cursor control interface. */
virtual gui::ICursorControl* getCursorControl() = 0; virtual gui::ICursorControl* getCursorControl() = 0;
//! Provides access to the message logger. //! Provides access to the message logger.
/** \return Pointer to the logger. */ /** \return Pointer to the logger. */
virtual ILogger* getLogger() = 0; virtual ILogger* getLogger() = 0;
//! Gets a list with all video modes available. //! Gets a list with all video modes available.
/** If you are confused now, because you think you have to /** If you are confused now, because you think you have to
create an Irrlicht Device with a video mode before being able create an Irrlicht Device with a video mode before being able
to get the video mode list, let me tell you that there is no to get the video mode list, let me tell you that there is no
need to start up an Irrlicht Device with EDT_DIRECT3D8, need to start up an Irrlicht Device with EDT_DIRECT3D8,
EDT_OPENGL or EDT_SOFTWARE: For this (and for lots of other EDT_OPENGL or EDT_SOFTWARE: For this (and for lots of other
reasons) the null driver, EDT_NULL exists. reasons) the null driver, EDT_NULL exists.
\return Pointer to a list with all video modes supported \return Pointer to a list with all video modes supported
by the gfx adapter. */ by the gfx adapter. */
virtual video::IVideoModeList* getVideoModeList() = 0; virtual video::IVideoModeList* getVideoModeList() = 0;
//! Provides access to the operation system operator object. //! Provides access to the operation system operator object.
/** The OS operator provides methods for /** The OS operator provides methods for
getting system specific informations and doing system getting system specific informations and doing system
specific operations, such as exchanging data with the clipboard specific operations, such as exchanging data with the clipboard
or reading the operation system version. or reading the operation system version.
\return Pointer to the OS operator. */ \return Pointer to the OS operator. */
virtual IOSOperator* getOSOperator() = 0; virtual IOSOperator* getOSOperator() = 0;
//! Provides access to the engine's timer. //! Provides access to the engine's timer.
/** The system time can be retrieved by it as /** The system time can be retrieved by it as
well as the virtual time, which also can be manipulated. well as the virtual time, which also can be manipulated.
\return Pointer to the ITimer object. */ \return Pointer to the ITimer object. */
virtual ITimer* getTimer() = 0; virtual ITimer* getTimer() = 0;
//! Sets the caption of the window. //! Sets the caption of the window.
/** \param text: New text of the window caption. */ /** \param text: New text of the window caption. */
virtual void setWindowCaption(const wchar_t* text) = 0; virtual void setWindowCaption(const wchar_t* text) = 0;
//! Returns if the window is active. //! Returns if the window is active.
/** If the window is inactive, /** If the window is inactive,
nothing needs to be drawn. So if you don't want to draw anything nothing needs to be drawn. So if you don't want to draw anything
when the window is inactive, create your drawing loop this way: when the window is inactive, create your drawing loop this way:
\code \code
while(device->run()) while(device->run())
{ {
if (device->isWindowActive()) if (device->isWindowActive())
{ {
// draw everything here // draw everything here
} }
else else
device->yield(); device->yield();
} }
\endcode \endcode
\return True if window is active. */ \return True if window is active. */
virtual bool isWindowActive() const = 0; virtual bool isWindowActive() const = 0;
//! Checks if the Irrlicht window has focus //! Checks if the Irrlicht window has focus
/** \return True if window has focus. */ /** \return True if window has focus. */
virtual bool isWindowFocused() const = 0; virtual bool isWindowFocused() const = 0;
//! Checks if the Irrlicht window is minimized //! Checks if the Irrlicht window is minimized
/** \return True if window is minimized. */ /** \return True if window is minimized. */
virtual bool isWindowMinimized() const = 0; virtual bool isWindowMinimized() const = 0;
//! Checks if the Irrlicht window is running in fullscreen mode //! Checks if the Irrlicht window is running in fullscreen mode
/** \return True if window is fullscreen. */ /** \return True if window is fullscreen. */
virtual bool isFullscreen() const = 0; virtual bool isFullscreen() const = 0;
//! Get the current color format of the window //! Get the current color format of the window
/** \return Color format of the window. */ /** \return Color format of the window. */
virtual video::ECOLOR_FORMAT getColorFormat() const = 0; virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
//! Notifies the device that it should close itself. //! Notifies the device that it should close itself.
/** IrrlichtDevice::run() will always return false after closeDevice() was called. */ /** IrrlichtDevice::run() will always return false after closeDevice() was called. */
virtual void closeDevice() = 0; virtual void closeDevice() = 0;
//! Get the version of the engine. //! Get the version of the engine.
/** The returned string /** The returned string
will look like this: "1.2.3" or this: "1.2". will look like this: "1.2.3" or this: "1.2".
\return String which contains the version. */ \return String which contains the version. */
virtual const c8* getVersion() const = 0; virtual const c8* getVersion() const = 0;
//! Sets a new user event receiver which will receive events from the engine. //! Sets a new user event receiver which will receive events from the engine.
/** Return true in IEventReceiver::OnEvent to prevent the event from continuing along /** Return true in IEventReceiver::OnEvent to prevent the event from continuing along
the chain of event receivers. The path that an event takes through the system depends the chain of event receivers. The path that an event takes through the system depends
on its type. See irr::EEVENT_TYPE for details. on its type. See irr::EEVENT_TYPE for details.
\param receiver New receiver to be used. */ \param receiver New receiver to be used. */
virtual void setEventReceiver(IEventReceiver* receiver) = 0; virtual void setEventReceiver(IEventReceiver* receiver) = 0;
//! Provides access to the current event receiver. //! Provides access to the current event receiver.
/** \return Pointer to the current event receiver. Returns 0 if there is none. */ /** \return Pointer to the current event receiver. Returns 0 if there is none. */
virtual IEventReceiver* getEventReceiver() = 0; virtual IEventReceiver* getEventReceiver() = 0;
//! Sends a user created event to the engine. //! Sends a user created event to the engine.
/** Is is usually not necessary to use this. However, if you /** Is is usually not necessary to use this. However, if you
are using an own input library for example for doing joystick are using an own input library for example for doing joystick
input, you can use this to post key or mouse input events to input, you can use this to post key or mouse input events to
the engine. Internally, this method only delegates the events the engine. Internally, this method only delegates the events
further to the scene manager and the GUI environment. */ further to the scene manager and the GUI environment. */
virtual bool postEventFromUser(const SEvent& event) = 0; virtual bool postEventFromUser(const SEvent& event) = 0;
//! Sets the input receiving scene manager. //! Sets the input receiving scene manager.
/** If set to null, the main scene manager (returned by /** If set to null, the main scene manager (returned by
GetSceneManager()) will receive the input GetSceneManager()) will receive the input
\param sceneManager New scene manager to be used. */ \param sceneManager New scene manager to be used. */
virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager) = 0; virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager) = 0;
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
/** The default is false. This method only works in windowed /** The default is false. This method only works in windowed
mode. mode.
\param resize Flag whether the window should be resizeable. */ \param resize Flag whether the window should be resizable. */
virtual void setResizeable(bool resize=false) = 0; virtual void setResizable(bool resize=false) = 0;
//! Minimizes the window if possible. //! Minimizes the window if possible.
virtual void minimizeWindow() =0; virtual void minimizeWindow() =0;
//! Activate any joysticks, and generate events for them. //! Activate any joysticks, and generate events for them.
/** Irrlicht contains support for joysticks, but does not generate joystick events by default, /** Irrlicht contains support for joysticks, but does not generate joystick events by default,
as this would consume joystick info that 3rd party libraries might rely on. Call this method to as this would consume joystick info that 3rd party libraries might rely on. Call this method to
activate joystick support in Irrlicht and to receive irr::SJoystickEvent events. activate joystick support in Irrlicht and to receive irr::SJoystickEvent events.
\param joystickInfo On return, this will contain an array of each joystick that was found and activated. \param joystickInfo On return, this will contain an array of each joystick that was found and activated.
\return true if joysticks are supported on this device and _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ \return true if joysticks are supported on this device and _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
is defined, false if joysticks are not supported or support is compiled out. is defined, false if joysticks are not supported or support is compiled out.
*/ */
virtual bool activateJoysticks(core::array<SJoystickInfo>& joystickInfo) =0; virtual bool activateJoysticks(core::array<SJoystickInfo>& joystickInfo) =0;
//! Set the current Gamma Value for the Display //! Set the current Gamma Value for the Display
virtual bool setGammaRamp(f32 red, f32 green, f32 blue, virtual bool setGammaRamp(f32 red, f32 green, f32 blue,
f32 relativebrightness, f32 relativecontrast) =0; f32 relativebrightness, f32 relativecontrast) =0;
//! Get the current Gamma Value for the Display //! Get the current Gamma Value for the Display
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue, virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
f32 &brightness, f32 &contrast) =0; f32 &brightness, f32 &contrast) =0;
}; };
} // end namespace irr } // end namespace irr
#endif #endif
//! Copyright (C) 2009 Gary Conway //! Copyright (C) 2009 Gary Conway
//! This file is part of the "Irrlicht Engine". //! This file is part of the "Irrlicht Engine".
//! For conditions of distribution and use, see copyright notice in irrlicht.h //! For conditions of distribution and use, see copyright notice in irrlicht.h
/* /*
Author: Gary Conway (Viper) - co-author of the ZIP file format, Feb 1989, Author: Gary Conway (Viper) - co-author of the ZIP file format, Feb 1989,
see the story at http://www.idcnet.us/ziphistory.html see the story at http://www.idcnet.us/ziphistory.html
Website: http://idcnet.us Website: http://idcnet.us
Email: codeslinger@vipergc.com Email: codeslinger@vipergc.com
Created: March 1, 2009 Created: March 1, 2009
Version: 1.0 Version: 1.0
Updated: Updated:
This module will load SGI .rgb files (along with the other extensions). The module complies This module will load SGI .rgb files (along with the other extensions). The module complies
with version 1.0 of the SGI Image File Format by Paul Haeberli of Silicon Graphics Computer Systems with version 1.0 of the SGI Image File Format by Paul Haeberli of Silicon Graphics Computer Systems
The module handles BW, RGB and RGBA images. The module handles BW, RGB and RGBA images.
RGB images are stored with either 8 bits per COLOR VALUE, one each for red,green,blue (24bpp) RGB images are stored with either 8 bits per COLOR VALUE, one each for red,green,blue (24bpp)
or 16 bits per COLOR VALUE, again one each for red,green,blue (48 bpp), not including the alpha channel or 16 bits per COLOR VALUE, again one each for red,green,blue (48 bpp), not including the alpha channel
OPTIONS NOT SUPPORTED OPTIONS NOT SUPPORTED
1. 16 bit COLOR VALUES (48bpp modes) 1. 16 bit COLOR VALUES (48bpp modes)
2. COLORMAP = DITHERED mode 2. COLORMAP = DITHERED mode
For non- run length encoded files, this is the structure For non- run length encoded files, this is the structure
The Header The Header
The Image Data The Image Data
If the image is run length encoded, this is the structure: If the image is run length encoded, this is the structure:
The Header The Header
The Offset Tables The Offset Tables
The Image Data The Image Data
The header consists of the following: The header consists of the following:
Size | Type | Name | Description Size | Type | Name | Description
2 bytes | short | MAGIC | IRIS image file magic number 2 bytes | short | MAGIC | IRIS image file magic number
1 byte | char | STORAGE | Storage format 1 byte | char | STORAGE | Storage format
1 byte | char | BPC | Number of bytes per pixel channel 1 byte | char | BPC | Number of bytes per pixel channel
2 bytes | ushort | DIMENSION | Number of dimensions 2 bytes | ushort | DIMENSION | Number of dimensions
2 bytes | ushort | XSIZE | X size in pixels 2 bytes | ushort | XSIZE | X size in pixels
2 bytes | ushort | YSIZE | Y size in pixels 2 bytes | ushort | YSIZE | Y size in pixels
2 bytes | ushort | ZSIZE | Number of channels 2 bytes | ushort | ZSIZE | Number of channels
4 bytes | long | PIXMIN | Minimum pixel value 4 bytes | long | PIXMIN | Minimum pixel value
4 bytes | long | PIXMAX | Maximum pixel value 4 bytes | long | PIXMAX | Maximum pixel value
4 bytes | char | DUMMY | Ignored 4 bytes | char | DUMMY | Ignored
80 bytes | char | IMAGENAME | Image name 80 bytes | char | IMAGENAME | Image name
4 bytes | long | COLORMAP | Colormap ID 4 bytes | long | COLORMAP | Colormap ID
404 bytes | char | DUMMY | Ignored 404 bytes | char | DUMMY | Ignored
Here is a description of each field in the image file header: Here is a description of each field in the image file header:
MAGIC - This is the decimal value 474 saved as a short. This identifies the file as an SGI image file. MAGIC - This is the decimal value 474 saved as a short. This identifies the file as an SGI image file.
STORAGE - specifies whether the image is stored using run length encoding (RLE) or not (VERBATIM). STORAGE - specifies whether the image is stored using run length encoding (RLE) or not (VERBATIM).
If RLE is used, the value of this byte will be 1. Otherwise the value of this byte will If RLE is used, the value of this byte will be 1. Otherwise the value of this byte will
be 0. The only allowed values for this field are 0 or 1. be 0. The only allowed values for this field are 0 or 1.
BPC - describes the precision that is used to store each channel of an image. This is the number of BPC - describes the precision that is used to store each channel of an image. This is the number of
bytes per pixel component. The majority of SGI image files use 1 byte per pixel component, bytes per pixel component. The majority of SGI image files use 1 byte per pixel component,
giving 256 levels. Some SGI image files use 2 bytes per component. The only allowed values giving 256 levels. Some SGI image files use 2 bytes per component. The only allowed values
for this field are 1 or 2. for this field are 1 or 2.
DIMENSION - described the number of dimensions in the data stored in the image file. DIMENSION - described the number of dimensions in the data stored in the image file.
The only allowed values are 1, 2, or 3. If this value is 1, the image file The only allowed values are 1, 2, or 3. If this value is 1, the image file
consists of only 1 channel and only 1 scanline (row). The length of this consists of only 1 channel and only 1 scanline (row). The length of this
scanline is given by the value of XSIZE below. If this value is 2, the file scanline is given by the value of XSIZE below. If this value is 2, the file
consists of a single channel with a number of scanlines. The width and height consists of a single channel with a number of scanlines. The width and height
of the image are given by the values of XSIZE and YSIZE below. of the image are given by the values of XSIZE and YSIZE below.
If this value is 3, the file consists of a number of channels. If this value is 3, the file consists of a number of channels.
The width and height of the image are given by the values of XSIZE and YSIZE below. The width and height of the image are given by the values of XSIZE and YSIZE below.
The number of channels is given by the value of ZSIZE below. The number of channels is given by the value of ZSIZE below.
XSIZE - The width of the image in pixels XSIZE - The width of the image in pixels
YSIZE - The height of the image in pixels YSIZE - The height of the image in pixels
ZSIZE - The number of channels in the image. B/W (greyscale) images are stored as 2 dimensional ZSIZE - The number of channels in the image. B/W (greyscale) images are stored as 2 dimensional
images with a ZSIZE of 1. RGB color images are stored as 3 dimensional images with a images with a ZSIZE of 1. RGB color images are stored as 3 dimensional images with a
ZSIZE of 3. An RGB image with an ALPHA channel is stored as a 3 dimensional image with ZSIZE of 3. An RGB image with an ALPHA channel is stored as a 3 dimensional image with
a ZSIZE of 4. There are no inherent limitations in the SGI image file format that would a ZSIZE of 4. There are no inherent limitations in the SGI image file format that would
preclude the creation of image files with more than 4 channels. preclude the creation of image files with more than 4 channels.
PINMIN - The minimum pixel value in the image. The value of 0 may be used if no pixel has a value PINMIN - The minimum pixel value in the image. The value of 0 may be used if no pixel has a value
that is smaller than 0. that is smaller than 0.
PINMAX - The maximum pixel value in the image. The value of 255 may be used if no pixel has a PINMAX - The maximum pixel value in the image. The value of 255 may be used if no pixel has a
value that is greater than 255. This is the value that is considered to be full value that is greater than 255. This is the value that is considered to be full
brightness in the image. brightness in the image.
DUMMY - This 4 bytes of data should be set to 0. DUMMY - This 4 bytes of data should be set to 0.
IMAGENAME - An null terminated ascii string of up to 79 characters terminated by a null may be IMAGENAME - An null terminated ascii string of up to 79 characters terminated by a null may be
included here. This is not commonly used. included here. This is not commonly used.
COLORMAP - This controls how the pixel values in the file should be interpreted. It can have one COLORMAP - This controls how the pixel values in the file should be interpreted. It can have one
of these four values: of these four values:
0: NORMAL - The data in the channels represent B/W values for images with 1 channel, RGB values 0: NORMAL - The data in the channels represent B/W values for images with 1 channel, RGB values
for images with 3 channels, and RGBA values for images with 4 channels. Almost all for images with 3 channels, and RGBA values for images with 4 channels. Almost all
the SGI image files are of this type. the SGI image files are of this type.
1: DITHERED - The image will have only 1 channel of data. For each pixel, RGB data is packed 1: DITHERED - The image will have only 1 channel of data. For each pixel, RGB data is packed
into one 8 bit value. 3 bits are used for red and green, while blue uses 2 bits. into one 8 bit value. 3 bits are used for red and green, while blue uses 2 bits.
Red data is found in bits[2..0], green data in bits[5..3], and blue data in Red data is found in bits[2..0], green data in bits[5..3], and blue data in
bits[7..6]. This format is obsolete. bits[7..6]. This format is obsolete.
2: SCREEN - The image will have only 1 channel of data. This format was used to store 2: SCREEN - The image will have only 1 channel of data. This format was used to store
color-indexed pixels. To convert the pixel values into RGB values a colormap color-indexed pixels. To convert the pixel values into RGB values a colormap
must be used. The appropriate color map varies from image to image. This format is obsolete. must be used. The appropriate color map varies from image to image. This format is obsolete.
3: COLORMAP - The image is used to store a color map from an SGI machine. In this case the 3: COLORMAP - The image is used to store a color map from an SGI machine. In this case the
image is not displayable in the conventional sense. image is not displayable in the conventional sense.
DUMMY - This 404 bytes of data should be set to 0. This makes the header exactly 512 bytes. DUMMY - This 404 bytes of data should be set to 0. This makes the header exactly 512 bytes.
*/ */
#include "CImageLoaderRGB.h" #include "CImageLoaderRGB.h"
#ifdef _IRR_COMPILE_WITH_RGB_LOADER_ #ifdef _IRR_COMPILE_WITH_RGB_LOADER_
#include "IReadFile.h" #include "IReadFile.h"
#include "SColor.h" #include "SColor.h"
#include "CColorConverter.h" #include "CColorConverter.h"
#include "CImage.h" #include "CImage.h"
#include "os.h" #include "os.h"
#include "irrString.h" #include "irrString.h"
namespace irr namespace irr
{ {
namespace video namespace video
{ {
//! constructor //! constructor
CImageLoaderRGB::CImageLoaderRGB() CImageLoaderRGB::CImageLoaderRGB()
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CImageLoaderRGB"); setDebugName("CImageLoaderRGB");
#endif #endif
} }
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
//! based on the file extensions listed here //! based on the file extensions listed here
bool CImageLoaderRGB::isALoadableFileExtension(const irr::core::stringc &fileName) const bool CImageLoaderRGB::isALoadableFileExtension(const irr::core::stringc &fileName) const
{ {
return core::hasFileExtension( fileName, "rgb", "rgba", "sgi" ) || return core::hasFileExtension( fileName, "rgb", "rgba", "sgi" ) ||
core::hasFileExtension( fileName, "int", "inta", "bw" ); core::hasFileExtension( fileName, "int", "inta", "bw" );
} }
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
bool CImageLoaderRGB::isALoadableFileFormat(io::IReadFile* file) const bool CImageLoaderRGB::isALoadableFileFormat(io::IReadFile* file) const
{ {
rgbStruct *rgb = new rgbStruct; rgbStruct *rgb = new rgbStruct;
bool retVal = checkFormat(file, rgb); bool retVal = checkFormat(file, rgb);
delete rgb; delete rgb;
return retVal; return retVal;
} }
/* /*
The main entry point, read and format the image file. The main entry point, read and format the image file.
RETURNS: pointer to the image data on success RETURNS: pointer to the image data on success
null pointer on fail null pointer on fail
*/ */
//! creates a surface from the file //! creates a surface from the file
IImage* CImageLoaderRGB::loadImage(io::IReadFile* file) const IImage* CImageLoaderRGB::loadImage(io::IReadFile* file) const
{ {
IImage* image = 0; IImage* image = 0;
s32* paletteData = 0; s32* paletteData = 0;
rgbStruct *rgb = new rgbStruct(); // construct our structure for holding data rgbStruct *rgb = new rgbStruct(); // construct our structure for holding data
// read header information // read header information
if (checkFormat(file, rgb)) if (checkFormat(file, rgb))
{ {
// 16 bits per COLOR VALUE, not supported, this is 48bpp mode // 16 bits per COLOR VALUE, not supported, this is 48bpp mode
if (rgb->header.BPC != 1) if (rgb->header.BPC != 1)
{ {
os::Printer::log("Only one byte per pixel RGB files are supported", file->getFileName(), ELL_ERROR); os::Printer::log("Only one byte per pixel RGB files are supported", file->getFileName(), ELL_ERROR);
} }
else if (rgb->header.Colormap != 0) else if (rgb->header.Colormap != 0)
{ {
os::Printer::log("Dithered, Screen and Colormap RGB files are not supported", file->getFileName(), ELL_ERROR); os::Printer::log("Dithered, Screen and Colormap RGB files are not supported", file->getFileName(), ELL_ERROR);
} }
else if (rgb->header.Storage == 1 && !readOffsetTables(file, rgb)) else if (rgb->header.Storage == 1 && !readOffsetTables(file, rgb))
{ {
os::Printer::log("Failed to read RLE table in RGB file", file->getFileName(), ELL_ERROR); os::Printer::log("Failed to read RLE table in RGB file", file->getFileName(), ELL_ERROR);
} }
else if (!rgb->allocateTemps()) else if (!rgb->allocateTemps())
{ {
os::Printer::log("Out of memory in RGB file loader", file->getFileName(), ELL_ERROR); os::Printer::log("Out of memory in RGB file loader", file->getFileName(), ELL_ERROR);
} }
else else
{ {
// read and process the file to rgbData // read and process the file to rgbData
processFile(rgb, file); processFile(rgb, file);
/* /*
ZSIZE Description ZSIZE Description
1 BW (grayscale) image 1 BW (grayscale) image
3 RGB image 3 RGB image
4 RGBa image with one alpha channel 4 RGBa image with one alpha channel
When the Alpha channel is present, I am not sure with RGB files if When the Alpha channel is present, I am not sure with RGB files if
it's a precomputed RGB color or it needs to be completely calculated. My guess it's a precomputed RGB color or it needs to be completely calculated. My guess
would be that it's not precomputed for two reasons. would be that it's not precomputed for two reasons.
1. the loss of precision when calculating the fraction, then storing the result as an int 1. the loss of precision when calculating the fraction, then storing the result as an int
2. the loss of the original color data when the image might be composited with another. Yes 2. the loss of the original color data when the image might be composited with another. Yes
the original color data could be computed, however, not without another loss in precision the original color data could be computed, however, not without another loss in precision
Also, I don't know where to find the background color Also, I don't know where to find the background color
Pixmin and Pixmax are apparently the min and max alpha blend values (0-100%) Pixmin and Pixmax are apparently the min and max alpha blend values (0-100%)
Complete Alpha blending computation Complete Alpha blending computation
The actual resulting merged color is computed this way: The actual resulting merged color is computed this way:
(image color × alpha) + (background color × (100% - alpha)). (image color ◊ alpha) + (background color ◊ (100% - alpha)).
Using precomputed blending Using precomputed blending
(image color) + (background color × (100% - alpha)). (image color) + (background color ◊ (100% - alpha)).
Alternatively, the RGB files could use another blending technique entirely Alternatively, the RGB files could use another blending technique entirely
*/ */
switch (rgb->header.Zsize) switch (rgb->header.Zsize)
{ {
case 1: case 1:
// BW (grayscale) image // BW (grayscale) image
paletteData = new s32[256]; paletteData = new s32[256];
for (int n=0; n<256; n++) for (int n=0; n<256; n++)
paletteData[n] = n; paletteData[n] = n;
image = new CImage(ECF_A1R5G5B5, core::dimension2d<u32>(rgb->header.Xsize, rgb->header.Ysize)); image = new CImage(ECF_A1R5G5B5, core::dimension2d<u32>(rgb->header.Xsize, rgb->header.Ysize));
if (image) if (image)
CColorConverter::convert8BitTo16Bit(rgb->rgbData, (s16*)image->lock(), rgb->header.Xsize, rgb->header.Ysize, paletteData, 0, true); CColorConverter::convert8BitTo16Bit(rgb->rgbData, (s16*)image->lock(), rgb->header.Xsize, rgb->header.Ysize, paletteData, 0, true);
break; break;
case 3: case 3:
// RGB image // RGB image
// one byte per COLOR VALUE, eg, 24bpp // one byte per COLOR VALUE, eg, 24bpp
image = new CImage(ECF_R8G8B8, core::dimension2d<u32>(rgb->header.Xsize, rgb->header.Ysize)); image = new CImage(ECF_R8G8B8, core::dimension2d<u32>(rgb->header.Xsize, rgb->header.Ysize));
if (image) if (image)
CColorConverter::convert24BitTo24Bit(rgb->rgbData, (u8*)image->lock(), rgb->header.Xsize, rgb->header.Ysize, 0, true, false); CColorConverter::convert24BitTo24Bit(rgb->rgbData, (u8*)image->lock(), rgb->header.Xsize, rgb->header.Ysize, 0, true, false);
break; break;
case 4: case 4:
// RGBa image with one alpha channel (32bpp) // RGBa image with one alpha channel (32bpp)
// image is stored in rgbData as RGBA // image is stored in rgbData as RGBA
converttoARGB(rgb->rgbData, rgb); converttoARGB(rgb->rgbData, rgb);
image = new CImage(ECF_A8R8G8B8, core::dimension2d<u32>(rgb->header.Xsize, rgb->header.Ysize)); image = new CImage(ECF_A8R8G8B8, core::dimension2d<u32>(rgb->header.Xsize, rgb->header.Ysize));
if (image) if (image)
CColorConverter::convert32BitTo32Bit((s32*)rgb->rgbData, (s32*)image->lock(), rgb->header.Xsize, rgb->header.Ysize, 0, true); CColorConverter::convert32BitTo32Bit((s32*)rgb->rgbData, (s32*)image->lock(), rgb->header.Xsize, rgb->header.Ysize, 0, true);
break; break;
default: default:
// Format unknown // Format unknown
os::Printer::log("Unsupported pixel format in RGB file", file->getFileName(), ELL_ERROR); os::Printer::log("Unsupported pixel format in RGB file", file->getFileName(), ELL_ERROR);
} }
if (image) if (image)
image->unlock(); image->unlock();
} }
} }
// and tidy up allocated memory // and tidy up allocated memory
if (paletteData) if (paletteData)
delete [] paletteData; delete [] paletteData;
if (rgb) if (rgb)
delete rgb; delete rgb;
return image; return image;
} }
// returns true on success // returns true on success
bool CImageLoaderRGB::readHeader(io::IReadFile* file, rgbStruct* rgb) const bool CImageLoaderRGB::readHeader(io::IReadFile* file, rgbStruct* rgb) const
{ {
if ( file->read(&rgb->header, sizeof(rgb->header)) < sizeof(rgb->header) ) if ( file->read(&rgb->header, sizeof(rgb->header)) < sizeof(rgb->header) )
return false; return false;
// test for INTEL or BIG ENDIAN processor // test for INTEL or BIG ENDIAN processor
// if INTEL, then swap the byte order on 16 bit INT's to make them BIG ENDIAN // if INTEL, then swap the byte order on 16 bit INT's to make them BIG ENDIAN
// because that is the native format for the .rgb file // because that is the native format for the .rgb file
#ifndef __BIG_ENDIAN__ #ifndef __BIG_ENDIAN__
rgb->header.Magic = os::Byteswap::byteswap(rgb->header.Magic); rgb->header.Magic = os::Byteswap::byteswap(rgb->header.Magic);
rgb->header.Storage = os::Byteswap::byteswap(rgb->header.Storage); rgb->header.Storage = os::Byteswap::byteswap(rgb->header.Storage);
rgb->header.Dimension = os::Byteswap::byteswap(rgb->header.Dimension); rgb->header.Dimension = os::Byteswap::byteswap(rgb->header.Dimension);
rgb->header.Xsize = os::Byteswap::byteswap(rgb->header.Xsize); rgb->header.Xsize = os::Byteswap::byteswap(rgb->header.Xsize);
rgb->header.Ysize = os::Byteswap::byteswap(rgb->header.Ysize); rgb->header.Ysize = os::Byteswap::byteswap(rgb->header.Ysize);
rgb->header.Zsize = os::Byteswap::byteswap(rgb->header.Zsize); rgb->header.Zsize = os::Byteswap::byteswap(rgb->header.Zsize);
rgb->header.Pixmin = os::Byteswap::byteswap(rgb->header.Pixmin); rgb->header.Pixmin = os::Byteswap::byteswap(rgb->header.Pixmin);
rgb->header.Pixmax = os::Byteswap::byteswap(rgb->header.Pixmax); rgb->header.Pixmax = os::Byteswap::byteswap(rgb->header.Pixmax);
rgb->header.Colormap = os::Byteswap::byteswap(rgb->header.Colormap); rgb->header.Colormap = os::Byteswap::byteswap(rgb->header.Colormap);
#endif #endif
// calculate the size of the buffer needed: XSIZE * YSIZE * ZSIZE * BPC // calculate the size of the buffer needed: XSIZE * YSIZE * ZSIZE * BPC
rgb->ImageSize = (rgb->header.Xsize)*(rgb->header.Ysize)*(rgb->header.Zsize)*(rgb->header.BPC); rgb->ImageSize = (rgb->header.Xsize)*(rgb->header.Ysize)*(rgb->header.Zsize)*(rgb->header.BPC);
// allocate our buffer // allocate our buffer
//if( !(rgb->rgbData = new u8 [rgb->ImageSize]) ) //if( !(rgb->rgbData = new u8 [rgb->ImageSize]) )
// return false; // return false;
return true; return true;
} }
bool CImageLoaderRGB::checkFormat(io::IReadFile* file, rgbStruct* rgb) const bool CImageLoaderRGB::checkFormat(io::IReadFile* file, rgbStruct* rgb) const
{ {
if (!readHeader(file, rgb)) if (!readHeader(file, rgb))
return false; return false;
if (rgb->header.Magic == 0x1DA) if (rgb->header.Magic == 0x1DA)
return true; return true;
else else
return false; return false;
} }
/* /*
If the image is stored using run length encoding, offset tables follow the header that If the image is stored using run length encoding, offset tables follow the header that
describe what the file offsets are to the RLE for each scanline. This information only describe what the file offsets are to the RLE for each scanline. This information only
applies if the value for STORAGE above is 1. applies if the value for STORAGE above is 1.
Size | Type | Name | Description Size | Type | Name | Description
tablen longs | long | STARTTAB | Start table tablen longs | long | STARTTAB | Start table
tablen longs | long | LENGTHTAB | Length table tablen longs | long | LENGTHTAB | Length table
One entry in each table is needed for each scanline of RLE data. The total number of scanlines in the image (tablen) is determined by the product of the YSIZE and ZSIZE. There are two tables of longs that are written. Each consists of tablen longs of data. The first table has the file offsets to the RLE data for each scanline in the image. In a file with more than 1 channel (ZSIZE > 1) this table first has all the offsets for the scanlines in the first channel, followed be offsets for the scanlines in the second channel, etc. The second table has the RLE data length for each scanline in the image. In a file with more than 1 channel (ZSIZE > 1) this table first has all the RLE data lengths for the scanlines in the first channel, followed be RLE data lengths for the scanlines in the second channel, etc. One entry in each table is needed for each scanline of RLE data. The total number of scanlines in the image (tablen) is determined by the product of the YSIZE and ZSIZE. There are two tables of longs that are written. Each consists of tablen longs of data. The first table has the file offsets to the RLE data for each scanline in the image. In a file with more than 1 channel (ZSIZE > 1) this table first has all the offsets for the scanlines in the first channel, followed be offsets for the scanlines in the second channel, etc. The second table has the RLE data length for each scanline in the image. In a file with more than 1 channel (ZSIZE > 1) this table first has all the RLE data lengths for the scanlines in the first channel, followed be RLE data lengths for the scanlines in the second channel, etc.
To find the the file offset, and the number of bytes in the RLE data for a particular scanline, these To find the the file offset, and the number of bytes in the RLE data for a particular scanline, these
two arrays may be read in and indexed as follows: two arrays may be read in and indexed as follows:
To read in the tables: To read in the tables:
unsigned long *starttab, *lengthtab; unsigned long *starttab, *lengthtab;
tablen = YSIZE*ZSIZE*sizeof(long); tablen = YSIZE*ZSIZE*sizeof(long);
starttab = (unsigned long *)mymalloc(tablen); starttab = (unsigned long *)mymalloc(tablen);
lengthtab = (unsigned long *)mymalloc(tablen); lengthtab = (unsigned long *)mymalloc(tablen);
fseek(rgb->inf,512,SEEK_SET); fseek(rgb->inf,512,SEEK_SET);
readlongtab(rgb->inf,starttab); readlongtab(rgb->inf,starttab);
readlongtab(rgb->inf,lengthtab); readlongtab(rgb->inf,lengthtab);
To find the file offset and RLE data length for a scanline: To find the file offset and RLE data length for a scanline:
rowno is an integer in the range 0 to YSIZE-1 channo is an integer in the range 0 to ZSIZE-1 rowno is an integer in the range 0 to YSIZE-1 channo is an integer in the range 0 to ZSIZE-1
rleoffset = starttab[rowno+channo*YSIZE] rleoffset = starttab[rowno+channo*YSIZE]
rlelength = lengthtab[rowno+channo*YSIZE] rlelength = lengthtab[rowno+channo*YSIZE]
It is possible for two identical rows (scanlines) to share compressed data. A completely It is possible for two identical rows (scanlines) to share compressed data. A completely
white image could be written as a single compressed row and having all table entries point white image could be written as a single compressed row and having all table entries point
to that row. Another little hack that should work is if you are writing out a RGB RLE file, to that row. Another little hack that should work is if you are writing out a RGB RLE file,
and a particular scanline is achromatic (greyscale), you could just make the r, g and b rows and a particular scanline is achromatic (greyscale), you could just make the r, g and b rows
point to the same data!! point to the same data!!
RETURNS: on success true, else returns false RETURNS: on success true, else returns false
*/ */
bool CImageLoaderRGB::readOffsetTables(io::IReadFile* file, rgbStruct *rgb) const bool CImageLoaderRGB::readOffsetTables(io::IReadFile* file, rgbStruct *rgb) const
{ {
u32 x; u32 x;
rgb->TableLen = rgb->header.Ysize * rgb->header.Zsize ; // calc size of tables rgb->TableLen = rgb->header.Ysize * rgb->header.Zsize ; // calc size of tables
// return error if unable to allocate tables // return error if unable to allocate tables
if ( !(rgb->StartTable = new u32[rgb->TableLen]) ) if ( !(rgb->StartTable = new u32[rgb->TableLen]) )
return false; return false;
if ( !(rgb->LengthTable = new u32[rgb->TableLen]) ) if ( !(rgb->LengthTable = new u32[rgb->TableLen]) )
return false; return false;
file->seek(512); file->seek(512);
file->read(rgb->StartTable, rgb->TableLen* sizeof(u32)); file->read(rgb->StartTable, rgb->TableLen* sizeof(u32));
file->read(rgb->LengthTable, rgb->TableLen* sizeof(u32)); file->read(rgb->LengthTable, rgb->TableLen* sizeof(u32));
// if we are on an INTEL platform, swap the bytes // if we are on an INTEL platform, swap the bytes
#ifndef __BIG_ENDIAN__ #ifndef __BIG_ENDIAN__
x= rgb->TableLen * sizeof(u32); x= rgb->TableLen * sizeof(u32);
convertLong(rgb->StartTable, (long) (x/sizeof(u32))); convertLong(rgb->StartTable, (long) (x/sizeof(u32)));
convertLong((u32 *)rgb->LengthTable, (long) (x/sizeof(u32))); convertLong((u32 *)rgb->LengthTable, (long) (x/sizeof(u32)));
#endif #endif
return true; return true;
} }
/* /*
The header has already been read into rgb structure The header has already been read into rgb structure
The Tables have been read if necessary The Tables have been read if necessary
Now process the actual data Now process the actual data
*/ */
void CImageLoaderRGB::processFile(rgbStruct *rgb, io::IReadFile* file) const void CImageLoaderRGB::processFile(rgbStruct *rgb, io::IReadFile* file) const
{ {
u8 *ptr; u8 *ptr;
int i, j; int i, j;
u16 *tempShort; u16 *tempShort;
// calculate the size of the buffer needed: XSIZE * YSIZE * ZSIZE * BPC // calculate the size of the buffer needed: XSIZE * YSIZE * ZSIZE * BPC
rgb->rgbData = new u8 [(rgb->header.Xsize)*(rgb->header.Ysize)*(rgb->header.Zsize)*(rgb->header.BPC)]; rgb->rgbData = new u8 [(rgb->header.Xsize)*(rgb->header.Ysize)*(rgb->header.Zsize)*(rgb->header.BPC)];
ptr = rgb->rgbData; ptr = rgb->rgbData;
// cycle through all scanlines // cycle through all scanlines
#ifdef _IRR_RGB_FILE_INVERTED_IMAGE_ #ifdef _IRR_RGB_FILE_INVERTED_IMAGE_
// preserve the image as stored, eg, inverted // preserve the image as stored, eg, inverted
for (i = 0; i < (int)(rgb->header.Ysize); i++) for (i = 0; i < (int)(rgb->header.Ysize); i++)
#else #else
// invert the image to make it upright // invert the image to make it upright
for (i = (int)(rgb->header.Ysize)-1; i>=0; i--) for (i = (int)(rgb->header.Ysize)-1; i>=0; i--)
#endif #endif
{ {
// check the number of channels and read a row of data // check the number of channels and read a row of data
if( rgb->header.Zsize >= 1 ) if( rgb->header.Zsize >= 1 )
readRGBrow( rgb->tmpR, i, 0, file, rgb); readRGBrow( rgb->tmpR, i, 0, file, rgb);
if( rgb->header.Zsize >= 2 ) if( rgb->header.Zsize >= 2 )
readRGBrow( rgb->tmpG, i, 1, file, rgb); readRGBrow( rgb->tmpG, i, 1, file, rgb);
if( rgb->header.Zsize >= 3 ) if( rgb->header.Zsize >= 3 )
readRGBrow( rgb->tmpB, i, 2, file, rgb); readRGBrow( rgb->tmpB, i, 2, file, rgb);
if( rgb->header.Zsize >= 4 ) if( rgb->header.Zsize >= 4 )
readRGBrow( rgb->tmpA, i, 3, file, rgb); readRGBrow( rgb->tmpA, i, 3, file, rgb);
// cycle thru all values for this row // cycle thru all values for this row
for (j = 0; j < (int)(rgb->header.Xsize); j++) for (j = 0; j < (int)(rgb->header.Xsize); j++)
{ {
if(rgb->header.BPC == 1) if(rgb->header.BPC == 1)
{ {
// ONE byte per color // ONE byte per color
if( rgb->header.Zsize >= 1 ) *ptr++ = *(rgb->tmpR + j); if( rgb->header.Zsize >= 1 ) *ptr++ = *(rgb->tmpR + j);
if( rgb->header.Zsize >= 2 ) *ptr++ = *(rgb->tmpG + j); if( rgb->header.Zsize >= 2 ) *ptr++ = *(rgb->tmpG + j);
if( rgb->header.Zsize >= 3 ) *ptr++ = *(rgb->tmpB + j); if( rgb->header.Zsize >= 3 ) *ptr++ = *(rgb->tmpB + j);
if( rgb->header.Zsize >= 4 ) *ptr++ = *(rgb->tmpA + j); if( rgb->header.Zsize >= 4 ) *ptr++ = *(rgb->tmpA + j);
} }
else else
{ {
// TWO bytes per color // TWO bytes per color
if( rgb->header.Zsize >= 1 ) if( rgb->header.Zsize >= 1 )
{ {
// two bytes of color data // two bytes of color data
tempShort = (u16 *) (ptr); tempShort = (u16 *) (ptr);
*tempShort = *( (u16 *) (rgb->tmpR) + j); *tempShort = *( (u16 *) (rgb->tmpR) + j);
tempShort++; tempShort++;
ptr = ( u8 *)(tempShort); ptr = ( u8 *)(tempShort);
} }
if( rgb->header.Zsize >= 2 ) if( rgb->header.Zsize >= 2 )
{ {
tempShort = ( u16 *) (ptr); tempShort = ( u16 *) (ptr);
*tempShort = *( ( u16 *) (rgb->tmpG) + j); *tempShort = *( ( u16 *) (rgb->tmpG) + j);
tempShort++; tempShort++;
ptr = ( u8 *) (tempShort); ptr = ( u8 *) (tempShort);
} }
if( rgb->header.Zsize >= 3 ) if( rgb->header.Zsize >= 3 )
{ {
tempShort = ( u16 *) (ptr); tempShort = ( u16 *) (ptr);
*tempShort = *( ( u16 *) (rgb->tmpB) + j); *tempShort = *( ( u16 *) (rgb->tmpB) + j);
tempShort++; tempShort++;
ptr = ( u8 *)(tempShort); ptr = ( u8 *)(tempShort);
} }
if( rgb->header.Zsize >= 4 ) if( rgb->header.Zsize >= 4 )
{ {
tempShort = ( u16 *) (ptr); tempShort = ( u16 *) (ptr);
*tempShort = *( ( u16 *) (rgb->tmpA) + j); *tempShort = *( ( u16 *) (rgb->tmpA) + j);
tempShort++; tempShort++;
ptr = ( u8 *)(tempShort); ptr = ( u8 *)(tempShort);
} }
} // end if(rgb->header.BPC == 1) } // end if(rgb->header.BPC == 1)
} // end for } // end for
// // pad the image width with blanks to bring it up to the rounded width. // // pad the image width with blanks to bring it up to the rounded width.
// for(;j<width;++j) *ptr++ = 0; // for(;j<width;++j) *ptr++ = 0;
} // end for } // end for
} }
/* /*
This information only applies if the value for STORAGE is 1. If the image is This information only applies if the value for STORAGE is 1. If the image is
stored using run length encoding, the image data follows the offset/length tables. stored using run length encoding, the image data follows the offset/length tables.
The RLE data is not in any particular order. The offset tables are used to The RLE data is not in any particular order. The offset tables are used to
locate the rle data for any scanline. locate the rle data for any scanline.
The RLE data must be read in from the file and expanded into pixel data in the following manner: The RLE data must be read in from the file and expanded into pixel data in the following manner:
If BPC is 1, then there is one byte per pixel. In this case the RLE data should be If BPC is 1, then there is one byte per pixel. In this case the RLE data should be
read into an array of chars. To expand data, the low order seven bits of the first read into an array of chars. To expand data, the low order seven bits of the first
byte: bits[6..0] are used to form a count. If the high order bit of the first byte byte: bits[6..0] are used to form a count. If the high order bit of the first byte
is 1: bit[7], then the count is used to specify how many bytes to copy from the RLE is 1: bit[7], then the count is used to specify how many bytes to copy from the RLE
data buffer to the destination. Otherwise, if the high order bit of the first byte data buffer to the destination. Otherwise, if the high order bit of the first byte
is 0: bit[7], then the count is used to specify how many times to repeat the value is 0: bit[7], then the count is used to specify how many times to repeat the value
of the following byte, in the destination. This process continues until a count of the following byte, in the destination. This process continues until a count
of 0 is found. This should decompress exactly XSIZE pixels. of 0 is found. This should decompress exactly XSIZE pixels.
One entry in each table is needed for each scanline of RLE data. The total number of One entry in each table is needed for each scanline of RLE data. The total number of
scanlines in the image (tablen) is determined by the product of the YSIZE and ZSIZE. scanlines in the image (tablen) is determined by the product of the YSIZE and ZSIZE.
There are two tables of longs that are written. Each consists of tablen longs of data. There are two tables of longs that are written. Each consists of tablen longs of data.
The first table has the file offsets to the RLE data for each scanline in the image. In The first table has the file offsets to the RLE data for each scanline in the image. In
a file with more than 1 channel (ZSIZE > 1) this table first has all the offsets for the a file with more than 1 channel (ZSIZE > 1) this table first has all the offsets for the
scanlines in the first channel, followed be offsets for the scanlines in the second scanlines in the first channel, followed be offsets for the scanlines in the second
channel, etc. The second table has the RLE data length for each scanline in the image. channel, etc. The second table has the RLE data length for each scanline in the image.
In a file with more than 1 channel (ZSIZE > 1) this table first has all the RLE data In a file with more than 1 channel (ZSIZE > 1) this table first has all the RLE data
lengths for the scanlines in the first channel, followed be RLE data lengths for the lengths for the scanlines in the first channel, followed be RLE data lengths for the
scanlines in the second channel, etc. scanlines in the second channel, etc.
Return a row of data, expanding RLE compression if necessary Return a row of data, expanding RLE compression if necessary
*/ */
void CImageLoaderRGB::readRGBrow(u8 *buf, int y, int z, io::IReadFile* file, rgbStruct* rgb) const void CImageLoaderRGB::readRGBrow(u8 *buf, int y, int z, io::IReadFile* file, rgbStruct* rgb) const
{ {
u8 *iPtr, *oPtr; u8 *iPtr, *oPtr;
u16 pixel; u16 pixel;
int count; int count;
bool done = false; bool done = false;
u16 *tempShort; u16 *tempShort;
if (rgb->header.Storage != 1) if (rgb->header.Storage != 1)
{ {
// stored VERBATIM // stored VERBATIM
file->seek(512+(y*rgb->header.Xsize * rgb->header.BPC)+(z* rgb->header.Xsize * rgb->header.Ysize * rgb->header.BPC)); file->seek(512+(y*rgb->header.Xsize * rgb->header.BPC)+(z* rgb->header.Xsize * rgb->header.Ysize * rgb->header.BPC));
file->read((char*)buf, rgb->header.Xsize * rgb->header.BPC); file->read((char*)buf, rgb->header.Xsize * rgb->header.BPC);
#ifndef __BIG_ENDIAN__ #ifndef __BIG_ENDIAN__
if (rgb->header.BPC != 1) if (rgb->header.BPC != 1)
convertShort( (u16 *)(buf), rgb->header.Xsize); convertShort( (u16 *)(buf), rgb->header.Xsize);
#endif #endif
return; return;
} }
// the file is stored as Run Length Encoding (RLE) // the file is stored as Run Length Encoding (RLE)
// each sequence is stored as 0x80 NumRepeats ByteToRepeat // each sequence is stored as 0x80 NumRepeats ByteToRepeat
// get the file offset from StartTable and SEEK // get the file offset from StartTable and SEEK
// then read the data // then read the data
file->seek((long) rgb->StartTable[y+z * rgb->header.Ysize]); file->seek((long) rgb->StartTable[y+z * rgb->header.Ysize]);
file->read((char*) rgb->tmp, (unsigned int)rgb->LengthTable[y+z * rgb->header.Ysize]); file->read((char*) rgb->tmp, (unsigned int)rgb->LengthTable[y+z * rgb->header.Ysize]);
// rgb->tmp has the data // rgb->tmp has the data
iPtr = rgb->tmp; iPtr = rgb->tmp;
oPtr = buf; oPtr = buf;
while (!done) while (!done)
{ {
// if BPC = 1, then one byte per pixel // if BPC = 1, then one byte per pixel
if (rgb->header.BPC == 1) if (rgb->header.BPC == 1)
{ {
pixel = *iPtr++; pixel = *iPtr++;
} }
else else
{ {
// BPC = 2, so two bytes per pixel // BPC = 2, so two bytes per pixel
tempShort = (u16 *) iPtr; tempShort = (u16 *) iPtr;
pixel = *tempShort; pixel = *tempShort;
tempShort++; tempShort++;
iPtr = (u8 *) tempShort; iPtr = (u8 *) tempShort;
} }
if (rgb->header.BPC != 1) #ifndef __BIG_ENDIAN__
convertShort(&pixel, 1); if (rgb->header.BPC != 1)
convertShort(&pixel, 1);
count = (int)(pixel & 0x7F); #endif
// limit the count value to the remiaing row size count = (int)(pixel & 0x7F);
if (oPtr + count*rgb->header.BPC > buf + rgb->header.Xsize * rgb->header.BPC)
{ // limit the count value to the remiaing row size
count = ( (buf + rgb->header.Xsize * rgb->header.BPC) - oPtr ) / rgb->header.BPC; if (oPtr + count*rgb->header.BPC > buf + rgb->header.Xsize * rgb->header.BPC)
} {
count = ( (buf + rgb->header.Xsize * rgb->header.BPC) - oPtr ) / rgb->header.BPC;
if (count<=0) }
{
done = true; if (count<=0)
return; {
} done = true;
return;
if (pixel & 0x80) }
{
// repeat the byte pointed to by iPtr, count times if (pixel & 0x80)
while (count--) {
{ // repeat the byte pointed to by iPtr, count times
if(rgb->header.BPC == 1) while (count--)
{ {
*oPtr++ = *iPtr++; if(rgb->header.BPC == 1)
} {
else *oPtr++ = *iPtr++;
{ }
tempShort = (u16 *) (iPtr); else
pixel = *tempShort; {
tempShort++; tempShort = (u16 *) (iPtr);
iPtr = (u8 *) (tempShort); pixel = *tempShort;
tempShort++;
convertShort(&pixel, 1); iPtr = (u8 *) (tempShort);
#ifndef __BIG_ENDIAN__
tempShort = (u16 *) (oPtr); convertShort(&pixel, 1);
*tempShort = pixel; #endif
tempShort++; tempShort = (u16 *) (oPtr);
oPtr = (u8 *) (tempShort); *tempShort = pixel;
} tempShort++;
} oPtr = (u8 *) (tempShort);
} }
else }
{ }
if (rgb->header.BPC == 1) else
{ {
pixel = *iPtr++; if (rgb->header.BPC == 1)
} {
else pixel = *iPtr++;
{ }
tempShort = (u16 *) (iPtr); else
pixel = *tempShort; {
tempShort++; tempShort = (u16 *) (iPtr);
iPtr = (u8 *) (tempShort); pixel = *tempShort;
} tempShort++;
iPtr = (u8 *) (tempShort);
if (rgb->header.BPC != 1) }
convertShort(&pixel, 1);
#ifndef __BIG_ENDIAN__
while (count--) if (rgb->header.BPC != 1)
{ convertShort(&pixel, 1);
if(rgb->header.BPC == 1) #endif
{
*oPtr++ = (char) pixel; while (count--)
} {
else if(rgb->header.BPC == 1)
{ {
tempShort = (u16 *) (oPtr); *oPtr++ = (char) pixel;
*tempShort = pixel; }
tempShort++; else
oPtr = (u8 *) (tempShort); {
} tempShort = (u16 *) (oPtr);
} *tempShort = pixel;
tempShort++;
} // else if (pixel & 0x80) oPtr = (u8 *) (tempShort);
} // while (!done) }
}
}
} // else if (pixel & 0x80)
} // while (!done)
}
#ifndef __BIG_ENDIAN__
//todo: replace with os::byteswap
/*
In the following description a notation like bits[7..0] is used to denote a #ifndef __BIG_ENDIAN__
range of bits in a binary value. Bit 0 is the lowest order bit in the value. //todo: replace with os::byteswap
All short values are represented by 2 bytes. The first byte stores the /*
high order 8 bits of the value: bits[15..8]. The second byte stores the In the following description a notation like bits[7..0] is used to denote a
low order 8 bits of the value: bits[7..0]. range of bits in a binary value. Bit 0 is the lowest order bit in the value.
*/
All short values are represented by 2 bytes. The first byte stores the
void CImageLoaderRGB::convertShort(u16 *array, long length) const high order 8 bits of the value: bits[15..8]. The second byte stores the
{ low order 8 bits of the value: bits[7..0].
unsigned long b1, b2; */
unsigned char *ptr;
void CImageLoaderRGB::convertShort(u16 *array, long length) const
ptr = (unsigned char *)array; {
while (length--) unsigned long b1, b2;
{ unsigned char *ptr;
b1 = *ptr++;
b2 = *ptr++; ptr = (unsigned char *)array;
*array++ = (u16) ((b1 << 8) | (b2)); while (length--)
} {
} b1 = *ptr++;
b2 = *ptr++;
*array++ = (u16) ((b1 << 8) | (b2));
}
/* }
All long values are represented by 4 bytes. The first byte stores the
high order 8 bits of the value: bits[31..24]. The second byte stores
bits[23..16]. The third byte stores bits[15..8]. The forth byte stores
the low order 8 bits of the value: bits[7..0]. /*
All long values are represented by 4 bytes. The first byte stores the
And this function will read a long value from the file: high order 8 bits of the value: bits[31..24]. The second byte stores
*/ bits[23..16]. The third byte stores bits[15..8]. The forth byte stores
void CImageLoaderRGB::convertLong(u32 *array, long length) const the low order 8 bits of the value: bits[7..0].
{
unsigned long b1, b2, b3, b4; And this function will read a long value from the file:
unsigned char *ptr; */
void CImageLoaderRGB::convertLong(u32 *array, long length) const
ptr = (unsigned char *)array; {
while (length--) unsigned long b1, b2, b3, b4;
{ unsigned char *ptr;
b1 = *ptr++;
b2 = *ptr++; ptr = (unsigned char *)array;
b3 = *ptr++; while (length--)
b4 = *ptr++; {
*array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); b1 = *ptr++;
} b2 = *ptr++;
} b3 = *ptr++;
b4 = *ptr++;
#endif *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4);
}
// we have 1 byte per COLOR VALUE, eg 24bpp and 1 alpha channel }
// calculate the color values based on the alpha values
// color values are stored as R,G,B,A #endif
// todo: replace with CColorConverter method // we have 1 byte per COLOR VALUE, eg 24bpp and 1 alpha channel
// calculate the color values based on the alpha values
void CImageLoaderRGB::converttoARGB(u8* in, rgbStruct *rgb) const // color values are stored as R,G,B,A
{
u32 cnt=0; // todo: replace with CColorConverter method
u8 tmp;
// (image color × alpha) + (background color × (100% - alpha)). void CImageLoaderRGB::converttoARGB(u8* in, rgbStruct *rgb) const
{
for ( int y=0; y < rgb->header.Ysize; y++) u32 cnt=0;
{ u8 tmp;
for ( int x=0; x < rgb->header.Xsize; x++) // (image color ◊ alpha) + (background color ◊ (100% - alpha)).
{
tmp = in[cnt+3]; for ( int y=0; y < rgb->header.Ysize; y++)
in[cnt+3] = in[cnt+2]; {
in[cnt+2] = in[cnt+1]; for ( int x=0; x < rgb->header.Xsize; x++)
in[cnt+1] = in[cnt]; {
in[cnt] = tmp; tmp = in[cnt+3];
in +=4; in[cnt+3] = in[cnt+2];
} in[cnt+2] = in[cnt+1];
} in[cnt+1] = in[cnt];
} in[cnt] = tmp;
in +=4;
}
}
//! creates a loader which is able to load windows bitmaps }
IImageLoader* createImageLoaderRGB()
{
return new CImageLoaderRGB;
} //! creates a loader which is able to load windows bitmaps
IImageLoader* createImageLoaderRGB()
{
} // end namespace video return new CImageLoaderRGB;
} // end namespace irr }
#endif } // end namespace video
} // end namespace irr
#endif
...@@ -182,21 +182,19 @@ private: ...@@ -182,21 +182,19 @@ private:
bool readHeader(io::IReadFile* file, rgbStruct* rgb) const; bool readHeader(io::IReadFile* file, rgbStruct* rgb) const;
void readRGBrow( u8 *buf, int y, int z, io::IReadFile* file, rgbStruct* rgb) const; void readRGBrow( u8 *buf, int y, int z, io::IReadFile* file, rgbStruct* rgb) const;
void convertLong(u32 *array, long length) const;
void convertShort(u16 *array, long length) const;
void processFile(rgbStruct *rgb, io::IReadFile *file) const; void processFile(rgbStruct *rgb, io::IReadFile *file) const;
bool checkFormat(io::IReadFile *file, rgbStruct *rgb) const; bool checkFormat(io::IReadFile *file, rgbStruct *rgb) const;
bool readOffsetTables(io::IReadFile* file, rgbStruct *rgb) const; bool readOffsetTables(io::IReadFile* file, rgbStruct *rgb) const;
void converttoARGB(u8* in, rgbStruct *rgb) const; void converttoARGB(u8* in, rgbStruct *rgb) const;
#ifndef __BIG_ENDIAN__
void convertLong(u32 *array, long length) const;
void convertShort(u16 *array, long length) const;
#endif
}; };
} // end namespace video } // end namespace video
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_RGB_LOADER_
#endif #endif // __C_IMAGE_LOADER_RGB_H_INCLUDED__
#endif
...@@ -406,8 +406,8 @@ void CIrrDeviceConsole::closeDevice() ...@@ -406,8 +406,8 @@ void CIrrDeviceConsole::closeDevice()
IsDeviceRunning = false; IsDeviceRunning = false;
} }
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
void CIrrDeviceConsole::setResizeable(bool resize) void CIrrDeviceConsole::setResizable(bool resize)
{ {
// do nothing // do nothing
} }
......
...@@ -75,8 +75,8 @@ namespace irr ...@@ -75,8 +75,8 @@ namespace irr
//! notifies the device that it should close itself //! notifies the device that it should close itself
virtual void closeDevice(); virtual void closeDevice();
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
virtual void setResizeable(bool resize=false); virtual void setResizable(bool resize=false);
//! Minimizes the window. //! Minimizes the window.
virtual void minimizeWindow(); virtual void minimizeWindow();
......
...@@ -1050,8 +1050,8 @@ video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const ...@@ -1050,8 +1050,8 @@ video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const
} }
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
void CIrrDeviceLinux::setResizeable(bool resize) void CIrrDeviceLinux::setResizable(bool resize)
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
if (CreationParams.DriverType == video::EDT_NULL) if (CreationParams.DriverType == video::EDT_NULL)
......
...@@ -87,8 +87,8 @@ namespace irr ...@@ -87,8 +87,8 @@ namespace irr
//! supported by the gfx adapter. //! supported by the gfx adapter.
video::IVideoModeList* getVideoModeList(); video::IVideoModeList* getVideoModeList();
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
virtual void setResizeable(bool resize=false); virtual void setResizable(bool resize=false);
//! Minimizes the window. //! Minimizes the window.
virtual void minimizeWindow(); virtual void minimizeWindow();
......
...@@ -45,7 +45,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) ...@@ -45,7 +45,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_HWSURFACE|SDL_ANYFORMAT), Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_HWSURFACE|SDL_ANYFORMAT),
MouseX(0), MouseY(0), MouseButtonStates(0), MouseX(0), MouseY(0), MouseButtonStates(0),
Width(param.WindowSize.Width), Height(param.WindowSize.Height), Width(param.WindowSize.Width), Height(param.WindowSize.Height),
Close(0), Resizeable(false), Close(0), Resizable(false),
WindowHasFocus(false), WindowMinimized(false) WindowHasFocus(false), WindowMinimized(false)
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -660,10 +660,10 @@ video::IVideoModeList* CIrrDeviceSDL::getVideoModeList() ...@@ -660,10 +660,10 @@ video::IVideoModeList* CIrrDeviceSDL::getVideoModeList()
} }
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
void CIrrDeviceSDL::setResizeable(bool resize) void CIrrDeviceSDL::setResizable(bool resize)
{ {
if (resize != Resizeable) if (resize != Resizable)
{ {
if (resize) if (resize)
SDL_Flags |= SDL_RESIZABLE; SDL_Flags |= SDL_RESIZABLE;
...@@ -672,7 +672,7 @@ void CIrrDeviceSDL::setResizeable(bool resize) ...@@ -672,7 +672,7 @@ void CIrrDeviceSDL::setResizeable(bool resize)
if (Screen) if (Screen)
SDL_FreeSurface(Screen); SDL_FreeSurface(Screen);
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags ); Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
Resizeable = resize; Resizable = resize;
} }
} }
......
...@@ -64,8 +64,8 @@ namespace irr ...@@ -64,8 +64,8 @@ namespace irr
//! \return Returns a pointer to a list with all video modes supported //! \return Returns a pointer to a list with all video modes supported
video::IVideoModeList* getVideoModeList(); video::IVideoModeList* getVideoModeList();
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
virtual void setResizeable(bool resize=false); virtual void setResizable(bool resize=false);
//! Minimizes the window. //! Minimizes the window.
virtual void minimizeWindow(); virtual void minimizeWindow();
...@@ -185,7 +185,7 @@ namespace irr ...@@ -185,7 +185,7 @@ namespace irr
u32 Width, Height; u32 Width, Height;
bool Close; bool Close;
bool Resizeable; bool Resizable;
bool WindowHasFocus; bool WindowHasFocus;
bool WindowMinimized; bool WindowMinimized;
......
...@@ -892,8 +892,8 @@ void CIrrDeviceWin32::OnResized() ...@@ -892,8 +892,8 @@ void CIrrDeviceWin32::OnResized()
Resized = true; Resized = true;
} }
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
void CIrrDeviceWin32::setResizeable(bool resize) void CIrrDeviceWin32::setResizable(bool resize)
{ {
if (ExternalWindow || !getVideoDriver() || CreationParams.Fullscreen) if (ExternalWindow || !getVideoDriver() || CreationParams.Fullscreen)
return; return;
......
...@@ -66,8 +66,8 @@ namespace irr ...@@ -66,8 +66,8 @@ namespace irr
//! Notifies the device, that it has been resized //! Notifies the device, that it has been resized
void OnResized(); void OnResized();
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
virtual void setResizeable(bool resize=false); virtual void setResizable(bool resize=false);
//! Minimizes the window. //! Minimizes the window.
virtual void minimizeWindow(); virtual void minimizeWindow();
......
...@@ -741,8 +741,8 @@ void CIrrDeviceWinCE::OnResized() ...@@ -741,8 +741,8 @@ void CIrrDeviceWinCE::OnResized()
} }
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
void CIrrDeviceWinCE::setResizeable(bool resize) void CIrrDeviceWinCE::setResizable(bool resize)
{ {
if (ExternalWindow || !getVideoDriver() || CreationParams.Fullscreen) if (ExternalWindow || !getVideoDriver() || CreationParams.Fullscreen)
return; return;
......
...@@ -66,8 +66,8 @@ namespace irr ...@@ -66,8 +66,8 @@ namespace irr
//! Notifies the device, that it has been resized //! Notifies the device, that it has been resized
void OnResized(); void OnResized();
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
virtual void setResizeable(bool resize=false); virtual void setResizable(bool resize=false);
//! Minimizes the window. //! Minimizes the window.
virtual void minimizeWindow(); virtual void minimizeWindow();
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
{ {
if (_device->isResizeAble()) if (_device->isResizable())
return proposedFrameSize; return proposedFrameSize;
else else
return [window frame].size; return [window frame].size;
......
...@@ -63,10 +63,13 @@ namespace irr ...@@ -63,10 +63,13 @@ namespace irr
virtual void closeDevice(); virtual void closeDevice();
//! Sets if the window should be resizable in windowed mode. //! Sets if the window should be resizable in windowed mode.
virtual void setResizeAble(bool resize); virtual void setResizable(bool resize);
//! Returns true if the window is resizable, false if not //! Returns true if the window is resizable, false if not
virtual bool isResizeAble() const; virtual bool isResizable() const;
//! Minimizes the window if possible
virtual void minimizeWindow();
//! Activate any joysticks, and generate events for them. //! Activate any joysticks, and generate events for them.
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo); virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo);
...@@ -76,8 +79,8 @@ namespace irr ...@@ -76,8 +79,8 @@ namespace irr
virtual video::IVideoModeList* getVideoModeList(); virtual video::IVideoModeList* getVideoModeList();
void flush(); void flush();
void setMouseLocation(int x,int y); void setMouseLocation(int x, int y);
void setResize(int width,int height); void setResize(int width, int height);
void setCursorVisible(bool visible); void setCursorVisible(bool visible);
private: private:
......
...@@ -369,7 +369,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param) ...@@ -369,7 +369,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
if (CreationParams.DriverType != video::EDT_NULL) if (CreationParams.DriverType != video::EDT_NULL)
createWindow(); createWindow();
setResizeAble(false); setResizable(false);
CursorControl = new CCursorControl(CreationParams.WindowSize, this); CursorControl = new CCursorControl(CreationParams.WindowSize, this);
createDriver(); createDriver();
...@@ -1085,17 +1085,21 @@ void CIrrDeviceMacOSX::initKeycodes() ...@@ -1085,17 +1085,21 @@ void CIrrDeviceMacOSX::initKeycodes()
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizable in windowed mode.
void CIrrDeviceMacOSX::setResizeAble(bool resize) void CIrrDeviceMacOSX::setResizable(bool resize)
{ {
IsResizable = resize; IsResizable = resize;
} }
bool CIrrDeviceMacOSX::isResizeAble() const bool CIrrDeviceMacOSX::isResizable() const
{ {
return IsResizable; return IsResizable;
} }
void CIrrDeviceMacOSX::minimizeWindow()
{
// todo: implement
}
bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rect<s32>* src ) bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rect<s32>* src )
{ {
......
...@@ -2021,63 +2021,16 @@ ...@@ -2021,63 +2021,16 @@
0910BA810D1F6BB800D46B04 /* gui */ = { 0910BA810D1F6BB800D46B04 /* gui */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
34FFD9CB0F6601AC00420884 /* element */,
4C53DEE60A484C220014E966 /* BuiltInFont.h */, 4C53DEE60A484C220014E966 /* BuiltInFont.h */,
5DD480580C7D945800728AA9 /* CDefaultGUIElementFactory.cpp */, 5DD480580C7D945800728AA9 /* CDefaultGUIElementFactory.cpp */,
5DD480590C7D945800728AA9 /* CDefaultGUIElementFactory.h */, 5DD480590C7D945800728AA9 /* CDefaultGUIElementFactory.h */,
4C53DF2E0A484C230014E966 /* CGUIButton.cpp */,
4C53DF2F0A484C230014E966 /* CGUIButton.h */,
4C53DF300A484C230014E966 /* CGUICheckBox.cpp */,
4C53DF310A484C230014E966 /* CGUICheckBox.h */,
5DD4805E0C7D947B00728AA9 /* CGUIColorSelectDialog.cpp */,
5DD4805F0C7D947B00728AA9 /* CGUIColorSelectDialog.h */,
4C53DF320A484C230014E966 /* CGUIComboBox.cpp */,
4C53DF330A484C230014E966 /* CGUIComboBox.h */,
4C53DF340A484C230014E966 /* CGUIContextMenu.cpp */,
4C53DF350A484C230014E966 /* CGUIContextMenu.h */,
4C53DF360A484C230014E966 /* CGUIEditBox.cpp */,
4C53DF370A484C230014E966 /* CGUIEditBox.h */,
4C53DF380A484C230014E966 /* CGUIEnvironment.cpp */,
4C53DF390A484C230014E966 /* CGUIEnvironment.h */,
4C53DF3A0A484C230014E966 /* CGUIFileOpenDialog.cpp */,
4C53DF3B0A484C230014E966 /* CGUIFileOpenDialog.h */,
4C53DF3C0A484C230014E966 /* CGUIFont.cpp */, 4C53DF3C0A484C230014E966 /* CGUIFont.cpp */,
4C53DF3D0A484C230014E966 /* CGUIFont.h */, 4C53DF3D0A484C230014E966 /* CGUIFont.h */,
4C53DF3E0A484C230014E966 /* CGUIImage.cpp */,
4C53DF3F0A484C230014E966 /* CGUIImage.h */,
3484C4DF0F48D1B000C81F60 /* CGUIImageList.h */,
3484C4E00F48D1B000C81F60 /* CGUIImageList.cpp */,
4C53DF400A484C230014E966 /* CGUIInOutFader.cpp */,
4C53DF410A484C230014E966 /* CGUIInOutFader.h */,
4C53DF420A484C230014E966 /* CGUIListBox.cpp */,
4C53DF430A484C230014E966 /* CGUIListBox.h */,
4C53DF440A484C230014E966 /* CGUIMenu.cpp */,
4C53DF450A484C230014E966 /* CGUIMenu.h */,
4C53DF460A484C230014E966 /* CGUIMeshViewer.cpp */,
4C53DF470A484C230014E966 /* CGUIMeshViewer.h */,
4C53DF480A484C230014E966 /* CGUIMessageBox.cpp */,
4C53DF490A484C230014E966 /* CGUIMessageBox.h */,
4C53DF4A0A484C230014E966 /* CGUIModalScreen.cpp */,
4C53DF4B0A484C230014E966 /* CGUIModalScreen.h */,
4C53DF4C0A484C230014E966 /* CGUIScrollBar.cpp */,
4C53DF4D0A484C230014E966 /* CGUIScrollBar.h */,
4C53DF4E0A484C230014E966 /* CGUISkin.cpp */, 4C53DF4E0A484C230014E966 /* CGUISkin.cpp */,
4C53DF4F0A484C230014E966 /* CGUISkin.h */, 4C53DF4F0A484C230014E966 /* CGUISkin.h */,
5DD480600C7D947B00728AA9 /* CGUISpinBox.cpp */,
5DD480610C7D947B00728AA9 /* CGUISpinBox.h */,
5DD480620C7D947B00728AA9 /* CGUISpriteBank.cpp */, 5DD480620C7D947B00728AA9 /* CGUISpriteBank.cpp */,
5DD480630C7D947B00728AA9 /* CGUISpriteBank.h */, 5DD480630C7D947B00728AA9 /* CGUISpriteBank.h */,
4C53DF500A484C230014E966 /* CGUIStaticText.cpp */,
4C53DF510A484C230014E966 /* CGUIStaticText.h */,
4C53DF520A484C230014E966 /* CGUITabControl.cpp */,
4C53DF530A484C230014E966 /* CGUITabControl.h */,
0910B9DA0D1F5D4100D46B04 /* CGUITable.cpp */,
0910B9DB0D1F5D4100D46B04 /* CGUITable.h */,
4C53DF540A484C230014E966 /* CGUIToolBar.cpp */,
4C53DF550A484C230014E966 /* CGUIToolBar.h */,
3484C4EC0F48D3A100C81F60 /* CGUITreeView.h */,
3484C4ED0F48D3A100C81F60 /* CGUITreeView.cpp */,
4C53DF560A484C230014E966 /* CGUIWindow.cpp */,
4C53DF570A484C230014E966 /* CGUIWindow.h */,
); );
name = gui; name = gui;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2085,31 +2038,14 @@ ...@@ -2085,31 +2038,14 @@
0910BA820D1F6C3900D46B04 /* io */ = { 0910BA820D1F6C3900D46B04 /* io */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4C53E0030A484C250014E966 /* CZipReader.cpp */, 34FFD9CA0F66018500420884 /* xml */,
4C53E0040A484C250014E966 /* CZipReader.h */, 34FFD9C90F66014200420884 /* file */,
4C53DEEF0A484C220014E966 /* CAttributeImpl.h */, 34FFD9C80F66012D00420884 /* attributes */,
4C53DEF00A484C220014E966 /* CAttributes.cpp */, 34FFD9C70F66011C00420884 /* archive */,
4C53DEF10A484C220014E966 /* CAttributes.h */,
4C53DF260A484C230014E966 /* CFileList.cpp */, 4C53DF260A484C230014E966 /* CFileList.cpp */,
4C53DF270A484C230014E966 /* CFileList.h */, 4C53DF270A484C230014E966 /* CFileList.h */,
4C53DF280A484C230014E966 /* CFileSystem.cpp */, 4C53DF280A484C230014E966 /* CFileSystem.cpp */,
4C53DF290A484C230014E966 /* CFileSystem.h */, 4C53DF290A484C230014E966 /* CFileSystem.h */,
4C53DF6E0A484C230014E966 /* CLimitReadFile.cpp */,
4C53DF6F0A484C230014E966 /* CLimitReadFile.h */,
3484C4FB0F48D4CB00C81F60 /* CMemoryFile.h */,
3484C4FC0F48D4CB00C81F60 /* CMemoryFile.cpp */,
4C43EEBE0A74A5C800F942FC /* CPakReader.cpp */,
4C43EEBF0A74A5C800F942FC /* CPakReader.h */,
4C53DFA70A484C240014E966 /* CReadFile.cpp */,
4C53DFA80A484C240014E966 /* CReadFile.h */,
4C53DFF20A484C250014E966 /* CWriteFile.cpp */,
4C53DFF30A484C250014E966 /* CWriteFile.h */,
4C53DFFA0A484C250014E966 /* CXMLReader.cpp */,
4C53DFFB0A484C250014E966 /* CXMLReader.h */,
4C53DFFC0A484C250014E966 /* CXMLReaderImpl.h */,
4C53DFFD0A484C250014E966 /* CXMLWriter.cpp */,
4C53DFFE0A484C250014E966 /* CXMLWriter.h */,
4C53E00E0A484C250014E966 /* irrXML.cpp */,
); );
name = io; name = io;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2117,16 +2053,7 @@ ...@@ -2117,16 +2053,7 @@
0910BA830D1F6CA600D46B04 /* irr */ = { 0910BA830D1F6CA600D46B04 /* irr */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
34EC243A0F59272E0037BC3A /* CIrrDeviceConsole.h */, 34FFD9C60F6600DA00420884 /* device */,
34EC243B0F59272E0037BC3A /* CIrrDeviceConsole.cpp */,
4C53DF660A484C230014E966 /* CIrrDeviceLinux.cpp */,
4C53DF670A484C230014E966 /* CIrrDeviceLinux.h */,
5DD480C40C7DA66800728AA9 /* CIrrDeviceSDL.cpp */,
5DD480C30C7DA66800728AA9 /* CIrrDeviceSDL.h */,
4C53DF680A484C230014E966 /* CIrrDeviceStub.cpp */,
4C53DF690A484C230014E966 /* CIrrDeviceStub.h */,
4C53DF6A0A484C230014E966 /* CIrrDeviceWin32.cpp */,
4C53DF6B0A484C230014E966 /* CIrrDeviceWin32.h */,
4C53DF720A484C230014E966 /* CLogger.cpp */, 4C53DF720A484C230014E966 /* CLogger.cpp */,
4C53DF730A484C230014E966 /* CLogger.h */, 4C53DF730A484C230014E966 /* CLogger.h */,
4C53DF990A484C240014E966 /* COSOperator.cpp */, 4C53DF990A484C240014E966 /* COSOperator.cpp */,
...@@ -2613,6 +2540,138 @@ ...@@ -2613,6 +2540,138 @@
name = loader; name = loader;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
34FFD9C50F6600A900420884 /* libraries */ = {
isa = PBXGroup;
children = (
4C53E1710A484C2C0014E966 /* zlib */,
4C53E0130A484C250014E966 /* jpeglib */,
09293C2B0ED31FF8003B8C9C /* libpng */,
);
name = libraries;
sourceTree = "<group>";
};
34FFD9C60F6600DA00420884 /* device */ = {
isa = PBXGroup;
children = (
4C53E14A0A484C2C0014E966 /* MacOSX */,
34EC243A0F59272E0037BC3A /* CIrrDeviceConsole.h */,
34EC243B0F59272E0037BC3A /* CIrrDeviceConsole.cpp */,
4C53DF660A484C230014E966 /* CIrrDeviceLinux.cpp */,
4C53DF670A484C230014E966 /* CIrrDeviceLinux.h */,
5DD480C40C7DA66800728AA9 /* CIrrDeviceSDL.cpp */,
5DD480C30C7DA66800728AA9 /* CIrrDeviceSDL.h */,
4C53DF680A484C230014E966 /* CIrrDeviceStub.cpp */,
4C53DF690A484C230014E966 /* CIrrDeviceStub.h */,
4C53DF6A0A484C230014E966 /* CIrrDeviceWin32.cpp */,
4C53DF6B0A484C230014E966 /* CIrrDeviceWin32.h */,
);
name = device;
sourceTree = "<group>";
};
34FFD9C70F66011C00420884 /* archive */ = {
isa = PBXGroup;
children = (
4C53E0030A484C250014E966 /* CZipReader.cpp */,
4C53E0040A484C250014E966 /* CZipReader.h */,
4C43EEBE0A74A5C800F942FC /* CPakReader.cpp */,
4C43EEBF0A74A5C800F942FC /* CPakReader.h */,
);
name = archive;
sourceTree = "<group>";
};
34FFD9C80F66012D00420884 /* attributes */ = {
isa = PBXGroup;
children = (
4C53DEEF0A484C220014E966 /* CAttributeImpl.h */,
4C53DEF00A484C220014E966 /* CAttributes.cpp */,
4C53DEF10A484C220014E966 /* CAttributes.h */,
);
name = attributes;
sourceTree = "<group>";
};
34FFD9C90F66014200420884 /* file */ = {
isa = PBXGroup;
children = (
4C53DFA70A484C240014E966 /* CReadFile.cpp */,
4C53DFA80A484C240014E966 /* CReadFile.h */,
4C53DFF20A484C250014E966 /* CWriteFile.cpp */,
4C53DFF30A484C250014E966 /* CWriteFile.h */,
4C53DF6E0A484C230014E966 /* CLimitReadFile.cpp */,
4C53DF6F0A484C230014E966 /* CLimitReadFile.h */,
3484C4FB0F48D4CB00C81F60 /* CMemoryFile.h */,
3484C4FC0F48D4CB00C81F60 /* CMemoryFile.cpp */,
);
name = file;
sourceTree = "<group>";
};
34FFD9CA0F66018500420884 /* xml */ = {
isa = PBXGroup;
children = (
4C53DFFA0A484C250014E966 /* CXMLReader.cpp */,
4C53DFFB0A484C250014E966 /* CXMLReader.h */,
4C53DFFC0A484C250014E966 /* CXMLReaderImpl.h */,
4C53DFFD0A484C250014E966 /* CXMLWriter.cpp */,
4C53DFFE0A484C250014E966 /* CXMLWriter.h */,
4C53E00E0A484C250014E966 /* irrXML.cpp */,
);
name = xml;
sourceTree = "<group>";
};
34FFD9CB0F6601AC00420884 /* element */ = {
isa = PBXGroup;
children = (
4C53DF2E0A484C230014E966 /* CGUIButton.cpp */,
4C53DF2F0A484C230014E966 /* CGUIButton.h */,
4C53DF300A484C230014E966 /* CGUICheckBox.cpp */,
4C53DF310A484C230014E966 /* CGUICheckBox.h */,
5DD4805E0C7D947B00728AA9 /* CGUIColorSelectDialog.cpp */,
5DD4805F0C7D947B00728AA9 /* CGUIColorSelectDialog.h */,
4C53DF320A484C230014E966 /* CGUIComboBox.cpp */,
4C53DF330A484C230014E966 /* CGUIComboBox.h */,
4C53DF340A484C230014E966 /* CGUIContextMenu.cpp */,
4C53DF350A484C230014E966 /* CGUIContextMenu.h */,
4C53DF360A484C230014E966 /* CGUIEditBox.cpp */,
4C53DF370A484C230014E966 /* CGUIEditBox.h */,
4C53DF380A484C230014E966 /* CGUIEnvironment.cpp */,
4C53DF390A484C230014E966 /* CGUIEnvironment.h */,
4C53DF3A0A484C230014E966 /* CGUIFileOpenDialog.cpp */,
4C53DF3B0A484C230014E966 /* CGUIFileOpenDialog.h */,
4C53DF3E0A484C230014E966 /* CGUIImage.cpp */,
4C53DF3F0A484C230014E966 /* CGUIImage.h */,
3484C4DF0F48D1B000C81F60 /* CGUIImageList.h */,
3484C4E00F48D1B000C81F60 /* CGUIImageList.cpp */,
4C53DF400A484C230014E966 /* CGUIInOutFader.cpp */,
4C53DF410A484C230014E966 /* CGUIInOutFader.h */,
4C53DF420A484C230014E966 /* CGUIListBox.cpp */,
4C53DF430A484C230014E966 /* CGUIListBox.h */,
4C53DF440A484C230014E966 /* CGUIMenu.cpp */,
4C53DF450A484C230014E966 /* CGUIMenu.h */,
4C53DF460A484C230014E966 /* CGUIMeshViewer.cpp */,
4C53DF470A484C230014E966 /* CGUIMeshViewer.h */,
4C53DF480A484C230014E966 /* CGUIMessageBox.cpp */,
4C53DF490A484C230014E966 /* CGUIMessageBox.h */,
4C53DF4A0A484C230014E966 /* CGUIModalScreen.cpp */,
4C53DF4B0A484C230014E966 /* CGUIModalScreen.h */,
4C53DF4C0A484C230014E966 /* CGUIScrollBar.cpp */,
4C53DF4D0A484C230014E966 /* CGUIScrollBar.h */,
5DD480600C7D947B00728AA9 /* CGUISpinBox.cpp */,
5DD480610C7D947B00728AA9 /* CGUISpinBox.h */,
4C53DF500A484C230014E966 /* CGUIStaticText.cpp */,
4C53DF510A484C230014E966 /* CGUIStaticText.h */,
4C53DF520A484C230014E966 /* CGUITabControl.cpp */,
4C53DF530A484C230014E966 /* CGUITabControl.h */,
0910B9DA0D1F5D4100D46B04 /* CGUITable.cpp */,
0910B9DB0D1F5D4100D46B04 /* CGUITable.h */,
4C53DF540A484C230014E966 /* CGUIToolBar.cpp */,
4C53DF550A484C230014E966 /* CGUIToolBar.h */,
3484C4EC0F48D3A100C81F60 /* CGUITreeView.h */,
3484C4ED0F48D3A100C81F60 /* CGUITreeView.cpp */,
4C53DF560A484C230014E966 /* CGUIWindow.cpp */,
4C53DF570A484C230014E966 /* CGUIWindow.h */,
);
name = element;
sourceTree = "<group>";
};
4C00546D0A48470500C844C2 /* examples */ = { 4C00546D0A48470500C844C2 /* examples */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -2757,11 +2816,8 @@ ...@@ -2757,11 +2816,8 @@
4C53DEE50A484C220014E966 /* Irrlicht */ = { 4C53DEE50A484C220014E966 /* Irrlicht */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
09293C2B0ED31FF8003B8C9C /* libpng */, 34FFD9C50F6600A900420884 /* libraries */,
4C6DC9960A486B110017A6E5 /* Engine */, 4C6DC9960A486B110017A6E5 /* Engine */,
4C53E14A0A484C2C0014E966 /* MacOSX */,
4C53E0130A484C250014E966 /* jpeglib */,
4C53E1710A484C2C0014E966 /* zlib */,
); );
name = Irrlicht; name = Irrlicht;
path = ..; path = ..;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment