本文整理汇总了Java中pythagoras.f.IDimension类的典型用法代码示例。如果您正苦于以下问题:Java IDimension类的具体用法?Java IDimension怎么用?Java IDimension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDimension类属于pythagoras.f包,在下文中一共展示了IDimension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public void init () {
// remove the background layer added by default
game.rootLayer.disposeAll();
// add a grey square
TextureSurface surf = game.createSurface(width, height);
surf.begin().setFillColor(Color.rgb(200, 200, 200)).fillRect(0, 0, width, height).end().close();
ImageLayer square = new ImageLayer(surf.texture);
game.rootLayer.add(square);
conns.add(game.paint.connect(clock -> {
float t = clock.tick / 1000f;
IDimension vsize = game.plat.graphics().viewSize;
square.setTranslation((FloatMath.cos(t) + 1) * (vsize.width() - width)/2,
(FloatMath.sin(t) + 1) * (vsize.height() - height)/2);
}));
}
示例2: create
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public void create (final Showcase game, Closeable.Set onClose) {
// create a group layer to hold everything
final GroupLayer layer = new GroupLayer();
game.rootLayer.add(layer);
onClose.add(layer);
// load a sound that we'll play when placing sprites
final Sound ding = game.plat.assets().getSound("sprites/ding");
// create and add background image layer
Image bgImage = game.plat.assets().getImage("background.png");
IDimension viewSize = game.plat.graphics().viewSize;
ImageLayer bg = new ImageLayer(bgImage).setSize(viewSize);
layer.add(bg);
final List<Pea> peas = new ArrayList<>();
// add a listener for pointer (mouse, touch) input
bg.events().connect(new Pointer.Listener() {
public void onStart (Pointer.Interaction iact) {
peas.add(newPea(game.plat, layer, ding, iact.event.x, iact.event.y));
}
});
peas.add(newPea(game.plat, layer, ding, viewSize.width() / 2, viewSize.height() / 2));
onClose.add(game.paint.connect(new Slot<Clock>() {
public void onEmit (Clock clock) {
for (Pea pea : peas) pea.update(clock);
}
}));
}
示例3: screenSize
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public IDimension screenSize() {
// we just recompute this when asked so that we have the right orientation
// TODO: is this properly resolution independent?
CGRect screenBounds = UIScreen.getMainScreen().getBounds();
// TODO: (plat.osVersion < 8) manually divide by scale factor?
// tODO: (plat.osVersion < 8) manually flip width/height when in landscape?
screenSize.width = (int)screenBounds.getWidth();
screenSize.height = (int)screenBounds.getHeight();
if (useHalfSize(config)) {
screenSize.width /= 2;
screenSize.height /= 2;
}
return screenSize;
}
示例4: applyCompanyLogoBackground
import pythagoras.f.IDimension; //导入依赖的package包/类
private void applyCompanyLogoBackground() {
Background b = new Background() {
@Override
protected Instance instantiate(final IDimension size) {
return new LayerInstance(size, new Layer() {
@Override
protected void paintImpl(Surface surf) {
surf.draw(COMPANY_LOGO, 0, 0, size.width(), size.height());
}
});
}
};
b = applyInsets(b);
addStyles(Style.BACKGROUND.is(b));
}
示例5: layoutUI
import pythagoras.f.IDimension; //导入依赖的package包/类
private void layoutUI() {
final IDimension parentSize = _parent.size();
setConstraint(Constraints.fixedSize(parentSize.width(), parentSize.height()));
Group textBox = makeTextBox(parentSize);
add(textBox,
new Group(AxisLayout.vertical())
.add(new Shim(0, 0).setConstraint(AxisLayout.stretched()),
new Label(makeSpeakerIcon(parentSize)),
new Shim(0, percentOfScreenHeight(0.01f)))
.setConstraint(AxisLayout.stretched()));
}
示例6: makeTextBox
import pythagoras.f.IDimension; //导入依赖的package包/类
private Group makeTextBox(IDimension parentSize) {
final float width = parentSize.width() * TEXTBOX_WIDTH_PERCENT;
content = new Group(AxisLayout.vertical());
updateContent();
scroller = new Scroller(content).setBehavior(Scroller.Behavior.VERTICAL)
.setConstraint(Constraints.fixedSize(width, parentSize.height()));
return new SizableGroup(AxisLayout.vertical().offStretch(), width, parentSize.height())
.add(scroller)
.addStyles(Style.BACKGROUND.is(CALLOUT_BACKGROUND));
}
示例7: makeSpeakerIcon
import pythagoras.f.IDimension; //导入依赖的package包/类
private Icon makeSpeakerIcon(IDimension parentSize) {
float imageWidth = eventSpeakerImage.width();
float proportion = SPEAKER_WIDTH_PERCENT;
float desiredWidth = parentSize.width() * proportion;
float scale = desiredWidth / imageWidth;
return Icons.scaled(Icons.image(eventSpeakerImage), scale);
}
示例8: validate
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override
protected void validate() {
if (scroller != null) {
final IDimension parentSize = _parent.size();
final float textBoxWidth = parentSize.width() * TEXTBOX_WIDTH_PERCENT;
scroller.setConstraint(Constraints.fixedSize(textBoxWidth, parentSize.height()));
scroller.content.setConstraint(Constraints.fixedSize(textBoxWidth, parentSize.height()));
}
super.validate();
}
示例9: createUI
import pythagoras.f.IDimension; //导入依赖的package包/类
private void createUI() {
IDimension viewSize = game().plat.graphics().viewSize;
GameBounds contentBounds = SimGame.game.bounds;
Root root = iface.createRoot(new AbsoluteLayout(), makeStyleSheet(), layer);
Group content = createContentGroup(root);
root.add(AbsoluteLayout.at(content,
contentBounds.x(), contentBounds.y(), contentBounds.width(), contentBounds.height()))
.addStyles(Style.BACKGROUND.is(Background.solid(Palette.UNUSED_SPACE)))
.setSize(size());
if (viewSize.width() > contentBounds.width()) {
createLeftSideLayerToCoverShiftingEmployees((viewSize.width() - contentBounds.width()) / 2, viewSize.height());
}
}
示例10: screenSize
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public IDimension screenSize() {
DisplayMode mode = Display.getDesktopDisplayMode();
screenSize.width = scale().invScaled(mode.getWidth());
screenSize.height = scale().invScaled(mode.getHeight());
return screenSize;
}
示例11: setSize
import pythagoras.f.IDimension; //导入依赖的package包/类
/** Updates the size of this clipped layer, and hence its clipping rectangle. */
public ClippedLayer setSize (IDimension size) {
return setSize(size.width(), size.height());
}
示例12: screenSize
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public IDimension screenSize () {
Rectangle db = plat.display().getBounds();
return new Dimension(db.width, db.height);
}
示例13: screenSize
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public IDimension screenSize () {
return new Dimension(config.width, config.height);
}
示例14: screenSize
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public IDimension screenSize () {
GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
screenSize.width = vidMode.width();
screenSize.height = vidMode.height();
return screenSize;
}
示例15: screenSize
import pythagoras.f.IDimension; //导入依赖的package包/类
@Override public IDimension screenSize () {
// TODO: inverse scale?
screenSize.width = Document.get().getDocumentElement().getClientWidth();
screenSize.height = Document.get().getDocumentElement().getClientHeight();
return screenSize;
}