|
新手,接触venus不久。
想在VENUS IDLE界面上画一幅图片。
由于之前IDLE界面上已经有个一WLAN的背景图,我于是学着它的来。
类的定义如下(vapp_hs_cp.h)
class VappHsIdleModeCompass : public VfxFrame
{
public:
VappHsIdleModeCompass();
protected:
virtual void onInit();
virtual void onDeinit();
virtual void onDraw(VfxDrawContext &dc);
private:
enum
{
TEXT_WIDTH = 320,
TEXT_HEIGHT = 480,
FRAME_WIDTH = 320,
FRAME_HEIGHT = 480,
END_OF_ENUM
};
};
成员函数的定义(vapp_hs_cp.cpp)
VappHsIdleModeCompass::VappHsIdleModeCompass()
{
}
void VappHsIdleModeCompass::onInit()
{
VfxFrame::onInit();
setBounds(VfxRect(0, 0, FRAME_WIDTH, FRAME_HEIGHT));
}
void VappHsIdleModeCompass::onDeinit()
{
VfxFrame::onDeinit();
}
void VappHsIdleModeCompass::onDraw(VfxDrawContext &dc)
{
dc.drawImageFromRes(0, 0, IMG_ID_IDLE_COMPASS);
}
添加到IDLE里面,实例化对象
void VappHsScr::initIdleModeText()
{
VfxSize screenSize = getScreenSize();
VfxPoint p,p1;
p.x = 0;
p.y = screenSize.height - INDICATOR_GAP_Y - IDLE_MODE_TEXT_GAP_Y;
p1.x=0;
p1.y=0;
// 对象的实例化
VFX_OBJ_CREATE(m_idleModeImage, VappHsIdleModeCompass, this);
m_idleModeImage->setAnchor(VfxFPoint(0.0f, 1.0f));
m_idleModeImage->setPos(p1);
// 下面的是IDLE界面上WLAN背景图显示的实例化对象,我就是模仿的这个弄的
VFX_OBJ_CREATE(m_idleModeText, VappHsIdleModeText, this);
m_idleModeText->setAnchor(VfxFPoint(0.0f, 1.0f));
m_idleModeText->setPos(p);
VdatNetworkInfo *networkSrv = VFX_OBJ_GET_INSTANCE(VdatNetworkInfo);
networkSrv->m_signalIdleModeTextChanged.connect(this, &VappHsScr::onIdleModeTextChanged);
networkSrv->m_signalIdleModeIconChanged.connect(this, &VappHsScr::onIdleModeIconChanged);
// Update here; or the text will appear later when the home screen is shown.
onIdleModeTextChanged(networkSrv);
onIdleModeIconChanged(networkSrv);
}
但是,却发现IDLE界面一只没有显示
求解释啊~~~~ |
|