//wordt elke "tick" aangeroepen om het winterlandschap, sneeuwman en sneeuwvlokken te tekenen void SneeuwLandschap::draw() { //kleur de lucht blauw maSetColor( 0x0055ff ); maFillRect( 0, 0, screenWidth, screenHeight ); //maak sneeuw op de grond, a.d.h.v. sneeuwHoogte maSetColor( 0xffffff ); maFillRect( 0, screenHeight - this->sneeuwHoogte, screenWidth, this->sneeuwHoogte ); //teken de sneeuwman sneeuwMan->draw(); //Teken alle sneeuwvlokken, laat ze vallen en verwijder ze for (int i= 0; i<sneeuwVlokArray.size(); i++) { // zolang de grond nog niet geraakt is... if (!sneeuwVlokArray[i]->isDead(grond)) { // laat sneeuw vallen sneeuwVlokArray[i]->fall(5); // check of sneeuw grond heeft geraakt sneeuwVlokArray[i]->isDead(grond); // teken de sneeuw sneeuwVlokArray[i]->draw(); } // als grond is geraakt else { // verwijder sneeuwvlok uit de array sneeuwVlokArray.remove(i); } } }
/** * 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(); }
//wordt elke "tick" aangeroepen om het winterlandschap, sneeuwman en sneeuwvlokken te tekenen void SneeuwLandschap::draw() { //kleur de lucht blauw maSetColor( 0x0055ff ); maFillRect( 0, 0, screenWidth, screenHeight ); //maak sneeuw op de grond, a.d.h.v. sneeuwHoogte maSetColor( 0xffffff ); maFillRect( 0, screenHeight - this->sneeuwHoogte, screenWidth, this->sneeuwHoogte ); //TODO: teken de sneeuwman sneeuwMan->draw(); //TODO: teken alle sneeuwvlokken for(int i = 0; i <this->sneeuwVlokArray.size();i++) { this->sneeuwVlokArray[i]->draw(); if(this->sneeuwVlokArray[i]->isDead()) { delete sneeuwVlokArray[i]; sneeuwVlokArray.remove(i); } } }
//sneeuwvlok tekenen void SneeuwVlok::draw(){ if(this->crazyMode){ maSetColor(rand() % 999999 + 1); }else{ maSetColor(0xffffff); } maFillRect(this->positionX, positionY, this->size, this->size); maFillRect(this->positionX, positionY, this->size, this->size); }
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 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); }
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(); }
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); }
static void soft_fillRect(int left, int top, int width, int height) { maFillRect( sCurrentOffset.x + left, sCurrentOffset.y + top, width, height ); }
// Tekent een SneeuwVlok void SneeuwVlok::draw() { // Stel de kleur in op wit #ffffff maSetColor(0xffffff); // Teken de sneeuwvlok maFillRect(this->positionX, this->positionY, this->size, this->size); }
//wordt elke "tick" aangeroepen om het winterlandschap, sneeuwman en sneeuwvlokken te tekenen void SneeuwLandschap::draw() { //kleur de lucht blauw maSetColor( 0x0B0B3B ); maFillRect( 0, 0, screenWidth, screenHeight ); //maak sneeuw op de grond, a.d.h.v. sneeuwHoogte maSetColor( 0xffffff ); maFillRect( 0, screenHeight - this->sneeuwHoogte, screenWidth, this->sneeuwHoogte ); //Teken de sneeuwman this->sneeuwMan->draw(); //Teken alle sneeuwvlokken for(int i = 0;i<vlokjes.size();i++){ vlokjes[i]->draw(); }; }
VALUE method_maFillRect(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) { //printf("maSetColor"); int a = NUM2INT(x); int b = NUM2INT(y); int c = NUM2INT(w); int d = NUM2INT(h); //printf("worked"); maFillRect(a,b,c,d); return Qnil; }
/** * Create a colored image. * @param color The color of the image (a hex value). * @param width The width of the image. * @param height The height of the image. * @return Handle to the image. The image needs to be * deallocated with maDestoryObject. */ MAHandle ScreenColorList::createColorImage(int color, int width, int height) { MAHandle image = maCreatePlaceholder(); maCreateDrawableImage(image, width, height); MAHandle previousDrawTarget = maSetDrawTarget(image); maSetColor(color); maFillRect(0, 0, width, height); maSetDrawTarget(previousDrawTarget); return image; }
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); }
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(); }
int AnimatedConnWait() { int startTime = maGetMilliSecondCount(); int res; #ifdef ANIMATED int lPos = gPos; int i=0; int screenWidth = EXTENT_X(maGetScrSize()); maSetColor(0); maFillRect(0, lPos, screenWidth - 1, gTextHeight); printlnf("a%i",i++); #endif //ANIMATED while(1) { EVENT event; #ifdef ANIMATED gPos = lPos; maSetColor(0); maFillRect(0, lPos, screenWidth - 1, gTextHeight); printlnf("b%i",i++); #else maWait(0); #endif //ANIMATED if(maGetEvent(&event)) { if(event.type == EVENT_TYPE_CLOSE || (event.type == EVENT_TYPE_KEY_PRESSED && event.key == MAK_0)) { maExit(0); } else if(event.type == EVENT_TYPE_CONN) { res = event.conn.result; break; } } } printlnf("w%i", maGetMilliSecondCount() - startTime); return res; }
//wordt elke "tick" aangeroepen om het winterlandschap, sneeuwman en sneeuwvlokken te tekenen void SneeuwLandschap::draw() { //kleur de lucht blauw maSetColor(0x0055ff); maFillRect(0, 0, screenWidth, screenHeight); //maak sneeuw op de grond, a.d.h.v. sneeuwHoogte maSetColor(0xffffff); maFillRect(0, screenHeight - this->sneeuwHoogte, screenWidth, this->sneeuwHoogte); this->sneeuwMan->draw(); for(int i = 0; i < this->sneeuwVlokArray.size(); i++) { SneeuwVlok* vlok = this->sneeuwVlokArray[i]; if(vlok->isDead()) { this->sneeuwVlokArray.remove(i); delete vlok; }else{ vlok->draw(); } } }
int MAMain() { Extent screenSize; int midX, midY; int width, height; int scrW, scrH; screenSize = maGetScrSize(); scrW = EXTENT_X(screenSize); scrH = EXTENT_Y(screenSize); midX = scrW >> 1; midY = scrH >> 1; #ifdef RECT_SIZE_TEST width = 1; height = 1; #else //normal color test width = midX - 2; height = midY / 2 - 2; #endif maSetColor(0x800080); //deep purple maFillRect(0, 0, scrW, scrH); maSetColor(RGB(255, 0, 0)); //RED maFillRect(1, 1, width, height); maSetColor(RGB(255, 255, 0)); //YELLA maFillRect(1+width+2, 1, width, height); maSetColor(RGB(0, 255, 0)); //GREEN maFillRect(1, 1+height+2, width, height); maSetColor(RGB(0, 255, 255)); //TORQUOISE maFillRect(1+width+2, 1+height+2, width, height); maSetColor(RGB(0, 0, 255)); //BLUE maFillRect(1, 1+(height+2)*2, width, height); maSetColor(RGB(255, 0, 255)); //PURPLE maFillRect(1+width+2, 1+(height+2)*2, width, height); maSetColor(RGB(255, 255, 255)); //WHITE maFillRect(1, 1+(height+2)*3, width, height); maSetColor(0); //BLACK maFillRect(1+width+2, 1+(height+2)*3, width, height); maUpdateScreen(); FREEZE; }
//De teken methode zorgt ervoor dat de sneeuwman ook daadwerkelijk getekend word. void SneeuwMan::draw() { //Kleur wordt op lichtgrijs gezet. maSetColor(0xC0C0C0); //De 2 grijze vlakken worden getekend. maFillRect( this->positionX, this->positionY -40, 50, 40); maFillRect( this->positionX + 10, this->positionY - 70 , 30, 30); //De kleur wordt op zwart gezet. maSetColor(0x000000); //Zijn ogen, mond, ogen, en knoopjes worden getekend. maFillRect( this->positionX, this->positionY - 105, 50, 35); maFillRect( this->positionX + 20, this->positionY -40, 7, 7); maFillRect( this->positionX + 20, this->positionY -25, 7, 7); maFillRect( this->positionX + 20, this->positionY -10, 7, 7); maFillRect( this->positionX + 15, this->positionY -65, 5, 5); maFillRect( this->positionX + 30, this->positionY -65, 5, 5); maFillRect( this->positionX + 22, this->positionY -55, 5, 5); }
/** * Method that draws display data to the screen. */ void drawScreen() { MAExtent screenSize = maGetScrSize(); int width = EXTENT_X(screenSize); int height = EXTENT_Y(screenSize); int x = 20; int y = height / 2; char orientationText[128]; if (width > height) // Landscape { // Set the background color. maSetColor(0x000099); // Set text. sprintf(orientationText, "Landscape %d %d", width, height); } else // Portrait { // Set the background color. maSetColor(0x009900); // Set text. sprintf(orientationText, "Portrait %d %d", width, height); } // Fill background maFillRect(0, 0, width, height); // Use white to display the text. maSetColor(0xFFFFFF); // Draw the text. maDrawText(x, y, orientationText); // Redraw the screen. maUpdateScreen(); }
/* * @brief Displays the sensor values * or an error message if the sensor cannot register. */ void drawSensorOutput() { //clean the screen maSetColor(BG_COLOR); maFillRect(0, 0, gScreenWidth, gScreenHeight); //set output text color maSetColor(TEXT_COLOR); int posY = 0; for (int i=1; i<=SENSOR_TYPES; i++) { drawSensorStatus(i, 0, posY); posY += OFFSET_Y; // skip is sensor couldn't register if (gSensorError[i] != 0) continue; drawSensorValue(i, 0, posY); posY += OFFSET_Y; } }
void DisplayConsole(void) { int n, index; if (gConsoleDisplay == 0) return; maSetClipRect(0, 0, EXTENT_X(sConsole.screenSize), EXTENT_Y(sConsole.screenSize)); if(gConsoleDrawBackground) { maSetColor(gConsoleBackgroundColor); maFillRect(0, 0, EXTENT_X(sConsole.screenSize), EXTENT_Y(sConsole.screenSize)); } maSetColor(gConsoleTextColor); for (n = 0; n < sConsole.height; n++) { index = (n + sConsole.firstLine) % sConsole.height; maDrawTextW(0, n * sConsole.fontHeight, sConsole.lines[index].line); } maUpdateScreen(); }
void VisueelScherm::update() { //update waarden vam weerdata this->weerData->update(); //stel draw target in op onze tekening maSetDrawTarget( this->diagramTekening ); //teken een staaf diagram //legenda //teken blokje en text met zonneschijn, neerslag en temperatuur maSetColor(0xffffff); maDrawText(10, 10, "Legenda"); maDrawText(10, 25, "Zonneschijn"); maDrawText(10, 40, "Neerslag"); maDrawText(10, 55, "Temperatuur"); //zonneschijn maSetColor(0xffff00); maFillRect(100, 25, 15, 15); //neerslag maSetColor(0x0000ff); maFillRect(100, 40, 15, 15); //temperatuur maSetColor(0xff0000); maFillRect(100, 55, 15, 15); //teken 10-stap lijnen maSetColor(0xffffff); //grid-lijnen for(int i=100; i<=200; i+=10) { maLine(20, i, 200, i); } //teken de staven van zonneschijn, neerslag en minimum temperatuur // Zonneschijn maSetColor(0xffff00); maFillRect(30, 100+(100-this->weerData->zonneschijn[0]), 10, this->weerData->zonneschijn[0]); //vandaag maFillRect(45, 100+(100-this->weerData->zonneschijn[1]), 10, this->weerData->zonneschijn[1]); //morgen maFillRect(60, 100+(100-this->weerData->zonneschijn[2]), 10, this->weerData->zonneschijn[2]); //overmorgen // Neerslag maSetColor(0x0000ff); maFillRect(85, 100+(100-this->weerData->neerslag[0]), 10, this->weerData->neerslag[0]); //vandaag maFillRect(100, 100+(100-this->weerData->neerslag[1]), 10, this->weerData->neerslag[1]); //morgen maFillRect(115, 100+(100-this->weerData->neerslag[2]), 10, this->weerData->neerslag[2]); //overmorgen // Temperatuur maSetColor(0xff0000); maFillRect(140, 100+(100-this->weerData->minimumtemperatuur[0]), 10, this->weerData->minimumtemperatuur[0]); //vandaag maFillRect(155, 100+(100-this->weerData->minimumtemperatuur[1]), 10, this->weerData->minimumtemperatuur[1]); //morgen maFillRect(170, 100+(100-this->weerData->minimumtemperatuur[2]), 10, this->weerData->minimumtemperatuur[2]); //overmorgen //altijd draw target na tekenen teruggeven naar scherm! maSetDrawTarget( HANDLE_SCREEN ); //update de image met de nieuwe tekening this->diagramImage->setResource( this->diagramTekening ); }
int RenderMain ( void ) { int tmrLast = 0; int currFps = 0, lastFps = 0; int frameIndex = 0; float frameInterp = 0; float rotRadY = 0.0f, rotRadX = 0.0f; char textBuffer[128]; bool keyTable[4] = { false }; bool focus = true; Matrix4fi transMatrix( false ); MAExtent size = maGetScrSize( ); MDLFixed model( RES_MODEL_OGRE ); TransformPipe pipe( EXTENT_X( size ), EXTENT_Y( size ) ); // Center model model.centerModel( ); tmrLast = maGetMilliSecondCount( ); // // Rendering loop // while ( true ) { // // Handle input // MAEvent e; while ( maGetEvent( &e ) ) { if ( e.type == EVENT_TYPE_CLOSE || e.type == EVENT_TYPE_KEY_PRESSED || e.type == EVENT_TYPE_POINTER_PRESSED ) maExit(0); else if(e.type == EVENT_TYPE_FOCUS_LOST) focus = false; else if(e.type == EVENT_TYPE_FOCUS_GAINED) focus = true; else if ( e.type == EVENT_TYPE_KEY_PRESSED ) { if ( e.key == MAK_LEFT ) keyTable[MAK_LEFT-MAK_UP] = true; else if ( e.key == MAK_RIGHT ) keyTable[MAK_RIGHT-MAK_UP] = true; else if ( e.key == MAK_UP ) keyTable[MAK_UP-MAK_UP] = true; else if ( e.key == MAK_DOWN ) keyTable[MAK_DOWN-MAK_UP] = true; } else if ( e.type == EVENT_TYPE_KEY_RELEASED ) { if ( e.key == MAK_LEFT ) keyTable[MAK_LEFT-MAK_UP] = false; else if ( e.key == MAK_RIGHT ) keyTable[MAK_RIGHT-MAK_UP] = false; else if ( e.key == MAK_UP ) keyTable[MAK_UP-MAK_UP] = false; else if ( e.key == MAK_DOWN ) keyTable[MAK_DOWN-MAK_UP] = false; } } if(focus) { if ( keyTable[MAK_LEFT-MAK_UP] ) rotRadY -= (float)M_PI / 60; else if ( keyTable[MAK_RIGHT-MAK_UP] ) rotRadY += (float)M_PI / 60; else if ( keyTable[MAK_UP-MAK_UP] ) rotRadX -= (float)M_PI / 60; else if ( keyTable[MAK_DOWN-MAK_UP] ) rotRadX += (float)M_PI / 60; rotRadX = (rotRadX >= 2*(float)M_PI) ? rotRadX-2*(float)M_PI : rotRadX; rotRadY = (rotRadY >= 2*(float)M_PI) ? rotRadY-2*(float)M_PI : rotRadY; // // Construct transformation pipe // pipe.resetPipe( ); transMatrix.rotateX( (float)-M_PI/2 ); pipe.addTransform( transMatrix ); transMatrix.rotateY( (float)M_PI/4 ); pipe.addTransform( transMatrix ); transMatrix.rotateX( rotRadX ); pipe.addTransform( transMatrix ); transMatrix.rotateY( rotRadY ); pipe.addTransform( transMatrix ); transMatrix.translate( 0, 0, 130 ); pipe.addTransform( transMatrix ); // Clear screen maSetColor( 0 ); maFillRect( 0, 0, EXTENT_X( size ), EXTENT_Y( size ) ); // // Animate and render model // maSetColor( 0xffffff ); model.drawFrameLerp( frameIndex, FLT2FIX( frameInterp ), pipe ); frameInterp += 0.25f; if ( frameInterp >= 1.0f ) { frameIndex = (frameIndex+1) % model.getFrameCount( ); frameInterp = 0.0f; } // Draw fps to screen sprintf( textBuffer, "fps: %d", lastFps ); maDrawText( 0, 0, textBuffer ); // Update screen and keep backlight on maUpdateScreen( ); maResetBacklight( ); // FPS counter currFps++; if ( tmrLast+1000 <= maGetMilliSecondCount( ) ) { lastFps = currFps; currFps = 0; tmrLast = maGetMilliSecondCount( ); lprintfln( "fps: %d", lastFps ); } } else { // no focus maWait(0); } } }
//tekent een sneeuwman void SneeuwMan::draw() { // lichaam sneeuwpop bestaat uit drie delen maSetColor(0xE8E8E8); maFillRect(this->positionX - 25, this->positionY - 50, 50, 50); //onder maFillRect(this->positionX - 20, this->positionY - 90, 40, 40); // midden maFillRect(this->positionX - 15, this->positionY - 120, 30, 30); // boven (hoofd) // ogen sneeuwpop bestaat uit twee delen maSetColor(0x000000); maFillRect(this->positionX - 10, this->positionY - 115, 5, 5); // oog links maFillRect(this->positionX + 5, this->positionY - 115, 5, 5); // oog rechts // mond van de sneeuwpop bestaat uit 7 delen maSetColor(0xFC0011); maFillRect(this->positionX - 10, this->positionY - 105, 3, 3); // mond hoek 1 maFillRect(this->positionX - 7, this->positionY - 102, 3, 3); // mond hoek 2 maFillRect(this->positionX - 4, this->positionY - 99, 3, 3); // mond recht maFillRect(this->positionX - 1, this->positionY - 99, 3, 3); // mond recht maFillRect(this->positionX + 2, this->positionY - 99, 3, 3); // mond recht maFillRect(this->positionX + 4, this->positionY - 102, 3, 3); // mond hoek 3 maFillRect(this->positionX + 7, this->positionY - 105, 3, 3); // mond hoek 4 // scherm updaten //maUpdateScreen(); }
//Wordt aangeroepen door sneeuwlandschap het vlokje te laten tekenen void SneeuwVlok::draw(){ maSetColor(0xffffff); maFillRect(this->positionX, this->positionY, size, size); }
int MAMain() { const MAExtent scrSize = maGetScrSize(); const int scrHeight = EXTENT_Y(scrSize); const int scrWidth = EXTENT_X(scrSize); start: maSetColor(0x808080); maFillRect(0, 0, scrWidth, scrHeight); maSetColor(0xffffff); #ifdef STDTEST maLine(50, 50, 100, 100); maUpdateScreen(); maLine(50, -50, 100, -100); maUpdateScreen(); maLine(-50, 50, -100, 100); maUpdateScreen(); maLine(-50, -50, -100, -100); maUpdateScreen(); maLine(-10, 20, 20, -10); //5 maUpdateScreen(); maLine(-1, 1, 1, -1); //6-7 maUpdateScreen(); maLine(-20, 10, 10, -20); //8 maUpdateScreen(); maLine(-40, 40, 50, -100); //9 maUpdateScreen(); maLine(172, 226, 176, 205); //crash test dummy maUpdateScreen(); maLine(-5, 1, 2, -1); maUpdateScreen(); #else //Line pixel test maLine(1, 1, 1, 5); maUpdateScreen(); maSetColor(0x00ffff); maLine(1, 2, 3, 2); maUpdateScreen(); maSetColor(0xff00ff); maLine(2, 3, 0, 3); maUpdateScreen(); maSetColor(0xff80ff); maLine(0, 4, 2, 4); maUpdateScreen(); maSetColor(0xffffff); maLine(4, 5, 4, 1); maUpdateScreen(); #endif //Freeze while(1) { maWait(0); MAEvent event; if(maGetEvent(&event)) { if(event.type == EVENT_TYPE_CLOSE) break; if(event.type == EVENT_TYPE_KEY_PRESSED) { if(event.key == MAK_0) break; } } goto start; } return 0; }