Module for managing images for scripting.
More...
#include <ScreenImageMgr.hpp>
|
void | createScreenImage (const QString &id, const QString &filename, float x, float y, float scale=1., bool visible=true, float alpha=1., float fadeDuration=1.) |
| Create an image from a file and display on the screen at x,y coordinates. More...
|
|
bool | getShowImage (const QString &id) |
| Find out if an image is currently visible. More...
|
|
void | showImage (const QString &id, bool show) |
| Set an image's visible status. More...
|
|
int | getImageWidth (const QString &id) |
|
int | getImageHeight (const QString &id) |
|
void | setImageScale (const QString &id, float scaleX, float scaleY, float duration=0.) |
| Set the x and y scale for the specified image, relative to size given at load time. More...
|
|
float | getImageScaleX (const QString &id) |
|
float | getImageScaleY (const QString &id) |
|
void | setImageAlpha (const QString &id, float alpha) |
| Set an image's alpha value when visible. More...
|
|
void | setImageXY (const QString &id, float x, float y, float duration=0.) |
| Set the x and y coordinates for the specified image. More...
|
|
void | addImageXY (const QString &id, float x, float y, float duration=0.) |
| Add x and y coordinate offsets to the specified image. More...
|
|
void | deleteImage (const QString &id) |
| Delete an image. More...
|
|
void | deleteAllImages (void) |
| Delete all images currently managed by ScreenImageMgr. More...
|
|
QStringList | getAllImageIDs (void) |
| Get a list of currently loaded image IDs. More...
|
|
|
enum | StelModuleSelectAction { AddToSelection,
ReplaceSelection,
RemoveFromSelection
} |
| Enum used when selecting objects to define whether to add to, replace, or remove from the existing selection list. More...
|
|
enum | StelModuleActionName {
ActionDraw,
ActionUpdate,
ActionHandleMouseClicks,
ActionHandleMouseMoves,
ActionHandleKeys
} |
| Define the possible action for which an order is defined. More...
|
|
class StelAction * | addAction (const QString &id, const QString &groupId, const QString &text, QObject *target, const char *slot, const QString &shortcut="", const QString &altShortcut="") |
| convenience methods to add an action (call to slot) to the StelActionMgr object. More...
|
|
class StelAction * | addAction (const QString &id, const QString &groupId, const QString &text, const char *slot, const QString &shortcut="", const QString &altShortcut="") |
| convenience methods to add an action (call to own slot) to the StelActionMgr object. More...
|
|
Module for managing images for scripting.
Images are identified by a string ID which is passed to ScreenImageMgr members when it is necessary to specify an image to work with. Member functions in this class which modify the state of the class are all mediated through the signal/slot mechanism to ensure such operations happen in the main thread where images are drawn, and not in the script thread.
Definition at line 121 of file ScreenImageMgr.hpp.
ScreenImageMgr::ScreenImageMgr |
( |
| ) |
|
void ScreenImageMgr::addImageXY |
( |
const QString & |
id, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
duration = 0. |
|
) |
| |
|
slot |
Add x and y coordinate offsets to the specified image.
- Parameters
-
id | the ID for the desired image. |
x | The x-coordinate shift for the image, pixels. |
y | The y-coordinate shift for the image, pixels. |
duration | The time for the change to take place, in seconds. |
void ScreenImageMgr::createScreenImage |
( |
const QString & |
id, |
|
|
const QString & |
filename, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
scale = 1. , |
|
|
bool |
visible = true , |
|
|
float |
alpha = 1. , |
|
|
float |
fadeDuration = 1. |
|
) |
| |
|
slot |
Create an image from a file and display on the screen at x,y coordinates.
- Parameters
-
id | the ID to use when referring to this image (an arbitrary string). If an image with this id exists already, it will be deleted first. |
filename | the partial path of the file to load. This will be searched for using StelFileMgr, with "scripts/" prefixed to the filename. |
x | The x-coordinate for the image (0 = left of screen) |
y | The y-coordinate for the image (0 = bottom of screen) |
scale | scale factor for the image. 1 = original size, 0.5 = 50% size etc. |
visible | The initial visible state of the image |
alpha | The initial alpha (opacity) value for the image (range 0.0=transparent to 1.0=opaque) |
fadeDuration | the time it takes for screen images to fade in/out/change alpha in seconds. |
void ScreenImageMgr::deleteAllImages |
( |
void |
| ) |
|
|
slot |
void ScreenImageMgr::deleteImage |
( |
const QString & |
id | ) |
|
|
slot |
Delete an image.
- Parameters
-
id | the ID for the desired image. |
virtual void ScreenImageMgr::draw |
( |
StelCore * |
core | ) |
|
|
virtual |
Execute all the drawing functions for this module.
- Parameters
-
core | the core to use for the drawing |
Reimplemented from StelModule.
QStringList ScreenImageMgr::getAllImageIDs |
( |
void |
| ) |
|
|
slot |
Get a list of currently loaded image IDs.
Defines the order in which the various modules are drawn.
Reimplemented from StelModule.
int ScreenImageMgr::getImageHeight |
( |
const QString & |
id | ) |
|
|
slot |
- Parameters
-
id | the ID for the desired image. |
- Returns
- height (unscaled!) in pixels.
float ScreenImageMgr::getImageScaleX |
( |
const QString & |
id | ) |
|
|
slot |
- Parameters
-
id | the ID for the desired image. |
- Returns
- current X scaling factor, relative to loaded size.
float ScreenImageMgr::getImageScaleY |
( |
const QString & |
id | ) |
|
|
slot |
- Parameters
-
id | the ID for the desired image. |
- Returns
- current Y scaling factor, relative to loaded size.
int ScreenImageMgr::getImageWidth |
( |
const QString & |
id | ) |
|
|
slot |
- Parameters
-
id | the ID for the desired image. |
- Returns
- width (unscaled!) in pixels.
bool ScreenImageMgr::getShowImage |
( |
const QString & |
id | ) |
|
|
slot |
Find out if an image is currently visible.
- Parameters
-
id | the ID for the desired image. |
- Returns
- true if visible, false if not visible or not loaded.
virtual void ScreenImageMgr::init |
( |
| ) |
|
|
virtual |
Initialize itself.
If the initialization takes significant time, the progress should be displayed on the loading bar.
Implements StelModule.
void ScreenImageMgr::setImageAlpha |
( |
const QString & |
id, |
|
|
float |
alpha |
|
) |
| |
|
slot |
Set an image's alpha value when visible.
- Parameters
-
id | the ID for the desired image. |
alpha | the new alpha value to set. |
void ScreenImageMgr::setImageScale |
( |
const QString & |
id, |
|
|
float |
scaleX, |
|
|
float |
scaleY, |
|
|
float |
duration = 0. |
|
) |
| |
|
slot |
Set the x and y scale for the specified image, relative to size given at load time.
- Parameters
-
id | the ID for the desired image. |
scaleX | The new x-scale for the image. |
scaleY | The new y-scale for the image. |
duration | The time for the change to take place, in seconds. |
void ScreenImageMgr::setImageXY |
( |
const QString & |
id, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
duration = 0. |
|
) |
| |
|
slot |
Set the x and y coordinates for the specified image.
- Parameters
-
id | the ID for the desired image. |
x | The new x-coordinate for the image, pixels. |
y | The new y-coordinate for the image, pixels. |
duration | The time for the change to take place, in seconds. |
void ScreenImageMgr::showImage |
( |
const QString & |
id, |
|
|
bool |
show |
|
) |
| |
|
slot |
Set an image's visible status.
- Parameters
-
id | the ID for the desired image. |
show | the new visible state to set. |
virtual void ScreenImageMgr::update |
( |
double |
deltaTime | ) |
|
|
virtual |
Update time-dependent parts of the module.
Implements StelModule.
The documentation for this class was generated from the following file: