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; }
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); }
Rect Font::calculateRectOfIndex(int index, const char *str, const Rect& bound) const { int line = calculateLine(index, str, bound); int lineBreak = 0; if(line>0) lineBreak = getLineBreak(line-1, str, bound); MAPoint2d cursor = {0, 0}; cursor.y+=line*mCharset->lineHeight; MAExtent lineRect = getStringDimensions(&str[lineBreak], index-lineBreak); cursor.x+=EXTENT_X(lineRect); MAExtent charRect = getStringDimensions(&str[index], 1); return Rect(cursor.x, cursor.y, EXTENT_X(charRect), mCharset->lineHeight); }
int MAMain() { int x=0, y=0, dx=1, dy=1; int scrW, scrH; int srcW, srcH; { int srcSize = maGetImageSize(SIMG); srcW = EXTENT_X(srcSize); srcH = EXTENT_Y(srcSize); } maCreateDrawableImage(TIMG, srcW,srcH); maSetDrawTarget(TIMG); maSetColor(0); //black maFillRect(0,0, srcW,srcH); maDrawImage(SIMG, 0,0); maSetColor(0xff0000); //red maLine(0,0, srcW,srcH); maLine(srcW,0, 0,srcH); maSetDrawTarget(HANDLE_SCREEN); { int scrSize = maGetScrSize(); scrW = EXTENT_X(scrSize); scrH = EXTENT_Y(scrSize); } while(1) { //int then = maGetMilliSecondCount(); maSetColor(0); //black maFillRect(0,0, scrW,scrH); maDrawImage(TIMG, x, y); if((dx > 0 && x + srcW > scrW) || (dx < 0 && x < 0)) { dx = -dx; } if((dy > 0 && y + srcH > scrH) || (dy < 0 && y < 0)) { dy = -dy; } x += dx; y += dy; maUpdateScreen(); /*{ int now = maGetMilliSecondCount(); int time_padding = 10 - (now - then); if(time_padding > 0) maSleep(time_padding); }*/ } }
int MAMain() { double SDA = sin(0.0981746875); //(0x3fb921f9f01b866e) sin error, returning 1 //) returned 0x000000003ff00000(5.29980882362664E-315) InitConsole(); printf("Floating test"); DUMPDH(179.288537549407); DUMPDH(SDA); //return 0; Extent scrSize = maGetScrSize(); scrSize = EXTENT(176, 208); double d; d = __adddf3(__floatsidf(EXTENT_X(scrSize)), __muldf3(__floatsidf(EXTENT_Y(scrSize)), 63.25)); d /= 0.0; //division by zero. DUMPD(__floatsidf(EXTENT_X(scrSize))); DUMPD(__floatsidf(EXTENT_Y(scrSize))); DUMPD(63.25); DUMPD(__muldf3(__floatsidf(EXTENT_Y(scrSize)), 63.25)); d = __adddf3(__floatsidf(EXTENT_X(scrSize)), __divdf3(__floatsidf(EXTENT_Y(scrSize)), 63.25)); printf("%f %i", d, __fixdfsi(d)); printf("%f %i", __floatsidf(42), __fixdfsi(__floatsidf(42))); printf("%f %i", 63.25, __fixdfsi(63.25)); printf("%i", dcmp(63.25, 42.0)); printf("%i", dcmp(42.0, 63.25)); printf("%i", dcmp(42.0, 42.0)); DUMPDH(63.25); DUMPDH(42.0); DUMPDH(__negdf2(63.25)); DUMPDH(__negdf2(42.0)); DUMPDH(-63.25); DUMPDH(-42.0); DUMPDH(2.1470*1000000000.0); DUMPDH(2.1475*1000000000.0); //vsprintf has a bug //wait for keypress, then exit printf("Press 0 to exit\n"); FREEZE; return 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(); }
/** * 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(); }
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); }
/** * 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); }
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(); } }
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(); }
char *Controller::getText(char *dest, int maxSize) { int x = _output->getX(); int y = _output->getY(); int w = EXTENT_X(maGetTextSize("YNM")); int h = _output->textHeight(); dest[0] = '\0'; _runMode = modal_state; IFormWidget *formWidget = _output->createLineInput(dest, maxSize, x, y, w, h); _output->redraw(); maShowVirtualKeyboard(); while (isModal()) { MAEvent event = processEvents(EVENT_WAIT_INFINITE, EVENT_TYPE_KEY_PRESSED); if (event.type == EVENT_TYPE_KEY_PRESSED) { dev_clrkb(); if (isModal()) { if (event.key == 10) { _runMode = run_state; } else { _output->edit(formWidget, event.key); } } } } // paint the widget result onto the backing screen if (dest[0]) { _output->print(dest); } delete formWidget; return dest; }
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; }
//------------------------------------------------------------------------- void AppFrame::setMessage( const char* message, float progress ) //------------------------------------------------------------------------- { if ( progress >= 0 ) { mProgress = progress; Rect bounds( OutsideMargin, OutsideMargin, getWidth() - 2 * OutsideMargin, 10 ); mProgressBounds = bounds; requestRepaint( ); } else { mMessage = message; mProgress = -1; Rect bounds( OutsideMargin + InsideMargin, 0, getWidth( ) - 2 * ( OutsideMargin + InsideMargin ), 32767 ); MAExtent ext = mFont->getBoundedStringDimensions( mMessage.c_str( ), bounds ); int width = EXTENT_X( ext ); int height = EXTENT_Y( ext ); int center = getWidth( ) / 2; int top = OutsideMargin; mTextBounds = Rect( center - width / 2, top + InsideMargin, width, height ); mFillBounds = Rect( mTextBounds.x - InsideMargin, mTextBounds.y - InsideMargin, width + 2 * InsideMargin, height + 2 * InsideMargin ); requestRepaint( ); } }
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); }
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); }
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 ); }
static Texture* addTexture(MAHandle image, GLuint handle) { int imageWidth = EXTENT_X(maGetImageSize(image)); int imageHeight = EXTENT_Y(maGetImageSize(image)); textures[numTextures].glTexture = handle; textures[numTextures].maTexture = image; textures[numTextures].imageWidth = imageWidth; textures[numTextures].imageHeight = imageHeight; textures[numTextures].textureWidth = nextPowerOf2(1, imageWidth); textures[numTextures].textureHeight = nextPowerOf2(1, imageHeight); textures[numTextures].textureWidthInv = 0x10000/textures[numTextures].textureWidth; textures[numTextures].textureHeightInv = 0x10000/textures[numTextures].textureHeight; // cache texture coordinates (for the most common case, drawImage). textures[numTextures].textureCoords[0] = 0; textures[numTextures].textureCoords[1] = 0; textures[numTextures].textureCoords[2] = imageWidth; textures[numTextures].textureCoords[3] = 0; textures[numTextures].textureCoords[4] = imageWidth; textures[numTextures].textureCoords[5] = imageHeight; textures[numTextures].textureCoords[6] = 0; textures[numTextures].textureCoords[7] = imageHeight; numTextures++; //printf("Added texture. Num textures: %d\n", numTextures); return &textures[numTextures-1]; }
void keyReleaseEvent(int keyCode) { if(keyCode == MAK_CLEAR) { if(currentLength!=0)currentLength--; currentString[currentLength] = 0; int h = renderCurrent(); sprintf(buff, "%s", currentString); mExtent = maGetTextSize(buff); maDrawText(1,h,buff); h+=EXTENT_Y(mExtent); renderCursor(h, EXTENT_X(mExtent)); } if(keyCode == MAK_SOFTRIGHT) { const char* ms = matchString.c_str(); if(strcmp(ms, currentString) == 0) assert(name, true); else assert(name, false); MAUtil::Environment::getEnvironment().removeKeyListener(this); //printf("charInput test finished\n"); suite->runNextCase(); } }
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); }
void System::resize() { MAExtent screenSize = maGetScrSize(); logEntered(); _output->resize(EXTENT_X(screenSize), EXTENT_Y(screenSize)); if (isRunning()) { setDimensions(); dev_pushkey(SB_PKEY_SIZE_CHG); } }
MAHandle maInitFont(MAHandle resource, MAExtent charSize, MAExtent charsetSize, int asciiStart) { //int i; MAFont *f; //int charsPerLine = 0; if(maxFontIndex >= 15) return (MAHandle)0; f = &fonts[maxFontIndex]; f->charWidth = EXTENT_X(charSize); f->charHeight = EXTENT_Y(charSize); f->charsetWidth = EXTENT_X(charsetSize); f->charsetHeight = EXTENT_Y(charsetSize); f->asciiStart = asciiStart; f->handle = resource; f->charsPerLine = f->charsetWidth/f->charWidth; maxFontIndex++; return maxFontIndex-1; }
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; }
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); }
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; }
void resizeWidget( NativeUI::Widget* widget, const MAExtent& containerSize, float widthRatio ) { // set button size according to the container size. int widthValue = (int)(EXTENT_X(containerSize) * widthRatio); int heightValue = widget->getHeight() * widthValue/widget->getWidth(); widget->setSize(widthValue, heightValue); }
//------------------------------------------------------------------------- ModalScreen::ModalScreen( ) //------------------------------------------------------------------------- : Screen( ) { // // Screen size // MAExtent screenSize = maGetScrSize( ); mWidth = EXTENT_X( screenSize ); mHeight = EXTENT_Y( screenSize ); }
/** * 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); }
ArrowLayer::ArrowLayer(): MapLayer() { MAExtent imageSize = maGetImageSize(ARROW_ANIMATION); int height = EXTENT_Y(imageSize); int width = EXTENT_X(imageSize); animation = new MAUI::Image(0, 0, width, height, NULL, true, true, ARROW_ANIMATION); animState = ARROW_ANIMATION; }
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); }