本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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);
}
示例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>"));
}