コード例 #1
0
void drawInventoryItem(video::IVideoDriver *driver,
		gui::IGUIFont *font,
		InventoryItem *item, core::rect<s32> rect,
		const core::rect<s32> *clip)
{
	if(item == NULL)
		return;

	video::ITexture *texture = NULL;
	texture = item->getImage();

	if(texture != NULL)
	{
		const video::SColor color(255,255,255,255);
		const video::SColor colors[] = {color,color,color,color};
		driver->draw2DImage(texture, rect,
			core::rect<s32>(core::position2d<s32>(0,0),
			core::dimension2di(texture->getOriginalSize())),
			clip, colors, true);
	}
	else
	{
		video::SColor bgcolor(255,50,50,128);
		driver->draw2DRectangle(bgcolor, rect, clip);
	}

	if(font != NULL)
	{
		std::string text = item->getText();
		if(font && text != "")
		{
			v2u32 dim = font->getDimension(narrow_to_wide(text).c_str());
			v2s32 sdim(dim.X,dim.Y);

			core::rect<s32> rect2(
				/*rect.UpperLeftCorner,
				core::dimension2d<u32>(rect.getWidth(), 15)*/
				rect.LowerRightCorner - sdim,
				sdim
			);

			video::SColor bgcolor(128,0,0,0);
			driver->draw2DRectangle(bgcolor, rect2, clip);

			font->draw(text.c_str(), rect2,
					video::SColor(255,255,255,255), false, false,
					clip);
		}
	}
}
コード例 #2
0
ファイル: main.c プロジェクト: gardners/synthmark
void fixscreen (void)
{
    memset((unsigned char*)0xd800, 14, 0x3e8);
    bordercolor(14);
    bgcolor(6);
    textcolor(14);
}
コード例 #3
0
ファイル: l_object.cpp プロジェクト: hondalyfe88/MultiCraft
// get_sky(self)
int ObjectRef::l_get_sky(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;
	ObjectRef *ref = checkobject(L, 1);
	Player *player = getplayer(ref);
	if (player == NULL)
		return 0;
	video::SColor bgcolor(255, 255, 255, 255);
	std::string type;
	std::vector<std::string> params;

	player->getSky(&bgcolor, &type, &params);
	type = type == "" ? "regular" : type;

	push_ARGB8(L, bgcolor);
	lua_pushlstring(L, type.c_str(), type.size());
	lua_newtable(L);
	s16 i = 1;
	for (std::vector<std::string>::iterator it = params.begin();
			it != params.end(); ++it) {
		lua_pushlstring(L, it->c_str(), it->size());
		lua_rawseti(L, -2, i);
		i++;
	}
	return 3;
}
コード例 #4
0
ファイル: guiMainMenu.cpp プロジェクト: MarkTraceur/minetest
void GUIMainMenu::drawMenu()
{
	gui::IGUISkin* skin = Environment->getSkin();
	if (!skin)
		return;
	video::IVideoDriver* driver = Environment->getVideoDriver();
	
	/*video::SColor bgcolor(140,0,0,0);
	driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);*/

	video::SColor bgcolor(140,0,0,0);

	{
		core::rect<s32> rect(0, 0, 620, 230);
		rect += AbsoluteRect.UpperLeftCorner;
		driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
	}

	{
		core::rect<s32> rect(0, 250, 620, 430);
		rect += AbsoluteRect.UpperLeftCorner;
		driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);
	}

	gui::IGUIElement::draw();
}
コード例 #5
0
ファイル: screen.c プロジェクト: FrankBuss/kerberos
/**
 * Initialize the screen. Set up colors and clear it.
 */
void screenInit(void)
{
    bgcolor(COLOR_BACKGROUND);
    bordercolor(COLOR_BACKGROUND);
    textcolor(COLOR_FOREGROUND);
    clrscr();
}
コード例 #6
0
ファイル: main.c プロジェクト: afester/CodeSamples
int main() {
    clrscr();
    bordercolor(0);
    bgcolor(6);

    renderMenu(100);

    textcolor(7);
    gotoxy(0, 1);
    updateStatus(' ');
    cursor(1);
    while(1) {
        char c;
/*
        uint8_t row;
        uint8_t col;
        for (row = 0;  row < 16;  row++) {
            gotoxy(0, row + 3);
            cprintf("%3d ", row * 16);
            for (col = 0;  col < 16;  col++) {
                cputc(row * 16 + col);
                cputc(' ');
            }
        }
*/
        c = cgetc();

        if (c == 20) {
            // backspace
        } else if (c == 13) {
            // Return
        } else if (c == 157) {
            // Left
            uint8_t xpos = wherex() - 1;
            gotox(xpos);
        } else if (c == 29) {
            // Right
            uint8_t xpos = wherex() + 1;
            gotox(xpos);
        } else if (c == 17) {
            // Down
            uint8_t ypos = wherey() + 1;
            gotoy(ypos);
        } else if (c == 145) {
            // Up
            uint8_t ypos = wherey() - 1;
            gotoy(ypos);
        } else if (c == 19) {
            // Pos1
        } else if (c == 3) {
            // ESC -> Menu
            processMenu();
        } else {
            cputc(c);
        }        

        
        updateStatus(c);
    }
}
コード例 #7
0
ファイル: guiEngine.cpp プロジェクト: CodeMyAss/minetest
void GUIEngine::drawHeader(video::IVideoDriver* driver)
{
	core::dimension2d<u32> screensize = driver->getScreenSize();

	video::ITexture* texture = m_textures[TEX_LAYER_HEADER].texture;

	/* If no texture, draw nothing */
	if(!texture)
		return;

	f32 mult = (((f32)screensize.Width / 2.0)) /
			((f32)texture->getOriginalSize().Width);

	v2s32 splashsize(((f32)texture->getOriginalSize().Width) * mult,
			((f32)texture->getOriginalSize().Height) * mult);

	// Don't draw the header is there isn't enough room
	s32 free_space = (((s32)screensize.Height)-320)/2;

	if (free_space > splashsize.Y) {
		core::rect<s32> splashrect(0, 0, splashsize.X, splashsize.Y);
		splashrect += v2s32((screensize.Width/2)-(splashsize.X/2),
				((free_space/2)-splashsize.Y/2)+10);

	video::SColor bgcolor(255,50,50,50);

	driver->draw2DImage(texture, splashrect,
		core::rect<s32>(core::position2d<s32>(0,0),
		core::dimension2di(texture->getOriginalSize())),
		NULL, NULL, true);
	}
}
コード例 #8
0
void GUIInventoryMenu::drawMenu()
{
	gui::IGUISkin* skin = Environment->getSkin();
	if (!skin)
		return;
	video::IVideoDriver* driver = Environment->getVideoDriver();

	video::SColor bgcolor(140,0,0,0);
	driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);

	/*
		Draw items
	*/

	for(u32 i=0; i<m_draw_spec.size(); i++)
	{
		ListDrawSpec &s = m_draw_spec[i];
		drawList(s);
	}

	/*
		Call base class
	*/
	gui::IGUIElement::draw();
}
コード例 #9
0
ファイル: l_object.cpp プロジェクト: rubenwardy/minetest
// get_sky(self)
int ObjectRef::l_get_sky(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;
	ObjectRef *ref = checkobject(L, 1);
	RemotePlayer *player = getplayer(ref);
	if (player == NULL)
		return 0;
	video::SColor bgcolor(255, 255, 255, 255);
	std::string type;
	std::vector<std::string> params;
	bool clouds;

	player->getSky(&bgcolor, &type, &params, &clouds);
	type = type.empty() ? "regular" : type;

	push_ARGB8(L, bgcolor);
	lua_pushlstring(L, type.c_str(), type.size());
	lua_newtable(L);
	s16 i = 1;
	for (const std::string &param : params) {
		lua_pushlstring(L, param.c_str(), param.size());
		lua_rawseti(L, -2, i++);
	}
	lua_pushboolean(L, clouds);
	return 4;
}
コード例 #10
0
ファイル: ctk-conio.c プロジェクト: Inscribe/msp430xf1611
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_init(void)
{
  (void)bgcolor(SCREENCOLOR);
  (void)bordercolor(BORDERCOLOR);
  screensize(&sizex, &sizey);
  ctk_draw_clear(0, sizey);
}
コード例 #11
0
ファイル: hello.c プロジェクト: cc65/cc65
int main (void)
{
    unsigned char XSize, YSize;

    /* Set screen colors */
    (void) textcolor (COLOR_WHITE);
    (void) bordercolor (COLOR_BLACK);
    (void) bgcolor (COLOR_BLACK);

    /* Clear the screen, put cursor in upper left corner */
    clrscr ();

    /* Ask for the screen size */
    screensize (&XSize, &YSize);

    /* Draw a border around the screen */

    /* Top line */
    cputc (CH_ULCORNER);
    chline (XSize - 2);
    cputc (CH_URCORNER);

    /* Vertical line, left side */
    cvlinexy (0, 1, YSize - 2);

    /* Bottom line */
    cputc (CH_LLCORNER);
    chline (XSize - 2);
    cputc (CH_LRCORNER);

    /* Vertical line, right side */
    cvlinexy (XSize - 1, 1, YSize - 2);

    /* Write the greeting in the mid of the screen */
    gotoxy ((XSize - strlen (Text)) / 2, YSize / 2);
    cprintf ("%s", Text);

#if defined(__NES__) || defined(__PCE__) || defined(__GAMATE__) || defined(__ATARI5200__)

    /* Wait for the user to press a button */
    joy_install (joy_static_stddrv);
    while (!joy_read (JOY_1)) ;
    joy_uninstall ();

#else

    /* Wait for the user to press a key */
    cgetc ();

#endif

    /* Clear the screen again */
    clrscr ();

    /* Done */
    return EXIT_SUCCESS;
}
コード例 #12
0
void GUIInventoryMenu::drawList(const ListDrawSpec &s)
{
	video::IVideoDriver* driver = Environment->getVideoDriver();

	// Get font
	gui::IGUIFont *font = NULL;
	gui::IGUISkin* skin = Environment->getSkin();
	if (skin)
		font = skin->getFont();
	
	Inventory *inv = m_invmgr->getInventory(m_c, s.inventoryname);
	assert(inv);
	InventoryList *ilist = inv->getList(s.listname);
	
	core::rect<s32> imgrect(0,0,imgsize.X,imgsize.Y);
	
	for(s32 i=0; i<s.geom.X*s.geom.Y; i++)
	{
		s32 x = (i%s.geom.X) * spacing.X;
		s32 y = (i/s.geom.X) * spacing.Y;
		v2s32 p(x,y);
		core::rect<s32> rect = imgrect + s.pos + p;
		InventoryItem *item = NULL;
		if(ilist)
			item = ilist->getItem(i);

		if(m_selected_item != NULL && m_selected_item->listname == s.listname
				&& m_selected_item->i == i)
		{
			/*s32 border = imgsize.X/12;
			driver->draw2DRectangle(video::SColor(255,192,192,192),
					core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*border,
							rect.LowerRightCorner + v2s32(1,1)*border),
					NULL);
			driver->draw2DRectangle(video::SColor(255,0,0,0),
					core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*((border+1)/2),
							rect.LowerRightCorner + v2s32(1,1)*((border+1)/2)),
					NULL);*/
			s32 border = 2;
			driver->draw2DRectangle(video::SColor(255,255,0,0),
					core::rect<s32>(rect.UpperLeftCorner - v2s32(1,1)*border,
							rect.LowerRightCorner + v2s32(1,1)*border),
					&AbsoluteClippingRect);
		}

		video::SColor bgcolor(255,128,128,128);
		driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect);

		if(item)
		{
			drawInventoryItem(driver, font, item,
					rect, &AbsoluteClippingRect);
		}

	}
}
コード例 #13
0
ファイル: ctk-conio.c プロジェクト: 13416795/contiki
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_init(void)
{
  (void)bgcolor(SCREENCOLOR);
  (void)bordercolor(BORDERCOLOR);
  (void)textcolor(WINDOWCOLOR_FOCUS);
  screensize(&sizex, &sizey);
  ctk_draw_clear(0, sizey);
  gotoxy(0, 0);
}
コード例 #14
0
ファイル: guiVolumeChange.cpp プロジェクト: Bremaweb/minetest
void GUIVolumeChange::drawMenu()
{
	gui::IGUISkin* skin = Environment->getSkin();
	if (!skin)
		return;
	video::IVideoDriver* driver = Environment->getVideoDriver();
	video::SColor bgcolor(140, 0, 0, 0);
	driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
	gui::IGUIElement::draw();
}
コード例 #15
0
// virtual
void AbstractGroupItem::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *)
{
    QColor bgcolor(100, 100, 200, 100);
    QRectF bound = option->exposedRect.adjusted(0, 0, 1, 1);
    p->setClipRect(bound);
    p->setBrush(bgcolor);
    QPen pen = p->pen();
    pen.setColor(QColor(200, 90, 90));
    pen.setStyle(Qt::DashLine);
    pen.setWidthF(0.0);
    p->setPen(pen);
    p->drawRoundedRect(boundingRect().adjusted(0, 0, -1, 0), 3, 3);
}
コード例 #16
0
ファイル: contiki-main.c プロジェクト: 1uk3/contiki
/*-----------------------------------------------------------------------------------*/
void
main(void)
{
  struct ethernet_config *ethernet_config;

  clrscr();
  bordercolor(BORDERCOLOR);
  bgcolor(SCREENCOLOR);

  process_init();

#if 1
  ethernet_config = config_read("contiki.cfg");
#else
  {
    static struct ethernet_config config = {0xD500, "cs8900a.eth"};
    uip_ipaddr_t addr;

    uip_ipaddr(&addr, 192,168,0,128);
    uip_sethostaddr(&addr);

    uip_ipaddr(&addr, 255,255,255,0);
    uip_setnetmask(&addr);

    uip_ipaddr(&addr, 192,168,0,1);
    uip_setdraddr(&addr);

    uip_ipaddr(&addr, 192,168,0,1);
    resolv_conf(&addr);

    ethernet_config = &config;
  }
#endif

  procinit_init();

  process_start((struct process *)&ethernet_process, (char *)ethernet_config);

  autostart_start(autostart_processes);

  log_message("Contiki up and running ...", "");

  while(1) {

    process_run();

    etimer_request_poll();
  }
}
コード例 #17
0
void GUIConfirmRegistration::drawMenu()
{
	gui::IGUISkin *skin = Environment->getSkin();
	if (!skin)
		return;
	video::IVideoDriver *driver = Environment->getVideoDriver();

	video::SColor bgcolor(140, 0, 0, 0);
	driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);

	gui::IGUIElement::draw();
#ifdef __ANDROID__
	getAndroidUIInput();
#endif
}
コード例 #18
0
ファイル: guiMessage.cpp プロジェクト: Jeija/BlockPlanet
void GUIMessage::drawMenu()
{
	gui::IGUISkin* skin = Environment->getSkin();
	if (!skin)
	{
		return;
	}
	video::IVideoDriver* driver = Environment->getVideoDriver();
	{
		video::SColor bgcolor(50,0,0,0);
		driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
	}

	gui::IGUIElement::draw();
}
コード例 #19
0
ファイル: main.cpp プロジェクト: Silenthal/minetest
void drawMenuBackground(video::IVideoDriver* driver)
{
	core::dimension2d<u32> screensize = driver->getScreenSize();
		
	video::ITexture *bgtexture =
			driver->getTexture(getTexturePath("menubg.png").c_str());
	if(bgtexture)
	{
		s32 scaledsize = 128;
		
		// The important difference between destsize and screensize is
		// that destsize is rounded to whole scaled pixels.
		// These formulas use component-wise multiplication and division of v2u32.
		v2u32 texturesize = bgtexture->getSize();
		v2u32 sourcesize = texturesize * screensize / scaledsize + v2u32(1,1);
		v2u32 destsize = scaledsize * sourcesize / texturesize;
		
		// Default texture wrapping mode in Irrlicht is ETC_REPEAT.
		driver->draw2DImage(bgtexture,
			core::rect<s32>(0, 0, destsize.X, destsize.Y),
			core::rect<s32>(0, 0, sourcesize.X, sourcesize.Y),
			NULL, NULL, true);
	}
	
	video::ITexture *logotexture =
			driver->getTexture(getTexturePath("menulogo.png").c_str());
	if(logotexture)
	{
		v2s32 logosize(logotexture->getOriginalSize().Width,
				logotexture->getOriginalSize().Height);
		logosize *= 4;

		video::SColor bgcolor(255,50,50,50);
		core::rect<s32> bgrect(0, screensize.Height-logosize.Y-20,
				screensize.Width, screensize.Height);
		driver->draw2DRectangle(bgcolor, bgrect, NULL);

		core::rect<s32> rect(0,0,logosize.X,logosize.Y);
		rect += v2s32(screensize.Width/2,screensize.Height-10-logosize.Y);
		rect -= v2s32(logosize.X/2, 0);
		driver->draw2DImage(logotexture, rect,
			core::rect<s32>(core::position2d<s32>(0,0),
			core::dimension2di(logotexture->getSize())),
			NULL, NULL, true);
	}
}
コード例 #20
0
ファイル: main.cpp プロジェクト: Oblomov/minetest
void drawMenuBackground(video::IVideoDriver* driver)
{
	core::dimension2d<u32> screensize = driver->getScreenSize();
		
	video::ITexture *bgtexture =
			driver->getTexture(getTexturePath("menubg.png").c_str());
	if(bgtexture)
	{
		s32 texturesize = 128;
		s32 tiled_y = screensize.Height / texturesize + 1;
		s32 tiled_x = screensize.Width / texturesize + 1;
		
		for(s32 y=0; y<tiled_y; y++)
		for(s32 x=0; x<tiled_x; x++)
		{
			core::rect<s32> rect(0,0,texturesize,texturesize);
			rect += v2s32(x*texturesize, y*texturesize);
			driver->draw2DImage(bgtexture, rect,
				core::rect<s32>(core::position2d<s32>(0,0),
				core::dimension2di(bgtexture->getSize())),
				NULL, NULL, true);
		}
	}
	
	video::ITexture *logotexture =
			driver->getTexture(getTexturePath("menulogo.png").c_str());
	if(logotexture)
	{
		v2s32 logosize(logotexture->getOriginalSize().Width,
				logotexture->getOriginalSize().Height);
		logosize *= 4;

		video::SColor bgcolor(255,50,50,50);
		core::rect<s32> bgrect(0, screensize.Height-logosize.Y-20,
				screensize.Width, screensize.Height);
		driver->draw2DRectangle(bgcolor, bgrect, NULL);

		core::rect<s32> rect(0,0,logosize.X,logosize.Y);
		rect += v2s32(screensize.Width/2,screensize.Height-10-logosize.Y);
		rect -= v2s32(logosize.X/2, 0);
		driver->draw2DImage(logotexture, rect,
			core::rect<s32>(core::position2d<s32>(0,0),
			core::dimension2di(logotexture->getSize())),
			NULL, NULL, true);
	}
}
コード例 #21
0
void GUIDeathScreen::drawMenu()
{
  gui::IGUISkin* skin = Environment->getSkin();
  if (!skin)
    return;
  video::IVideoDriver* driver = Environment->getVideoDriver();
  
  {
    video::SColor color(180,50,0,0);
    driver->draw2DRectangle(color,
			    core::rect<s32>(0,0,m_screensize.X,m_screensize.Y), NULL);
  }
  {
    video::SColor bgcolor(50,0,0,0);
    driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
  }
  
  gui::IGUIElement::draw();
}
コード例 #22
0
void GameLevelChooser::paintEvent(QPaintEvent *event)
{
    this->setGeometry(parent->rect());
    MyPainter painter(this);
    painter.drawImage(this->rect(),*backImage);
    QColor bgcolor(Qt::white);
    bgcolor.setAlpha(200);
    painter.fillRect(this->rect(),bgcolor);

    int _h = this->height(), _w = this->width();
    Title->setGeometry(_w*0.2,_h*0.05,_w*0.6,_h*0.2);
    levelLabel->setGeometry(_w*0.15,_h*0.3,_w*0.35,_h*0.1);
    gameNoLabel->setGeometry(_w*0.55,_h*0.3,_w*0.35,_h*0.1);
    levelChooser->setGeometry(_w*0.15,_h*0.45,_w*0.35,_h*0.35);
    gameNoChooser->setGeometry(_w*0.55,_h*0.45,_w*0.35,_h*0.35);
    confirmButton->setGeometry(_w*0.55,_h*0.85,_w*0.35,_h*0.07);
    menuButton->setGeometry(_w*0.15,_h*0.85,_w*0.35,_h*0.07);

    GameViewPanel::paintEvent(event);
}
コード例 #23
0
ファイル: l_object.cpp プロジェクト: theDrake/minetest
// set_sky(self, bgcolor, type, list, clouds = true)
int ObjectRef::l_set_sky(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;
	ObjectRef *ref = checkobject(L, 1);
	RemotePlayer *player = getplayer(ref);
	if (player == NULL)
		return 0;

	video::SColor bgcolor(255,255,255,255);
	read_color(L, 2, &bgcolor);

	std::string type = luaL_checkstring(L, 3);

	std::vector<std::string> params;
	if (lua_istable(L, 4)) {
		lua_pushnil(L);
		while (lua_next(L, 4) != 0) {
			// key at index -2 and value at index -1
			if (lua_isstring(L, -1))
				params.push_back(lua_tostring(L, -1));
			else
				params.push_back("");
			// removes value, keeps key for next iteration
			lua_pop(L, 1);
		}
	}

	if (type == "skybox" && params.size() != 6)
		throw LuaError("skybox expects 6 textures");

	bool clouds = true;
	if (lua_isboolean(L, 5))
		clouds = lua_toboolean(L, 5);

	if (!getServer(L)->setSky(player, bgcolor, type, params, clouds))
		return 0;

	lua_pushboolean(L, true);
	return 1;
}
コード例 #24
0
ファイル: dbg.c プロジェクト: AntiheroSoftware/cc65
static void RedrawStatic (char Frame)
/* Redraw static display stuff */
{
    /* Reset the active frame */
    ActiveFrame = -1;

    /* Clear the screen hide the cursor */
    (void) bordercolor (COLOR_BORDER);
    (void) bgcolor (COLOR_BACKGROUND);
    clrscr ();
    cursor (0);

    /* Build the frame layout of the screen */
    (void) textcolor (COLOR_FRAMELOW);
    DrawFrames ();

    /* Draw the prompt line */
    HelpPrompt ();

    /* Activate the active frame */
    ActivateFrame (Frame, 0);
}
コード例 #25
0
ファイル: l_object.cpp プロジェクト: Nate-Devv/freeminer
// set_sky(self, bgcolor, type, list)
int ObjectRef::l_set_sky(lua_State *L)
{
	ObjectRef *ref = checkobject(L, 1);
	Player *player = getplayer(ref);
	if (player == NULL)
		return 0;

	video::SColor bgcolor(255,255,255,255);
	if (!lua_isnil(L, 2))
		bgcolor = readARGB8(L, 2);

	std::string type = luaL_checkstring(L, 3);

	std::vector<std::string> params;
	if (lua_istable(L, 4)) {
		int table = lua_gettop(L);
		lua_pushnil(L);
		while (lua_next(L, table) != 0) {
			// key at index -2 and value at index -1
			if (lua_isstring(L, -1))
				params.push_back(lua_tostring(L, -1));
			else
				params.push_back("");
			// removes value, keeps key for next iteration
			lua_pop(L, 1);
		}
	}

	if (type == "skybox" && params.size() != 6)
		throw LuaError("skybox expects 6 textures");

	if (!getServer(L)->setSky(player, bgcolor, type, params))
		return 0;

	lua_pushboolean(L, true);
	return 1;
}
コード例 #26
0
ファイル: checkbox.cpp プロジェクト: a397871706/plug
		checkbox::checkbox(window wd, const nana::rectangle& r, bool visible)
		{
            bgcolor(API::bgcolor(wd));
			create(wd, r, visible);
		}
コード例 #27
0
ファイル: checkbox.cpp プロジェクト: a397871706/plug
		checkbox::checkbox(window wd, const nana::char_t* text, bool visible)
		{
			create(wd, rectangle(), visible);
            bgcolor(API::bgcolor(wd));
			caption(text);
		}
コード例 #28
0
ファイル: checkbox.cpp プロジェクト: a397871706/plug
		checkbox::checkbox(window wd, bool visible)
		{
			create(wd, rectangle(), visible);
            bgcolor(API::bgcolor(wd));
		}
コード例 #29
0
ファイル: hud.cpp プロジェクト: Bloodknight/minetest
void drawItemStack(video::IVideoDriver *driver,
		gui::IGUIFont *font,
		const ItemStack &item,
		const core::rect<s32> &rect,
		const core::rect<s32> *clip,
		IGameDef *gamedef)
{
	if(item.empty())
		return;
	
	const ItemDefinition &def = item.getDefinition(gamedef->idef());
	video::ITexture *texture = gamedef->idef()->getInventoryTexture(def.name, gamedef);

	// Draw the inventory texture
	if(texture != NULL)
	{
		const video::SColor color(255,255,255,255);
		const video::SColor colors[] = {color,color,color,color};
		driver->draw2DImage(texture, rect,
			core::rect<s32>(core::position2d<s32>(0,0),
			core::dimension2di(texture->getOriginalSize())),
			clip, colors, true);
	}

	if(def.type == ITEM_TOOL && item.wear != 0)
	{
		// Draw a progressbar
		float barheight = rect.getHeight()/16;
		float barpad_x = rect.getWidth()/16;
		float barpad_y = rect.getHeight()/16;
		core::rect<s32> progressrect(
			rect.UpperLeftCorner.X + barpad_x,
			rect.LowerRightCorner.Y - barpad_y - barheight,
			rect.LowerRightCorner.X - barpad_x,
			rect.LowerRightCorner.Y - barpad_y);

		// Shrink progressrect by amount of tool damage
		float wear = item.wear / 65535.0;
		int progressmid =
			wear * progressrect.UpperLeftCorner.X +
			(1-wear) * progressrect.LowerRightCorner.X;

		// Compute progressbar color
		//   wear = 0.0: green
		//   wear = 0.5: yellow
		//   wear = 1.0: red
		video::SColor color(255,255,255,255);
		int wear_i = MYMIN(floor(wear * 600), 511);
		wear_i = MYMIN(wear_i + 10, 511);
		if(wear_i <= 255)
			color.set(255, wear_i, 255, 0);
		else
			color.set(255, 255, 511-wear_i, 0);

		core::rect<s32> progressrect2 = progressrect;
		progressrect2.LowerRightCorner.X = progressmid;
		driver->draw2DRectangle(color, progressrect2, clip);

		color = video::SColor(255,0,0,0);
		progressrect2 = progressrect;
		progressrect2.UpperLeftCorner.X = progressmid;
		driver->draw2DRectangle(color, progressrect2, clip);
	}

	if(font != NULL && item.count >= 2)
	{
		// Get the item count as a string
		std::string text = itos(item.count);
		v2u32 dim = font->getDimension(narrow_to_wide(text).c_str());
		v2s32 sdim(dim.X,dim.Y);

		core::rect<s32> rect2(
			/*rect.UpperLeftCorner,
			core::dimension2d<u32>(rect.getWidth(), 15)*/
			rect.LowerRightCorner - sdim,
			sdim
		);

		video::SColor bgcolor(128,0,0,0);
		driver->draw2DRectangle(bgcolor, rect2, clip);

		video::SColor color(255,255,255,255);
		font->draw(text.c_str(), rect2, color, false, false, clip);
	}
}
コード例 #30
0
ファイル: VDBWindow.cpp プロジェクト: Mx7f/vdb
static void makePretty(Fl_Widget * w) {
    w->color(bgcolor());
    w->labelsize(12);
}