當前位置: 首頁>>代碼示例>>Java>>正文


Java Component.getX方法代碼示例

本文整理匯總了Java中org.darkstorm.minecraft.gui.component.Component.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java Component.getX方法的具體用法?Java Component.getX怎麽用?Java Component.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.darkstorm.minecraft.gui.component.Component的用法示例。


在下文中一共展示了Component.getX方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderComponent

import org.darkstorm.minecraft.gui.component.Component; //導入方法依賴的package包/類
@Override
protected void renderComponent(Button button) {
	translateComponent(button, false);
	Rectangle area = button.getArea();
	glEnable(GL_BLEND);
	glDisable(GL_CULL_FACE);

	glDisable(GL_TEXTURE_2D);
	RenderUtil.setColor(button.getBackgroundColor());
	glBegin(GL_QUADS);
	{
		glVertex2d(0, 0);
		glVertex2d(area.width, 0);
		glVertex2d(area.width, area.height);
		glVertex2d(0, area.height);
	}
	glEnd();
	Point mouse = RenderUtil.calculateMouseLocation();
	Component parent = button.getParent();
	while(parent != null) {
		mouse.x -= parent.getX();
		mouse.y -= parent.getY();
		parent = parent.getParent();
	}
	if(area.contains(mouse)) {
		glColor4f(0.0f, 0.0f, 0.0f, Mouse.isButtonDown(0) ? 0.5f : 0.3f);
		glBegin(GL_QUADS);
		{
			glVertex2d(0, 0);
			glVertex2d(area.width, 0);
			glVertex2d(area.width, area.height);
			glVertex2d(0, area.height);
		}
		glEnd();
	}
	glEnable(GL_TEXTURE_2D);

	String text = button.getText();
	theme.getFontRenderer().drawString(
			text,
			area.width / 2 - theme.getFontRenderer().getStringWidth(text)
					/ 2,
			area.height / 2 - theme.getFontRenderer().FONT_HEIGHT / 2,
			RenderUtil.toRGBA(button.getForegroundColor()));

	glEnable(GL_CULL_FACE);
	glDisable(GL_BLEND);
	translateComponent(button, true);
}
 
開發者ID:CheataClient,項目名稱:CheataClientSrc,代碼行數:50,代碼來源:SimpleButtonUI.java

示例2: renderComponent

import org.darkstorm.minecraft.gui.component.Component; //導入方法依賴的package包/類
@Override
protected void renderComponent(CheckButton button) {
	translateComponent(button, false);
	Rectangle area = button.getArea();
	glEnable(GL_BLEND);
	glDisable(GL_CULL_FACE);

	glDisable(GL_TEXTURE_2D);
	RenderUtil.setColor(button.getBackgroundColor());
	int size = area.height - 4;
	glBegin(GL_QUADS);
	{
		glVertex2d(2, 2);
		glVertex2d(size + 2, 2);
		glVertex2d(size + 2, size + 2);
		glVertex2d(2, size + 2);
	}
	glEnd();
	if(button.isSelected()) {
		glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
		glBegin(GL_QUADS);
		{
			glVertex2d(3, 3.5);
			glVertex2d(size + 0.5, 3.5);
			glVertex2d(size + 0.5, size + 1);
			glVertex2d(3, size + 1);
		}
		glEnd();
	}
	glLineWidth(1.0f);
	glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
	glBegin(GL_LINE_LOOP);
	{
		glVertex2d(2, 2);
		glVertex2d(size + 2, 2);
		glVertex2d(size + 2, size + 2);
		glVertex2d(2 - 0.5, size + 2);
	}
	glEnd();
	Point mouse = RenderUtil.calculateMouseLocation();
	Component parent = button.getParent();
	while(parent != null) {
		mouse.x -= parent.getX();
		mouse.y -= parent.getY();
		parent = parent.getParent();
	}
	if(area.contains(mouse)) {
		glColor4f(0.0f, 0.0f, 0.0f, Mouse.isButtonDown(0) ? 0.5f : 0.3f);
		glBegin(GL_QUADS);
		{
			glVertex2d(0, 0);
			glVertex2d(area.width, 0);
			glVertex2d(area.width, area.height);
			glVertex2d(0, area.height);
		}
		glEnd();
	}
	glEnable(GL_TEXTURE_2D);

	String text = button.getText();
	theme.getFontRenderer().drawString(text, size + 4,
			area.height / 2 - theme.getFontRenderer().FONT_HEIGHT / 2,
			RenderUtil.toRGBA(button.getForegroundColor()));

	glEnable(GL_CULL_FACE);
	glDisable(GL_BLEND);
	translateComponent(button, true);
}
 
開發者ID:CheataClient,項目名稱:CheataClientSrc,代碼行數:69,代碼來源:SimpleCheckButtonUI.java

示例3: renderComponent

import org.darkstorm.minecraft.gui.component.Component; //導入方法依賴的package包/類
@Override
protected void renderComponent(Button button) {
    translateComponent(button, false);
    Rectangle area = button.getArea();
    glEnable(GL_BLEND);
    glDisable(GL_CULL_FACE);

    glDisable(GL_TEXTURE_2D);
    RenderUtil.setColor(button.getBackgroundColor());
    glBegin(GL_QUADS);
    {
        glVertex2d(0, 0);
        glVertex2d(area.width, 0);
        glVertex2d(area.width, area.height);
        glVertex2d(0, area.height);
    }
    glEnd();
    Point mouse = RenderUtil.calculateMouseLocation();
    Component parent = button.getParent();
    while (parent != null) {
        mouse.x -= parent.getX();
        mouse.y -= parent.getY();
        parent = parent.getParent();
    }
    if (area.contains(mouse)) {
        glColor4f(0.0f, 0.0f, 0.0f, Mouse.isButtonDown(0) ? 0.5f : 0.3f);
        glBegin(GL_QUADS);
        {
            glVertex2d(0, 0);
            glVertex2d(area.width, 0);
            glVertex2d(area.width, area.height);
            glVertex2d(0, area.height);
        }
        glEnd();
    }
    glEnable(GL_TEXTURE_2D);

    String text = button.getText();
    theme.getFontRenderer().drawString(text, area.width / 2 - theme.getFontRenderer().getStringWidth(text) / 2,
            area.height / 2 - theme.getFontRenderer().FONT_HEIGHT / 2,
            RenderUtil.toRGBA(button.getForegroundColor()));

    glEnable(GL_CULL_FACE);
    glDisable(GL_BLEND);
    translateComponent(button, true);
}
 
開發者ID:null-dev,項目名稱:EvenWurse,代碼行數:47,代碼來源:SimpleButtonUI.java

示例4: renderComponent

import org.darkstorm.minecraft.gui.component.Component; //導入方法依賴的package包/類
@Override
protected void renderComponent(CheckButton button) {
    translateComponent(button, false);
    Rectangle area = button.getArea();
    glEnable(GL_BLEND);
    glDisable(GL_CULL_FACE);

    glDisable(GL_TEXTURE_2D);
    RenderUtil.setColor(button.getBackgroundColor());
    int size = area.height - 4;
    glBegin(GL_QUADS);
    {
        glVertex2d(2, 2);
        glVertex2d(size + 2, 2);
        glVertex2d(size + 2, size + 2);
        glVertex2d(2, size + 2);
    }
    glEnd();
    if (button.isSelected()) {
        glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
        glBegin(GL_QUADS);
        {
            glVertex2d(3, 3.5);
            glVertex2d(size + 0.5, 3.5);
            glVertex2d(size + 0.5, size + 1);
            glVertex2d(3, size + 1);
        }
        glEnd();
    }
    glLineWidth(1.0f);
    glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
    glBegin(GL_LINE_LOOP);
    {
        glVertex2d(2, 2);
        glVertex2d(size + 2, 2);
        glVertex2d(size + 2, size + 2);
        glVertex2d(2 - 0.5, size + 2);
    }
    glEnd();
    Point mouse = RenderUtil.calculateMouseLocation();
    Component parent = button.getParent();
    while (parent != null) {
        mouse.x -= parent.getX();
        mouse.y -= parent.getY();
        parent = parent.getParent();
    }
    if (area.contains(mouse)) {
        glColor4f(0.0f, 0.0f, 0.0f, Mouse.isButtonDown(0) ? 0.5f : 0.3f);
        glBegin(GL_QUADS);
        {
            glVertex2d(0, 0);
            glVertex2d(area.width, 0);
            glVertex2d(area.width, area.height);
            glVertex2d(0, area.height);
        }
        glEnd();
    }
    glEnable(GL_TEXTURE_2D);

    String text = button.getText();
    theme.getFontRenderer().drawString(text, size + 4, area.height / 2 - theme.getFontRenderer().FONT_HEIGHT / 2,
            RenderUtil.toRGBA(button.getForegroundColor()));

    glEnable(GL_CULL_FACE);
    glDisable(GL_BLEND);
    translateComponent(button, true);
}
 
開發者ID:null-dev,項目名稱:EvenWurse,代碼行數:68,代碼來源:SimpleCheckButtonUI.java


注:本文中的org.darkstorm.minecraft.gui.component.Component.getX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。