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


Java Screen.newTextGraphics方法代码示例

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


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

示例1: display

import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen) {
    final TextGraphics textGraphics = screen.newTextGraphics();
    textGraphics.setBackgroundColor(new RGB(0, 0, 128));

    // region
    new ScreenBorder(getContext(), 60, 3).display(screen, 45, 60);
    textGraphics.putString(61, 46, KernelContext.getRegion(getContext()));

    // gil and steps
    new ScreenBorder(getContext(), 30, 6).display(screen, 38, 90);
    textGraphics.putString(91, 39, "Steps");
    textGraphics.putString(91, 40, Strings.padStart(String.valueOf(KernelContext.getSteps(getContext())), 28, ' '));
    textGraphics.putString(91, 41, "Gil");
    textGraphics.putString(91, 42, Strings.padStart(String.valueOf(KernelContext.getGil(getContext())), 28, ' '));
}
 
开发者ID:klaushauschild1984,项目名称:ff7rl,代码行数:17,代码来源:MenuState.java

示例2: display

import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen) {
    new ScreenBorder(getContext(), 83, 4).display(screen, 1, 17);
    final TextGraphics textGraphics = screen.newTextGraphics();
    textGraphics.setBackgroundColor(KernelContext.getColor(getContext()));
    textGraphics.putString(19, 3,
            String.format("[LEFT] CD %s [RIGHT] | [UP] Track [DOWN] | [ACCEPT] play/stop | [MENU] auto play", cd));
    getCdMenu().display(screen);
}
 
开发者ID:klaushauschild1984,项目名称:ff7rl,代码行数:10,代码来源:SoundTestState.java

示例3: display

import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
public void display(final Screen screen) {
    final TextGraphics graphics = screen.newTextGraphics();
    graphics.putString(left, top + (compact ? 1 : 2) * cursorPosition, "->");
    for (int i = 0; i < menuEntries.size(); i++) {
        E entry = menuEntries.get(i);
        if (entry.isEnabled()) {
            graphics.setForegroundColor(TextColor.ANSI.DEFAULT);
        } else {
            graphics.setForegroundColor(new TextColor.RGB(100, 100, 100));
        }
        graphics.putString(left + 4, top + i * (compact ? 1 : 2), entry.getLabel());
    }
}
 
开发者ID:klaushauschild1984,项目名称:ff7rl,代码行数:14,代码来源:ScreenMenu.java

示例4: display

import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen, final int top, final int left) {
    final TextGraphics textGraphics = screen.newTextGraphics();
    textGraphics.setBackgroundColor(KernelContext.getColor(context));

    // place corners
    textGraphics.putString(left, top, "+");
    textGraphics.putString(left + width - 1, top, "+");
    textGraphics.putString(left, top + height - 1, "+");
    textGraphics.putString(left + width - 1, top + height - 1, "+");

    // draw lines
    for (int i = left + 1; i < left + width - 1; i++) {
        textGraphics.putString(i, top, "-");
        textGraphics.putString(i, top + height - 1, "-");
    }
    for (int i = top + 1; i < top + height - 1; i++) {
        textGraphics.putString(left, i, "|");
        textGraphics.putString(left + width - 1, i, "|");
    }

    // fill inner space
    for (int x = left + 1; x < left + width - 1; x++) {
        for (int y = top + 1; y < top + height - 1; y++) {
            textGraphics.putString(x, y, " ");
        }
    }
}
 
开发者ID:klaushauschild1984,项目名称:ff7rl,代码行数:29,代码来源:ScreenBorder.java

示例5: display

import com.googlecode.lanterna.screen.Screen; //导入方法依赖的package包/类
@Override
public void display(final Screen screen, final int top, final int left) {
    final TextGraphics textGraphics = screen.newTextGraphics();
    for (int x = 0; x < size.width; x++) {
        for (int y = 0; y < size.height; y++) {
            // TODO handle transparent pixels and non present text
            final Color background = getBackground(x, y);
            final Color foreground = getForeground(x, y);
            final String text = getText(x, y);
            textGraphics.setBackgroundColor(convertColor(background));
            textGraphics.setForegroundColor(convertColor(foreground));
            textGraphics.putString(left + x, top + y, text);
        }
    }
}
 
开发者ID:klaushauschild1984,项目名称:ff7rl,代码行数:16,代码来源:ScreenImage.java


注:本文中的com.googlecode.lanterna.screen.Screen.newTextGraphics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。