当前位置: 首页>>代码示例>>Java>>正文


Java Component.getParent方法代码示例

本文整理汇总了Java中org.darkstorm.minecraft.gui.component.Component.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getParent方法的具体用法?Java Component.getParent怎么用?Java Component.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.darkstorm.minecraft.gui.component.Component的用法示例。


在下文中一共展示了Component.getParent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translateComponent

import org.darkstorm.minecraft.gui.component.Component; //导入方法依赖的package包/类
protected void translateComponent(Component component, boolean reverse) {
	Component parent = component.getParent();
	while(parent != null) {
		GL11.glTranslated((reverse ? -1 : 1) * parent.getX(), (reverse ? -1 : 1) * parent.getY(), 0);
		parent = parent.getParent();
	}
	GL11.glTranslated((reverse ? -1 : 1) * component.getX(), (reverse ? -1 : 1) * component.getY(), 0);
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:9,代码来源:AbstractComponentUI.java

示例2: translateComponent

import org.darkstorm.minecraft.gui.component.Component; //导入方法依赖的package包/类
protected void translateComponent(Component component, boolean reverse) {
    Component parent = component.getParent();
    while (parent != null) {
        GL11.glTranslated((reverse ? -1 : 1) * parent.getX(), (reverse ? -1 : 1) * parent.getY(), 0);
        parent = parent.getParent();
    }
    GL11.glTranslated((reverse ? -1 : 1) * component.getX(), (reverse ? -1 : 1) * component.getY(), 0);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:9,代码来源:AbstractComponentUI.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:CheataClient,项目名称:CheataClientSrc,代码行数:50,代码来源: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:CheataClient,项目名称:CheataClientSrc,代码行数:69,代码来源:SimpleCheckButtonUI.java

示例5: 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

示例6: 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.getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。