コード例 #1
0
ファイル: uisearchtextfield.cpp プロジェクト: EQ4/vstgui
//----------------------------------------------------------------------------------------------------
void UISearchTextField::draw (CDrawContext *pContext)
{
	drawBack (pContext);
	drawClearMark (pContext);

	if (platformControl)
	{
		setDirty (false);
		return;
	}

	pContext->setDrawMode (kAntiAliasing);

	CColor origFontColor (fontColor);
	if (getText ().empty ())
	{
		CColor color (fontColor);
		color.alpha /= 2;
		setFontColor (color);
		drawPlatformText(pContext, CString ("Search").getPlatformString ());
	}
	else
		drawPlatformText (pContext, getText ().getPlatformString ());

	setDirty (false);
	setFontColor (origFontColor);
}
コード例 #2
0
ファイル: menuWindow.cpp プロジェクト: athomaj/RType
void MenuWindow::display()
{
      drawBack();
      window->draw(sprite);
      checkMouseEvent();
      menu->drawBackGround(*window);

      if (currentPage == MenuWindow::LEVEL)
    	 level->drawBackGround(*window, mouseClicked);
      if (currentPage == MenuWindow::OPTION)
	optionPage->drawBackGround(*window, mouseClicked);
      if (currentPage == MenuWindow::WAIT)
	waitPage->drawBackGround(*window);
      if (currentPage == MenuWindow::SCORE)
	scorePage->drawBackGround(*window, mouseClicked);
      if (currentPage == MenuWindow::CONNECTION)
    	  conectPage->drawBackGround(*window, mouseClicked);
      if (c != 0 && currentPage == MenuWindow::CONNECTION)
    	  conectPage->writeCharacter(c);
      if (currentPage == MenuWindow::ROOM)
	room->drawBackGround(*window, mouseClicked);
      if (currentPage == MenuWindow::DEAD)
	deadPage->drawBackGround(*window, mouseClicked);
      if (currentPage == MenuWindow::END)
	endPage->drawBackGround(*window, mouseClicked);
      if (c != 0 && currentPage == MenuWindow::ROOM)
      {
    	  room->writeCharacter(c);
      }
      window->display();
      c = 0;
}
コード例 #3
0
ファイル: itemuser.cpp プロジェクト: Spudster3/cgru
void ItemUser::paint( QPainter *painter, const QStyleOptionViewItem &option) const
{
   drawBack( painter, option);
   int x = option.rect.x() + 5;
   int y = option.rect.y() + 2;
   int w = option.rect.width() - 10;
   int h = option.rect.height() - 4;
   int height_user = HeightUser-4;

   painter->setPen( clrTextMain( option) );
   if( permanent) painter->setFont( afqt::QEnvironment::f_name);
   else           painter->setFont( afqt::QEnvironment::f_info);
   painter->drawText( x, y, w, h, Qt::AlignLeft | Qt::AlignTop,     strLeftTop);

   painter->setPen( clrTextInfo( option) );
   painter->setFont( afqt::QEnvironment::f_info);
   painter->drawText( x, y, w, height_user, Qt::AlignLeft    | Qt::AlignBottom,  strLeftBottom  );
   painter->drawText( x, y, w, height_user, Qt::AlignHCenter | Qt::AlignTop,     strHCenterTop  );
   painter->drawText( x, y, w, height_user, Qt::AlignRight   | Qt::AlignBottom,  strRightBottom );
   painter->setPen( afqt::QEnvironment::qclr_black );
   painter->drawText( x, y, w, height_user, Qt::AlignRight   | Qt::AlignTop,     strRightTop    );

   if( false == annotation.isEmpty())
      painter->drawText( x, y, w, h, Qt::AlignBottom | Qt::AlignHCenter, annotation );

   {  // draw stars:
      static const int stars_size = 8;
      static const int stars_height = 21;
      static const int stars_left = 35;
      static const int stars_maxdelta = stars_size * 2 + 5;

      int quantity = numrunningtasks;
      //quantity = 155;

      if( quantity > 0)
      {
         int numstars = quantity;
         int stars_right = w - 50;
         int stars_delta = (stars_right - stars_left) / numstars;
         if( stars_delta < 1 )
         {
            stars_delta = 1;
            numstars = stars_right - stars_left;
         }
         else if( stars_delta > stars_maxdelta ) stars_delta = stars_maxdelta;
         int sx = x + stars_left;
         for( int j = 0; j < numstars; j++)
         {
            drawStar( stars_size, sx, y + stars_height, painter);
            sx += stars_delta;
         }

         painter->setFont( afqt::QEnvironment::f_name);
         painter->setPen( afqt::QEnvironment::clr_textstars.c);
         painter->drawText( x, y, w, HeightUser, Qt::AlignHCenter | Qt::AlignBottom, QString::number(numrunningtasks));
      }
   }

   drawPost( painter, option);
}
コード例 #4
0
ファイル: menuWindow.cpp プロジェクト: athomaj/RType
void MenuWindow::display()
{
    // checkEvent();
    drawBack();
    sf::Texture texture3;
    if (!texture3.loadFromFile("logo.png"))
        std::cerr << "Logo.png is not found" << std::endl;
    // Create a sprite
    sf::Sprite sprite;
    sprite.setTexture(texture3);
    sprite.setScale(sf::Vector2f(((float)width / texture3.getSize().x) * 0.25f  ,  ((float)height / texture3.getSize().y) * 0.1f  ));
    sprite.setPosition(sf::Vector2f(0.02f * (float)width, 0.33f * (float)height));
    //  sprite.setPosition(sf::Vector2f());
    // Draw it
    window->draw(sprite);
    /* sf::Texture texture4;
    if (!texture4.loadFromFile("rtupes.png"))
    std::cerr << "Logo.png is not found" << std::endl;
         // Create a sprite
         sf::Sprite sprite2;
         sprite.setTexture(texture4);
         sprite.setPosition(700, 700);
         // Draw it
         window->draw(sprite2); */
    checkMouseEvent();
    menu->draw(*window);
    window->display();
}
コード例 #5
0
void ofxUICanvas::draw()
{
    ofPushStyle(); 
    glDisable(GL_DEPTH_TEST);       
    glDisable(GL_LIGHTING);
    ofEnableBlendMode(OF_BLENDMODE_ALPHA); 
    ofSetRectMode(OF_RECTMODE_CORNER);         
    ofSetLineWidth(1.0);         
    
    drawPadded();
    
    drawPaddedOutline(); 
    
    drawBack(); 
    
    drawFill(); 
    
    drawFillHighlight(); 
    
    drawOutline(); 
    
    drawOutlineHighlight();

    for(int i = widgets.size()-1; i >= 0; i--)
    {
        if(widgets[i]->isVisible())
        {
            widgets[i]->draw(); 	
        }
    }
    
    glDisable(GL_DEPTH_TEST); 
    ofPopStyle();         
}
コード例 #6
0
void ofxUIScrollableCanvas::draw()
{
    ofxUIPushStyle();
    
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_LIGHTING);
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    ofxUISetRectMode(OFX_UI_RECTMODE_CORNER);
    ofSetLineWidth(1.0);
    
    drawPadded();
    
    drawPaddedOutline();
    
    drawBack();
    
    drawFill();
    
    drawFillHighlight();
    
    drawOutline();
    
    drawOutlineHighlight();
    
    for(vector<ofxUIWidget *>::reverse_iterator it = widgets.rbegin(); it != widgets.rend(); ++it)
    {
        if((*it)->isVisible() && (*it)->getRect()->rInside(*sRect))
        {
            (*it)->draw();
        }
    }
    
    ofxUIPopStyle();
}
コード例 #7
0
ファイル: coptionmenu.cpp プロジェクト: EQ4/vstgui
//------------------------------------------------------------------------
void COptionMenu::draw (CDrawContext *pContext)
{
	CMenuItem* item = getEntry (currentIndex);
	drawBack (pContext, inPopup ? bgWhenClick : 0);
	if (item)
		drawPlatformText (pContext, CString (item->getTitle ()).getPlatformString ());
	setDirty (false);
}
コード例 #8
0
void LightCycle::drawBike() {
	drawBottomDetails();
	drawBottomBar();
	drawEngineBlock();
	drawFront();
	drawBack();
	drawInnerCircles();
	drawLayeredCircles();
	drawDetails();
}
コード例 #9
0
ファイル: ctextedit.cpp プロジェクト: DaniM/lyngo
//------------------------------------------------------------------------
void CTextEdit::draw (CDrawContext *pContext)
{
	if (platformControl)
	{
		drawBack (pContext);
		setDirty (false);
		return;
	}

	CTextLabel::draw (pContext);
}
コード例 #10
0
ファイル: item.cpp プロジェクト: RISEFX/cgru
void Item::paint( QPainter *painter, const QStyleOptionViewItem &option) const
{
	drawBack( painter, option);

	painter->setPen( afqt::QEnvironment::qclr_black );

	painter->setFont( afqt::QEnvironment::f_name);
	painter->drawText( option.rect, Qt::AlignTop | Qt::AlignLeft, m_name);

	painter->setFont( afqt::QEnvironment::f_info);
	painter->drawText( option.rect, Qt::AlignBottom | Qt::AlignRight, QString(" ( virtual Item painting ) "));
}
コード例 #11
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::draw() {
	ofxUIPushStyle();
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	
	drawPadded();
	drawPaddedOutline();
	drawBack();
	drawOutline();
	drawOutlineHighlight();
	drawFill();
	drawFillHighlight();
	
	ofxUIPopStyle();
}
コード例 #12
0
void ofxUIDropDownList::draw()
{
    ofxUIPushStyle();
    
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    
    drawPadded();
    drawPaddedOutline();
    
    drawBack();
    
    drawOutline();
    drawOutlineHighlight();
    
    drawFill();
    drawFillHighlight();
    
    ofxUIPopStyle();
}
コード例 #13
0
ファイル: SceneBase.cpp プロジェクト: Rengaht/PExtraUI
void SceneBase::draw(bool debug_mode){
	
	ofPushStyle();
	float alpha_=255.0*_anim_in.getPortion()*(1-_anim_out.getPortion());
	ofSetColor(255,alpha_);
		
		drawBack();
		
		if(_img_back.bAllocated()){
				_img_back.draw(0,0,ofGetWidth(),ofGetHeight());
		}
		drawFront();

	ofPopStyle();

	if(debug_mode){
		for(int i=0;i<_mbutton;++i) 
			if(_arr_button[i].isEnable()) _arr_button[i].draw();
	}



}
コード例 #14
0
ファイル: itemmonitor.cpp プロジェクト: CGRU/cgru
void ItemMonitor::paint( QPainter *painter, const QStyleOptionViewItem &option) const
{
    drawBack( painter, option, isSuperUser() ? &(afqt::QEnvironment::clr_LinkVisited.c) : NULL);

    int x = option.rect.x();
    int y = option.rect.y();
    int w = option.rect.width();
    int h = option.rect.height();

    painter->setPen(   clrTextMain( option) );
    painter->setFont(  afqt::QEnvironment::f_name);
    painter->drawText( option.rect, Qt::AlignTop | Qt::AlignHCenter, m_name );

    painter->setPen(   clrTextInfo( option) );
    painter->setFont(  afqt::QEnvironment::f_info);
    painter->drawText( x+10, y+15, eventstitle );
    for( int e = 0; e < eventscount; e++)
        painter->drawText( x+5, y+30+12*e, events[e] );

    painter->setPen(   clrTextInfo( option) );
    painter->setFont(  afqt::QEnvironment::f_info);
    int i = y+2;
    int dy = 15;
    painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignRight, time_launch_str );
    painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignRight, time_register_str );
    painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignRight, time_activity_str );

    painter->drawText( x, y, w-5, h, Qt::AlignBottom | Qt::AlignRight, address_str );

    i = y+2;
    painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignHCenter, m_user_id_str );
    painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignHCenter, jobsidstitle );
    painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignHCenter, jobsids );

    painter->drawText( x, y+2, w-5, h, Qt::AlignTop | Qt::AlignRight, engine );
}
コード例 #15
0
ファイル: GameMain.cpp プロジェクト: autch/aquaplus_gpl
BOOL Render()
{
	int			i;

	sysInf.animeCnt ++;
	if(bgInf.shake_cnt) bgInf.shake_cnt ++;
	if(saveInf.bWave) saveInf.waveCnt ++;
	if(saveInf.demo && saveInf.demo_max){
		saveInf.demo_cnt ++;
		if(saveInf.demo_cnt>=saveInf.demo_max)saveInf.demo = 0;
	}
	DWORD	nowTime = timeGetTime() -sysInf.oldTime;
	if(nowTime<=0 || sysInf.bForceRender){
		fps = 1000 /FPS_CYCLE;
	}else{
#ifdef bFpsSet
		if(nowTime <DWORD(FPS_CYCLE*(sysInf.render_skip+1))){
			Sleep(FPS_CYCLE*(sysInf.render_skip+1)-nowTime);
			nowTime = timeGetTime() -sysInf.oldTime;
		}else if(sysInf.render_skip<5){
			sysInf.render_skip ++;
			return FALSE;
		}
#endif
		fps = 1000/(nowTime);
	}
	sysInf.bForceRender = off;
	sysInf.oldTime = timeGetTime();
	sysInf.render_skip = 0;

	switch(sysInf.execMode){
	  case opening_mode:
		titleWnd->Draw();
		break;
	  case backlog_mode:
		backLog.DrawBackLog();
		break;
	  case staffRoll_mode:
		lpStaffRoll->Draw();
		break;
	  case save_mode:
	  case load_mode:
		if(saveWnd)saveWnd->Blt();
		break;
	  case menu_mode:
		lpMenuWnd->Draw();
		break;
	  case kabegami_mode:
		lpKabeSetWnd->Draw();
		break;
	  case staffmode_mode:
		lpStaffmodeWnd->Draw();
		break;
	  default:
		drawBG();
		SetBmpDraw();
		drawChar();
		drawBack();
		msgWnd.BltMessage();
		selectWnd.selectBlt();
		break;
	}
#ifdef _DEBUG
	if(sysInf.bInfo){
		sprintf(debugBuf,"fps=%3d",fps);
		TextOut(g_DibInf.memDC,10,10,debugBuf,strlen(debugBuf));
	}
#endif
	return TRUE;
} // Render
コード例 #16
0
ファイル: ctextlabel.cpp プロジェクト: DaniM/lyngo
//------------------------------------------------------------------------
void CTextLabel::draw (CDrawContext *pContext)
{
	drawBack (pContext);
	drawText (pContext, truncatedText.empty () ? text : truncatedText.c_str ());
	setDirty (false);
}
コード例 #17
0
//--------------------------------------------------------------
void kinectApp::draw(){
    
    //-- background --//
    drawBack();
    
    
    //-- show tracking results --//
    ofSetColor(255, 255, 255);
    
    if (isLive) {
        drawCamView();
        
        if (hands) { drawAllHands(); }
        if (skel) { drawSkeletons(); }
        if (objects) { drawObjects(); }
        
        drawDetails();
    }
    
    
    ofSetColor (255, 255, 255);
    
    
    //-- show FrameRate --//
    stringstream msgA;
    msgA
    //<< "FrameRate: " << ofToString(int(ofGetFrameRate())) << endl //uncomment this to get processed FrameRate
    << "FrameRate: " << ofToString(fps) << " " << endl;
    usedFont.drawString(msgA.str(), 16, 126);
    
    
    //-- calculate & display tracking status --//
    if (isLive && skel) { statusSkeletons = ofToString(openNIDevices.getNumTrackedUsers()); }
    else { statusSkeletons = "0"; }
    
    if (isLive && hands) { statusHands = ofToString(openNIDevices.getNumTrackedHands()); }
    else { statusHands = "0"; }
    
    if (isLive && objects) { statusObjects = ofToString(contourFinder.blobs.size()); }
    else { statusObjects = "0"; }
    
    stringstream msgB;
    msgB
    << "Hands: " << statusHands << endl
    << "Skeletons: " << statusSkeletons << endl
    << "Objects: " << statusObjects << endl;
    usedFont.drawString(msgB.str(), 136, 126);
    
    
    //-- show status of settings (new, saved, loaded or reset) --//
    stringstream msgC;
    msgC
    << "Settings: " << statusConfig << endl;
    usedFont.drawString(msgC.str(), 256, 126);	
    
    
    //-- show osc info --//
    stringstream msgD;
    msgD
    << "SEND DATA TO" << endl
    << "Host: " << host << endl
    << "Port: " << ofToString(port) << endl;
    usedFont.drawString(msgD.str(), 471, 126);
}
コード例 #18
0
ファイル: ctextlabel.cpp プロジェクト: EQ4/vstgui
//------------------------------------------------------------------------
void CTextLabel::draw (CDrawContext *pContext)
{
	drawBack (pContext);
	drawPlatformText (pContext, truncatedText.empty () ? text.getPlatformString () : truncatedText.getPlatformString ());
	setDirty (false);
}
コード例 #19
0
ファイル: main.c プロジェクト: Jersono/Type-Lab4-CC3
int main(){
	/*Game Settings*/

	State state = STARTED;
	int render = 0;
	ALLEGRO_DISPLAY *display;
	ALLEGRO_EVENT_QUEUE *queue;
	ALLEGRO_TIMER *timer;
	ALLEGRO_FONT *pixelate;
	ALLEGRO_BITMAP *back1;
	ALLEGRO_BITMAP *back2;
	ALLEGRO_BITMAP *space;
	ALLEGRO_BITMAP *logo;
	struct Background bg1;
	struct Background bg2;
	struct Background bgspace;

	al_init();

	display = al_create_display(800, 600);
	al_set_window_position(display, 100, 100);
	al_set_window_title(display, "GaliType - Grupo 6");

	al_init_font_addon();
	al_init_ttf_addon();
	al_init_image_addon();
	al_install_keyboard();

	back1 = al_load_bitmap("back1.png");
	back2 = al_load_bitmap("back2.png");
	space = al_load_bitmap("space.jpg");
	logo = al_load_bitmap("logo.png");

	initBack(&bg1, 0, 0, 1.5, -1, 800, 600, back1);
	initBack(&bg2, 0, 0, 1, -1, 800, 600, back2);
	initBack(&bgspace, 0, 0, 0.5, -1, 1000, 600, space);

	queue = al_create_event_queue();
	timer = al_create_timer(1.0 / 60);

	al_register_event_source(queue, al_get_timer_event_source(timer));
	al_register_event_source(queue, al_get_keyboard_event_source());
	al_register_event_source(queue, al_get_display_event_source(display));



	pixelate = al_load_ttf_font("Pixelate.ttf", 30, 0);

	al_start_timer(timer);
	while (state != FINISHED){
		ALLEGRO_EVENT ev;
		al_wait_for_event(queue, &ev);
		if (ev.type == ALLEGRO_EVENT_KEY_DOWN){
			if (state == STARTED){
				switch (ev.keyboard.keycode)
				{
				case ALLEGRO_KEY_ESCAPE:
					state = FINISHED;
					break;
				case ALLEGRO_KEY_ENTER:
					state = SELECT_DIFFICULTY;
					break;
				}
			}
			if (state == SELECT_DIFFICULTY){
				switch (ev.keyboard.keycode){
					case ALLEGRO_KEY_1:
					case ALLEGRO_KEY_PAD_1:
						startGame(EASY);
						break;
					case ALLEGRO_KEY_2:
					case ALLEGRO_KEY_PAD_2:
						startGame(MEDIUM);
						break;
					case ALLEGRO_KEY_3:
					case ALLEGRO_KEY_PAD_3:
						startGame(HARD);
						break;
					case ALLEGRO_KEY_4:
					case ALLEGRO_KEY_PAD_4:
						startGame(TYPING_MASTER);
						break;
					case ALLEGRO_KEY_ESCAPE:
						state = STARTED;
						break;
				}
			}
		}

		else if (ev.type == ALLEGRO_EVENT_TIMER)
		{
			updateBack(&bg1);
			updateBack(&bg2);
			updateBack(&bgspace);
			render = 1;
		}
		else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE){
			state = FINISHED;
		}
		if (render == 1 && al_is_event_queue_empty(queue))
		{
			render = 0;
			drawBack(&bgspace);
			drawBack(&bg1);
			drawBack(&bg2);

			al_draw_bitmap(logo, 50, 25, 0);
			if (state == STARTED){
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 250, 0, "Get ready to type...");
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 350, 0, "Press Enter to start a new game");
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 450, 0, "Press Esc to exit.");
			}
			if (state == SELECT_DIFFICULTY){
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 250, 0, "Select difficulty:");
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 300, 0, "1. Easy");
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 350, 0, "2. Medium");
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 400, 0, "3. Hard");
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 450, 0, "4. Typing Boss");
				al_draw_text(pixelate, al_map_rgb(255, 255, 255), 50, 500, 0, "Press Esc to return...");
			}
			al_flip_display();
			al_clear_to_color(al_map_rgb(0, 0, 0));

		}

	}

	al_destroy_bitmap(back1);
	al_destroy_bitmap(back2);
	al_destroy_bitmap(space);
	al_destroy_bitmap(logo);
	al_destroy_font(pixelate);
	al_destroy_display(display);
	return 0;
}
コード例 #20
0
ファイル: graphics.c プロジェクト: naknut/Project-Puzzle
void options(char ip[])
{
    int quit = 0;
    int menu_choice = 0;
    //fps
    struct timer_t2 fps;

    init_options();
    init_font();

    //wait for user to continue or exit
    while( quit != 1 )
    {
        //Start the frame timer
        timer_start(&fps);
        //While there are events to handle
        while( SDL_PollEvent( &event ) )
        {

            if( event.type == SDL_QUIT )
            {
                //exit
                clean_up();
                exit(0);
            }
            if( event.type == SDL_KEYDOWN )
            {
                switch(event.key.keysym.sym)
                {
                    case SDLK_ESCAPE:
                        quit = 1; break;
                }
            }

            mouse_over_options(event.button.x, event.button.y);

            if( event.type == SDL_MOUSEBUTTONDOWN)
            {
                switch(event.button.button)
                {
                    case SDL_BUTTON_LEFT:
                        press_options(event.button.x, event.button.y);
                        break;
                }
            }


            if( event.type == SDL_MOUSEBUTTONUP)
            {
                switch(event.button.button)
                {
                    case SDL_BUTTON_LEFT:
                        menu_choice = press_options(event.button.x, event.button.y);
                        break;
                }
            }

            switch(menu_choice)
            {
                case 1:
                    handle_input(event,ip);
                    printf("String in graphics.c (%s)\n",ip);
                    break;
                case 2:
                    quit = 1;
                    printf("Försöker bryta ut ur options\n");
                    break;
                default:
                    break;
            }
        }
        apply_letter(ip);
        apply_texture();

        startDraw();
        //draw menu
        drawOptions(SCREEN_WIDTH, SCREEN_HEIGHT);
        drawBack();
        endDraw();

        if( timer_get_ticks(&fps) < 1000 / FRAMES_PER_SECOND )
        {
            //delay the as much time as we need to get desired frames per second
            SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - timer_get_ticks(&fps) );
        }
    }
}