void Clear(const Brush &brush) { DrawFilledRectangle(0, 0, GetWidth(), GetHeight(), brush); }
static void DrawDevices (PMENU_STATE pMS, BYTE OldDevice, BYTE NewDevice) { #define MAX_VIS_DEVICES 5 COORD y, cy; TEXT t; RECT r; PBYTE pDeviceMap; SetSemaphore (GraphicsSem); SetContext (StatusContext); SetContextFont (TinyFont); y = 41; t.baseline.x = 40; t.align = ALIGN_CENTER; t.CharCount = 3; pDeviceMap = (PBYTE)pMS->CurFrame; if (OldDevice > NUM_DEVICES || (NewDevice < NUM_DEVICES && (NewDevice < (BYTE)pMS->first_item.y || NewDevice >= (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES)))) { STAMP s; extern FRAME misc_data; r.corner.x = 2; r.extent.width = FIELD_WIDTH + 1; if (!(pMS->Initialized & 1)) { ++r.corner.x; r.extent.width -= 2; r.corner.y = 33; r.extent.height = 89; SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); DrawFilledRectangle (&r); } else { TEXT ct; r.corner.y = 20; r.extent.height = 109; DrawStarConBox (&r, 1, BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19), BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F), TRUE, BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)); SetContextFont (StarConFont); ct.baseline.x = (STATUS_WIDTH >> 1) - 1; ct.baseline.y = 27; ct.align = ALIGN_CENTER; ct.pStr = GAME_STRING (DEVICE_STRING_BASE); ct.CharCount = (COUNT)~0; SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0x1F, 0x1F), 0x0B)); DrawText (&ct); SetContextFont (TinyFont); } if (NewDevice < (BYTE)pMS->first_item.y) pMS->first_item.y = NewDevice; else if (NewDevice >= (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES)) pMS->first_item.y = NewDevice - (MAX_VIS_DEVICES - 1); s.origin.x = 4; s.origin.y = 34; cy = y; SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x14, 0x14), 0x03)); for (OldDevice = (BYTE)pMS->first_item.y; OldDevice < (BYTE)(pMS->first_item.y + MAX_VIS_DEVICES) && OldDevice < (BYTE)pMS->first_item.x; ++OldDevice) { s.frame = SetAbsFrameIndex ( misc_data, 77 + pDeviceMap[OldDevice] ); DrawStamp (&s); if (OldDevice != NewDevice) { t.baseline.y = cy; t.pStr = GAME_STRING (pDeviceMap[OldDevice] + DEVICE_STRING_BASE + 1); t.CharCount = lpstrchr (t.pStr, ' '); DrawText (&t); t.baseline.y += 7; t.pStr += t.CharCount + 1; t.CharCount = (COUNT)~0; DrawText (&t); } cy += 18; s.origin.y += 18; } OldDevice = NewDevice; }
void gameOver(Bitmap *currframe, int16_t pos_x, int16_t pos_y){ DrawFilledRectangle(currframe,0,0,320,200,RGB(255,0,0)); }
void DrawStarConBox (PRECT pRect, SIZE BorderWidth, COLOR TopLeftColor, COLOR BottomRightColor, BOOLEAN FillInterior, COLOR InteriorColor) { RECT locRect; if (BorderWidth == 0) BorderWidth = 2; else { SetContextForeGroundColor (TopLeftColor); locRect.corner = pRect->corner; locRect.extent.width = pRect->extent.width; locRect.extent.height = 1; DrawFilledRectangle (&locRect); if (BorderWidth == 2) { ++locRect.corner.x; ++locRect.corner.y; locRect.extent.width -= 2; DrawFilledRectangle (&locRect); } locRect.corner = pRect->corner; locRect.extent.width = 1; locRect.extent.height = pRect->extent.height; DrawFilledRectangle (&locRect); if (BorderWidth == 2) { ++locRect.corner.x; ++locRect.corner.y; locRect.extent.height -= 2; DrawFilledRectangle (&locRect); } SetContextForeGroundColor (BottomRightColor); locRect.corner.x = pRect->corner.x + pRect->extent.width - 1; locRect.corner.y = pRect->corner.y + 1; locRect.extent.height = pRect->extent.height - 1; DrawFilledRectangle (&locRect); if (BorderWidth == 2) { --locRect.corner.x; ++locRect.corner.y; locRect.extent.height -= 2; DrawFilledRectangle (&locRect); } locRect.corner.x = pRect->corner.x; locRect.extent.width = pRect->extent.width; locRect.corner.y = pRect->corner.y + pRect->extent.height - 1; locRect.extent.height = 1; DrawFilledRectangle (&locRect); if (BorderWidth == 2) { ++locRect.corner.x; --locRect.corner.y; locRect.extent.width -= 2; DrawFilledRectangle (&locRect); } } if (FillInterior) { SetContextForeGroundColor (InteriorColor); locRect.corner.x = pRect->corner.x + BorderWidth; locRect.corner.y = pRect->corner.y + BorderWidth; locRect.extent.width = pRect->extent.width - (BorderWidth << 1); locRect.extent.height = pRect->extent.height - (BorderWidth << 1); DrawFilledRectangle (&locRect); } }
void DrawFilledRectangle(const PixelRect &rc, const Brush &brush) { DrawFilledRectangle(rc.left, rc.top, rc.right, rc.bottom, brush); }
void Phaser() { // Initialize hardware InitAudio(44100); InitDisplay_DOGM128(); InitEncoders(); // Calibrate touch screen TwoPointCalibration cal; TwoPointCalibrate_TSC2046(&cal); // Prepare a cleared screen static uint8_t screen[1024]; extern uint8_t background[1204]; memcpy(screen,background,sizeof(screen)); UpdateDisplay_DOGM128(screen); // Set up effect parameters and buffers const int midpoint=60; // The midpoint for the delay offset value int mix=0x8000; // Mixing factor for the phaser effect - set to 50% int feedback=0x8000; // Feedback factor for the phaser effect - set to 50% int count=0; // LFO control counter int maxcount=64; // The number of iterations to run before updating the LFO bool update=true; // Update flag for the screen static int32_t inbuf[NumberOfSamples*2],outbuf[NumberOfSamples*2]; // Input and output audio buffers static int32_t tmpbuf1[NumberOfSamples],tmpbuf2[NumberOfSamples]; // Temporary audio buffers // Initialize the phaser effects for both stereo channels static DelayPhaser dp[2]; InitDelayPhaser(&dp[0],0,mix,feedback); InitDelayPhaser(&dp[1],0,mix,feedback); // Initialize an LFO to control the phaser effect LFO lfo; InitLFO(&lfo,80,20); // period of 80, amplitude of +-20 // This loop processes 16 stereo samples at a time, // and thus run in 16/44100 seconds, or 363 microseconds. for(;;) { // Read input from the audio codec ReadFullAudioBuffer(inbuf,NumberOfSamples*2); // Get input from the touch screen int x,y; bool press=CalibratedTouchscreenPosition_TSC2046(&cal,&x,&y); if(press) { // Handle clicks on the delay slider if(x>=18-9&&x<55-9) { int oldcount=maxcount; maxcount=(63-y)*4; if(oldcount!=maxcount) update=true; } // Handle clicks on the mixing slider else if(x>=55-9&&x<92-9) { int oldmix=mix; mix=(63-y)*0x400; SetDelayPhaserMix(&dp[0],mix); SetDelayPhaserMix(&dp[1],mix); if(oldmix!=mix) update=true; } // Handle clicks on the feedback slider else if(x>=92-9&&x<92+2*18) { int oldfeedback=feedback; feedback=(63-y)*0x400; SetDelayPhaserFeedback(&dp[0],feedback); SetDelayPhaserFeedback(&dp[1],feedback); if(oldfeedback!=feedback) update=true; } } // Read input from the encoders int rot0=ReadEncoderChange(0); int rot1=ReadEncoderChange(1); int rot2=ReadEncoderChange(2); // Handle delay encoder if(rot0) { maxcount+=4*rot0; if(maxcount<0) maxcount=0; update=true; } // Handle mixing encoder if(rot1) { mix+=0x800*rot1; if(mix>0x10000) mix=0x10000; if(mix<0) mix=0; SetDelayPhaserMix(&dp[0],mix); SetDelayPhaserMix(&dp[1],mix); update=true; } // Handle feedback encoder if(rot2) { feedback+=0x800*rot2; if(feedback>0x10000) feedback=0x10000; if(feedback<0) feedback=0; SetDelayPhaserFeedback(&dp[0],feedback); SetDelayPhaserFeedback(&dp[1],feedback); update=true; } // Update screen if necessary // TODO: fix this code snippet since it takes too much time to execute and therefore distorts the audio signal if(update) { // Draw delay slider int delayheight=maxcount/4; EraseFilledRectangle(screen,18,0,18,64-delayheight); DrawFilledRectangle(screen,18,64-delayheight,18,delayheight); // Draw mixing slider int mixheight=mix/0x400; EraseFilledRectangle(screen,55,0,18,64-mixheight); DrawFilledRectangle(screen,55,64-mixheight,18,mixheight); // Draw feedback slider int feedbackheight=feedback/0x400; EraseFilledRectangle(screen,92,0,18,64-feedbackheight); DrawFilledRectangle(screen,92,64-feedbackheight,18,feedbackheight); //UpdateDisplay_DOGM128(screen); j=0; update=false; screenupdated=true; } if(screenupdated) { if (my_updatedisplay(screen) == 8) { screenupdated=false; } } // Run LFO if needed if(++count>=maxcount) { count=0; int lfoval=RunTriangleLFO(&lfo); SetDelayPhaserOffset(&dp[0],lfoval+midpoint); SetDelayPhaserOffset(&dp[1],lfoval+midpoint); } // Run phaser effect for(int channel=0;channel<2;channel++) { // Extract one channel from the input to a temporary buffer for(int i=0;i<NumberOfSamples;i++) tmpbuf1[i]=inbuf[2*i+channel]; // Run effect in temporary buffers RunDelayPhaser(&dp[channel],tmpbuf1,tmpbuf2,NumberOfSamples); // Write processed samples back to the output buffer for(int i=0;i<NumberOfSamples;i++) outbuf[2*i+channel]=tmpbuf2[i]; } // Send output buffer to audio codec WriteAudioBuffer(outbuf,NumberOfSamples*2); } }
void View::DrawLigatureNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff) { assert(dc); assert(element); assert(layer); assert(staff); LogDebug("DrawLigatureNote"); Note *note = dynamic_cast<Note *>(element); assert(note); int xn, x1, x2, y, y1, y2, y3, y4; // int yy2, y5; // unused int verticalCenter, up, epaisseur; epaisseur = std::max(2, m_doc->GetDrawingBeamWidth(staff->m_drawingStaffSize, false) / 2); xn = element->GetDrawingX(); y = 99; // LogDebug("DrawLigatureNote: _ligObliqua=%d drawingX=%d y=%d", note->m_ligObliqua, xn, y); LogDebug("DrawLigatureNote: drawingX=%d y=%d", xn, y); /* if ((note->m_lig==LIG_MEDIAL) || (note->m_lig==LIG_TERMINAL)) { CalculateLigaturePosX(element, layer, staff); } else */ { xn = element->GetDrawingX(); } // Compute the dimensions of the rectangle x1 = xn - m_doc->GetDrawingBrevisWidth(staff->m_drawingStaffSize); x2 = xn + m_doc->GetDrawingBrevisWidth(staff->m_drawingStaffSize); y1 = y + m_doc->GetDrawingUnit(staff->m_drawingStaffSize); y2 = y - m_doc->GetDrawingUnit(staff->m_drawingStaffSize); y3 = (int)(y1 + m_doc->GetDrawingUnit(staff->m_drawingStaffSize) / 2); // part of the frame that overflows y4 = (int)(y2 - m_doc->GetDrawingUnit(staff->m_drawingStaffSize) / 2); // if (!note->m_ligObliqua && (!View::s_drawingLigObliqua)) // rectangular notes, incl. ligature { if (note->GetColored() != BOOLEAN_true) { // double the bases of rectangles DrawObliquePolygon(dc, x1, y1, x2, y1, -epaisseur); DrawObliquePolygon(dc, x1, y2, x2, y2, epaisseur); } else DrawFilledRectangle(dc, x1, y1, x2, y2); // // ENZ correction of x2 DrawVerticalLine(dc, y3, y4, x1, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); // lateral brace DrawVerticalLine(dc, y3, y4, x2, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); } /* else // handle obliques { if (!View::s_drawingLigObliqua) // 1st pass: Initial flagStemHeight { DrawVerticalLine (dc,y3,y4,x1, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); View::s_drawingLigObliqua = true; //oblique = false; // if (val == DUR_1) // left tail up if DUR_1 // queue_lig = true; } else // 2nd pass: oblique lines and final flagStemHeighte { x1 -= m_doc->m_drawingBrevisWidth[staff->m_drawingStaffSize] * 2; // auto advance y1 = *View::s_drawingLigY - m_doc->GetDrawingUnit(staff->m_drawingStaffSize); // ligat_y contains original y yy2 = y2; y5 = y1+ m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize); y2 += m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize); // go up a INTERL if (note->GetColored()==BOOLEAN_true) DrawObliquePolygon (dc, x1, y1, x2, yy2, m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize)); else { DrawObliquePolygon (dc, x1, y1, x2, yy2, 5); DrawObliquePolygon (dc, x1, y5, x2, y2, -5); } DrawVerticalLine (dc,y3,y4,x2,m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); // enclosure flagStemHeighte View::s_drawingLigObliqua = false; // queue_lig = false; // ??defuses alg.queue DUR_BR?? } } if (note->m_lig) // remember positions from one note to another; connect notes by bars { *(View::s_drawingLigX+1) = x2; *(View::s_drawingLigY+1) = y; // connect ligature beamed notes by bar flagStemHeightes //if (in(x1,(*View::s_drawingLigX)-2,(*View::s_drawingLigX)+2) || (this->fligat && this->lat && !Note1::marq_obl)) // the latest conditions to allow previous ligature flagStemHeighte // DrawVerticalLine (dc, *ligat_y, y1, (this->fligat && this->lat) ? x2: x1, m_doc->m_parameters.m_stemWidth); // ax2 - drawing flagStemHeight lines missing *View::s_drawingLigX = *(View::s_drawingLigX + 1); *View::s_drawingLigY = *(View::s_drawingLigY + 1); } y3 = y2 - m_doc->GetDrawingUnit(staff->m_drawingStaffSize)*6; if (note->m_lig) { if (note->m_dur == DUR_BR) // && this->queue_lig) // tail left bottom: initial downward DUR_BR // ax2 - no support for queue_lig (see WG corrigeLigature) { DrawVerticalLine (dc, y2, y3, x1, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); } else if (note->m_dur == DUR_LG) // && !this->queue_lig) // DUR_LG ligature, tail right down // ax2 - no support for queue_lig { DrawVerticalLine (dc, y2, y3, x2, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); } else if (note->m_dur == DUR_1) // && this->queue_lig) // queue gauche haut // ax2 - no support for queue_lig { y2 = y1 + m_doc->GetDrawingUnit(staff->m_drawingStaffSize)*6; DrawVerticalLine (dc, y1, y2, x1, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); } } else if (note->m_dur == DUR_LG) // isolated DUR_LG: tail like normal notes */ if (note->GetActualDur() == DUR_LG) { verticalCenter = staff->GetDrawingY() - m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) * 2; // ENZ up = (y < verticalCenter) ? true : false; // ENZ if (note->GetDrawingStemDir() != STEMDIRECTION_NONE) { if (note->GetDrawingStemDir() == STEMDIRECTION_up) { up = true; } else { up = false; } } if (!up) { y3 = y1 - m_doc->GetDrawingUnit(staff->m_drawingStaffSize) * 8; y2 = y1; } else { y3 = y1 + m_doc->GetDrawingUnit(staff->m_drawingStaffSize) * 6; y2 = y1; } DrawVerticalLine(dc, y2, y3, x2, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); } return; }
void DrawFilledRectangle(int left, int top, int right, int bottom, const Brush &brush) { if (!brush.IsHollow()) DrawFilledRectangle(left, top, right, bottom, brush.GetColor()); }
void View::DrawMensuralStem(DeviceContext *dc, LayerElement *object, Staff *staff, data_STEMDIRECTION dir, int radius, int xn, int originY, int heightY) { assert(object->GetDurationInterface()); int staffSize = staff->m_drawingStaffSize; int staffY = staff->GetDrawingY(); int baseStem, totalFlagStemHeight, flagStemHeight, nbFlags; int drawingDur = (object->GetDurationInterface())->GetActualDur(); bool drawingCueSize = object->IsCueSize(); int verticalCenter = staffY - m_doc->GetDrawingDoubleUnit(staffSize) * 2; bool mensural_black = (staff->m_drawingNotationType == NOTATIONTYPE_mensural_black); baseStem = m_doc->GetDrawingUnit(staffSize) * STANDARD_STEMLENGTH; flagStemHeight = m_doc->GetDrawingDoubleUnit(staffSize); if (drawingCueSize) { baseStem = m_doc->GetCueSize(baseStem); flagStemHeight = m_doc->GetCueSize(flagStemHeight); } nbFlags = (mensural_black ? drawingDur - DUR_2 : drawingDur - DUR_4); totalFlagStemHeight = flagStemHeight * (nbFlags * 2 - 1) / 2; /* SMuFL provides combining stem-and-flag characters with one and two flags, but at the moment, I'm using only the one flag ones, partly out of concern for possible three-flag notes. */ /* In black notation, the semiminima gets one flag; in white notation, it gets none. In both cases, as in CWMN, each shorter duration gets one additional flag. */ if (dir == STEMDIRECTION_down) { // flip all lengths. Exception: in mensural notation, the stem will never be at // left, so leave radius as is. baseStem = -baseStem; totalFlagStemHeight = -totalFlagStemHeight; heightY = -heightY; } // If we have flags, add them to the height. int y1 = originY; int y2 = ((nbFlags > 0) ? (y1 + baseStem + totalFlagStemHeight) : (y1 + baseStem)) + heightY; int x2; if (drawingDur < DUR_BR) x2 = xn + radius; else x2 = xn; if ((dir == STEMDIRECTION_up) && (y2 < verticalCenter)) { y2 = verticalCenter; } else if ((dir == STEMDIRECTION_down) && (y2 > verticalCenter)) { y2 = verticalCenter; } // shorten the stem at its connection with the note head // this will not work if the pseudo size is changed int shortening = 0.9 * m_doc->GetDrawingUnit(staffSize); // LogDebug("DrawMensuralStem: drawingDur=%d mensural_black=%d nbFlags=%d", drawingDur, mensural_black, nbFlags); int stemY1 = (dir == STEMDIRECTION_up) ? y1 + shortening : y1 - shortening; int stemY2 = y2; if (nbFlags > 0) { // if we have flags, shorten the stem to make sure we have a nice overlap with the flag glyph int shortener = (drawingCueSize) ? m_doc->GetCueSize(m_doc->GetDrawingUnit(staffSize)) : m_doc->GetDrawingUnit(staffSize); stemY2 = (dir == STEMDIRECTION_up) ? y2 - shortener : y2 + shortener; } int halfStemWidth = m_doc->GetDrawingStemWidth(staffSize) / 2; // draw the stems and the flags if (dir == STEMDIRECTION_up) { if (nbFlags > 0) { for (int i = 0; i < nbFlags; i++) DrawSmuflCode(dc, x2 - halfStemWidth, stemY1 - i * flagStemHeight, SMUFL_E949_mensuralCombStemUpFlagSemiminima, staff->m_drawingStaffSize, drawingCueSize); } else DrawFilledRectangle(dc, x2 - halfStemWidth, stemY1, x2 + halfStemWidth, stemY2); } else { if (nbFlags > 0) { for (int i = 0; i < nbFlags; i++) DrawSmuflCode(dc, x2 - halfStemWidth, stemY1 + i * flagStemHeight, SMUFL_E94A_mensuralCombStemDownFlagSemiminima, staff->m_drawingStaffSize, drawingCueSize); } else DrawFilledRectangle(dc, x2 - halfStemWidth, stemY1, x2 + halfStemWidth, stemY2); } // Store the start and end values StemmedDrawingInterface *interface = object->GetStemmedDrawingInterface(); assert(interface); interface->SetDrawingStemDir(dir); }
void View::DrawMaximaToBrevis(DeviceContext *dc, int y, LayerElement *element, Layer *layer, Staff *staff) { assert(dc); assert(element); assert(layer); assert(staff); Note *note = dynamic_cast<Note *>(element); assert(note); int xn, xLeft, xRight, yTop, yBottom, y3, y4; // int yy2, y5; // unused int verticalCenter, up, height; bool mensural_black = (staff->m_drawingNotationType == NOTATIONTYPE_mensural_black); bool fillNotehead = (mensural_black || note->GetColored()) && !(mensural_black && note->GetColored()); height = m_doc->GetDrawingBeamWidth(staff->m_drawingStaffSize, false) / 2; xn = element->GetDrawingX(); // Calculate size of the rectangle xLeft = xn - m_doc->GetDrawingBrevisWidth(staff->m_drawingStaffSize); xRight = xn + m_doc->GetDrawingBrevisWidth(staff->m_drawingStaffSize); if (note->GetActualDur() == DUR_MX) { // Maxima is twice the width of brevis xLeft -= m_doc->GetDrawingBrevisWidth(staff->m_drawingStaffSize); xRight += m_doc->GetDrawingBrevisWidth(staff->m_drawingStaffSize); } yTop = y + m_doc->GetDrawingUnit(staff->m_drawingStaffSize); yBottom = y - m_doc->GetDrawingUnit(staff->m_drawingStaffSize); y3 = yTop; y4 = yBottom; if (!mensural_black) { y3 += (int)m_doc->GetDrawingUnit(staff->m_drawingStaffSize) / 2; // partie d'encadrement qui depasse y4 -= (int)m_doc->GetDrawingUnit(staff->m_drawingStaffSize) / 2; } if (!fillNotehead) { // double the bases of rectangles DrawObliquePolygon(dc, xLeft, yTop, xRight, yTop, -height); DrawObliquePolygon(dc, xLeft, yBottom, xRight, yBottom, height); } else { DrawFilledRectangle(dc, xLeft, yTop, xRight, yBottom); } DrawVerticalLine(dc, y3, y4, xLeft, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); // corset lateral DrawVerticalLine(dc, y3, y4, xRight, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); // stem if (note->GetActualDur() < DUR_BR) { verticalCenter = staff->GetDrawingY() - m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) * 2; up = (y < verticalCenter) ? true : false; if (note->GetDrawingStemDir() != STEMDIRECTION_NONE) { if (note->GetDrawingStemDir() == STEMDIRECTION_up) { up = true; } else { up = false; } } if (!up) { y3 = yTop - m_doc->GetDrawingUnit(staff->m_drawingStaffSize) * 8; yBottom = yTop; } else { y3 = yTop + m_doc->GetDrawingUnit(staff->m_drawingStaffSize) * 6; yBottom = yTop; } DrawVerticalLine(dc, yBottom, y3, xRight, m_doc->GetDrawingStemWidth(staff->m_drawingStaffSize)); } return; }
void clear(const Brush &brush) { DrawFilledRectangle(0, 0, get_width(), get_height(), brush); }
void clear(const Color color) { DrawFilledRectangle(0, 0, get_width(), get_height(), color); }
void DrawFilledRectangle(PixelScalar left, PixelScalar top, PixelScalar right, PixelScalar bottom, const Color color) { DrawFilledRectangle(left, top, right, bottom, map(color)); }
void DrawMenuStateStrings (BYTE beg_index, SWORD NewState) { BYTE end_index; RECT r; STAMP s; CONTEXT OldContext; BYTE hilite = 1; extern FRAME PlayFrame; if (NewState < 0) { NewState = -NewState; hilite = 0; } if (optWhichMenu == OPT_PC) { BYTE tmpState = (BYTE)NewState; GetAlternateMenu (&beg_index, &tmpState); NewState = tmpState; } if (beg_index == PM_STARMAP) NewState--; end_index = GetEndMenuState (beg_index); s.frame = 0; if (NewState <= end_index - beg_index) s.frame = SetAbsFrameIndex (PlayFrame, beg_index + NewState); PreUpdateFlashRect (); OldContext = SetContext (StatusContext); GetContextClipRect (&r); s.origin.x = RADAR_X - r.corner.x; s.origin.y = RADAR_Y - r.corner.y; r.corner.x = s.origin.x - 1; r.corner.y = s.origin.y - 11; r.extent.width = RADAR_WIDTH + 2; BatchGraphics (); SetContextForeGroundColor ( BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)); if (s.frame && optWhichMenu == OPT_PC) { if (beg_index == PM_CREW) snprintf (pm_crew_str, sizeof pm_crew_str, "%s(%d)", GAME_STRING (MAINMENU_STRING_BASE + PM_CREW), GLOBAL (CrewCost)); if (beg_index == PM_FUEL) snprintf (pm_fuel_str, sizeof pm_fuel_str, "%s(%d)", GAME_STRING (MAINMENU_STRING_BASE + PM_FUEL), GLOBAL (FuelCost)); if (beg_index == PM_SOUND_ON) { end_index = beg_index + 5; switch (beg_index + NewState) { case PM_SOUND_ON: case PM_SOUND_OFF: NewState = 0; break; case PM_MUSIC_ON: case PM_MUSIC_OFF: NewState = 1; break; case PM_CYBORG_OFF: case PM_CYBORG_NORMAL: case PM_CYBORG_DOUBLE: case PM_CYBORG_SUPER: NewState = 2; break; case PM_CHANGE_CAPTAIN: NewState = 3; break; case PM_CHANGE_SHIP: NewState = 4; break; case PM_EXIT_SETTINGS: NewState = 5; break; } } r.extent.height = RADAR_HEIGHT + 11; DrawPCMenu (beg_index, end_index, (BYTE)NewState, hilite, &r); s.frame = 0; } else { if (optWhichMenu == OPT_PC) { r.corner.x -= 1; r.extent.width += 1; r.extent.height = RADAR_HEIGHT + 11; } else r.extent.height = 11; DrawFilledRectangle (&r); } if (s.frame) { DrawStamp (&s); switch (beg_index + NewState) { TEXT t; UNICODE buf[20]; case PM_CREW: t.baseline.x = s.origin.x + RADAR_WIDTH - 2; t.baseline.y = s.origin.y + RADAR_HEIGHT - 2; t.align = ALIGN_RIGHT; t.CharCount = (COUNT)~0; t.pStr = buf; snprintf (buf, sizeof buf, "%u", GLOBAL (CrewCost)); SetContextFont (TinyFont); SetContextForeGroundColor (THREEDOMENU_TEXT_COLOR); font_DrawText (&t); break; case PM_FUEL: t.baseline.x = s.origin.x + RADAR_WIDTH - 2; t.baseline.y = s.origin.y + RADAR_HEIGHT - 2; t.align = ALIGN_RIGHT; t.CharCount = (COUNT)~0; t.pStr = buf; snprintf (buf, sizeof buf, "%u", GLOBAL (FuelCost)); SetContextFont (TinyFont); SetContextForeGroundColor (THREEDOMENU_TEXT_COLOR); font_DrawText (&t); break; } } UnbatchGraphics (); SetContext (OldContext); PostUpdateFlashRect (); }
void DrawFilledRectangle(PixelScalar left, PixelScalar top, PixelScalar right, PixelScalar bottom, const Brush &brush) { if (!brush.IsHollow()) DrawFilledRectangle(left, top, right, bottom, brush.GetColor()); }
void Rectangle(int left, int top, int right, int bottom) { DrawFilledRectangle(left, top, right, bottom, brush); if (IsPenOverBrush()) DrawOutlineRectangle(left, top, right, bottom); }
static void DrawCargoDisplay (void) { STAMP s; TEXT t; RECT r; COORD cy; COUNT i; r.corner.x = 2; r.extent.width = FIELD_WIDTH + 1; r.corner.y = 20; // XXX: Shouldn't the height be 1 less? This draws the bottom border // 1 pixel too low. Or if not, why do we need another box anyway? r.extent.height = 129 - r.corner.y; DrawStarConBox (&r, 1, SHADOWBOX_MEDIUM_COLOR, SHADOWBOX_DARK_COLOR, TRUE, CARGO_BACK_COLOR); // draw the "CARGO" title SetContextFont (StarConFont); t.baseline.x = (STATUS_WIDTH >> 1) - 1; t.baseline.y = 27; t.align = ALIGN_CENTER; t.pStr = GAME_STRING (CARGO_STRING_BASE); t.CharCount = (COUNT)~0; SetContextForeGroundColor (CARGO_SELECTED_AMOUNT_COLOR); font_DrawText (&t); SetContextFont (TinyFont); s.frame = SetAbsFrameIndex (MiscDataFrame, (NUM_SCANDOT_TRANSITIONS * 2) + 3); r.corner.x = ELEMENT_COL_0; r.extent = GetFrameBounds (s.frame); s.origin.x = r.corner.x + (r.extent.width >> 1); cy = ELEMENT_ORG_Y; // print element column headings t.align = ALIGN_RIGHT; t.baseline.y = cy - 1; t.CharCount = (COUNT)~0; SetContextForeGroundColor (CARGO_WORTH_COLOR); t.baseline.x = ELEMENT_COL_1; t.pStr = "$"; font_DrawText (&t); t.baseline.x = ELEMENT_COL_2; t.pStr = "#"; font_DrawText (&t); // draw element icons and print amounts for (i = 0; i < NUM_ELEMENT_CATEGORIES; ++i, cy += ELEMENT_SPACING_Y) { // erase background under an element icon SetContextForeGroundColor (BLACK_COLOR); r.corner.y = cy; DrawFilledRectangle (&r); // draw an element icon s.origin.y = r.corner.y + (r.extent.height >> 1); DrawStamp (&s); s.frame = SetRelFrameIndex (s.frame, 5); DrawElementAmount (i, false); } // erase background under the Bio icon SetContextForeGroundColor (BLACK_COLOR); r.corner.y = BIO_ORG_Y; DrawFilledRectangle (&r); // draw the Bio icon s.origin.y = r.corner.y + (r.extent.height >> 1); s.frame = SetAbsFrameIndex (s.frame, 68); DrawStamp (&s); // print the Bio amount DrawElementAmount (NUM_ELEMENT_CATEGORIES, false); // draw the line over the Bio amount r.corner.x = 4; r.corner.y = BIO_ORG_Y - 2; r.extent.width = FIELD_WIDTH - 3; r.extent.height = 1; SetContextForeGroundColor (CARGO_SELECTED_BACK_COLOR); DrawFilledRectangle (&r); // print "Free" t.baseline.x = 5; t.baseline.y = FREE_ORG_Y + TEXT_BASELINE; t.align = ALIGN_LEFT; t.pStr = GAME_STRING (CARGO_STRING_BASE + 1); t.CharCount = (COUNT)~0; font_DrawText (&t); ShowRemainingCapacity (); }
void DrawFilledRectangle(const PixelRect &rc, const Color color) { DrawFilledRectangle(rc.left, rc.top, rc.right, rc.bottom, color); }
// Put the ship icons in the PickMeleeFrame, and create a queue // for each player. // XXX TODO: split off creating the queue into a separate function. void FillPickMeleeFrame (MeleeSetup *setup) { COUNT i; CONTEXT OldContext; OldContext = SetContext (OffScreenContext); for (i = 0; i < NUM_SIDES; ++i) { COUNT side; COUNT sideI; RECT r; TEXT t; STAMP s; UNICODE buf[30]; FleetShipIndex index; sideI = GetPlayerOrder (i); side = !sideI; s.frame = SetAbsFrameIndex (PickMeleeFrame, side); SetContextFGFrame (s.frame); GetFrameRect (s.frame, &r); t.baseline.x = r.extent.width >> 1; t.baseline.y = r.extent.height - NAME_AREA_HEIGHT + RES_SCALE(4); r.corner.x += RES_SCALE(2); r.corner.y += RES_SCALE(2); r.extent.width -= RES_SCALE((2 * 2) + (RES_DESCALE(ICON_WIDTH) + 2) + 1); // JMS_GFX r.extent.height -= RES_SCALE(2 * 2) + NAME_AREA_HEIGHT; // JMS_GFX SetContextForeGroundColor (PICK_BG_COLOR); DrawFilledRectangle (&r); r.corner.x += RES_SCALE(2); // JMS_GFX r.extent.width += RES_SCALE((RES_DESCALE(ICON_WIDTH) + 2) - (2 * 2)); // JMS_GFX r.corner.y += r.extent.height; r.extent.height = NAME_AREA_HEIGHT; DrawFilledRectangle (&r); // Team name at the bottom of the frame: t.align = ALIGN_CENTER; t.pStr = MeleeSetup_getTeamName (setup, sideI); t.CharCount = (COUNT) ~0; SetContextFont (TinyFont); SetContextForeGroundColor (PICKSHIP_TEAM_NAME_TEXT_COLOR); font_DrawText (&t); // Total team value of the starting team: sprintf (buf, "%u", MeleeSetup_getFleetValue (setup, sideI)); t.baseline.x = RES_SCALE(4); t.baseline.y = RES_SCALE(7); t.align = ALIGN_LEFT; t.pStr = buf; t.CharCount = (COUNT)~0; SetContextForeGroundColor (PICKSHIP_TEAM_START_VALUE_COLOR); font_DrawText (&t); assert (CountLinks (&race_q[side]) == 0); for (index = 0; index < MELEE_FLEET_SIZE; index++) { MeleeShip StarShip; StarShip = MeleeSetup_getShip (setup, sideI, index); if (StarShip == MELEE_NONE) continue; { BYTE row, col; BYTE ship_cost; HMASTERSHIP hMasterShip; HSTARSHIP hBuiltShip; MASTER_SHIP_INFO *MasterPtr; STARSHIP *BuiltShipPtr; BYTE captains_name_index; hMasterShip = GetStarShipFromIndex (&master_q, StarShip); MasterPtr = LockMasterShip (&master_q, hMasterShip); captains_name_index = NameCaptain (&race_q[side], MasterPtr->SpeciesID); hBuiltShip = Build (&race_q[side], MasterPtr->SpeciesID); // Draw the icon. row = PickMelee_GetShipRow (index); col = PickMelee_GetShipColumn (index); s.origin.x = RES_SCALE(4) + ((ICON_WIDTH + RES_SCALE(2)) * col); // JMS_GFX s.origin.y = RES_SCALE(10) + ((ICON_HEIGHT + RES_SCALE(2)) * row); s.frame = MasterPtr->ShipInfo.icons; DrawStamp (&s); ship_cost = MasterPtr->ShipInfo.ship_cost; UnlockMasterShip (&master_q, hMasterShip); BuiltShipPtr = LockStarShip (&race_q[side], hBuiltShip); BuiltShipPtr->index = index; BuiltShipPtr->ship_cost = ship_cost; BuiltShipPtr->playerNr = side; BuiltShipPtr->captains_name_index = captains_name_index; // The next ones are not used in Melee BuiltShipPtr->crew_level = 0; BuiltShipPtr->max_crew = 0; BuiltShipPtr->race_strings = 0; BuiltShipPtr->icons = 0; BuiltShipPtr->RaceDescPtr = 0; UnlockStarShip (&race_q[side], hBuiltShip); } } } SetContext (OldContext); }
void Clear(const Color color) { DrawFilledRectangle(0, 0, GetWidth(), GetHeight(), color); }
int Edit(SpielerName *Spieler) { // Buffervariablen definieren char spielername1[15]; //lokaler string name1 char spielername2[15]; // Lokaler string name2 char spielerbuffer[15]; // Name buffer fuer loeschfunktion int key; int i=0; //Countervariable // Buffervariablen "leeren" strncpy(spielername1," ",15); strncpy(spielername2," ",15); // Grundbild zeichen DrawFilledRectangle(0, 0, 1300, 750, COL_BLACK,1) ; // Hintergrund DrawEmptyRectangle(0, 0, 1300, 750, COL_GREEN, 4) ; // Umrandung DrawTextXY(550,51,COL_GREEN,"Level-Modus"); DrawEmptyRectangle(150,90,1000,50, COL_GREEN, 2) ; DrawTextXY(350,130,COL_GREEN,"Name von Spieler 1 eingeben"); DrawTextXY(550,200,COL_GREEN,spielername1); DrawEmptyRectangle(150, 440,1000,50, COL_GREEN, 2) ; DrawTextXY(550,480,COL_GREEN,"0: Beenden"); // Spieler 1 // Durchlauf 14 mal, bis das array voll ist for(i=0;i<14;i++) { key=GetKeyPress(); // Tastendruck auslesen if((key>=32) && (key<=128)) // Nur Gross- und Kleinbuchstaben beruecksichtigen { // Hintergrundbild aktualisieren DrawFilledRectangle(0, 0, 1300, 750, COL_BLACK,1) ; DrawEmptyRectangle(0, 0, 1300, 750, COL_GREEN, 4) ; DrawTextXY(550,51,COL_GREEN,"Level-Modus"); DrawEmptyRectangle(150,90,1000,50, COL_GREEN, 2) ; DrawTextXY(350,130,COL_GREEN,"Name von Spieler 1 eingeben"); spielername1[i]=key; // Zeichenzuweisung DrawTextXY(550,200,COL_GREEN,spielername1); DrawEmptyRectangle(150, 440,1000,50, COL_GREEN, 2) ; DrawTextXY(550,480,COL_GREEN,"0: Beenden"); } if (key==8) // 8 entspricht backspace { DrawFilledRectangle(0, 0, 1300, 750, COL_BLACK,1) ; strncpy(spielerbuffer,spielername1,15); // aktueller Name zwischenspeichern strncpy(spielername1," ",15); // Spielername reseten strncpy(spielername1,spielerbuffer,i-1); // Name zurückschreiben mit länge -1 strncpy(spielerbuffer," ",15); // Buffer löschen DrawEmptyRectangle(0, 0, 1300, 750, COL_GREEN, 4) ; DrawTextXY(550,51,COL_GREEN,"Level-Modus"); DrawEmptyRectangle(150,90,1000,50, COL_GREEN, 2) ; DrawTextXY(350,130,COL_GREEN,"Name von Spieler 1 eingeben"); DrawEmptyRectangle(150, 440,1000,50, COL_GREEN, 2) ; DrawTextXY(550,200,COL_GREEN,spielername1); // Name erneut schreiben DrawTextXY(550,480,COL_GREEN,"0: Beenden"); i=i-2; // Counter auf Start reseten } if (key== 13)// wenn Enter gedrückt wird (Enter = ASCII 13) { i=14; // Counter auf "voll" setzten, Schlaufe wird verlassen } if (key== '0') // Abbruch { return 0; } } // Spieler 2 i=0; //Zähler reseten //Hintergrund zeichen DrawFilledRectangle(0, 0, 1300, 750, COL_BLACK,1) ; DrawEmptyRectangle(0, 0, 1300, 750, COL_GREEN, 4) ; DrawTextXY(550,51,COL_GREEN,"Level-Modus"); DrawEmptyRectangle(150,90,1000,50, COL_GREEN, 2) ; DrawTextXY(350,130,COL_GREEN,"Name von Spieler 1 eingeben"); DrawEmptyRectangle(150,250,1000,50, COL_GREEN, 2) ; DrawTextXY(350,290,COL_GREEN,"Name von Spieler 2 eingeben"); DrawEmptyRectangle(150, 440,1000,50, COL_GREEN, 2) ; DrawTextXY(550,480,COL_GREEN,"0: Beenden"); spielername2[i]=key; // Zeichenzuweisung DrawTextXY(550,200,COL_GREEN,spielername1); DrawTextXY(550,360,COL_GREEN,spielername2); // durchlaufen bis array voll for(i=0;i<14;i++) { key=GetKeyPress(); // Tastendruck auslesen if((key>=32) && (key<=128)) // Nur Gross- und Kleinbuchstaben beruecksichtigen { //Hintergrund aktualisieren DrawFilledRectangle(0, 0, 1300, 750, COL_BLACK,1) ; DrawEmptyRectangle(0, 0, 1300, 750, COL_GREEN, 4) ; DrawTextXY(550,51,COL_GREEN,"Level-Modus"); DrawEmptyRectangle(150,90,1000,50, COL_GREEN, 2) ; DrawTextXY(350,130,COL_GREEN,"Name von Spieler 1 eingeben"); DrawEmptyRectangle(150,250,1000,50, COL_GREEN, 2) ; DrawTextXY(350,290,COL_GREEN,"Name von Spieler 2 eingeben"); DrawEmptyRectangle(150, 440,1000,50, COL_GREEN, 2) ; DrawTextXY(550,480,COL_GREEN,"0: Beenden"); spielername2[i]=key; // Zeichenzuweisung DrawTextXY(550,200,COL_GREEN,spielername1); DrawTextXY(550,360,COL_GREEN,spielername2); } if (key==8) // 8 entspricht backspace { DrawFilledRectangle(0, 0, 1300, 750, COL_BLACK,1) ; strncpy(spielerbuffer,spielername2,15); // aktueller Name zwischenspeichern strncpy(spielername2," ",15); // Spielername reseten strncpy(spielername2,spielerbuffer,i-1); // Name zurückschreiben mit länge -1 strncpy(spielerbuffer," ",15); // Buffer löschen DrawEmptyRectangle(0, 0, 1300, 750, COL_GREEN, 4) ; DrawTextXY(550,51,COL_GREEN,"Level-Modus"); DrawEmptyRectangle(150,90,1000,50, COL_GREEN, 2) ; DrawTextXY(350,130,COL_GREEN,"Name von Spieler 1 eingeben"); DrawEmptyRectangle(150,250,1000,50, COL_GREEN, 2) ; DrawTextXY(350,290,COL_GREEN,"Name von Spieler 2 eingeben"); DrawTextXY(550,200,COL_GREEN,spielername1); DrawTextXY(550,360,COL_GREEN,spielername2); DrawEmptyRectangle(150, 440,1000,50, COL_GREEN, 2) ; DrawTextXY(550,480,COL_GREEN,"0: Beenden"); i=i-2; // Counter reseten } if (key== 13) // Wenn Enter, counter auf "voll", schlaufe wird verlassen { i=14; } if (key== '0') // Abbruch { return 0; } } // Übertrag aus buffer auf Counter übertragen strncpy(Spieler->Spieler1,spielername1,15); strncpy(Spieler->Spieler2,spielername2,15); return 1; }