Formatting
This commit is contained in:
parent
61917ce2a4
commit
2b42bbd60f
|
@ -6,3 +6,5 @@ lib/
|
|||
libgui.layout
|
||||
obj/
|
||||
CMakeLists.txt
|
||||
cmake-build-debug/
|
||||
.idea/
|
||||
|
|
|
@ -129,28 +129,38 @@ private:
|
|||
std::map<int16_t, ftGX2Data> fontData; /**< Map which holds the glyph data structures for the corresponding characters in one size. */
|
||||
|
||||
int16_t getStyleOffsetWidth(uint16_t width, uint16_t format);
|
||||
|
||||
int16_t getStyleOffsetHeight(int16_t format, uint16_t pixelSize);
|
||||
|
||||
void unloadFont();
|
||||
|
||||
ftgxCharData *cacheGlyphData(wchar_t charCode, int16_t pixelSize);
|
||||
|
||||
uint16_t cacheGlyphDataComplete(int16_t pixelSize);
|
||||
|
||||
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
|
||||
|
||||
void copyTextureToFramebuffer(CVideo * pVideo, GX2Texture *tex, int16_t screenX, int16_t screenY, int16_t screenZ, const glm::vec4 & color, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale);
|
||||
void copyTextureToFramebuffer(CVideo *pVideo, GX2Texture *tex, int16_t screenX, int16_t screenY, int16_t screenZ, const glm::vec4 &color, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 &blurColor,
|
||||
const float &internalRenderingScale);
|
||||
|
||||
public:
|
||||
FreeTypeGX(const uint8_t *fontBuffer, FT_Long bufferSize, bool lastFace = false);
|
||||
|
||||
~FreeTypeGX();
|
||||
|
||||
uint16_t drawText(CVideo *pVideo, int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, const glm::vec4 &color,
|
||||
uint16_t textStyling, uint16_t textWidth, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 &blurColor, const float &internalRenderingScale);
|
||||
|
||||
uint16_t getWidth(const wchar_t *text, int16_t pixelSize);
|
||||
|
||||
uint16_t getCharWidth(const wchar_t wChar, int16_t pixelSize, const wchar_t prevChar = 0x0000);
|
||||
|
||||
uint16_t getHeight(const wchar_t *text, int16_t pixelSize);
|
||||
|
||||
void getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widthLimit = 0);
|
||||
|
||||
static wchar_t *charToWideChar(const char *p);
|
||||
|
||||
static char *wideCharToUTF8(const wchar_t *strChar);
|
||||
};
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
class GameBgImage : public GuiImageAsync {
|
||||
public:
|
||||
GameBgImage(const std::string &filename, GuiImageData *preloadImage);
|
||||
|
||||
virtual ~GameBgImage();
|
||||
|
||||
void setAlphaFadeOut(const glm::vec4 &a) {
|
||||
|
@ -14,6 +15,7 @@ public:
|
|||
}
|
||||
|
||||
void draw(CVideo *pVideo);
|
||||
|
||||
private:
|
||||
glm::mat4 identity;
|
||||
glm::vec4 alphaFadeOut;
|
||||
|
|
|
@ -6,18 +6,23 @@
|
|||
class GridBackground : public GuiImage {
|
||||
public:
|
||||
GridBackground(GuiImageData *imgData);
|
||||
|
||||
virtual ~GridBackground();
|
||||
|
||||
void setColorIntensity(const glm::vec4 &color) {
|
||||
colorIntensity = color;
|
||||
}
|
||||
|
||||
const glm::vec4 &getColorIntensity() const {
|
||||
return colorIntensity;
|
||||
}
|
||||
|
||||
void setDistanceFadeOut(const float &a) {
|
||||
distanceFadeOut = a;
|
||||
}
|
||||
|
||||
void draw(CVideo *pVideo, const glm::mat4 &modelView);
|
||||
|
||||
private:
|
||||
glm::mat4 m_modelView;
|
||||
glm::vec4 colorIntensity;
|
||||
|
|
|
@ -32,56 +32,73 @@ public:
|
|||
//!\param w Width
|
||||
//!\param h Height
|
||||
GuiButton(float w, float h);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiButton();
|
||||
|
||||
//!Sets the button's image
|
||||
//!\param i Pointer to GuiImage object
|
||||
void setImage(GuiImage *i);
|
||||
|
||||
//!Sets the button's image on over
|
||||
//!\param i Pointer to GuiImage object
|
||||
void setImageOver(GuiImage *i);
|
||||
|
||||
void setIcon(GuiImage *i);
|
||||
|
||||
void setIconOver(GuiImage *i);
|
||||
|
||||
//!Sets the button's image on hold
|
||||
//!\param i Pointer to GuiImage object
|
||||
void setImageHold(GuiImage *i);
|
||||
|
||||
//!Sets the button's image on click
|
||||
//!\param i Pointer to GuiImage object
|
||||
void setImageClick(GuiImage *i);
|
||||
|
||||
//!Sets the button's label
|
||||
//!\param t Pointer to GuiText object
|
||||
//!\param n Index of label to set (optional, default is 0)
|
||||
void setLabel(GuiText *t, int32_t n = 0);
|
||||
|
||||
//!Sets the button's label on over (eg: different colored text)
|
||||
//!\param t Pointer to GuiText object
|
||||
//!\param n Index of label to set (optional, default is 0)
|
||||
void setLabelOver(GuiText *t, int32_t n = 0);
|
||||
|
||||
//!Sets the button's label on hold
|
||||
//!\param t Pointer to GuiText object
|
||||
//!\param n Index of label to set (optional, default is 0)
|
||||
void setLabelHold(GuiText *t, int32_t n = 0);
|
||||
|
||||
//!Sets the button's label on click
|
||||
//!\param t Pointer to GuiText object
|
||||
//!\param n Index of label to set (optional, default is 0)
|
||||
void setLabelClick(GuiText *t, int32_t n = 0);
|
||||
|
||||
//!Sets the sound to play on over
|
||||
//!\param s Pointer to GuiSound object
|
||||
void setSoundOver(GuiSound *s);
|
||||
|
||||
//!Sets the sound to play on hold
|
||||
//!\param s Pointer to GuiSound object
|
||||
void setSoundHold(GuiSound *s);
|
||||
|
||||
//!Sets the sound to play on click
|
||||
//!\param s Pointer to GuiSound object
|
||||
void setSoundClick(GuiSound *s);
|
||||
|
||||
//!Set a new GuiTrigger for the element
|
||||
//!\param i Index of trigger array to set
|
||||
//!\param t Pointer to GuiTrigger
|
||||
void setTrigger(GuiTrigger *t, int32_t idx = -1);
|
||||
|
||||
//!
|
||||
void resetState(void);
|
||||
|
||||
//!Constantly called to draw the GuiButton
|
||||
void draw(CVideo *video);
|
||||
|
||||
//!Constantly called to allow the GuiButton to respond to updated input data
|
||||
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
|
||||
void update(GuiController *c);
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
//!\param w Width
|
||||
//!\param h Height
|
||||
GuiDragListener(float w, float h);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiDragListener();
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ enum {
|
|||
|
||||
//!Forward declaration
|
||||
class GuiController;
|
||||
|
||||
class CVideo;
|
||||
|
||||
//!Primary GUI class. Most other classes inherit from this class.
|
||||
|
@ -71,26 +72,32 @@ class GuiElement {
|
|||
public:
|
||||
//!Constructor
|
||||
GuiElement();
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiElement() {}
|
||||
|
||||
//!Set the element's parent
|
||||
//!\param e Pointer to parent element
|
||||
virtual void setParent(GuiElement *e) {
|
||||
parentElement = e;
|
||||
}
|
||||
|
||||
//!Gets the element's parent
|
||||
//!\return Pointer to parent element
|
||||
virtual GuiElement *getParent() {
|
||||
return parentElement;
|
||||
}
|
||||
|
||||
//!Gets the current leftmost coordinate of the element
|
||||
//!Considers horizontal alignment, x offset, width, and parent element's GetLeft() / GetWidth() values
|
||||
//!\return left coordinate
|
||||
virtual float getLeft();
|
||||
|
||||
//!Gets the current topmost coordinate of the element
|
||||
//!Considers vertical alignment, y offset, height, and parent element's GetTop() / GetHeight() values
|
||||
//!\return top coordinate
|
||||
virtual float getTop();
|
||||
|
||||
//!Gets the current Z coordinate of the element
|
||||
//!\return Z coordinate
|
||||
virtual float getDepth() {
|
||||
|
@ -165,24 +172,29 @@ public:
|
|||
}
|
||||
return pCenterY;
|
||||
}
|
||||
|
||||
//!Gets elements xoffset
|
||||
virtual float getOffsetX() {
|
||||
return xoffset;
|
||||
}
|
||||
|
||||
//!Gets elements yoffset
|
||||
virtual float getOffsetY() {
|
||||
return yoffset;
|
||||
}
|
||||
|
||||
//!Gets the current width of the element. Does not currently consider the scale
|
||||
//!\return width
|
||||
virtual float getWidth() {
|
||||
return width;
|
||||
};
|
||||
|
||||
//!Gets the height of the element. Does not currently consider the scale
|
||||
//!\return height
|
||||
virtual float getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
//!Sets the size (width/height) of the element
|
||||
//!\param w Width of element
|
||||
//!\param h Height of element
|
||||
|
@ -190,53 +202,64 @@ public:
|
|||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
//!Sets the element's visibility
|
||||
//!\param v Visibility (true = visible)
|
||||
virtual void setVisible(bool v) {
|
||||
visible = v;
|
||||
visibleChanged(this, v);
|
||||
}
|
||||
|
||||
//!Checks whether or not the element is visible
|
||||
//!\return true if visible, false otherwise
|
||||
virtual bool isVisible() const {
|
||||
return !isStateSet(STATE_HIDDEN) && visible;
|
||||
};
|
||||
|
||||
//!Checks whether or not the element is selectable
|
||||
//!\return true if selectable, false otherwise
|
||||
virtual bool isSelectable() {
|
||||
return !isStateSet(STATE_DISABLED) && selectable;
|
||||
}
|
||||
|
||||
virtual bool isDrawOverOnlyWhenSelected() {
|
||||
return drawOverOnlyWhenSelected;
|
||||
}
|
||||
|
||||
virtual void setdrawOverOnlyWhenSelected(bool s) {
|
||||
drawOverOnlyWhenSelected = s;
|
||||
}
|
||||
|
||||
//!Checks whether or not the element is clickable
|
||||
//!\return true if clickable, false otherwise
|
||||
virtual bool isClickable() {
|
||||
return !isStateSet(STATE_DISABLED) && clickable;
|
||||
}
|
||||
|
||||
//!Checks whether or not the element is holdable
|
||||
//!\return true if holdable, false otherwise
|
||||
virtual bool isHoldable() {
|
||||
return !isStateSet(STATE_DISABLED) && holdable;
|
||||
}
|
||||
|
||||
//!Sets whether or not the element is selectable
|
||||
//!\param s Selectable
|
||||
virtual void setSelectable(bool s) {
|
||||
selectable = s;
|
||||
}
|
||||
|
||||
//!Sets whether or not the element is clickable
|
||||
//!\param c Clickable
|
||||
virtual void setClickable(bool c) {
|
||||
clickable = c;
|
||||
}
|
||||
|
||||
//!Sets whether or not the element is holdable
|
||||
//!\param c Holdable
|
||||
virtual void setHoldable(bool d) {
|
||||
holdable = d;
|
||||
}
|
||||
|
||||
//!Sets the element's state
|
||||
//!\param s State (STATE_DEFAULT, STATE_SELECTED, STATE_CLICKED, STATE_DISABLED)
|
||||
//!\param c Controller channel (0-3, -1 = none)
|
||||
|
@ -250,6 +273,7 @@ public:
|
|||
stateChan = c;
|
||||
stateChanged(this, s, c);
|
||||
}
|
||||
|
||||
virtual void clearState(int32_t s, int32_t c = -1) {
|
||||
if (c >= 0 && c < 5) {
|
||||
state[c] &= ~s;
|
||||
|
@ -260,6 +284,7 @@ public:
|
|||
stateChan = c;
|
||||
stateChanged(this, s, c);
|
||||
}
|
||||
|
||||
virtual bool isStateSet(int32_t s, int32_t c = -1) const {
|
||||
if (c >= 0 && c < 5) {
|
||||
return (state[c] & s) != 0;
|
||||
|
@ -271,27 +296,32 @@ public:
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//!Gets the element's current state
|
||||
//!\return state
|
||||
virtual int32_t getState(int32_t c = 0) {
|
||||
return state[c];
|
||||
};
|
||||
|
||||
//!Gets the controller channel that last changed the element's state
|
||||
//!\return Channel number (0-3, -1 = no channel)
|
||||
virtual int32_t getStateChan() {
|
||||
return stateChan;
|
||||
};
|
||||
|
||||
//!Resets the element's state to STATE_DEFAULT
|
||||
virtual void resetState() {
|
||||
for (int32_t i = 0; i < 5; i++)
|
||||
state[i] = STATE_DEFAULT;
|
||||
stateChan = -1;
|
||||
}
|
||||
|
||||
//!Sets the element's alpha value
|
||||
//!\param a alpha value
|
||||
virtual void setAlpha(float a) {
|
||||
alpha = a;
|
||||
}
|
||||
|
||||
//!Gets the element's alpha value
|
||||
//!Considers alpha, alphaDyn, and the parent element's getAlpha() value
|
||||
//!\return alpha
|
||||
|
@ -308,6 +338,7 @@ public:
|
|||
|
||||
return a;
|
||||
}
|
||||
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
virtual void setScale(float s) {
|
||||
|
@ -315,21 +346,25 @@ public:
|
|||
scaleY = s;
|
||||
scaleZ = s;
|
||||
}
|
||||
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
virtual void setScaleX(float s) {
|
||||
scaleX = s;
|
||||
}
|
||||
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
virtual void setScaleY(float s) {
|
||||
scaleY = s;
|
||||
}
|
||||
|
||||
//!Sets the element's scale
|
||||
//!\param s scale (1 is 100%)
|
||||
virtual void setScaleZ(float s) {
|
||||
scaleZ = s;
|
||||
}
|
||||
|
||||
//!Gets the element's current scale
|
||||
//!Considers scale, scaleDyn, and the parent element's getScale() value
|
||||
virtual float getScale() {
|
||||
|
@ -340,6 +375,7 @@ public:
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
//!Gets the element's current scale
|
||||
//!Considers scale, scaleDyn, and the parent element's getScale() value
|
||||
virtual float getScaleX() {
|
||||
|
@ -350,6 +386,7 @@ public:
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
//!Gets the element's current scale
|
||||
//!Considers scale, scaleDyn, and the parent element's getScale() value
|
||||
virtual float getScaleY() {
|
||||
|
@ -360,6 +397,7 @@ public:
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
//!Gets the element's current scale
|
||||
//!Considers scale, scaleDyn, and the parent element's getScale() value
|
||||
virtual float getScaleZ() {
|
||||
|
@ -370,41 +408,50 @@ public:
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
//!Checks whether rumble was requested by the element
|
||||
//!\return true is rumble was requested, false otherwise
|
||||
virtual bool isRumbleActive() {
|
||||
return rumble;
|
||||
}
|
||||
|
||||
//!Sets whether or not the element is requesting a rumble event
|
||||
//!\param r true if requesting rumble, false if not
|
||||
virtual void setRumble(bool r) {
|
||||
rumble = r;
|
||||
}
|
||||
|
||||
//!Set an effect for the element
|
||||
//!\param e Effect to enable
|
||||
//!\param a Amount of the effect (usage varies on effect)
|
||||
//!\param t Target amount of the effect (usage varies on effect)
|
||||
virtual void setEffect(int32_t e, int32_t a, int32_t t = 0);
|
||||
|
||||
//!Sets an effect to be enabled on wiimote cursor over
|
||||
//!\param e Effect to enable
|
||||
//!\param a Amount of the effect (usage varies on effect)
|
||||
//!\param t Target amount of the effect (usage varies on effect)
|
||||
virtual void setEffectOnOver(int32_t e, int32_t a, int32_t t = 0);
|
||||
|
||||
//!Shortcut to SetEffectOnOver(EFFECT_SCALE, 4, 110)
|
||||
virtual void setEffectGrow() {
|
||||
setEffectOnOver(EFFECT_SCALE, 4, 110);
|
||||
}
|
||||
|
||||
//!Reset all applied effects
|
||||
virtual void resetEffects();
|
||||
|
||||
//!Gets the current element effects
|
||||
//!\return element effects
|
||||
virtual int32_t getEffect() const {
|
||||
return effects;
|
||||
}
|
||||
|
||||
//!\return true if element animation is on going
|
||||
virtual bool isAnimated() const {
|
||||
return (parentElement != 0) && (getEffect() > 0);
|
||||
}
|
||||
|
||||
//!Checks whether the specified coordinates are within the element's boundaries
|
||||
//!\param x X coordinate
|
||||
//!\param y Y coordinate
|
||||
|
@ -415,6 +462,7 @@ public:
|
|||
&& y > (this->getCenterY() - getScaleY() * getHeight() * 0.5f)
|
||||
&& y < (this->getCenterY() + getScaleY() * getHeight() * 0.5f));
|
||||
}
|
||||
|
||||
//!Sets the element's position
|
||||
//!\param x X coordinate
|
||||
//!\param y Y coordinate
|
||||
|
@ -422,6 +470,7 @@ public:
|
|||
xoffset = x;
|
||||
yoffset = y;
|
||||
}
|
||||
|
||||
//!Sets the element's position
|
||||
//!\param x X coordinate
|
||||
//!\param y Y coordinate
|
||||
|
@ -431,36 +480,44 @@ public:
|
|||
yoffset = y;
|
||||
zoffset = z;
|
||||
}
|
||||
|
||||
//!Gets whether or not the element is in STATE_SELECTED
|
||||
//!\return true if selected, false otherwise
|
||||
virtual int32_t getSelected() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//!Sets the element's alignment respective to its parent element
|
||||
//!Bitwise ALIGN_LEFT | ALIGN_RIGHT | ALIGN_CENTRE, ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
|
||||
//!\param align Alignment
|
||||
virtual void setAlignment(int32_t a) {
|
||||
alignment = a;
|
||||
}
|
||||
|
||||
//!Gets the element's alignment
|
||||
virtual int32_t getAlignment() const {
|
||||
return alignment;
|
||||
}
|
||||
|
||||
//!Angle of the object
|
||||
virtual void setAngle(float a) {
|
||||
angle = a;
|
||||
}
|
||||
|
||||
//!Angle of the object
|
||||
virtual float getAngle() const {
|
||||
float r_angle = angle;
|
||||
if (parentElement) r_angle += parentElement->getAngle();
|
||||
return r_angle;
|
||||
}
|
||||
|
||||
//!Called constantly to allow the element to respond to the current input data
|
||||
//!\param t Pointer to a GuiController, containing the current input data from PAD/WPAD/VPAD
|
||||
virtual void update(GuiController *t) {}
|
||||
|
||||
//!Called constantly to redraw the element
|
||||
virtual void draw(CVideo *v) {}
|
||||
|
||||
//!Called constantly to process stuff in the element
|
||||
virtual void process() {}
|
||||
|
||||
|
@ -491,12 +548,14 @@ public:
|
|||
//POINT r = { p.x + getLeft(), p.y + getTop() };
|
||||
return p;
|
||||
}
|
||||
|
||||
//! Switch pointer screen to control position
|
||||
POINT PtrToControl(POINT p) {
|
||||
//! TODO for 3D
|
||||
//POINT r = { p.x - getLeft(), p.y - getTop() };
|
||||
return p;
|
||||
}
|
||||
|
||||
//! Signals
|
||||
sigslot::signal2<GuiElement *, bool> visibleChanged;
|
||||
sigslot::signal3<GuiElement *, int32_t, int32_t> stateChanged;
|
||||
|
|
|
@ -26,68 +26,92 @@ class GuiFrame : public GuiElement {
|
|||
public:
|
||||
//!Constructor
|
||||
GuiFrame(GuiFrame *parent = 0);
|
||||
|
||||
//!\overload
|
||||
//!\param w Width of window
|
||||
//!\param h Height of window
|
||||
GuiFrame(float w, float h, GuiFrame *parent = 0);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiFrame();
|
||||
|
||||
//!Appends a GuiElement to the GuiFrame
|
||||
//!\param e The GuiElement to append. If it is already in the GuiFrame, it is removed first
|
||||
void append(GuiElement *e);
|
||||
|
||||
//!Inserts a GuiElement into the GuiFrame at the specified index
|
||||
//!\param e The GuiElement to insert. If it is already in the GuiFrame, it is removed first
|
||||
//!\param i Index in which to insert the element
|
||||
void insert(GuiElement *e, uint32_t i);
|
||||
|
||||
//!Removes the specified GuiElement from the GuiFrame
|
||||
//!\param e GuiElement to be removed
|
||||
void remove(GuiElement *e);
|
||||
|
||||
//!Removes all GuiElements
|
||||
void removeAll();
|
||||
|
||||
//!Bring element to front of the window
|
||||
void bringToFront(GuiElement *e) {
|
||||
remove(e);
|
||||
append(e);
|
||||
}
|
||||
|
||||
//!Returns the GuiElement at the specified index
|
||||
//!\param index The index of the element
|
||||
//!\return A pointer to the element at the index, NULL on error (eg: out of bounds)
|
||||
GuiElement *getGuiElementAt(uint32_t index) const;
|
||||
|
||||
//!Returns the size of the list of elements
|
||||
//!\return The size of the current element list
|
||||
uint32_t getSize();
|
||||
|
||||
//!Sets the visibility of the window
|
||||
//!\param v visibility (true = visible)
|
||||
void setVisible(bool v);
|
||||
|
||||
//!Resets the window's state to STATE_DEFAULT
|
||||
void resetState();
|
||||
|
||||
//!Sets the window's state
|
||||
//!\param s State
|
||||
void setState(int32_t s, int32_t c = -1);
|
||||
|
||||
void clearState(int32_t s, int32_t c = -1);
|
||||
|
||||
//!Gets the index of the GuiElement inside the window that is currently selected
|
||||
//!\return index of selected GuiElement
|
||||
int32_t getSelected();
|
||||
|
||||
//!Dim the Window's background
|
||||
void dimBackground(bool d);
|
||||
|
||||
//!Draws all the elements in this GuiFrame
|
||||
void draw(CVideo *v);
|
||||
|
||||
//!Updates the window and all elements contains within
|
||||
//!Allows the GuiFrame and all elements to respond to the input data specified
|
||||
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
|
||||
void update(GuiController *t);
|
||||
|
||||
//!virtual Close Window - this will put the object on the delete queue in MainWindow
|
||||
virtual void close();
|
||||
|
||||
//!virtual show window function
|
||||
virtual void show() {}
|
||||
|
||||
//!virtual hide window function
|
||||
virtual void hide() {}
|
||||
|
||||
//!virtual enter main loop function (blocking)
|
||||
virtual void exec() {}
|
||||
|
||||
//!virtual updateEffects which is called by the main loop
|
||||
virtual void updateEffects();
|
||||
|
||||
//!virtual process which is called by the main loop
|
||||
virtual void process();
|
||||
|
||||
//! Signals
|
||||
//! On Closing
|
||||
sigslot::signal1<GuiFrame *> closing;
|
||||
|
|
|
@ -33,46 +33,58 @@ public:
|
|||
//!\overload
|
||||
//!\param img Pointer to GuiImageData element
|
||||
GuiImage(GuiImageData *img);
|
||||
|
||||
//!\overload
|
||||
//!Creates an image filled with the specified color
|
||||
//!\param w Image width
|
||||
//!\param h Image height
|
||||
//!\param c Array with 4 x image color (BL, BR, TL, TR)
|
||||
GuiImage(int32_t w, int32_t h, const GX2Color &c, int32_t imgType = IMAGE_COLOR);
|
||||
|
||||
GuiImage(int32_t w, int32_t h, const GX2Color *c, uint32_t colorCount = 1, int32_t imgType = IMAGE_COLOR);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiImage();
|
||||
|
||||
//!Sets the number of times to draw the image horizontally
|
||||
//!\param t Number of times to draw the image
|
||||
void setTileHorizontal(int32_t t) {
|
||||
tileHorizontal = t;
|
||||
}
|
||||
|
||||
//!Sets the number of times to draw the image vertically
|
||||
//!\param t Number of times to draw the image
|
||||
void setTileVertical(int32_t t) {
|
||||
tileVertical = t;
|
||||
}
|
||||
|
||||
//!Constantly called to draw the image
|
||||
void draw(CVideo *pVideo);
|
||||
|
||||
//!Gets the image data
|
||||
//!\return pointer to image data
|
||||
GuiImageData *getImageData() const {
|
||||
return imageData;
|
||||
}
|
||||
|
||||
//!Sets up a new image using the GuiImageData object specified
|
||||
//!\param img Pointer to GuiImageData object
|
||||
void setImageData(GuiImageData *img);
|
||||
|
||||
//!Gets the pixel color at the specified coordinates of the image
|
||||
//!\param x X coordinate
|
||||
//!\param y Y coordinate
|
||||
GX2Color getPixel(int32_t x, int32_t y);
|
||||
|
||||
//!Sets the pixel color at the specified coordinates of the image
|
||||
//!\param x X coordinate
|
||||
//!\param y Y coordinate
|
||||
//!\param color Pixel color
|
||||
void setPixel(int32_t x, int32_t y, const GX2Color &color);
|
||||
|
||||
//!Change ImageColor
|
||||
void setImageColor(const GX2Color &c, int32_t idx = -1);
|
||||
|
||||
//!Change ImageColor
|
||||
void setSize(int32_t w, int32_t h);
|
||||
|
||||
|
@ -83,9 +95,11 @@ public:
|
|||
blurDirection[dir] = value;
|
||||
}
|
||||
}
|
||||
|
||||
void setColorIntensity(const glm::vec4 &col) {
|
||||
colorIntensity = col;
|
||||
}
|
||||
|
||||
protected:
|
||||
void internalInit(int32_t w, int32_t h);
|
||||
|
||||
|
|
|
@ -25,16 +25,20 @@
|
|||
class GuiImageAsync : public GuiImage {
|
||||
public:
|
||||
GuiImageAsync(const uint8_t *imageBuffer, const uint32_t &imageBufferSize, GuiImageData *preloadImg);
|
||||
|
||||
GuiImageAsync(const std::string &filename, GuiImageData *preloadImg);
|
||||
|
||||
virtual ~GuiImageAsync();
|
||||
|
||||
static void clearQueue();
|
||||
|
||||
static void removeFromQueue(GuiImageAsync *image) {
|
||||
threadRemoveImage(image);
|
||||
}
|
||||
|
||||
//! don't forget to LOCK GUI if using this asynchron call
|
||||
sigslot::signal1<GuiImageAsync *> imageLoaded;
|
||||
|
||||
static void threadExit();
|
||||
|
||||
private:
|
||||
|
@ -46,7 +50,9 @@ private:
|
|||
const uint32_t imgBufferSize;
|
||||
|
||||
static void guiImageAsyncThread(CThread *thread, void *arg);
|
||||
|
||||
static void threadAddImage(GuiImageAsync *Image);
|
||||
|
||||
static void threadRemoveImage(GuiImageAsync *Image);
|
||||
|
||||
static std::vector<GuiImageAsync *> imageQueue;
|
||||
|
|
|
@ -26,38 +26,48 @@ class GuiImageData : public GuiElement {
|
|||
public:
|
||||
//!Constructor
|
||||
GuiImageData();
|
||||
|
||||
//!\param img Image data
|
||||
//!\param imgSize The image size
|
||||
GuiImageData(const uint8_t *img, int32_t imgSize, GX2TexClampMode textureClamp = GX2_TEX_CLAMP_MODE_CLAMP, GX2SurfaceFormat textureFormat = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiImageData();
|
||||
|
||||
//!Load image from buffer
|
||||
//!\param img Image data
|
||||
//!\param imgSize The image size
|
||||
void loadImage(const uint8_t *img, int32_t imgSize, GX2TexClampMode textureClamp = GX2_TEX_CLAMP_MODE_CLAMP, GX2SurfaceFormat textureFormat = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8);
|
||||
|
||||
//! getter functions
|
||||
const GX2Texture *getTexture() const {
|
||||
return texture;
|
||||
};
|
||||
|
||||
const GX2Sampler *getSampler() const {
|
||||
return sampler;
|
||||
};
|
||||
|
||||
//!Gets the image width
|
||||
//!\return image width
|
||||
int32_t getWidth() const {
|
||||
if (texture) return texture->surface.width;
|
||||
else return 0;
|
||||
};
|
||||
|
||||
//!Gets the image height
|
||||
//!\return image height
|
||||
int32_t getHeight() const {
|
||||
if (texture) return texture->surface.height;
|
||||
else return 0;
|
||||
};
|
||||
|
||||
//! release memory of the image data
|
||||
void releaseData(void);
|
||||
|
||||
private:
|
||||
void gdImageToUnormR8G8B8A8(gdImagePtr gdImg, uint32_t *imgBuffer, uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
void gdImageToUnormR5G6B5(gdImagePtr gdImg, uint16_t *imgBuffer, uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
GX2Texture *texture;
|
||||
|
|
|
@ -22,9 +22,11 @@
|
|||
class GuiParticleImage : public GuiImage, public sigslot::has_slots<> {
|
||||
public:
|
||||
GuiParticleImage(int32_t w, int32_t h, uint32_t particleCount, float minRadius, float maxRadius, float minSpeed, float maxSpeed);
|
||||
|
||||
virtual ~GuiParticleImage();
|
||||
|
||||
void draw(CVideo *pVideo);
|
||||
|
||||
private:
|
||||
float *posVertexs;
|
||||
uint8_t *colorVertexs;
|
||||
|
|
|
@ -30,28 +30,41 @@
|
|||
class GuiScrollbar : public GuiElement, public sigslot::has_slots<> {
|
||||
public:
|
||||
GuiScrollbar(int32_t height);
|
||||
|
||||
virtual ~GuiScrollbar();
|
||||
|
||||
void ScrollOneUp();
|
||||
|
||||
void ScrollOneDown();
|
||||
|
||||
int32_t GetSelectedItem() {
|
||||
return SelItem;
|
||||
}
|
||||
|
||||
int32_t GetSelectedIndex() {
|
||||
return SelInd;
|
||||
}
|
||||
|
||||
void draw(CVideo *video);
|
||||
|
||||
void update(GuiController *t);
|
||||
|
||||
//! Signals
|
||||
sigslot::signal2<int32_t, int32_t> listChanged;
|
||||
|
||||
//! Slots
|
||||
void SetScrollSpeed(int32_t speed) {
|
||||
ScrollSpeed = speed;
|
||||
};
|
||||
|
||||
void SetPageSize(int32_t size);
|
||||
|
||||
void SetRowSize(int32_t size);
|
||||
|
||||
void SetSelectedItem(int32_t pos);
|
||||
|
||||
void SetSelectedIndex(int32_t pos);
|
||||
|
||||
void SetEntrieCount(int32_t cnt);
|
||||
|
||||
void setSoundClick(GuiSound *snd) {
|
||||
|
@ -101,8 +114,11 @@ public:
|
|||
|
||||
protected:
|
||||
void setScrollboxPosition(int32_t SelItem, int32_t SelInd);
|
||||
|
||||
void OnUpButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
|
||||
|
||||
void OnDownButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
|
||||
|
||||
void OnBoxButtonHold(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
|
||||
|
||||
uint32_t ScrollState;
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
//!Constructor
|
||||
//!\param checked Checked
|
||||
GuiSelectBox(GuiImage *background, std::string caption, float width = 0.0f, float height = 0.0f, GuiFrame *parent = 0);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiSelectBox();
|
||||
|
||||
|
@ -61,27 +62,36 @@ public:
|
|||
}
|
||||
|
||||
void OnTopValueClicked(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
|
||||
|
||||
void Init(std::map<std::string, std::string> values, int32_t valueID);
|
||||
|
||||
void setState(int32_t s, int32_t c = -1);
|
||||
|
||||
virtual void setSize(float width, float height);
|
||||
|
||||
virtual float getTopValueHeight();
|
||||
|
||||
virtual float getTopValueWidth();
|
||||
|
||||
virtual float getHeight();
|
||||
|
||||
virtual float getWidth();
|
||||
|
||||
protected:
|
||||
void DeleteValueData();
|
||||
|
||||
void update(GuiController *c);
|
||||
|
||||
void OnValueClicked(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
|
||||
|
||||
void OnDPADClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
|
||||
|
||||
void OnValueOpenEffectFinish(GuiElement *element);
|
||||
|
||||
void OnValueCloseEffectFinish(GuiElement *element);
|
||||
|
||||
void ShowHideValues(bool showhide);
|
||||
|
||||
void SelectValue(uint32_t value);
|
||||
|
||||
uint32_t selected;
|
||||
|
|
|
@ -26,31 +26,44 @@ public:
|
|||
//!\param sound Pointer to the sound data
|
||||
//!\param filesize Length of sound data
|
||||
GuiSound(const char *filepath);
|
||||
|
||||
GuiSound(const uint8_t *sound, int32_t length);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiSound();
|
||||
|
||||
//!Load a file and replace the old one
|
||||
bool Load(const char *filepath);
|
||||
|
||||
//!Load a file and replace the old one
|
||||
bool Load(const uint8_t *snd, int32_t len);
|
||||
|
||||
//!Start sound playback
|
||||
void Play();
|
||||
|
||||
//!Stop sound playback
|
||||
void Stop();
|
||||
|
||||
//!Pause sound playback
|
||||
void Pause();
|
||||
|
||||
//!Resume sound playback
|
||||
void Resume();
|
||||
|
||||
//!Checks if the sound is currently playing
|
||||
//!\return true if sound is playing, false otherwise
|
||||
bool IsPlaying();
|
||||
|
||||
//!Rewind the music
|
||||
void Rewind();
|
||||
|
||||
//!Set sound volume
|
||||
//!\param v Sound volume (0-100)
|
||||
void SetVolume(uint32_t v);
|
||||
|
||||
//!\param l Loop (true to loop)
|
||||
void SetLoop(bool l);
|
||||
|
||||
protected:
|
||||
int32_t voice; //!< Currently assigned ASND voice channel
|
||||
};
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
//!Constructor
|
||||
//!\param checked Checked
|
||||
GuiSwitch(GuiImage *background, bool checked, float w = 0.0f, float h = 0.0f);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiSwitch();
|
||||
|
||||
|
@ -37,6 +38,7 @@ public:
|
|||
void setImageOff(GuiImage *img);
|
||||
|
||||
void setImageHighlighted(GuiImage *img);
|
||||
|
||||
protected:
|
||||
|
||||
GuiImage *backgroundImg = NULL;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define GUI_TEXT_H_
|
||||
|
||||
#include <gui/GuiElement.h>
|
||||
|
||||
//!Forward declaration
|
||||
class FreeTypeGX;
|
||||
|
||||
|
@ -26,26 +27,34 @@ class GuiText : public GuiElement {
|
|||
public:
|
||||
//!Constructor
|
||||
GuiText();
|
||||
|
||||
//!\param t Text
|
||||
//!\param s Font size
|
||||
//!\param c Font color
|
||||
GuiText(const char *t, int32_t s, const glm::vec4 &c);
|
||||
|
||||
//!\overload
|
||||
//!\param t Text
|
||||
//!\param s Font size
|
||||
//!\param c Font color
|
||||
GuiText(const wchar_t *t, int32_t s, const glm::vec4 &c);
|
||||
|
||||
//!\overload
|
||||
//!\Assumes SetPresets() has been called to setup preferred text attributes
|
||||
//!\param t Text
|
||||
GuiText(const char *t);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiText();
|
||||
|
||||
//!Sets the text of the GuiText element
|
||||
//!\param t Text
|
||||
virtual void setText(const char *t);
|
||||
|
||||
virtual void setText(const wchar_t *t);
|
||||
|
||||
virtual void setTextf(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||
|
||||
//!Sets up preset values to be used by GuiText(t)
|
||||
//!Useful when printing multiple text elements, all with the same attributes set
|
||||
//!\param sz Font size
|
||||
|
@ -54,15 +63,19 @@ public:
|
|||
//!\param wrap Wrapmode when w>0
|
||||
//!\param a Text alignment
|
||||
static void setPresets(int32_t sz, const glm::vec4 &c, int32_t w, int32_t a);
|
||||
|
||||
static void setPresetFont(FreeTypeGX *font);
|
||||
|
||||
//!Sets the font size
|
||||
//!\param s Font size
|
||||
void setFontSize(int32_t s);
|
||||
|
||||
//!Sets the maximum width of the drawn texture image
|
||||
//!If the text exceeds this, it is wrapped to the next line
|
||||
//!\param w Maximum width
|
||||
//!\param m WrapMode
|
||||
void setMaxWidth(int32_t w = 0, int32_t m = WRAP);
|
||||
|
||||
//!Sets the font color
|
||||
//!\param c Font color
|
||||
void setColor(const glm::vec4 &c);
|
||||
|
@ -72,41 +85,54 @@ public:
|
|||
void setTextBlur(float blur) {
|
||||
defaultBlur = blur;
|
||||
}
|
||||
|
||||
//!Get the original text as char
|
||||
virtual const wchar_t *getText() const {
|
||||
return text;
|
||||
}
|
||||
|
||||
virtual std::string toUTF8(void) const;
|
||||
|
||||
//!Get the Horizontal Size of Text
|
||||
int32_t getTextWidth() {
|
||||
return textWidth;
|
||||
}
|
||||
|
||||
int32_t getTextWidth(int32_t ind);
|
||||
|
||||
//!Get the max textwidth
|
||||
int32_t getTextMaxWidth() {
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
//!Get fontsize
|
||||
int32_t getFontSize() {
|
||||
return size;
|
||||
};
|
||||
|
||||
//!Set max lines to draw
|
||||
void setLinesToDraw(int32_t l) {
|
||||
linestodraw = l;
|
||||
}
|
||||
|
||||
//!Get current Textline (for position calculation)
|
||||
const wchar_t *getDynText(int32_t ind = 0);
|
||||
|
||||
virtual const wchar_t *getTextLine(int32_t ind) {
|
||||
return getDynText(ind);
|
||||
};
|
||||
|
||||
//!Change the font
|
||||
bool setFont(FreeTypeGX *font);
|
||||
|
||||
//! virtual function used in child classes
|
||||
virtual int32_t getStartWidth() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
//!Constantly called to draw the text
|
||||
void draw(CVideo *pVideo);
|
||||
|
||||
//! text enums
|
||||
enum {
|
||||
WRAP,
|
||||
|
@ -124,10 +150,13 @@ protected:
|
|||
|
||||
//!Clear the dynamic text
|
||||
void clearDynamicText();
|
||||
|
||||
//!Create a dynamic dotted text if the text is too long
|
||||
void makeDottedText();
|
||||
|
||||
//!Scroll the text once
|
||||
void scrollText(uint32_t frameCount);
|
||||
|
||||
//!Wrap the text to several lines
|
||||
void wrapText();
|
||||
|
||||
|
|
|
@ -21,14 +21,15 @@
|
|||
#include <gui/GuiFrame.h>
|
||||
|
||||
//!A simple CheckBox
|
||||
class GuiToggle : public GuiButton, public sigslot::has_slots<>
|
||||
{
|
||||
class GuiToggle : public GuiButton, public sigslot::has_slots<> {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param checked Checked
|
||||
GuiToggle(bool checked, float width, float height);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiToggle();
|
||||
|
||||
void setValue(bool checked) {
|
||||
if (selected != checked) {
|
||||
selected = checked;
|
||||
|
@ -36,18 +37,24 @@ class GuiToggle : public GuiButton, public sigslot::has_slots<>
|
|||
valueChanged(this, selected);
|
||||
}
|
||||
}
|
||||
|
||||
void setChecked() {
|
||||
setValue(true);
|
||||
|
||||
}
|
||||
|
||||
void setUnchecked() {
|
||||
setValue(false);
|
||||
}
|
||||
|
||||
bool getValue() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
sigslot::signal2<GuiToggle *, bool> valueChanged;
|
||||
|
||||
void OnToggleClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
|
||||
|
||||
protected:
|
||||
|
||||
bool selected;
|
||||
|
|
|
@ -68,19 +68,24 @@ public:
|
|||
|
||||
//!Constructor
|
||||
GuiTrigger();
|
||||
|
||||
//!Constructor
|
||||
GuiTrigger(uint32_t ch, uint32_t btns, bool clickEverywhere = false, bool holdEverywhere = false, bool selectionClickEverywhere = false);
|
||||
|
||||
//!Destructor
|
||||
virtual ~GuiTrigger();
|
||||
|
||||
//!Sets a simple trigger. Requires: element is selected, and trigger button is pressed
|
||||
void setTrigger(uint32_t ch, uint32_t btns);
|
||||
|
||||
void setClickEverywhere(bool b) {
|
||||
bClickEverywhere = b;
|
||||
}
|
||||
|
||||
void setHoldOnly(bool b) {
|
||||
bHoldEverywhere = b;
|
||||
}
|
||||
|
||||
void setSelectionClickEverywhere(bool b) {
|
||||
bSelectionClickEverywhere = b;
|
||||
}
|
||||
|
@ -88,20 +93,29 @@ public:
|
|||
bool isClickEverywhere() const {
|
||||
return bClickEverywhere;
|
||||
}
|
||||
|
||||
bool isHoldEverywhere() const {
|
||||
return bHoldEverywhere;
|
||||
}
|
||||
|
||||
bool isSelectionClickEverywhere() const {
|
||||
return bSelectionClickEverywhere;
|
||||
}
|
||||
|
||||
bool left(const GuiController *controller) const;
|
||||
|
||||
bool right(const GuiController *controller) const;
|
||||
|
||||
bool up(const GuiController *controller) const;
|
||||
|
||||
bool down(const GuiController *controller) const;
|
||||
|
||||
int32_t clicked(const GuiController *controller) const;
|
||||
|
||||
bool held(const GuiController *controller) const;
|
||||
|
||||
bool released(const GuiController *controller) const;
|
||||
|
||||
private:
|
||||
uint32_t chan;
|
||||
uint32_t btns;
|
||||
|
|
|
@ -76,6 +76,7 @@ public:
|
|||
|
||||
return conv_buttons;
|
||||
}
|
||||
|
||||
uint32_t remapClassicButtons(uint32_t buttons) {
|
||||
uint32_t conv_buttons = 0;
|
||||
|
||||
|
|
|
@ -24,15 +24,19 @@ extern "C" {
|
|||
#include <malloc.h>
|
||||
|
||||
void libgui_memoryInitialize(void);
|
||||
|
||||
void libgui_memoryRelease(void);
|
||||
|
||||
void *MEM2_alloc(uint32_t size, uint32_t align);
|
||||
|
||||
void MEM2_free(void *ptr);
|
||||
|
||||
void *MEM1_alloc(uint32_t size, uint32_t align);
|
||||
|
||||
void MEM1_free(void *ptr);
|
||||
|
||||
void *MEMBucket_alloc(uint32_t size, uint32_t align);
|
||||
|
||||
void MEMBucket_free(void *ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -306,9 +306,13 @@ public:
|
|||
virtual ~_connection_base0() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit() = 0;
|
||||
|
||||
virtual _connection_base0 *clone() = 0;
|
||||
|
||||
virtual _connection_base0 *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
||||
|
@ -318,9 +322,13 @@ public:
|
|||
virtual ~_connection_base1() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type) = 0;
|
||||
|
||||
virtual _connection_base1<arg1_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base1<arg1_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
||||
|
@ -330,9 +338,13 @@ public:
|
|||
virtual ~_connection_base2() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type, arg2_type) = 0;
|
||||
|
||||
virtual _connection_base2<arg1_type, arg2_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base2<arg1_type, arg2_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
||||
|
@ -342,9 +354,13 @@ public:
|
|||
virtual ~_connection_base3() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type, arg2_type, arg3_type) = 0;
|
||||
|
||||
virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
||||
|
@ -354,9 +370,13 @@ public:
|
|||
virtual ~_connection_base4() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0;
|
||||
|
||||
virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
||||
|
@ -367,11 +387,15 @@ public:
|
|||
virtual ~_connection_base5() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type) = 0;
|
||||
|
||||
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
@ -383,11 +407,15 @@ public:
|
|||
virtual ~_connection_base6() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
|
||||
arg6_type) = 0;
|
||||
|
||||
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
@ -399,11 +427,15 @@ public:
|
|||
virtual ~_connection_base7() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
|
||||
arg6_type, arg7_type) = 0;
|
||||
|
||||
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, arg7_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, arg7_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
@ -415,11 +447,15 @@ public:
|
|||
virtual ~_connection_base8() {
|
||||
;
|
||||
}
|
||||
|
||||
virtual has_slots<mt_policy> *getdest() const = 0;
|
||||
|
||||
virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
|
||||
arg6_type, arg7_type, arg8_type) = 0;
|
||||
|
||||
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *clone() = 0;
|
||||
|
||||
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *duplicate(has_slots<mt_policy> *pnewdest) = 0;
|
||||
};
|
||||
|
@ -428,6 +464,7 @@ template<class mt_policy>
|
|||
class _signal_base : public mt_policy {
|
||||
public:
|
||||
virtual void slot_disconnect(has_slots<mt_policy> *pslot) = 0;
|
||||
|
||||
virtual void slot_duplicate(const has_slots<mt_policy> *poldslot, has_slots<mt_policy> *pnewslot) = 0;
|
||||
};
|
||||
|
||||
|
@ -802,6 +839,7 @@ public:
|
|||
|
||||
typedef typename connections_list::const_iterator const_iterator;
|
||||
typedef typename connections_list::iterator iterator;
|
||||
|
||||
_signal_base3() {
|
||||
;
|
||||
}
|
||||
|
@ -1457,6 +1495,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)();
|
||||
};
|
||||
|
||||
|
@ -1495,6 +1534,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type);
|
||||
};
|
||||
|
||||
|
@ -1535,6 +1575,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type, arg2_type);
|
||||
};
|
||||
|
||||
|
@ -1575,6 +1616,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type);
|
||||
};
|
||||
|
||||
|
@ -1617,6 +1659,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type,
|
||||
arg4_type);
|
||||
};
|
||||
|
@ -1664,6 +1707,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type);
|
||||
};
|
||||
|
@ -1711,6 +1755,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type);
|
||||
};
|
||||
|
@ -1758,6 +1803,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, arg7_type);
|
||||
};
|
||||
|
@ -1807,6 +1853,7 @@ public:
|
|||
|
||||
private:
|
||||
dest_type *m_pobject;
|
||||
|
||||
void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
|
||||
arg5_type, arg6_type, arg7_type, arg8_type);
|
||||
};
|
||||
|
@ -1815,6 +1862,7 @@ template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
|
|||
class signal0 : public _signal_base0<mt_policy> {
|
||||
public:
|
||||
typedef typename _signal_base0<mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal0() {
|
||||
;
|
||||
}
|
||||
|
@ -1872,6 +1920,7 @@ template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
|
|||
class signal1 : public _signal_base1<arg1_type, mt_policy> {
|
||||
public:
|
||||
typedef typename _signal_base1<arg1_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal1() {
|
||||
;
|
||||
}
|
||||
|
@ -1929,6 +1978,7 @@ template<class arg1_type, typename arg2_type, typename mt_policy = SIGSLOT_DEFAU
|
|||
class signal2 : public _signal_base2<arg1_type, arg2_type, mt_policy> {
|
||||
public:
|
||||
typedef typename _signal_base2<arg1_type, arg2_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal2() {
|
||||
;
|
||||
}
|
||||
|
@ -1987,6 +2037,7 @@ template<class arg1_type, typename arg2_type, typename arg3_type, typename mt_po
|
|||
class signal3 : public _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy> {
|
||||
public:
|
||||
typedef typename _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal3() {
|
||||
;
|
||||
}
|
||||
|
@ -2047,6 +2098,7 @@ class signal4 : public _signal_base4<arg1_type, arg2_type, arg3_type,
|
|||
arg4_type, mt_policy> {
|
||||
public:
|
||||
typedef typename _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal4() {
|
||||
;
|
||||
}
|
||||
|
@ -2108,6 +2160,7 @@ class signal5 : public _signal_base5<arg1_type, arg2_type, arg3_type,
|
|||
arg4_type, arg5_type, mt_policy> {
|
||||
public:
|
||||
typedef typename _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal5() {
|
||||
;
|
||||
}
|
||||
|
@ -2175,6 +2228,7 @@ class signal6 : public _signal_base6<arg1_type, arg2_type, arg3_type,
|
|||
public:
|
||||
typedef typename _signal_base6<arg1_type, arg2_type, arg3_type,
|
||||
arg4_type, arg5_type, arg6_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal6() {
|
||||
;
|
||||
}
|
||||
|
@ -2242,6 +2296,7 @@ class signal7 : public _signal_base7<arg1_type, arg2_type, arg3_type,
|
|||
public:
|
||||
typedef typename _signal_base7<arg1_type, arg2_type, arg3_type,
|
||||
arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal7() {
|
||||
;
|
||||
}
|
||||
|
@ -2310,6 +2365,7 @@ class signal8 : public _signal_base8<arg1_type, arg2_type, arg3_type,
|
|||
public:
|
||||
typedef typename _signal_base8<arg1_type, arg2_type, arg3_type,
|
||||
arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>::connections_list::const_iterator const_iterator;
|
||||
|
||||
signal8() {
|
||||
;
|
||||
}
|
||||
|
|
|
@ -33,55 +33,72 @@ class BufferCircle {
|
|||
public:
|
||||
//!> Constructor
|
||||
BufferCircle();
|
||||
|
||||
//!> Destructor
|
||||
~BufferCircle();
|
||||
|
||||
//!> Set circle size
|
||||
void Resize(int32_t size);
|
||||
|
||||
//!> Get the circle size
|
||||
int32_t Size() {
|
||||
return SoundBuffer.size();
|
||||
};
|
||||
|
||||
//!> Set/resize the buffer size
|
||||
void SetBufferBlockSize(int32_t size);
|
||||
|
||||
//!> Remove a buffer
|
||||
void RemoveBuffer(int32_t pos);
|
||||
|
||||
//!> Set all buffers clear
|
||||
void ClearBuffer();
|
||||
|
||||
//!> Free all buffers
|
||||
void FreeBuffer();
|
||||
|
||||
//!> Switch to next buffer
|
||||
void LoadNext();
|
||||
|
||||
//!> Get the current buffer
|
||||
uint8_t *GetBuffer() {
|
||||
return GetBuffer(which);
|
||||
};
|
||||
|
||||
//!> Get a buffer at a position
|
||||
uint8_t *GetBuffer(int32_t pos) {
|
||||
if (!Valid(pos)) return NULL;
|
||||
else return SoundBuffer[pos];
|
||||
};
|
||||
|
||||
//!> Get current buffer size
|
||||
uint32_t GetBufferSize() {
|
||||
return GetBufferSize(which);
|
||||
};
|
||||
|
||||
//!> Get buffer size at position
|
||||
uint32_t GetBufferSize(int32_t pos) {
|
||||
if (!Valid(pos)) return 0;
|
||||
else return BufferSize[pos];
|
||||
};
|
||||
|
||||
//!> Is current buffer ready
|
||||
bool IsBufferReady() {
|
||||
return IsBufferReady(which);
|
||||
};
|
||||
|
||||
//!> Is a buffer at a position ready
|
||||
bool IsBufferReady(int32_t pos) {
|
||||
if (!Valid(pos)) return false;
|
||||
else return BufferReady[pos];
|
||||
};
|
||||
|
||||
//!> Set a buffer at a position to a ready state
|
||||
void SetBufferReady(int32_t pos, bool st);
|
||||
|
||||
//!> Set the buffersize at a position
|
||||
void SetBufferSize(int32_t pos, int32_t size);
|
||||
|
||||
//!> Get the current position in the circle
|
||||
uint16_t Which() {
|
||||
return which;
|
||||
|
@ -91,10 +108,12 @@ public:
|
|||
inline uint16_t Next() {
|
||||
return (which + 1 >= Size()) ? 0 : which + 1;
|
||||
}
|
||||
|
||||
inline uint16_t Prev() {
|
||||
if (Size() == 0) return 0;
|
||||
else return ((int32_t) which - 1 < 0) ? Size() - 1 : which - 1;
|
||||
}
|
||||
|
||||
protected:
|
||||
//!> Check if the position is a valid position in the vector
|
||||
bool Valid(int32_t pos) {
|
||||
|
|
|
@ -30,12 +30,18 @@
|
|||
class Mp3Decoder : public SoundDecoder {
|
||||
public:
|
||||
Mp3Decoder(const char *filepath);
|
||||
|
||||
Mp3Decoder(const uint8_t *sound, int32_t len);
|
||||
|
||||
virtual ~Mp3Decoder();
|
||||
|
||||
int32_t Rewind();
|
||||
|
||||
int32_t Read(uint8_t *buffer, int32_t buffer_size, int32_t pos);
|
||||
|
||||
protected:
|
||||
void OpenFile();
|
||||
|
||||
struct mad_stream Stream;
|
||||
struct mad_frame Frame;
|
||||
struct mad_synth Synth;
|
||||
|
|
|
@ -31,12 +31,18 @@
|
|||
class OggDecoder : public SoundDecoder {
|
||||
public:
|
||||
OggDecoder(const char *filepath);
|
||||
|
||||
OggDecoder(const uint8_t *snd, int32_t len);
|
||||
|
||||
virtual ~OggDecoder();
|
||||
|
||||
int32_t Rewind();
|
||||
|
||||
int32_t Read(uint8_t *buffer, int32_t buffer_size, int32_t pos);
|
||||
|
||||
protected:
|
||||
void OpenFile();
|
||||
|
||||
OggVorbis_File ogg_file;
|
||||
vorbis_info *ogg_info;
|
||||
};
|
||||
|
|
|
@ -35,61 +35,83 @@ class CFile;
|
|||
class SoundDecoder {
|
||||
public:
|
||||
SoundDecoder();
|
||||
|
||||
SoundDecoder(const std::string &filepath);
|
||||
|
||||
SoundDecoder(const uint8_t *buffer, int32_t size);
|
||||
|
||||
virtual ~SoundDecoder();
|
||||
|
||||
virtual void Lock() {
|
||||
mutex.lock();
|
||||
}
|
||||
|
||||
virtual void Unlock() {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
virtual int32_t Read(uint8_t *buffer, int32_t buffer_size, int32_t pos);
|
||||
|
||||
virtual int32_t Tell() {
|
||||
return CurPos;
|
||||
}
|
||||
|
||||
virtual int32_t Seek(int32_t pos);
|
||||
|
||||
virtual int32_t Rewind();
|
||||
|
||||
virtual uint16_t GetFormat() {
|
||||
return Format;
|
||||
}
|
||||
|
||||
virtual uint16_t GetSampleRate() {
|
||||
return SampleRate;
|
||||
}
|
||||
|
||||
virtual void Decode();
|
||||
|
||||
virtual bool IsBufferReady() {
|
||||
return SoundBuffer.IsBufferReady();
|
||||
}
|
||||
|
||||
virtual uint8_t *GetBuffer() {
|
||||
return SoundBuffer.GetBuffer();
|
||||
}
|
||||
|
||||
virtual uint32_t GetBufferSize() {
|
||||
return SoundBuffer.GetBufferSize();
|
||||
}
|
||||
|
||||
virtual void LoadNext() {
|
||||
SoundBuffer.LoadNext();
|
||||
}
|
||||
|
||||
virtual bool IsEOF() {
|
||||
return EndOfFile;
|
||||
}
|
||||
|
||||
virtual void SetLoop(bool l) {
|
||||
Loop = l;
|
||||
EndOfFile = false;
|
||||
}
|
||||
|
||||
virtual uint8_t GetSoundType() {
|
||||
return SoundType;
|
||||
}
|
||||
|
||||
virtual void ClearBuffer() {
|
||||
SoundBuffer.ClearBuffer();
|
||||
whichLoad = 0;
|
||||
}
|
||||
|
||||
virtual bool IsStereo() {
|
||||
return (GetFormat() & CHANNELS_STEREO) != 0;
|
||||
}
|
||||
|
||||
virtual bool Is16Bit() {
|
||||
return ((GetFormat() & 0xFF) == FORMAT_PCM_16_BIT);
|
||||
}
|
||||
|
||||
virtual bool IsDecoding() {
|
||||
return Decoding;
|
||||
}
|
||||
|
@ -113,6 +135,7 @@ public:
|
|||
};
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
void Upsample(int16_t *src, int16_t *dst, uint32_t nr_src_samples, uint32_t nr_dst_samples);
|
||||
|
||||
CFile *file_fd;
|
||||
|
|
|
@ -49,12 +49,15 @@ public:
|
|||
}
|
||||
|
||||
void AddDecoder(int32_t voice, const char *filepath);
|
||||
|
||||
void AddDecoder(int32_t voice, const uint8_t *snd, int32_t len);
|
||||
|
||||
void RemoveDecoder(int32_t voice);
|
||||
|
||||
SoundDecoder *getDecoder(int32_t i) {
|
||||
return ((i < 0 || i >= MAX_DECODERS) ? NULL : DecoderList[i]);
|
||||
};
|
||||
|
||||
Voice *getVoice(int32_t i) {
|
||||
return ((i < 0 || i >= MAX_DECODERS) ? NULL : voiceList[i]);
|
||||
};
|
||||
|
@ -62,19 +65,23 @@ public:
|
|||
void ThreadSignal() {
|
||||
resumeThread();
|
||||
};
|
||||
|
||||
bool IsDecoding() {
|
||||
return Decoding;
|
||||
};
|
||||
protected:
|
||||
SoundHandler();
|
||||
|
||||
~SoundHandler();
|
||||
|
||||
static void axFrameCallback(void);
|
||||
|
||||
void executeThread(void);
|
||||
|
||||
void ClearDecoderList();
|
||||
|
||||
SoundDecoder *GetSoundDecoder(const char *filepath);
|
||||
|
||||
SoundDecoder *GetSoundDecoder(const uint8_t *sound, int32_t length);
|
||||
|
||||
static SoundHandler *handlerInstance;
|
||||
|
|
|
@ -131,9 +131,11 @@ public:
|
|||
return ((uint32_t *) voice)[1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t getState() const {
|
||||
return state;
|
||||
}
|
||||
|
||||
void setState(uint32_t s) {
|
||||
state = s;
|
||||
}
|
||||
|
|
|
@ -53,12 +53,18 @@ typedef struct {
|
|||
class WavDecoder : public SoundDecoder {
|
||||
public:
|
||||
WavDecoder(const char *filepath);
|
||||
|
||||
WavDecoder(const uint8_t *snd, int32_t len);
|
||||
|
||||
virtual ~WavDecoder();
|
||||
|
||||
int32_t Read(uint8_t *buffer, int32_t buffer_size, int32_t pos);
|
||||
|
||||
protected:
|
||||
void OpenFile();
|
||||
|
||||
void CloseFile();
|
||||
|
||||
uint32_t DataOffset;
|
||||
uint32_t DataSize;
|
||||
bool Is16Bit;
|
||||
|
|
|
@ -27,10 +27,7 @@ public:
|
|||
|
||||
//! constructor
|
||||
CThread(int32_t iAttr, int32_t iPriority = 16, int32_t iStackSize = 0x8000, CThread::Callback callback = NULL, void *callbackArg = NULL)
|
||||
: pThread(NULL)
|
||||
, pThreadStack(NULL)
|
||||
, pCallback(callback)
|
||||
, pCallbackArg(callbackArg) {
|
||||
: pThread(NULL), pThreadStack(NULL), pCallback(callback), pCallbackArg(callbackArg) {
|
||||
//! save attribute assignment
|
||||
iAttributes = iAttr;
|
||||
//! allocate the thread
|
||||
|
@ -55,11 +52,13 @@ public:
|
|||
virtual void *getThread() const {
|
||||
return pThread;
|
||||
}
|
||||
|
||||
//! Thread entry function
|
||||
virtual void executeThread(void) {
|
||||
if (pCallback)
|
||||
pCallback(this, pCallbackArg);
|
||||
}
|
||||
|
||||
//! Suspend thread
|
||||
virtual void suspendThread(void) {
|
||||
if (isThreadSuspended())
|
||||
|
@ -67,6 +66,7 @@ public:
|
|||
if (pThread)
|
||||
OSSuspendThread(pThread);
|
||||
}
|
||||
|
||||
//! Resume thread
|
||||
virtual void resumeThread(void) {
|
||||
if (!isThreadSuspended())
|
||||
|
@ -74,27 +74,32 @@ public:
|
|||
if (pThread)
|
||||
OSResumeThread(pThread);
|
||||
}
|
||||
|
||||
//! Set thread priority
|
||||
virtual void setThreadPriority(int32_t prio) {
|
||||
if (pThread)
|
||||
OSSetThreadPriority(pThread, prio);
|
||||
}
|
||||
|
||||
//! Check if thread is suspended
|
||||
virtual bool isThreadSuspended(void) const {
|
||||
if (pThread)
|
||||
return OSIsThreadSuspended(pThread);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Check if thread is terminated
|
||||
virtual bool isThreadTerminated(void) const {
|
||||
if (pThread)
|
||||
return OSIsThreadTerminated(pThread);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Check if thread is running
|
||||
virtual bool isThreadRunning(void) const {
|
||||
return !isThreadSuspended() && !isThreadRunning();
|
||||
}
|
||||
|
||||
//! Shutdown thread
|
||||
virtual void shutdownThread(void) {
|
||||
//! wait for thread to finish
|
||||
|
@ -113,6 +118,7 @@ public:
|
|||
pThread = NULL;
|
||||
pThreadStack = NULL;
|
||||
}
|
||||
|
||||
//! Thread attributes
|
||||
enum eCThreadAttributes {
|
||||
eAttributeNone = 0x07,
|
||||
|
@ -128,6 +134,7 @@ private:
|
|||
((CThread *) argv)->executeThread();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t iAttributes;
|
||||
OSThread *pThread;
|
||||
uint8_t *pThreadStack;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
class CVideo {
|
||||
public:
|
||||
CVideo(int32_t forceTvScanMode = -1, int32_t forceDrcScanMode = -1);
|
||||
|
||||
virtual ~CVideo();
|
||||
|
||||
void prepareTvRendering(void) {
|
||||
|
@ -99,6 +100,7 @@ public:
|
|||
tvEnabled = bEnable;
|
||||
}
|
||||
}
|
||||
|
||||
void drcEnable(bool bEnable) {
|
||||
if (drcEnabled != bEnable) {
|
||||
GX2SetDRCEnable(bEnable ? GX2_ENABLE : GX2_DISABLE);
|
||||
|
@ -113,6 +115,7 @@ public:
|
|||
uint32_t getTvWidth(void) const {
|
||||
return tvColorBuffer.surface.width;
|
||||
}
|
||||
|
||||
uint32_t getTvHeight(void) const {
|
||||
return tvColorBuffer.surface.height;
|
||||
}
|
||||
|
@ -120,6 +123,7 @@ public:
|
|||
uint32_t getDrcWidth(void) const {
|
||||
return drcColorBuffer.surface.width;
|
||||
}
|
||||
|
||||
uint32_t getDrcHeight(void) const {
|
||||
return drcColorBuffer.surface.height;
|
||||
}
|
||||
|
@ -127,6 +131,7 @@ public:
|
|||
const glm::mat4 &getProjectionMtx(void) const {
|
||||
return projectionMtx;
|
||||
}
|
||||
|
||||
const glm::mat4 &getViewMtx(void) const {
|
||||
return viewMtx;
|
||||
}
|
||||
|
@ -134,9 +139,11 @@ public:
|
|||
float getWidthScaleFactor(void) const {
|
||||
return widthScaleFactor;
|
||||
}
|
||||
|
||||
float getHeightScaleFactor(void) const {
|
||||
return heightScaleFactor;
|
||||
}
|
||||
|
||||
float getDepthScaleFactor(void) const {
|
||||
return depthScaleFactor;
|
||||
}
|
||||
|
@ -162,8 +169,10 @@ public:
|
|||
rayOrigin = glm::vec3(rayStartWorld);
|
||||
rayDirection = glm::normalize(rayDirectionWorld);
|
||||
}
|
||||
|
||||
private:
|
||||
static void *GX2RAlloc(uint32_t flags, uint32_t size, uint32_t align);
|
||||
|
||||
static void GX2RFree(uint32_t flags, void *p);
|
||||
|
||||
void renderFXAA(const GX2Texture *texture, const GX2Sampler *sampler);
|
||||
|
|
|
@ -47,10 +47,14 @@ public:
|
|||
private:
|
||||
//!Constructor
|
||||
CursorDrawer();
|
||||
|
||||
//!Destructor
|
||||
~CursorDrawer();
|
||||
|
||||
static CursorDrawer *instance;
|
||||
|
||||
void draw_Cursor(float x, float y);
|
||||
|
||||
void init_colorVtxs();
|
||||
|
||||
uint8_t *colorVtxs = NULL;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
class ColorShader : public Shader {
|
||||
private:
|
||||
ColorShader();
|
||||
|
||||
virtual ~ColorShader();
|
||||
|
||||
static const uint32_t cuAttributeCount = 2;
|
||||
|
@ -52,6 +53,7 @@ public:
|
|||
}
|
||||
return shaderInstance;
|
||||
}
|
||||
|
||||
static void destroyInstance() {
|
||||
if (shaderInstance) {
|
||||
delete shaderInstance;
|
||||
|
@ -78,12 +80,15 @@ public:
|
|||
void setAngle(const float &val) {
|
||||
VertexShader::setUniformReg(angleLocation, 4, &val);
|
||||
}
|
||||
|
||||
void setOffset(const glm::vec3 &vec) {
|
||||
VertexShader::setUniformReg(offsetLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setScale(const glm::vec3 &vec) {
|
||||
VertexShader::setUniformReg(scaleLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setColorIntensity(const glm::vec4 &vec) {
|
||||
PixelShader::setUniformReg(colorIntensityLocation, 4, &vec[0]);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
}
|
||||
return shaderInstance;
|
||||
}
|
||||
|
||||
static void destroyInstance() {
|
||||
if (shaderInstance) {
|
||||
delete shaderInstance;
|
||||
|
@ -58,6 +59,7 @@ public:
|
|||
|
||||
private:
|
||||
FXAAShader();
|
||||
|
||||
virtual ~FXAAShader();
|
||||
|
||||
static const uint32_t cuAttributeCount = 2;
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
class FetchShader : public Shader {
|
||||
public:
|
||||
FetchShader(GX2AttribStream *attributes, uint32_t attrCount, GX2FetchShaderType type = GX2_FETCH_SHADER_TESSELLATION_NONE, GX2TessellationMode tess = GX2_TESSELLATION_MODE_DISCRETE)
|
||||
: fetchShader(NULL)
|
||||
, fetchShaderProgramm(NULL) {
|
||||
: fetchShader(NULL), fetchShaderProgramm(NULL) {
|
||||
uint32_t shaderSize = GX2CalcFetchShaderSizeEx(attrCount, type, tess);
|
||||
fetchShaderProgramm = (uint8_t *) memalign(GX2_SHADER_PROGRAM_ALIGNMENT, shaderSize);
|
||||
if (fetchShaderProgramm) {
|
||||
|
@ -32,6 +31,7 @@ public:
|
|||
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_SHADER, fetchShaderProgramm, shaderSize);
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~FetchShader() {
|
||||
if (fetchShaderProgramm)
|
||||
free(fetchShaderProgramm);
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
pixelShader->mode = GX2_SHADER_MODE_UNIFORM_REGISTER;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~PixelShader() {
|
||||
if (pixelShader) {
|
||||
if (pixelShader->program)
|
||||
|
@ -119,6 +120,7 @@ public:
|
|||
pixelShader->samplerVarCount++;
|
||||
}
|
||||
}
|
||||
|
||||
GX2PixelShader *getPixelShader() const {
|
||||
return pixelShader;
|
||||
}
|
||||
|
@ -130,6 +132,7 @@ public:
|
|||
static inline void setUniformReg(uint32_t location, uint32_t size, const void *reg) {
|
||||
GX2SetPixelUniformReg(location, size, (uint32_t *) reg);
|
||||
}
|
||||
|
||||
protected:
|
||||
GX2PixelShader *pixelShader;
|
||||
};
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
class Shader {
|
||||
protected:
|
||||
Shader() {}
|
||||
|
||||
virtual ~Shader() {}
|
||||
|
||||
public:
|
||||
static const uint16_t cuVertexAttrSize = sizeof(float) * 3;
|
||||
static const uint16_t cuTexCoordAttrSize = sizeof(float) * 2;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
class Shader3D : public Shader {
|
||||
private:
|
||||
Shader3D();
|
||||
|
||||
virtual ~Shader3D();
|
||||
|
||||
static Shader3D *shaderInstance;
|
||||
|
@ -56,6 +57,7 @@ public:
|
|||
}
|
||||
return shaderInstance;
|
||||
}
|
||||
|
||||
static void destroyInstance() {
|
||||
if (shaderInstance) {
|
||||
delete shaderInstance;
|
||||
|
@ -83,18 +85,23 @@ public:
|
|||
void setProjectionMtx(const glm::mat4 &mtx) {
|
||||
VertexShader::setUniformReg(projectionMatrixLocation, 16, &mtx[0][0]);
|
||||
}
|
||||
|
||||
void setViewMtx(const glm::mat4 &mtx) {
|
||||
VertexShader::setUniformReg(viewMatrixLocation, 16, &mtx[0][0]);
|
||||
}
|
||||
|
||||
void setModelViewMtx(const glm::mat4 &mtx) {
|
||||
VertexShader::setUniformReg(modelMatrixLocation, 16, &mtx[0][0]);
|
||||
}
|
||||
|
||||
void setColorIntensity(const glm::vec4 &vec) {
|
||||
PixelShader::setUniformReg(colorIntensityLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setAlphaFadeOut(const glm::vec4 &vec) {
|
||||
PixelShader::setUniformReg(fadeOutLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setDistanceFadeOut(const float &value) {
|
||||
PixelShader::setUniformReg(fadeDistanceLocation, 4, &value);
|
||||
}
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
#include <gui/video/shaders/VertexShader.h>
|
||||
#include <gui/video/shaders/PixelShader.h>
|
||||
#include <gui/video/shaders/FetchShader.h>
|
||||
|
||||
class ShaderFractalColor : public Shader {
|
||||
private:
|
||||
ShaderFractalColor();
|
||||
|
||||
virtual ~ShaderFractalColor();
|
||||
|
||||
static ShaderFractalColor *shaderInstance;
|
||||
|
@ -58,6 +60,7 @@ public:
|
|||
}
|
||||
return shaderInstance;
|
||||
}
|
||||
|
||||
static void destroyInstance() {
|
||||
if (shaderInstance) {
|
||||
delete shaderInstance;
|
||||
|
@ -87,9 +90,11 @@ public:
|
|||
void setProjectionMtx(const glm::mat4 &mtx) {
|
||||
VertexShader::setUniformReg(projectionMatrixLocation, 16, &mtx[0][0]);
|
||||
}
|
||||
|
||||
void setViewMtx(const glm::mat4 &mtx) {
|
||||
VertexShader::setUniformReg(viewMatrixLocation, 16, &mtx[0][0]);
|
||||
}
|
||||
|
||||
void setModelViewMtx(const glm::mat4 &mtx) {
|
||||
VertexShader::setUniformReg(modelMatrixLocation, 16, &mtx[0][0]);
|
||||
}
|
||||
|
@ -97,12 +102,15 @@ public:
|
|||
void setBlurBorder(const float &blurBorderSize) {
|
||||
PixelShader::setUniformReg(blurLocation, 4, &blurBorderSize);
|
||||
}
|
||||
|
||||
void setColorIntensity(const glm::vec4 &vec) {
|
||||
PixelShader::setUniformReg(colorIntensityLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setAlphaFadeOut(const glm::vec4 &vec) {
|
||||
PixelShader::setUniformReg(fadeOutLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setFractalColor(const int &fractalColorEnable) {
|
||||
PixelShader::setUniformReg(fractalLocation, 4, &fractalColorEnable);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
class Texture2DShader : public Shader {
|
||||
private:
|
||||
Texture2DShader();
|
||||
|
||||
virtual ~Texture2DShader();
|
||||
|
||||
static const uint32_t cuAttributeCount = 2;
|
||||
|
@ -55,6 +56,7 @@ public:
|
|||
}
|
||||
return shaderInstance;
|
||||
}
|
||||
|
||||
static void destroyInstance() {
|
||||
if (shaderInstance) {
|
||||
delete shaderInstance;
|
||||
|
@ -81,15 +83,19 @@ public:
|
|||
void setAngle(const float &val) {
|
||||
VertexShader::setUniformReg(angleLocation, 4, &val);
|
||||
}
|
||||
|
||||
void setOffset(const glm::vec3 &vec) {
|
||||
VertexShader::setUniformReg(offsetLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setScale(const glm::vec3 &vec) {
|
||||
VertexShader::setUniformReg(scaleLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setColorIntensity(const glm::vec4 &vec) {
|
||||
PixelShader::setUniformReg(colorIntensityLocation, 4, &vec[0]);
|
||||
}
|
||||
|
||||
void setBlurring(const glm::vec3 &vec) {
|
||||
PixelShader::setUniformReg(blurLocation, 4, &vec[0]);
|
||||
}
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
class VertexShader : public Shader {
|
||||
public:
|
||||
VertexShader(uint32_t numAttr)
|
||||
: attributesCount( numAttr )
|
||||
, attributes( new GX2AttribStream[attributesCount] )
|
||||
, vertexShader( (GX2VertexShader*) memalign(0x40, sizeof(GX2VertexShader)) ) {
|
||||
: attributesCount(numAttr), attributes(new GX2AttribStream[attributesCount]), vertexShader((GX2VertexShader *) memalign(0x40, sizeof(GX2VertexShader))) {
|
||||
if (vertexShader) {
|
||||
memset(vertexShader, 0, sizeof(GX2VertexShader));
|
||||
vertexShader->mode = GX2_SHADER_MODE_UNIFORM_REGISTER;
|
||||
|
@ -151,6 +149,7 @@ public:
|
|||
}
|
||||
return &attributes[idx];
|
||||
}
|
||||
|
||||
uint32_t getAttributesCount() const {
|
||||
return attributesCount;
|
||||
}
|
||||
|
@ -158,6 +157,7 @@ public:
|
|||
static void setUniformReg(uint32_t location, uint32_t size, const void *reg) {
|
||||
GX2SetVertexUniformReg(location, size, (uint32_t *) reg);
|
||||
}
|
||||
|
||||
protected:
|
||||
uint32_t attributesCount;
|
||||
GX2AttribStream *attributes;
|
||||
|
|
|
@ -18,11 +18,15 @@ public:
|
|||
};
|
||||
|
||||
CFile();
|
||||
|
||||
CFile(const std::string &filepath, eOpenTypes mode);
|
||||
|
||||
CFile(const uint8_t *memory, int32_t memsize);
|
||||
|
||||
virtual ~CFile();
|
||||
|
||||
int32_t open(const std::string &filepath, eOpenTypes mode);
|
||||
|
||||
int32_t open(const uint8_t *memory, int32_t memsize);
|
||||
|
||||
BOOL isOpen() const {
|
||||
|
@ -38,15 +42,21 @@ public:
|
|||
void close();
|
||||
|
||||
int32_t read(uint8_t *ptr, size_t size);
|
||||
|
||||
int32_t write(const uint8_t *ptr, size_t size);
|
||||
|
||||
int32_t fwrite(const char *format, ...);
|
||||
|
||||
int32_t seek(long int offset, int32_t origin);
|
||||
|
||||
uint64_t tell() {
|
||||
return pos;
|
||||
};
|
||||
|
||||
uint64_t size() {
|
||||
return filesize;
|
||||
};
|
||||
|
||||
void rewind() {
|
||||
this->seek(0, SEEK_SET);
|
||||
};
|
||||
|
|
|
@ -80,8 +80,7 @@ wchar_t* FreeTypeGX::charToWideChar(const char* strChar) {
|
|||
}
|
||||
|
||||
wchar_t *tempDest = strWChar;
|
||||
while ((*tempDest++ = *strChar++))
|
||||
;
|
||||
while ((*tempDest++ = *strChar++));
|
||||
|
||||
return strWChar;
|
||||
}
|
||||
|
@ -338,7 +337,8 @@ int16_t FreeTypeGX::getStyleOffsetHeight(int16_t format, uint16_t pixelSize) {
|
|||
* @return The number of characters printed.
|
||||
*/
|
||||
|
||||
uint16_t FreeTypeGX::drawText(CVideo *video, int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, const glm::vec4 & color, uint16_t textStyle, uint16_t textWidth, const float &textBlur, const float & colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale) {
|
||||
uint16_t FreeTypeGX::drawText(CVideo *video, int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, const glm::vec4 &color, uint16_t textStyle, uint16_t textWidth, const float &textBlur, const float &colorBlurIntensity,
|
||||
const glm::vec4 &blurColor, const float &internalRenderingScale) {
|
||||
if (!text)
|
||||
return 0;
|
||||
|
||||
|
@ -497,7 +497,8 @@ void FreeTypeGX::getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widt
|
|||
* @param screenY The screen Y coordinate at which to output the rendered texture.
|
||||
* @param color Color to apply to the texture.
|
||||
*/
|
||||
void FreeTypeGX::copyTextureToFramebuffer(CVideo *pVideo, GX2Texture *texture, int16_t x, int16_t y, int16_t z, const glm::vec4 & color, const float & defaultBlur, const float & blurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale) {
|
||||
void FreeTypeGX::copyTextureToFramebuffer(CVideo *pVideo, GX2Texture *texture, int16_t x, int16_t y, int16_t z, const glm::vec4 &color, const float &defaultBlur, const float &blurIntensity, const glm::vec4 &blurColor,
|
||||
const float &internalRenderingScale) {
|
||||
static const float imageAngle = 0.0f;
|
||||
static const float blurScale = (2.0f / (internalRenderingScale));
|
||||
|
||||
|
|
|
@ -62,22 +62,27 @@ void GuiButton::setImage(GuiImage* img) {
|
|||
image = img;
|
||||
if (img) img->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setImageOver(GuiImage *img) {
|
||||
imageOver = img;
|
||||
if (img) img->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setImageHold(GuiImage *img) {
|
||||
imageHold = img;
|
||||
if (img) img->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setImageClick(GuiImage *img) {
|
||||
imageClick = img;
|
||||
if (img) img->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setIcon(GuiImage *img) {
|
||||
icon = img;
|
||||
if (img) img->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setIconOver(GuiImage *img) {
|
||||
iconOver = img;
|
||||
if (img) img->setParent(this);
|
||||
|
@ -87,21 +92,26 @@ void GuiButton::setLabel(GuiText* txt, int32_t n) {
|
|||
label[n] = txt;
|
||||
if (txt) txt->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setLabelOver(GuiText *txt, int32_t n) {
|
||||
labelOver[n] = txt;
|
||||
if (txt) txt->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setLabelHold(GuiText *txt, int32_t n) {
|
||||
labelHold[n] = txt;
|
||||
if (txt) txt->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setLabelClick(GuiText *txt, int32_t n) {
|
||||
labelClick[n] = txt;
|
||||
if (txt) txt->setParent(this);
|
||||
}
|
||||
|
||||
void GuiButton::setSoundOver(GuiSound *snd) {
|
||||
soundOver = snd;
|
||||
}
|
||||
|
||||
void GuiButton::setSoundHold(GuiSound *snd) {
|
||||
soundHold = snd;
|
||||
}
|
||||
|
@ -222,7 +232,8 @@ void GuiButton::update(GuiController * c) {
|
|||
}
|
||||
|
||||
clicked(this, c, trigger[i]);
|
||||
} else if((isStateSet(STATE_CLICKED, c->chanIdx) || isStateSet(STATE_CLICKED_TOUCH, c->chanIdx)) && (clickedTrigger == trigger[i]) && !isStateSet(STATE_HELD, c->chanIdx) && !trigger[i]->held(c) && ((isClicked == GuiTrigger::CLICKED_NONE) || trigger[i]->released(c))) {
|
||||
} else if ((isStateSet(STATE_CLICKED, c->chanIdx) || isStateSet(STATE_CLICKED_TOUCH, c->chanIdx)) && (clickedTrigger == trigger[i]) && !isStateSet(STATE_HELD, c->chanIdx) && !trigger[i]->held(c) &&
|
||||
((isClicked == GuiTrigger::CLICKED_NONE) || trigger[i]->released(c))) {
|
||||
if ((isStateSet(STATE_CLICKED_TOUCH, c->chanIdx) && this->isInside(c->data.x, c->data.y)) || (isStateSet(STATE_CLICKED, c->chanIdx))) {
|
||||
clickedTrigger = NULL;
|
||||
clearState(STATE_CLICKED, c->chanIdx);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <gui/GuiCheckBox.h>
|
||||
#include <gui/GuiImage.h>
|
||||
#include <gui/GuiImageData.h>
|
||||
|
||||
/**
|
||||
* Constructor for the GuiCheckBox class.
|
||||
*/
|
||||
|
|
|
@ -176,6 +176,7 @@ void GuiElement::resetEffects() {
|
|||
effectAmountOver = 0;
|
||||
effectTargetOver = 0;
|
||||
}
|
||||
|
||||
void GuiElement::updateEffects() {
|
||||
if (!this->isVisible() && parentElement)
|
||||
return;
|
||||
|
|
|
@ -26,20 +26,13 @@ bool GuiImageAsync::bExitRequested = false;
|
|||
GuiImageAsync *GuiImageAsync::pInUse = NULL;
|
||||
|
||||
GuiImageAsync::GuiImageAsync(const uint8_t *imageBuffer, const uint32_t &imageBufferSize, GuiImageData *preloadImg)
|
||||
: GuiImage(preloadImg)
|
||||
, imgData(NULL)
|
||||
, imgBuffer(imageBuffer)
|
||||
, imgBufferSize(imageBufferSize) {
|
||||
: GuiImage(preloadImg), imgData(NULL), imgBuffer(imageBuffer), imgBufferSize(imageBufferSize) {
|
||||
threadInit();
|
||||
threadAddImage(this);
|
||||
}
|
||||
|
||||
GuiImageAsync::GuiImageAsync(const std::string &file, GuiImageData *preloadImg)
|
||||
: GuiImage(preloadImg)
|
||||
, imgData(NULL)
|
||||
, filename(file)
|
||||
, imgBuffer(NULL)
|
||||
, imgBufferSize(0) {
|
||||
: GuiImage(preloadImg), imgData(NULL), filename(file), imgBuffer(NULL), imgBufferSize(0) {
|
||||
threadInit();
|
||||
threadAddImage(this);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <stdint.h>
|
||||
#include <gui/GuiImageData.h>
|
||||
#include <gui/memory.h>
|
||||
|
||||
/**
|
||||
* Constructor for the GuiImageData class.
|
||||
*/
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include "utils/utils.h"
|
||||
|
||||
GuiScrollbar::GuiScrollbar(int32_t h)
|
||||
: touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH)
|
||||
, wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) {
|
||||
: touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH), wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A) {
|
||||
SelItem = 0;
|
||||
SelInd = 0;
|
||||
PageSize = 0;
|
||||
|
|
|
@ -27,17 +27,10 @@
|
|||
*/
|
||||
|
||||
GuiSelectBox::GuiSelectBox(GuiImage *background, std::string caption, float width, float height, GuiFrame *parent)
|
||||
: GuiFrame(width,height,parent)
|
||||
,selected(0)
|
||||
,captionText(caption)
|
||||
,topValueButton(0,0)
|
||||
,touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH)
|
||||
,wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A)
|
||||
,buttonATrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_A, true)
|
||||
,buttonBTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_B, true)
|
||||
,buttonUpTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_UP | GuiTrigger::STICK_L_UP, true)
|
||||
,buttonDownTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_DOWN | GuiTrigger::STICK_L_DOWN, true)
|
||||
,DPADButtons(0,0) {
|
||||
: GuiFrame(width, height, parent), selected(0), captionText(caption), topValueButton(0, 0), touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH),
|
||||
wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A), buttonATrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_A, true),
|
||||
buttonBTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_B, true), buttonUpTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_UP | GuiTrigger::STICK_L_UP, true),
|
||||
buttonDownTrigger(GuiTrigger::CHANNEL_ALL, GuiTrigger::BUTTON_DOWN | GuiTrigger::STICK_L_DOWN, true), DPADButtons(0, 0) {
|
||||
setImageTopBackground(background);
|
||||
showValues = false;
|
||||
bChanged = false;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <gui/GuiSwitch.h>
|
||||
#include <gui/GuiImage.h>
|
||||
#include <gui/GuiImageData.h>
|
||||
|
||||
/**
|
||||
* Constructor for the GuiSwitch class.
|
||||
*/
|
||||
|
@ -25,6 +26,7 @@ GuiSwitch::GuiSwitch(GuiImage * background,bool checked,float w, float h)
|
|||
: GuiToggle(checked, w, h) {
|
||||
setImageBackground(background);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor for the GuiSwitch class.
|
||||
*/
|
||||
|
|
|
@ -521,9 +521,7 @@ void GuiText::draw(CVideo *pVideo) {
|
|||
|
||||
if (textDyn.size() > 0)
|
||||
font->drawText(pVideo, x_pos, y_pos, getDepth(), textDyn[textDyn.size() - 1], newSize, color, alignment, textDynWidth[textDyn.size() - 1], defaultBlur, blurGlowIntensity, blurGlowColor, finalRenderingScale);
|
||||
}
|
||||
|
||||
else if(wrapMode == SCROLL_HORIZONTAL) {
|
||||
} else if (wrapMode == SCROLL_HORIZONTAL) {
|
||||
scrollText(pVideo->getFrameCount());
|
||||
|
||||
if (textDyn.size() > 0)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
#include <gui/GuiToggle.h>
|
||||
|
||||
/**
|
||||
* Constructor for the GuiToggle class.
|
||||
*/
|
||||
|
|
|
@ -22,21 +22,11 @@
|
|||
* Constructor for the GuiTrigger class.
|
||||
*/
|
||||
GuiTrigger::GuiTrigger()
|
||||
: chan(CHANNEL_ALL)
|
||||
, btns(BUTTON_NONE)
|
||||
, bClickEverywhere(false)
|
||||
, bHoldEverywhere(false)
|
||||
, bSelectionClickEverywhere(false)
|
||||
, bLastTouched(false) {
|
||||
: chan(CHANNEL_ALL), btns(BUTTON_NONE), bClickEverywhere(false), bHoldEverywhere(false), bSelectionClickEverywhere(false), bLastTouched(false) {
|
||||
}
|
||||
|
||||
GuiTrigger::GuiTrigger(uint32_t ch, uint32_t btn, bool clickEverywhere, bool holdEverywhere, bool selectionClickEverywhere)
|
||||
: chan(ch)
|
||||
, btns(btn)
|
||||
, bClickEverywhere(clickEverywhere)
|
||||
, bHoldEverywhere(holdEverywhere)
|
||||
, bSelectionClickEverywhere(selectionClickEverywhere)
|
||||
, bLastTouched(false) {
|
||||
: chan(ch), btns(btn), bClickEverywhere(clickEverywhere), bHoldEverywhere(holdEverywhere), bSelectionClickEverywhere(selectionClickEverywhere), bLastTouched(false) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
#include "fs/CFile.hpp"
|
||||
|
||||
Mp3Decoder::Mp3Decoder(const char *filepath)
|
||||
: SoundDecoder(filepath)
|
||||
{
|
||||
: SoundDecoder(filepath) {
|
||||
SoundType = SOUND_MP3;
|
||||
ReadBuffer = NULL;
|
||||
mad_timer_reset(&Timer);
|
||||
|
@ -51,8 +50,7 @@ Mp3Decoder::Mp3Decoder(const char * filepath)
|
|||
}
|
||||
|
||||
Mp3Decoder::Mp3Decoder(const uint8_t *snd, int32_t len)
|
||||
: SoundDecoder(snd, len)
|
||||
{
|
||||
: SoundDecoder(snd, len) {
|
||||
SoundType = SOUND_MP3;
|
||||
ReadBuffer = NULL;
|
||||
mad_timer_reset(&Timer);
|
||||
|
@ -66,8 +64,7 @@ Mp3Decoder::Mp3Decoder(const uint8_t * snd, int32_t len)
|
|||
OpenFile();
|
||||
}
|
||||
|
||||
Mp3Decoder::~Mp3Decoder()
|
||||
{
|
||||
Mp3Decoder::~Mp3Decoder() {
|
||||
ExitRequested = true;
|
||||
while (Decoding)
|
||||
OSSleepTicks(OSMicrosecondsToTicks(100));
|
||||
|
@ -81,12 +78,10 @@ Mp3Decoder::~Mp3Decoder()
|
|||
ReadBuffer = NULL;
|
||||
}
|
||||
|
||||
void Mp3Decoder::OpenFile()
|
||||
{
|
||||
void Mp3Decoder::OpenFile() {
|
||||
GuardPtr = NULL;
|
||||
ReadBuffer = (uint8_t *) memalign(32, SoundBlockSize * SoundBlocks);
|
||||
if(!ReadBuffer)
|
||||
{
|
||||
if (!ReadBuffer) {
|
||||
if (file_fd)
|
||||
delete file_fd;
|
||||
file_fd = NULL;
|
||||
|
@ -95,8 +90,7 @@ void Mp3Decoder::OpenFile()
|
|||
|
||||
uint8_t dummybuff[4096];
|
||||
int32_t ret = Read(dummybuff, 4096, 0);
|
||||
if(ret <= 0)
|
||||
{
|
||||
if (ret <= 0) {
|
||||
if (file_fd)
|
||||
delete file_fd;
|
||||
file_fd = NULL;
|
||||
|
@ -108,8 +102,7 @@ void Mp3Decoder::OpenFile()
|
|||
Rewind();
|
||||
}
|
||||
|
||||
int32_t Mp3Decoder::Rewind()
|
||||
{
|
||||
int32_t Mp3Decoder::Rewind() {
|
||||
mad_synth_finish(&Synth);
|
||||
mad_frame_finish(&Frame);
|
||||
mad_stream_finish(&Stream);
|
||||
|
@ -126,8 +119,7 @@ int32_t Mp3Decoder::Rewind()
|
|||
return SoundDecoder::Rewind();
|
||||
}
|
||||
|
||||
static inline int16_t FixedToShort(mad_fixed_t Fixed)
|
||||
{
|
||||
static inline int16_t FixedToShort(mad_fixed_t Fixed) {
|
||||
/* Clipping */
|
||||
if (Fixed >= MAD_F_ONE)
|
||||
return (SHRT_MAX);
|
||||
|
@ -138,8 +130,7 @@ static inline int16_t FixedToShort(mad_fixed_t Fixed)
|
|||
return ((int16_t) Fixed);
|
||||
}
|
||||
|
||||
int32_t Mp3Decoder::Read(uint8_t * buffer, int32_t buffer_size, int32_t pos)
|
||||
{
|
||||
int32_t Mp3Decoder::Read(uint8_t *buffer, int32_t buffer_size, int32_t pos) {
|
||||
if (!file_fd)
|
||||
return -1;
|
||||
|
||||
|
@ -151,32 +142,27 @@ int32_t Mp3Decoder::Read(uint8_t * buffer, int32_t buffer_size, int32_t pos)
|
|||
uint8_t *write_pos = buffer;
|
||||
uint8_t *write_end = buffer + buffer_size;
|
||||
|
||||
while(1)
|
||||
{
|
||||
while(SynthPos < Synth.pcm.length)
|
||||
{
|
||||
while (1) {
|
||||
while (SynthPos < Synth.pcm.length) {
|
||||
if (write_pos >= write_end)
|
||||
return write_pos - buffer;
|
||||
|
||||
*((int16_t *) write_pos) = FixedToShort(Synth.pcm.samples[0][SynthPos]);
|
||||
write_pos += 2;
|
||||
|
||||
if(MAD_NCHANNELS(&Frame.header) == 2)
|
||||
{
|
||||
if (MAD_NCHANNELS(&Frame.header) == 2) {
|
||||
*((int16_t *) write_pos) = FixedToShort(Synth.pcm.samples[1][SynthPos]);
|
||||
write_pos += 2;
|
||||
}
|
||||
SynthPos++;
|
||||
}
|
||||
|
||||
if(Stream.buffer == NULL || Stream.error == MAD_ERROR_BUFLEN)
|
||||
{
|
||||
if (Stream.buffer == NULL || Stream.error == MAD_ERROR_BUFLEN) {
|
||||
uint8_t *ReadStart = ReadBuffer;
|
||||
int32_t ReadSize = SoundBlockSize * SoundBlocks;
|
||||
int32_t Remaining = 0;
|
||||
|
||||
if(Stream.next_frame != NULL)
|
||||
{
|
||||
if (Stream.next_frame != NULL) {
|
||||
Remaining = Stream.bufend - Stream.next_frame;
|
||||
memmove(ReadBuffer, Stream.next_frame, Remaining);
|
||||
ReadStart += Remaining;
|
||||
|
@ -184,8 +170,7 @@ int32_t Mp3Decoder::Read(uint8_t * buffer, int32_t buffer_size, int32_t pos)
|
|||
}
|
||||
|
||||
ReadSize = file_fd->read(ReadStart, ReadSize);
|
||||
if(ReadSize <= 0)
|
||||
{
|
||||
if (ReadSize <= 0) {
|
||||
GuardPtr = ReadStart;
|
||||
memset(GuardPtr, 0, MAD_BUFFER_GUARD);
|
||||
ReadSize = MAD_BUFFER_GUARD;
|
||||
|
@ -195,15 +180,11 @@ int32_t Mp3Decoder::Read(uint8_t * buffer, int32_t buffer_size, int32_t pos)
|
|||
mad_stream_buffer(&Stream, ReadBuffer, Remaining + ReadSize);
|
||||
}
|
||||
|
||||
if(mad_frame_decode(&Frame,&Stream))
|
||||
{
|
||||
if(MAD_RECOVERABLE(Stream.error))
|
||||
{
|
||||
if (mad_frame_decode(&Frame, &Stream)) {
|
||||
if (MAD_RECOVERABLE(Stream.error)) {
|
||||
if (Stream.error != MAD_ERROR_LOSTSYNC || !GuardPtr)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (Stream.error != MAD_ERROR_BUFLEN)
|
||||
return -1;
|
||||
else if (Stream.error == MAD_ERROR_BUFLEN && GuardPtr)
|
||||
|
|
Loading…
Reference in New Issue