小编DCS*_*oft的帖子

WaveFront .obj 文件 - “f”命令有什么作用?

我一直在阅读David Brackeen 的《用 Java 开发游戏》。到现在为止我已经明白了书中的所有内容。在 Wavefront 对象文件中,我理解该v命令的作用,但不理解该f命令。例如:

# OBJ - Wavefront object file
# The javagamebook loader only understands these commands:
#   mtllib <filename>    - Load materials from an external .mtl
#                          file.
#   v <x> <y> <z>        - Define a vertex with floating-point
#                          coords (x,y,z).
#   f <v1> <v2> <v3> ... - Define a new face. a face is a flat,
#                          convex polygon with vertices in
#                          counter-clockwise order. Positive
# …
Run Code Online (Sandbox Code Playgroud)

java wavefront

3
推荐指数
1
解决办法
4592
查看次数

PHP URL验证,如果无效则修复它

我正在尝试验证网址.这是我的代码:

function isValidURL($url) 
{
    return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
}
Run Code Online (Sandbox Code Playgroud)

这段代码正在运行,但现在我正在尝试解决如何添加http://或者https://如果URL正确但只是错过了开头http://

请指出我正确的方向.

php

3
推荐指数
1
解决办法
3138
查看次数

JFrame鼠标单击停止键盘按钮

我的问题是,当我点击框架屏幕的空间时,它会停止键盘键被注册,所以我的播放器停止移动.

在此先感谢您的帮助.

代码:

private Component comp;
....

public InputManager(Component comp) {
    this.comp = comp;
    mouseLocation = new Point();
    centerLocation = new Point();

    // register key and mouse listeners
    comp.addKeyListener(this);
    comp.addMouseListener(this);
    comp.addMouseMotionListener(this);
    comp.addMouseWheelListener(this);

    // allow input of the TAB key and other keys normally
    // used for focus traversal
    comp.setFocusTraversalKeysEnabled(false);
}
Run Code Online (Sandbox Code Playgroud)

GUI代码:

Game game = new Game();
    game.setMinimumSize(new Dimension(WIDTH * 2, HEIGHT * 2));
    game.setPreferredSize(new Dimension(WIDTH * 2, HEIGHT * 2));
    game.setMaximumSize(new Dimension(WIDTH * 2, HEIGHT * 2));

    frame = new …
Run Code Online (Sandbox Code Playgroud)

java swing awt keylistener

2
推荐指数
1
解决办法
858
查看次数

标签 统计

java ×2

awt ×1

keylistener ×1

php ×1

swing ×1

wavefront ×1