当我要求SpriteBatch绘制一个矩形时,如下方法所示:
public static void DrawSolidRectangle(Rectangle rectangle, Color color)
{
// the output from this is shown in the screenshot
System.Console.WriteLine(rectangle.ToString());
spriteBatch.Draw(pixel, rectangle, color);
}
我得到了不同大小的矩形,我提
这将拖动我的矩形路径。如果窗口没有调整大小,它可以完美地工作。
function onMouseDrag(event) {
MyRectanglePath.position = event.point;
}
这将调整我的游戏大小,使其成为浏览器窗口的100%宽度或100%长度的正方形。
function OnResizeCalled() {
var gameWidth = window.innerWidth;
var gameHeight = window.innerHeight;
var scaleToFit
这是我想要做的。
我需要在QGraphicsView中绘制一系列左右对齐的矩形。我的意思是,如果矩形i有泊松(0,y),那么矩形i+1需要有位置(0,max),其中max是这样的:矩形的右侧“接触”到QGraphicsView的右侧。
当调整窗口大小时,我需要重新计算max的值,以便矩形始终接触屏幕的右侧。
下面是我如何添加我的场景(这引用了一个继承QGraphicsView的类)
scene = new QGraphicsScene(this);
this->setScene(scene);
this->setAlignment(Qt::AlignTop|Qt::AlignLef
我遇到了一个问题,我设置的Stage的大小实际上并不是它看起来的大小。这个问题可以在以下代码中看到:
public class Main extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage stage) {
Pane pane = new Pane();
Rectangle shape = new Rectangle(