void ColorWheel::composeWheel()
{
    QPainter composePainter(&wheel);
    composePainter.drawImage(0, 0, wheelImage);
    composePainter.drawImage(squareRegion.boundingRect().topLeft(), squareImage);
    composePainter.end();
    drawSelector(start.hue());
}
示例#2
0
void drawSelector(gamePointf selector)
{
	gamePointi realSelector;
	realSelector.x = selector.x;
	realSelector.y = selector.y;
	realSelector.z = selector.z;
	drawSelector(realSelector);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_COLOR, GL_DST_ALPHA);
	glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
	drawOcto(selector.x-1, selector.y-1, selector.z+1, 1.0f);
	glDisable(GL_BLEND);
}
示例#3
0
//--------------------------------------------------------------
void ofApp::draw(){
    ofSetHexColor(0xfffffff);
    colorImage.draw(0, 0);
    
    //artk.draw();
    
    ofSetColor(255);
    string msg = "fps: " + ofToString(ofGetFrameRate(), 2) +"\nBPM: " + ofToString(bpm, 2);
    ofDrawBitmapString(msg, 10, 20);
    
    artk.applyProjectionMatrix();
    
    int numDetected = artk.getNumDetectedMarkers();
    
    glPushMatrix();
    for (int i = 0; i < numDetected; i++) {
        artk.applyModelMatrix(i);
        ofEnableDepthTest();
        ofEnableLighting();
        light0.enable();
        light1.enable();
        
        ofSetColor(40);
        ofRect(tileRange * (-9), tileRange * (-row/2 - 1), tileRange * 18, tileRange * (row +2));
        drawTile();
        drawSelector();
        
        if (boxes.size() > 0) {
            vector<soundBox>::iterator it;
            for (it = boxes.begin(); it < boxes.end(); it++) {
                it->display();
            }
        }
        
        //light0.draw();
        //light1.draw();
        
        light0.disable();
        light1.disable();
        ofDisableLighting();
        ofDisableDepthTest();
    }
    glPopMatrix();
}
示例#4
0
文件: MiniMap.cpp 项目: Tigge/simulty
void MiniMap::draw(gcn::Graphics *g) {

  g->setColor(gcn::Color(150, 150, 150));
  g->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));

  Point base(map->getWidth() * 2, 0);

  for(unsigned int x = 0; x < map->getWidth(); x++) {
    for(unsigned int y = 0; y < map->getHeight(); y++) {
      Tile *t = map->getTile(x, y);
      
      if(t->isRoad()) {
        g->setColor(gcn::Color(100, 100, 100));
      } else if(t->getZone() == SIMULTY_ZONE_RES) {
        g->setColor(gcn::Color(78, 216, 24));
      } else if(t->getZone() == SIMULTY_ZONE_COM) {
        g->setColor(gcn::Color(113, 148, 227));
      } else if(t->getZone() == SIMULTY_ZONE_IND) {
        g->setColor(gcn::Color(222, 159, 49));
      } else {
        g->setColor(gcn::Color(112, 152, 40));
      }
      int bx = base.getX() + x + (y * 2);
      int by = base.getY() + y;

      g->drawPoint(bx, by);
      g->drawPoint(bx + 1, by);
            
      if(x != 0) {
        g->drawPoint(bx, by - 1);
      } if( x != map->getWidth() - 1) {
        g->drawPoint(bx + 1, by + 1);
      }

    }
    base.translate(-3, 1);
  }
  
  drawSelector(g);
}
示例#5
0
//--------------------------------------------------------------------------
/// Function to invoke calls to draw the picker box and selector
void GuiColorPickerCtrl::renderColorBox(RectI &bounds)
{
   RectI pickerBounds;
   pickerBounds.point.x = bounds.point.x+1;
   pickerBounds.point.y = bounds.point.y+1;
   pickerBounds.extent.x = bounds.extent.x-1;
   pickerBounds.extent.y = bounds.extent.y-1;
   
   if (mProfile->mBorder)
      GFX->getDrawUtil()->drawRect(bounds, mProfile->mBorderColor);
      
   Point2I selectorPos = Point2I(bounds.point.x+mSelectorPos.x+1, bounds.point.y+mSelectorPos.y+1);

   // Draw color box differently depending on mode
   RectI blendRect;
   switch (mDisplayMode)
   {
   case pHorizColorRange:
      drawBlendRangeBox( pickerBounds, false, 7, mColorRange);
      drawSelector( pickerBounds, selectorPos, sVertical );
   break;
   case pVertColorRange:
      drawBlendRangeBox( pickerBounds, true, 7, mColorRange);
      drawSelector( pickerBounds, selectorPos, sHorizontal );
   break;
   case pHorizColorBrightnessRange:
      blendRect = pickerBounds;
      blendRect.point.y++;
      blendRect.extent.y -= 2;
      drawBlendRangeBox( pickerBounds, false, 7, mColorRange);
      // This is being drawn slightly offset from the larger rect so as to insure 255 and 0
      // can both be selected for every color.
      drawBlendBox( blendRect, colorAlpha, colorAlpha, colorBlack, colorBlack );
      blendRect.point.y += blendRect.extent.y - 1;
      blendRect.extent.y = 2;
      GFX->getDrawUtil()->drawRect( blendRect, colorBlack);
      drawSelector( pickerBounds, selectorPos, sHorizontal );
      drawSelector( pickerBounds, selectorPos, sVertical );
   break;
   case pVertColorBrightnessRange:
      drawBlendRangeBox( pickerBounds, true, 7, mColorRange);
      drawBlendBox( pickerBounds, colorAlpha, colorBlack, colorBlack, colorAlpha );
      drawSelector( pickerBounds, selectorPos, sHorizontal );
      drawSelector( pickerBounds, selectorPos, sVertical );
   break;
   case pHorizAlphaRange:
      drawBlendBox( pickerBounds, colorBlack, colorWhite, colorWhite, colorBlack );
      drawSelector( pickerBounds, selectorPos, sVertical );
   break;
   case pVertAlphaRange:
      drawBlendBox( pickerBounds, colorBlack, colorBlack, colorWhite, colorWhite );
      drawSelector( pickerBounds, selectorPos, sHorizontal ); 
   break;
   case pBlendColorRange:
      drawBlendBox( pickerBounds, colorWhite, mBaseColor, colorAlpha, colorBlack );
      drawSelector( pickerBounds, selectorPos, sHorizontal );      
      drawSelector( pickerBounds, selectorPos, sVertical );
   break;
   case pDropperBackground:
   break;
   case pPallet:
   default:
      GFX->getDrawUtil()->drawRectFill( pickerBounds, mBaseColor );
   break;
   }
}
示例#6
0
文件: nibbles.c 项目: bcherry/bcherry
// doIntro - display the game intro and wait for menu selections
// 	returns FALSE if user selects exit, TRUE otherwise
short int doIntro(short int *gamespeed, short int *gamedifficulty) {
	short int selector = MENUSTART, done = FALSE, key, options = FALSE, selection = 0;
	short int speed = *gamespeed, difficulty = *gamedifficulty;

	// clear the screen
	ClrScr();

	// draw the intro screen
	drawBorder();
	drawLogo();
	drawMenu();
	drawCopyright();
	drawSelector(selector);

	while (!done) {
		// wait for keypress
		while ((key = getKey()) == 0);

		if (key == KUP) {
			// move up the menu
			drawSelector(selector);

			if (selector == MENUSTART) {
				selector = MENUEND;
			} else {
				selector -= MENUSTEP;
			}

			drawSelector(selector);
		} else if (key == KDOWN) {
			// move down the menu
			drawSelector(selector);

			if (selector == MENUEND) {
				selector = MENUSTART;
			} else {
				selector += MENUSTEP;
			}

			drawSelector(selector);
		} else if (key == KLEFT) {
			if (options) {
				// if we are in the options menu
				selection = (selector - MENUSTART) / MENUSTEP;

				// set the speed option
				if (selection == START) {
					// same as speed option -- option 1 == SPEED
					drawSpeedOption(speed);

					if (speed == VERYSLOW) {
						speed = VERYFAST;
					} else {
						speed--;
					}

					drawSpeedOption(speed);

				// set the difficulty option
				} else if (selection == OPTIONS) {
					// same as difficulty option -- option 2 == DIFFICULTY
					drawDifficultyOption(difficulty);

					if (difficulty == EASY) {
						difficulty = HARD;
					} else {
						difficulty--;
					}

					drawDifficultyOption(difficulty);
				}
			}
		} else if (key == KENTER || key == KRIGHT) {
			// select menu option
			selection = (selector - MENUSTART) / MENUSTEP;

			if (options) {
			// if we're in the options menu

				// exit the options menu
				if (selection == QUIT) {
					// close options menu
					options = FALSE;

					// switch the options and main menus
					drawOptionsMenu(speed,difficulty);
					drawMenu();

					// reset the selector
					drawSelector(selector);
					selector = MENUSTART;
					drawSelector(selector);
				} else if (selection == START) {
					// same as speed option -- option 1 == SPEED
					drawSpeedOption(speed);

					if (speed == VERYFAST) {
						speed = VERYSLOW;
					} else {
						speed++;
					}

					drawSpeedOption(speed);
				} else if (selection == OPTIONS) {
					// same as difficulty option -- option 2 == DIFFICULTY
					drawDifficultyOption(difficulty);

					if (difficulty == HARD) {
						difficulty = EASY;
					} else {
						difficulty++;
					}

					drawDifficultyOption(difficulty);
				}
			} else {
				// if we chose to start or exit, end the loop
				if (selection == START || selection == QUIT) {
					done = TRUE;
				} else {
					// enter the options menu
					options = TRUE;

					// switch the main and options menus
					drawMenu();
					drawOptionsMenu(speed,difficulty);

					// reset the selector
					drawSelector(selector);
					selector = MENUSTART;
					drawSelector(selector);
				}
			}
		} else if (key == KESC) {
			// exit the options menu
			if (options) {
				// close options menu
				options = FALSE;

				// switch the options and main menus
				drawOptionsMenu(speed,difficulty);
				drawMenu();

				// reset the selector
				drawSelector(selector);
				selector = MENUSTART;
				drawSelector(selector);
			} else {
				selection = QUIT;
				done = TRUE;
			}
		}

		// wait for keypress to dissipate
		delay(KEYDELAY);
	}

	// set the game options
	*gamespeed = speed;
	*gamedifficulty = difficulty;

	return (selection == START) ? TRUE : FALSE;
}