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


Java CanvasElement.setHeight方法代码示例

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


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

示例1: onModuleLoad

import com.google.gwt.dom.client.CanvasElement; //导入方法依赖的package包/类
public void onModuleLoad() {
    canvas = Canvas.createIfSupported();
    if (canvas == null) {
        Window.alert("Canvas not supported");
        return;
    }
    RootPanel.get("screen").add(canvas);

    CanvasElement el = canvas.getCanvasElement();
    el.setWidth(960);
    el.setHeight(540);

    Context2d ctx = canvas.getContext2d();
    setupContext(ctx);
    ctx.scale(3, 3);

    RootPanel.get().addDomHandler(this, KeyDownEvent.getType());

    font = new Image("images/font.png");
    fontElement = ImageElement.as(font.getElement());

    audio = Audio.createIfSupported();

    game = new Game(this);
    game.pushState(new WelcomeState(game));

    new Timer() {
        @Override
        public void run() {
            game.handleEvent();
            game.update();
            game.draw();
        }
    }.scheduleRepeating(50);
}
 
开发者ID:czak,项目名称:retronix,代码行数:36,代码来源:Application.java

示例2: HtmlCanvas

import com.google.gwt.dom.client.CanvasElement; //导入方法依赖的package包/类
HtmlCanvas(CanvasElement canvas, int width, int height) {
  this.canvas = canvas;
  this.width = width;
  this.height = height;
  canvas.setWidth(width);
  canvas.setHeight(height);
  ctx = canvas.getContext2d();
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:9,代码来源:HtmlCanvas.java

示例3: HtmlCanvasLayerDom

import com.google.gwt.dom.client.CanvasElement; //导入方法依赖的package包/类
HtmlCanvasLayerDom(int width, int height) {
  super(Document.get().createCanvasElement());

  CanvasElement canvas = element().cast();
  canvas.setWidth(width);
  canvas.setHeight(height);

  this.canvas = new HtmlCanvas(canvas, width, height);
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:10,代码来源:HtmlCanvasLayerDom.java

示例4: HtmlCanvasLayerGL

import com.google.gwt.dom.client.CanvasElement; //导入方法依赖的package包/类
HtmlCanvasLayerGL(HtmlGraphicsGL gfx, int width, int height) {
  super(gfx);

  this.width = width;
  this.height = height;

  CanvasElement canvas = Document.get().createCanvasElement();
  canvas.setWidth(width);
  canvas.setHeight(height);

  this.canvas = new HtmlCanvas(canvas, width, height);
  tex = gfx.createTexture(false, false);
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:14,代码来源:HtmlCanvasLayerGL.java

示例5: createCanvasImpl

import com.google.gwt.dom.client.CanvasElement; //导入方法依赖的package包/类
@Override protected Canvas createCanvasImpl(Scale scale, int pixelWidth, int pixelHeight) {
  CanvasElement elem = Document.get().createCanvasElement();
  elem.setWidth(pixelWidth);
  elem.setHeight(pixelHeight);
  return new HtmlCanvas(this, new HtmlImage(this, scale, elem, "<canvas>"));
}
 
开发者ID:playn,项目名称:playn,代码行数:7,代码来源:HtmlGraphics.java


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