Я использую Mosync API C ++ для межплатформенной мобильной разработки. Я пытаюсь, чтобы прозрачный экран (на котором есть одна непрозрачная метка) отображался поверх другого экрана, поэтому я могу видеть оба экрана одновременно.
Но что происходит, когда экран не прозрачный, а черный? Почему это происходит? Я знаю, что это возможно сделать, потому что пример меню Sams CookBook - это прозрачный экран (со списком в нем), который отображается поверх другого экрана.
Как вы думаете, почему мой код ниже отображает не прозрачный экран, а черный экран? Мой небольшой пример проекта прилагается (включая прозрачный файл .png):
#include <MAUtil/Moblet.h>
#include <MAUI/Screen.h>
#include <MAUI/Label.h>
#include <MAUI/Image.h>
using namespace MAUtil;
using namespace MAUI;
#define RES_BLANK 1
class ClearScreen : public Screen
{
public:
ClearScreen() : Screen()
{
Image *cell = new Image( 0, 0, 400, 800, NULL, true, true, RES_BLANK );
Label *item = new Label( 10, 300, 200, 200, cell );
// What SHOULD happen: have the whole screen transparent by having a
// transparent Image as the background & have a pink label on this screen,
// Then I should be able to also see parts of MyScreen behind this screen
// because parts of this are transparent
// What ACTUALLY happens:
// This creates an Image that is black (that covers the whole screen)
// & a pink label on it
this -> setMain( cell );
}
private:
};
class MyScreen : public Screen
{
public:
MyScreen() : Screen()
{
Label *cell = new Label( 0, 0, 400, 800, NULL );
Label *item = new Label( 0, 0, 200, 200, cell );
cell -> setDrawBackground( true );
cell -> setBackgroundColor( 20000 );
item -> setDrawBackground( true );
item -> setBackgroundColor( 90000 );
this -> setMain( cell );
}
private:
};
class MyMoblet : public Moblet
{
public:
MyMoblet()
{
MyScreen *m = new MyScreen();
m -> show();
ClearScreen *c = new ClearScreen();
c -> show();
}
void keyPressEvent(int keyCode, int nativeCode)
{
}
void keyReleaseEvent(int keyCode, int nativeCode)
{
}
};
extern "C" int MAMain()
{
Moblet::run(new MyMoblet());
return 0;
};