Beispiel #1
0
	void Engine::repaint() {
		//lprintfln("repaint @ (%i ms)", maGetMilliSecondCount());
		if(!main) return;
		//printf("doing repaint!");
		
		Gfx_beginRendering();
		
		//clearClipRect();
		Gfx_clearClipRect();
		Gfx_clearMatrix();

		
		int scrW = EXTENT_X(maGetScrSize());
		int scrH = EXTENT_Y(maGetScrSize());
		//printf("screenSize: (%d, %d)\n", scrW, scrH);
		Gfx_pushClipRect(0, 0, scrW, scrH);
		main->update();
		main->draw();
		Gfx_popClipRect();

		if(overlay) {
			Gfx_clearClipRect();
			Gfx_clearMatrix();
			Gfx_pushClipRect(0, 0, scrW, scrH);

			overlay->requestRepaint();
			Gfx_translate(overlayPosition.x, overlayPosition.y);
			overlay->update();
			overlay->draw();
		}

		//maUpdateScreen();
		Gfx_updateScreen();
	}
FotoScherm::FotoScherm() {
	//bepaal grootte van het scherm
	MAExtent screenSize = maGetScrSize();
	screenWidth = EXTENT_X( screenSize );
	screenHeight = EXTENT_Y( screenSize );

	//het optiescherm
	this->optieScherm = new OptieScherm(this);

	//standaard font en grafisch uiterlijk (uit de resource file res.lst)
	Font* font = new MAUI::Font(RES_FONT);
	WidgetSkin* skin = new WidgetSkin(RES_SELECTED, RES_UNSELECTED, 16, 32, 16,
			32, false, false);

	//maak een label die andere widgets straks bevat, en een achtergrondkleur heeft
	this->achtergrondLabel = new Label(0, 0, screenWidth, screenHeight, NULL);

	//maak een plaatje (laden uit de resource file res.lst) en voeg label als parent toe
	this->image = new Image(screenWidth / 4, screenHeight / 4, screenWidth / 2,
			screenHeight / 2, this->achtergrondLabel, false, false, RES_IMAGE);

	//maak tekst bij het plaatje met een label
	this->imageTekst = new Label(screenWidth / 4,
			screenHeight - screenHeight / 4, screenWidth / 2, 32,
			this->achtergrondLabel, "Naam plaatje", 0xFF0000, font);
	this->imageTekst->setSkin(skin);

	//stel dit scherm in als het main scherm, met achtergrondlabel als de basis widget
	this->setMain(this->achtergrondLabel);
}
Beispiel #3
0
void KeyBaseCase::showErrorScreen(int errorCode)
{
	MAExtent e = maGetScrSize();
	Dimensions screen;
	screen.width = EXTENT_X(e);
	screen.height = EXTENT_Y(e);
	maSetClipRect(0, 0, screen.width, screen.height);

	maSetColor(BLACK);
	maFillRect(0, 0, screen.width, screen.height);

	int oldCol = maSetColor(0xff0000);
	const char* testName = name.c_str();
	maDrawText(4, 0, testName);

	int testNameHeight = EXTENT_Y(maGetTextSize(testName));

	if(FUNC_OUT_OF_MEMORY_ALLOC == errorCode)
		maDrawText(4, testNameHeight+2, "Out of Memory");
	else if(FUNC_OUT_OF_MEMORY_RESOURCE == errorCode)
		maDrawText(4, testNameHeight+2, "Couldn't create resource");
	else if(FUNC_SYSCALL_ERROR == errorCode)
		maDrawText(4, testNameHeight+2, "A syscall wasn't called correctly");
	else if(FUNC_SYSCALL_NOT_SUPPORTED == errorCode)
		maDrawText(4, testNameHeight+2, "Unsupported feature");
	else
		maDrawText(4, testNameHeight+2, "Unknown error!");

	maDrawText(4, testNameHeight*2+4, "press key or screen to continue");

	maUpdateScreen();
	maSetColor(oldCol);	
}
Beispiel #4
0
void InitConsole(void)
{
	int i;
	char string[128];

	sConsole.screenSize = maGetScrSize();
	maSetClipRect(0, 0, EXTENT_X(sConsole.screenSize), EXTENT_Y(sConsole.screenSize));

	//sConsole.fontHeight = EXTENT_Y(maGetTextSize("gl"));
	
	// this is actually even more safe:
	for(i = 0; i < 95; i++) string[i] = i + 32;
	string[127] = 0;
	sConsole.fontHeight = EXTENT_Y(maGetTextSize(string));

	sConsole.height = EXTENT_Y(sConsole.screenSize) / sConsole.fontHeight;
	sConsole.cursorPos.x = 0;
	sConsole.cursorPos.y = sConsole.height - 1;
	sConsole.firstLine = 0;
	sConsole.postponedLineFeed = 0;

	sConsole.lines = (ConLine*)malloc(sizeof(ConLine) * sConsole.height);
	for (i = 0;  i < sConsole.height;  i++)
		memset(sConsole.lines[i].line, 0, sizeof(ConLine));

	sConsole.initialized = 1;
}
Beispiel #5
0
TextScreen::TextScreen(NativeUI::StackScreen &scr,Data &datam):Screen(), data(datam), _scr(scr)
{
	//Init the Layout.
	_Layout = new NativeUI::VerticalLayout();
	_Layout->fillSpaceHorizontally();
	_Layout->fillSpaceVertically();
	TextScreen::Screen::setMainWidget(_Layout);

	//Init the editbox.
	MAExtent scrSize = maGetScrSize();
	int Height = EXTENT_Y(scrSize);

	_EditBox = new NativeUI::EditBox();

	_EditBox->fillSpaceHorizontally();
	_EditBox->setHeight((int)(0.9*Height));
	_EditBox->setPlaceholder("Add your text here.");
	_EditBox->setInputMode(EDIT_BOX_INPUT_MODE_ANY);
	_Layout->addChild(_EditBox);

	//Init the button.
	_Button = new NativeUI::Button();

	_Button->fillSpaceHorizontally();
	_Button->fillSpaceVertically();
	_Button->setText("Add text");
	_Button->setTextHorizontalAlignment(MAW_ALIGNMENT_CENTER);
	_Button->setTextVerticalAlignment(MAW_ALIGNMENT_CENTER);
	_Layout->addChild(_Button);
	_Button->addButtonListener(this);
}
    void ImageViewerScreen::arrangeWidgets()
    {
        /// Get screen dimensions.
        MAExtent size = maGetScrSize();
        /// Extract the screen width
        int screenWidth = EXTENT_X(size);
        /// Extract the screen height
        int screenHeight = EXTENT_Y(size);

        mImageView->setPosition(0, 0);
        mImageView->setWidth(screenWidth);
        mImageView->setHeight(screenHeight);

        mActivityIndicator->setPosition((screenWidth - mActivityIndicator->getWidth())/2,
                (screenHeight - mActivityIndicator->getHeight())/2);

        ScreenUtils::resizeWidget(mDismissButton, size, CONTAINER_BUTTON_RATIO);
        // bottom left
        int btnY = screenHeight - mDismissButton->getHeight();
        int btnX = 0;
        mDismissButton->setPosition(btnX, btnY);

        ScreenUtils::resizeWidget(mSaveImageButton, size, CONTAINER_BUTTON_RATIO);
         // bottom right
        btnY = screenHeight - mSaveImageButton->getHeight();
        btnX = screenWidth - mSaveImageButton->getWidth();
        mSaveImageButton->setPosition(btnX, btnY);
    }
Beispiel #7
0
	int renderCurrent()
	{
		int h = 1;
		MAExtent e = maGetScrSize();
		Dimensions screen;
		screen.width = EXTENT_X(e);
		screen.height = EXTENT_Y(e);

		maSetClipRect(0, 0, screen.width, screen.height);
		maSetColor(BLACK);
		maFillRect(0, 0, screen.width, screen.height);

		maSetColor(0xffffff);
		sprintf(buff, "Write the following string");
		mExtent = maGetTextSize(buff);


		maDrawText(1,h,buff);
		h+= EXTENT_Y(mExtent);

		sprintf(buff, "%s", matchString.c_str());
		mExtent = maGetTextSize(buff);

		maDrawText(1,h,buff);
		h+=EXTENT_Y(mExtent);

		sprintf(buff, "end");
		mExtent = maGetTextSize(buff);
		maDrawText(screen.width - EXTENT_X(mExtent),screen.height-EXTENT_Y(mExtent),buff);

		return h;
	}
Beispiel #8
0
FotoScherm::FotoScherm()
{
	//schermgroottes definieren
	MAExtent screenSize = maGetScrSize();
	int schermBreedte = EXTENT_X( screenSize );
	int schermHoogte = EXTENT_Y( screenSize );

	//font en skin instellen uit res.lst
	Font* font = new MAUI::Font(RES_FONT);
	WidgetSkin* skin = new WidgetSkin( RES_SELECTED, RES_UNSELECTED, 16, 32, 16, 32, false, false );

	//maak een label die andere widgets straks bevat, en een achtergrondkleur heeft
	achtergrondLabel = new Label(0,0,0,0,NULL);

	//stelt achtergrondkleur in
	achtergrondLabel->setBackgroundColor(0x000000);

	// stelt plaats van plaatje in
	imageTekst = new Label( schermBreedte/2 - 40, 250, 80, 30, achtergrondLabel, "", 0, font);
	imageTekst->setSkin(skin);
	image = new Image(schermBreedte/2-60,schermHoogte/2-60, 120, 160, achtergrondLabel, false, false, RES_IMAGE1);

	//zet als standaard, wisselt met optiescherm
	this->setMain(achtergrondLabel);

	//het optiescherm
	this->optieScherm = new OptieScherm( this );
}
Beispiel #9
0
/**
 * Constructor.
 */
VideoScreen::VideoScreen() :
	Screen(),
	mMainLayout(NULL),
	mMiddleSpacerLayout(NULL),
	mVideoView(NULL),
	mSourceStatus(NULL),
	mButtonsLayout(NULL),
	mPlay(NULL),
	mPause(NULL),
	mStop(NULL),
	mDuration(NULL),
	mEditBox(NULL),
	mLoadLayout(NULL),
	mSetUrl(NULL),
	mSetPath(NULL),
	mSpacerBottomLayout(NULL)
{
	// Initialize the UI and set the listeners.

	setTitle("Video");

	MAExtent screenSize = maGetScrSize();
	mScreenWidth = EXTENT_X(screenSize);
	mScreenHeight = EXTENT_Y(screenSize);

	createMainLayout();

	mVideoView->addVideoViewListener(this);
	mPlay->addButtonListener(this);
	mPause->addButtonListener(this);
	mStop->addButtonListener(this);
	mSetUrl->addButtonListener(this);
	mSetPath->addButtonListener(this);
	mExitButton->addButtonListener(this);
}
Beispiel #10
0
int main() {
    char bigAssBuffer[BIGASSBUFFERSIZE];
    char* hello = "HTTP GET test";
    Extent screenSize, textSize;
    screenSize = maGetScrSize();

    //Draw centered text
    println("");
    textSize = maDrawText(0, 0, hello);
    maSetColor(0);
    maFillRect(0, 0, EXTENT_X(textSize), EXTENT_Y(textSize));  //erase test text
    maDrawText((EXTENT_X(screenSize) - EXTENT_X(textSize)) / 2, 0, hello);
    maUpdateScreen();

    println("Connecting...");
    int res = maHttpGet("link.astando.se"
                        "/guido/LvRouting.asmx/GenerateRouteGuido?fromX=100502&fromY=77476&toX=100591&toY=77368",
                        //"wap.mopix.se/test/test.comb",
                        bigAssBuffer, BIGASSBUFFERSIZE);

    printiln("Got %i bytes", res);
    println(bigAssBuffer);
    println("PAK to quit");

    PAKAndRelease();
    maExit(0);
}
Beispiel #11
0
MAUIMoblet::MAUIMoblet() {
	lprintfln("MAUIMoblet::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	Engine& engine = Engine::getSingleton();
	engine.setDefaultFont(Util::getFontBlack());
	engine.setDefaultSkin(Util::getSkinBack());
	MAExtent screenSize = maGetScrSize();
	scrWidth = EXTENT_X(screenSize);
	scrHeight = EXTENT_Y(screenSize);
	feed = Feed();
	String data = "";
	Util::getData("fd.sav", data);
	if (data.length() <= 0) {
		data = "";
	}
	feed.setAll(data.c_str());
	Util::getData("lb.sav", data);
	if (data.length() <= 0) {
		data = "";
	}
	feed.setAlbum(data.c_str());
	data = "";
	if (feed.getLoaded()) {
		next = new AlbumLoadScreen(&feed);
		next->show();
	} else {
		next = new OptionsScreen(&feed, OptionsScreen::ST_LOGIN_OPTIONS);
		next->show();
	}
}
FotoScherm::FotoScherm()
{

	//het optiescherm
			this->optieScherm = new OptieScherm( this );

	//Bepaal grootte van het scherm
	MAExtent screenSize = maGetScrSize();
	int screenWidth = EXTENT_X( screenSize );
	int screenHeight = EXTENT_Y( screenSize );

	//standaard font en grafisch uiterlijk (uit de resource file res.lst)
	Font* font = new MAUI::Font(RES_FONT);
	WidgetSkin* skin = new WidgetSkin( RES_SELECTED, RES_UNSELECTED, 16, 32, 16, 32, false, false );

	//maak een label die andere widgets straks bevat, en een achtergrondkleur heeft
	achtergrondLabel = new Label(0,0,0,0,NULL);

	//Dit geeft het scherm de kleur zwart.
		achtergrondLabel->setBackgroundColor(0x000000);

	//maak een plaatje (laden uit de resource file res.lst) en voeg label als parent toe
	image = new Image(screenWidth/2-60,screenHeight/2-60, 120, 160, achtergrondLabel, false, false, RES_IMAGE);

	// maak tekst bij het plaatje met een label
	imageTekst = new Label( screenWidth/2 - 40, 250, 80, 30, achtergrondLabel, "", 0, font);
	imageTekst->setSkin(skin);
	imageTekst->setPaddingLeft(1);
	imageTekst->setPaddingTop(1);

	//dit scherm als standaard, met achtergrondlabel als basis widget
	this->setMain(achtergrondLabel);


}
Beispiel #13
0
void TestMoblet::testLoadWithName()
{
	mShowing = 2;

	maSetColor(0x000000);
	MAExtent size = maGetScrSize();
	maFillRect(0,0,EXTENT_X(size),EXTENT_Y(size) );

	maSetColor(0xCD5555);

	int top = 0;
	maDrawText(10,top,"--------- Test maFontLoadWithName(test each name from list) --------- ");
	top += 20;

	for (int i=0; i<fontNames.size(); i++)
	{
		top += 20;
		int handle = maFontLoadWithName(fontNames[i].c_str(), 15);
		if ( handle == RES_FONT_NAME_NONEXISTENT )
		{
			message = "Font nonexistent: " + fontNames[i];
			maDrawText(10,top, message.c_str());
		}
		else
		{
			maFontSetCurrent(handle);
			message =  "Font " + fontNames[i] + " has handle = " + MAUtil::integerToString(handle);
			maDrawText(10, top, message.c_str());
		}
	}

	maDrawText(10, top+40, "Tap screen to test maFontLoadDefault for some combinations");
	maUpdateScreen();
}
Beispiel #14
0
	/**
	 * This function will be called whenever the moblet has nothing else to do,
	 * drawing rectangles with the touchIds where the fingers touches the
	 * screen. The amount of touches possible on a device is platform dependent.
	 *
	 * In the MoRE emulator you can simulate multitouch by right-clicking the screen.
	 * This will simulate two touches, mirrored around the center of the screen.
	 * Each of these two touches will be marked with a blue circle.
	 */
	void idle()
	{

		// Clear the screen by drawing a black rectangle covering the visible area.
		maSetColor(0);
		int screenSize = maGetScrSize();
		maFillRect(0, 0, EXTENT_X(screenSize), EXTENT_Y(screenSize));

		// Loop through all the current touches and draw for each a rectangle
		// and the touch id.
		for(MAUtil::Map<int, MAPoint2d>::Iterator iterator = mTouches.begin();
			iterator != mTouches.end();
			iterator++)
		{
			MAPoint2d point = iterator->second;
			int touchId = iterator->first;

			char touchStr[16];
			sprintf(touchStr, "%d", touchId);

			// Draw a red rectangle, centred around the touch position
			maSetColor(0xff0000);
			maFillRect(point.x - (MARKER_SIZE/2), point.y - (MARKER_SIZE/2),
					MARKER_SIZE, MARKER_SIZE);

			// Draw the touch id to the top-left of each red rectangle.
			maSetColor(0xffffff);
			maDrawText(point.x + (MARKER_SIZE/2), point.y - (MARKER_SIZE/2),
					touchStr);
		}

		maUpdateScreen();
	}
Beispiel #15
0
void System::resize() {
  MAExtent screenSize = maGetScrSize();
  logEntered();
  _output->resize(EXTENT_X(screenSize), EXTENT_Y(screenSize));
  if (isRunning()) {
    setDimensions();
    dev_pushkey(SB_PKEY_SIZE_CHG);
  }
}
Beispiel #16
0
void TextScreen::initialize(MoSync::UI::Label *label)
{
    MAExtent screenSize = maGetScrSize();
    int scrHeight = EXTENT_Y(screenSize);
    label->setFontSize(scrHeight/16);

    label->setProperty(MAW_LABEL_TEXT_VERTICAL_ALIGNMENT, MAW_ALIGNMENT_CENTER);
    label->setProperty(MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT, MAW_ALIGNMENT_LEFT);
}
Beispiel #17
0
void MainScreen::pointerMoveEvent(MAPoint2d p) {
	int delta = p.x - lastPoint.x;
	lastPoint = p;

	double rotation = grid->getRotation();
	rotation += (double) delta * 3.14159 / EXTENT_X(maGetScrSize());
	grid->setRotation(rotation);
	mRotationVelocity += rotation - mRotationStart;
	mRotationStart = rotation;
}
//Wordt aangeroepen door sneeuwlandschap het vlokje te laten vallen
void SneeuwVlok::fall(int sneeuwHoogte){
	MAExtent screenSize = maGetScrSize();

	//Laat het vlokje vallen of markeert het vlokje als dood als het de sneeuw raakt
	if(positionY >= EXTENT_Y( screenSize )-sneeuwHoogte){
		this->dead = true;
	}else{
		this->positionY += 5;
	};
}
OptieScherm::OptieScherm( Screen* parent )
{
    //sla schermgrootte op in globale variabelen
    MAExtent screenSize = maGetScrSize();
    int screenWidth = EXTENT_X( screenSize );
    int screenHeight = EXTENT_Y( screenSize );

    //sla parent scherm op (FotoScherm) om de show() te kunnen aanroepen, zodat dit optiescherm weer gesloten wordt
    this->parent = parent;

    //standaard font en grafisch uiterlijk (uit de resource file res.lst)
    Font* font = new MAUI::Font(RES_FONT);
    WidgetSkin* skin = new WidgetSkin( RES_SELECTED, RES_UNSELECTED, 16, 32, 16, 32, false, false );

    //maak een label die andere widgets straks bevat, en een achtergrondkleur heeft
    Label* label = new Label(0,0,0,0,NULL);

    //stel achtergrondkleur in
    label->setBackgroundColor(0x000000);

    // zet standaard widget in als bovenstaande label (wisselt met FotoScherm)
    this->setMain( label );


    //maak rode knop
    this->rodeLabel = new Label( screenWidth/2-50, 155, 80, 30, label, "   Rood", 0, font );
    rodeLabel->setSkin( skin );
    this->kleurLabels.add( rodeLabel );	//voeg toe aan vector

    //maak groene knop
    this->groeneLabel = new Label( screenWidth/2-50, 190, 80, 30, label, "   Groen", 0, font );
    groeneLabel->setSkin( skin );
    this->kleurLabels.add( groeneLabel );	//voeg toe aan vector

    //maak blauwe knop
    this->blauweLabel = new Label( screenWidth/2-50, 225, 80, 30, label, "   Blauw", 0, font );
    blauweLabel->setSkin( skin );
    this->kleurLabels.add( blauweLabel );	//voeg toe aan vector

    //maak toepas knop
    this->toepasLabel = new Label( screenWidth/2-50, 275, 80, 30, label, "  Pas toe", 0, font );
    toepasLabel->setSkin( skin );

    //stel naam plaatje in m.b.v. editbox
    this->imageTekst = new EditBox( 50, 50, 150, 30, label, "Plaatje", 0x555500, font, true, false, 20, EditBox::IM_STANDARD );
    this->imageTekst->setSkin(skin);
    imageTekst->setPaddingLeft(5);
    imageTekst->setPaddingTop(5);

    //stel breedte plaatje in m.b.v. editbox
    this->imageSize = new EditBox( 50, 80, 40, 30, label, "120", 0x555500, font, true, false, 3, EditBox::IM_QWERTY);
    this->imageSize->setSkin(skin);
    imageSize->setPaddingLeft(5);
    imageSize->setPaddingTop(5);
}
Beispiel #20
0
/**
 * Get the screen size into the instance variables
 * mScreenWidth and mScreenHeight.
 */
static void updateScreenDimensions()
{
	/// Get screen dimensions.
	MAExtent size = maGetScrSize();

	/// Extract the screen width
	gScreenWidth = EXTENT_X(size);

	/// Extract the screen height
	gScreenHeight = EXTENT_Y(size);
}
Beispiel #21
0
	//-------------------------------------------------------------------------
	ModalScreen::ModalScreen( )
	//-------------------------------------------------------------------------
	: Screen( )
	{
		//
		// Screen size
		//
		MAExtent screenSize = maGetScrSize( );
		mWidth = EXTENT_X( screenSize );
		mHeight = EXTENT_Y( screenSize );
	}
Beispiel #22
0
void clearScreen(int color) {
	MAExtent e = maGetScrSize();
	Dimensions screen;
	screen.width = EXTENT_X(e);
	screen.height = EXTENT_Y(e);

	maSetClipRect(0, 0, screen.width, screen.height);
	int oldCol = maSetColor(color);
	maFillRect(0, 0, screen.width, screen.height);
	maSetColor(oldCol);
}
bool Controller::construct() {
  MAExtent screenSize = maGetScrSize();
  _output = new AnsiWidget(this, EXTENT_X(screenSize), EXTENT_Y(screenSize));
  _output->construct();
  _initialFontSize = _output->getFontSize();

  _runMode = init_state;
  opt_ide = IDE_NONE;
  opt_graphics = true;
  opt_pref_bpp = 0;
  opt_nosave = true;
  opt_interactive = true;
  opt_verbose = false;
  opt_quiet = true;
  opt_command[0] = 0;
  opt_usevmt = 0;
  os_graphics = 1;

  // restore the selected font scale and path
  MAHandle data = maCreatePlaceholder();
  MAHandle store = maOpenStore(PACKAGE, 0);

  if (store != STERR_NONEXISTENT) {
    if (maReadStore(store, data) == RES_OK) {
      int offset = 0;
      int storeVersion;
      int pathLength;
      char path[FILENAME_MAX + 1];
      
      maReadData(data, &storeVersion, offset, sizeof(int));
      offset += sizeof(int);

      if (storeVersion == STORE_VERSION) {
        maReadData(data, &_fontScale, offset, sizeof(int));
        offset += sizeof(int);        

        if (_fontScale != 100) {
          int fontSize = (_initialFontSize * _fontScale / 100);
          _output->setFontSize(fontSize);
        }
        
        maReadData(data, &pathLength, offset, sizeof(int));
        maReadData(data, &path, offset+ sizeof(int), pathLength);
        if (pathLength > 1) {
          chdir(path);
        }
      }
    }
    maCloseStore(store, 0);
  }
  maDestroyPlaceholder(data);

  return true;
}
Beispiel #24
0
VALUE method_maGetScrSize(VALUE self) {
//	VALUE obj = rb_class_new_instance(0, 0, MAExtent);
//	Extent e = maGetScrSize();
//	rb_iv_set(obj, "@width", INT2NUM(EXTENT_X(e)));
//	rb_iv_set(obj, "@height", INT2NUM(EXTENT_Y(e)));
	MAExtentStruct *e = ALLOC(MAExtentStruct);
	Extent ext = maGetScrSize();
	e->w = EXTENT_X(ext);
	e->h = EXTENT_Y(ext);
	VALUE obj = Data_Wrap_Struct(MAExtent, 0, free, e);
	return obj;
}
Beispiel #25
0
void ImageScreenWithButtons::CreateUI() {
	this->setTitle("Images");
	/// Get screen dimensions.
	MAExtent size = maGetScrSize();

	/// Extract the screen width
	mScreenWidth = EXTENT_X(size);

	/// Extract the screen height
	mScreenHeight = EXTENT_Y(size);

	mNextImage = new NativeUI::Button();
	mNextImage->setText("-->");
	mNextImage->wrapContentHorizontally();
	mNextImage->addButtonListener(this);

	mPreviousImage = new NativeUI::Button();
	mPreviousImage->setText("<--");
	mNextImage->wrapContentHorizontally();
	mPreviousImage->addButtonListener(this);

	mButtonBar = new NativeUI::HorizontalLayout();

	mButtonBar->fillSpaceHorizontally();
	mButtonBar->wrapContentVertically();

	mButtonBar->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);

	mButtonBar->addChild(mPreviousImage);
	mButtonBar->addChild(mNextImage);

	mMainLayout = new NativeUI::VerticalLayout();

	mMainLayout->fillSpaceHorizontally();
	mMainLayout->fillSpaceVertically();

	imageLayout = new NativeUI::HorizontalLayout();
	imageLayout->fillSpaceHorizontally();
	imageLayout->fillSpaceVertically();
	imageLayout->setChildVerticalAlignment(MAW_ALIGNMENT_CENTER);

	LoadImages();

	mCurrentPosition = DEFAULT_IMAGE_INDEX;
	imageLayout->addChild(mImages[DEFAULT_IMAGE_INDEX]);
	mImages[DEFAULT_IMAGE_INDEX]->showImage();
	imageLayout->setChildHorizontalAlignment(MAW_ALIGNMENT_CENTER);

	mMainLayout->addChild(imageLayout);
	mMainLayout->addChild(mButtonBar);

	this->setMainWidget(mMainLayout);
}
VisueelScherm::VisueelScherm( WeerData* weerData )
{
	//sla de weerdata op in het attribuut
	this->weerData = weerData;

	//ken font en skin toe
	this->font = new Font(RES_FONT);
	this->skin = new WidgetSkin(RES_SELECTED, RES_UNSELECTED, 16,32,16,32,false, false);

	//maak een achtergrond label om alle andere widgets in op te slaan, en te tonen
	Label* achtergrond = new Label(0,0,0,0,NULL);
	achtergrond->setBackgroundColor(0x000000);

	//maak een listbox waar update en visueelknop aan toegevoegd worden
	this->listBox = new ListBox(5,0,150,40,achtergrond);

	//knop om data te updaten
	this->updateKnop = new Label(5,0,50,25,achtergrond, "Update!", 0, font);
	this->updateKnop->setSkin( this->skin );

	//knop om naar visueel scherm te schakelen
	this->textueelKnop = new Label(55,0,50,25,achtergrond, "Visueel!", 0, font);
	this->textueelKnop->setSkin( this->skin );


	//staafdiagram

	//maak eerst een placeholder
	this->diagramTekening = maCreatePlaceholder();

	//laat de placeholder tekenbaar zijn
	maCreateDrawableImage( this->diagramTekening, EXTENT_X( maGetScrSize() ), EXTENT_Y( maGetScrSize() ) - 30 );

	//mak een nieuwe image met de placeholder
	this->diagramImage = new Image( 0, 30, EXTENT_X( maGetScrSize() ), EXTENT_Y( maGetScrSize() ) - 30, achtergrond, true, true, this->diagramTekening );


	this->setMain( achtergrond );
	this->update();
}
Beispiel #27
0
void TestMoblet::testLoadDefault()
{
	mShowing = 3;

	maSetColor(0x000000);
	MAExtent size = maGetScrSize();
	maFillRect(0,0,EXTENT_X(size),EXTENT_Y(size) );

	maSetColor(0xCD5555);

	int top = 0;
	maDrawText(10,top,"--------- Test maFontLoadDefault ---------");

	top += 20;
	maDrawText(10,top,"Test Monospace Normal -10");
	testFont(FONT_TYPE_MONOSPACE,FONT_STYLE_NORMAL,-10,top);

	top += 20;
	maDrawText(10, top, "Test Monospace Bold 15");
	testFont(FONT_TYPE_MONOSPACE, FONT_STYLE_BOLD, 15, top);

	top += 20;
	maDrawText(10, top, "Test Monospace Italic 15");
	testFont(FONT_TYPE_MONOSPACE, FONT_STYLE_ITALIC, 15, top);

	top += 20;
	maDrawText(10, top, "Test SansSerif Normal 15");
	testFont(FONT_TYPE_SANS_SERIF, FONT_STYLE_NORMAL, 15, top);

	top += 20;
	maDrawText(10, top, "Test SansSerif Bold 15");
	testFont(FONT_TYPE_SANS_SERIF, FONT_STYLE_BOLD, 15, top);

	top += 20;
	maDrawText(10, top, "Test SansSerif Italic 15");
	testFont(FONT_TYPE_SANS_SERIF, FONT_STYLE_ITALIC, 15, top);

	top += 20;
	maDrawText(10, top, "Test Serif Normal 15");
	testFont(FONT_TYPE_SERIF, FONT_STYLE_NORMAL, 15, top);

	top += 20;
	maDrawText(10, top, "Test Serif Bold 15");
	testFont(FONT_TYPE_SERIF, FONT_STYLE_BOLD, 15, top);

	top += 20;
	maDrawText(10, top, "Test Serif Italic 15");
	testFont(FONT_TYPE_SERIF, FONT_STYLE_ITALIC, 15, top);

	maDrawText(10, top+40, "Tap screen to EXIT");
	maUpdateScreen();
}
Beispiel #28
0
	void CameraScreen::arrangeWidgets()
	{
		MAExtent size = maGetScrSize();

		int screenWidth = EXTENT_X(size);
		int screenHeight = EXTENT_Y(size);

		mCamera->setPosition(0, 0);
		mCamera->setWidth(screenWidth);
		mCamera->setHeight(screenHeight);

		mActivityIndicator->setPosition((screenWidth - mActivityIndicator->getWidth())/2,
				(screenHeight - mActivityIndicator->getHeight())/2);

		ScreenUtils::resizeWidget(mTakeSnapshotButton, size, TAKE_PICTURE_BTN_RATIO);
		int btnY = screenHeight - mTakeSnapshotButton->getHeight(); // bottom
		int btnX = (screenWidth - mTakeSnapshotButton->getWidth())/2; // middle
		mTakeSnapshotButton->setPosition(btnX, btnY);

		ScreenUtils::resizeWidget(mShowSnapshotButton, size, BTN_RATIO);
		btnY = screenHeight - mShowSnapshotButton->getHeight(); // bottom
		btnX = screenWidth - mShowSnapshotButton->getWidth(); // right
		mShowSnapshotButton->setPosition(btnX, btnY);

		ScreenUtils::resizeWidget(mSetNextFlashModeButton, size, BTN_RATIO);
		btnY = 0; // top
		btnX = 0; // left
		mSetNextFlashModeButton->setPosition(btnX, btnY);

		// If we have only one camera we don't add the swap camera button.
		int nrOfCameras = mCamera->getNumberOfAvailableCameras();
		if ( nrOfCameras > 1 )
		{
			ScreenUtils::resizeWidget(mSetNextCameraButton, size, BTN_RATIO);
			btnY = 0; // top
			btnX = screenWidth - mSetNextCameraButton->getWidth(); // right
			mSetNextCameraButton->setPosition(btnX, btnY);
		}

		if ( mCamera->isZoomSupported() )
		{
			ScreenUtils::resizeWidget(mZoomInButton, size, BTN_RATIO);
			btnY = (screenHeight - mZoomInButton->getHeight())/2; // center
			btnX = 0; // left
			mZoomInButton->setPosition(btnX, btnY);

			ScreenUtils::resizeWidget(mZoomOutButton, size, BTN_RATIO);
			btnY = btnY + mZoomInButton->getHeight(); // under zoom in
			btnX = 0; // left
			mZoomOutButton->setPosition(btnX, btnY);
		}
	}
Beispiel #29
0
/**
 * Sends the Device Screen size to JavaScript.
 */
void HybridMoblet::sendDeviceScreenSizeToJavaScript()
{
	MAExtent scrSize = maGetScrSize();
	int width = EXTENT_X(scrSize);
	int height = EXTENT_Y(scrSize);
	char buf[512];
	sprintf(
		buf,
		"mosync.nativeui.setScreenSize(%d,%d)",
		width,
		height);
	callJS(buf);
}
//constructor
SneeuwLandschap::SneeuwLandschap()
{
	//sla schermgrootte op in globale variabelen
	MAExtent screenSize = maGetScrSize();
	screenWidth = EXTENT_X( screenSize );
	screenHeight = EXTENT_Y( screenSize );

	//stel sneeuwhoogte in (vanaf bodem)
	this->sneeuwHoogte = 30;

	//maak een nieuwe sneeuwman
	this->sneeuwMan = new SneeuwMan( screenWidth / 2, screenHeight - this->sneeuwHoogte );
}