Changes

Jump to navigation Jump to search
804 bytes removed ,  02:24, 29 July 2008
Status update, button.h and Draw() issues
Line 22: Line 22:  
*The menu, buttons and all will have to sit in a LayerManager, but LayerManager has no visible option, so where do we put the Menu when not in use? Or is it better to discard the menu from memory and rebuild later? Will look into how this is done on other software. Each menu/function can sit in its own LayerManager and be shoved offscreen when needed. Maybe if the manager is not drawn before a flush it will not appear? Will look into this.
 
*The menu, buttons and all will have to sit in a LayerManager, but LayerManager has no visible option, so where do we put the Menu when not in use? Or is it better to discard the menu from memory and rebuild later? Will look into how this is done on other software. Each menu/function can sit in its own LayerManager and be shoved offscreen when needed. Maybe if the manager is not drawn before a flush it will not appear? Will look into this.
 
*When allowing some other function to access video that does not use libwiisprite (say an emulator) then how do we make sure the path is clear, so to speak?
 
*When allowing some other function to access video that does not use libwiisprite (say an emulator) then how do we make sure the path is clear, so to speak?
 +
 +
===Status===
 +
*I've written some form of all the functions for the button class and am trying to test them now, but I'm having no luck getting the Draw() function to get anything on the screen. The demo includes a pointer using the Wiimote IR which draws, but the button does not, nor can I draw a TextField layer that I've used in other demos. I could use some help understanding what's going on in the Draw() and _Draw() functions, since I just copied them from libwiisprite's Sprite class.
      Line 36: Line 39:  
For now, it looks like all the images will have to be the same size in the button so it can have a consistent collision rectangle and frame width/height. I'm not sure of the best way to throw an error back yet so I'm just going to have it do nothing if you muck it up.
 
For now, it looks like all the images will have to be the same size in the button so it can have a consistent collision rectangle and frame width/height. I'm not sure of the best way to throw an error back yet so I'm just going to have it do nothing if you muck it up.
   −
  /*
+
  Code removed, see source download
  * libwsmenu - Button
  −
  */
  −
#ifndef LIBWSMENU_BUTTON
  −
#define LIBWSMENU_BUTTON
  −
#include <gccore.h>
  −
#include "layer.h"
  −
#include "image.h"
  −
//!libwsmenu namespace
  −
namespace wsm{
  −
//!Generates a button object for use with a menu
  −
class Button : public Sprite {
  −
  public:
  −
//!Constructor
  −
Button();
  −
~Button();
  −
void SetUp(Image* img_up, u32 frameWidth = 0, u32 frameHeight = 0);
  −
void SetDown(Image* img_down, u32 frameWidth = 0, u32 frameHeight = 0);
  −
void SetOver(Image* img_over, u32 frameWidth = 0, u32 frameHeight = 0);
  −
void SetIcon(Image* icon, u32 frameWidth = 0, u32 frameHeight = 0);
  −
void setText(char* btn_txt);
  −
void setText(std::string btn_txt);
  −
void SetFunction(void (*f_ptr)(void));
  −
bool IsPointerOver(u32 x, u32 y, bool select = 0) const;
  −
void Draw();
  −
private:
  −
bool _hovered;
  −
bool _selected;
  −
Image* _img_up;
  −
Image* _img_over;
  −
Image* _img_down;
  −
Image* _image;
  −
void _SetImage(Image* target, Image* image, u32 frameWidth, u32 frameHeight)
  −
std::string _btn_txt;
  −
void (*_f_ptr)(void);
  −
void _CalcFrame();
  −
Rectangle* _colRect;
  −
u32 _frame, _frameRawCount;
  −
u32* _frameSeq; u32 _frameSeqLength, _frameSeqPos;
  −
f32 _refPixelX, _refPixelY, _refWidth, _refHeight;
  −
REFPIXEL_POSITIONING _positioning;
  −
  };
  −
};
  −
#endif
      
==Development information==
 
==Development information==
49

edits

Navigation menu