亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gameframe.java

?? Java 3D Game SDK.老外做的.
?? JAVA
字號:
/* * GameFrame.java */package org.java3dgamesdk.core;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import com.sun.j3d.utils.universe.*;import javax.media.j3d.*;/** * This class is the main game frame for the windowed or full screen application. * * @author  Norbert Nopper */public class GameFrame extends JFrame implements Runnable, WindowListener, MouseInputListener, MouseWheelListener, KeyListener {        final private static int                MOUSEBUTTONS = 3;    final private static int                KEYS = 256;        /**     * Thread for updating the scene.     */    private Thread                          runThread;        /**     * Flag, if the application is running in window or full screen mode.     */    private boolean                         windowed;        /**     * Original display mode. Needed for setting back after leaving the application.     */    private DisplayMode                     originalDisplayMode;        /**     * Graphics device for the full screen mode.     */    private GraphicsDevice                  graphicsDevice;        /**     * The canvas for rendering 3D scenes.     */    protected Canvas3D                      canvas3d;        /**     * Graphics context for rendering 3D scenes.     */    protected GraphicsContext3D             gc3D;        /**     * Empty universe for immediate mode rendering.     */    private SimpleUniverse                  simpleUniverse;        /**     * Flag, if the game mouse is enabled.     */    protected boolean                       gameMouse;        /**     * The x position of the mouse. If game mouse is enabled, it is the relative position.     */    protected int                           mouseX;    /**     * The y position of the mouse. If game mouse is enabled, it is the relative position.     */    protected int                           mouseY;        /**     * Flag, if the mouse was moved or not.     */    private boolean                         mouseMoved;        /**     * Delta movement on the x axis.     */    protected int                           deltaX;    /**     * Delta movement on the y axis.     */    protected int                           deltaY;        /**     * Array for the three mouse buttons.     */    protected boolean[]                     mouseButton = new boolean[MOUSEBUTTONS];    /**     * Integer value of the mouse wheel position.     */        protected int                           mouseWheel;    /**     * Flag, if the mouse wheel was moved or not.     */    private boolean                         mouseWheelMoved;            /**     * AWT Toolkit to control the mouse cursor.     */        private Robot                           mouseRobot;    /**     * Array for the game keys.     */    protected boolean[]                     gameKeys = new boolean[KEYS];            /**     * Initialize the game frame without deciding to start in full or window mode.     */    public GameFrame() {        // pass the graphic configuration to the super class        super(SimpleUniverse.getPreferredConfiguration());                // at this point of time the application is in window mode        windowed = true;                // save the original display mode        this.originalDisplayMode = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode() ;                // get the graphics device        this.graphicsDevice = SimpleUniverse.getPreferredConfiguration().getDevice();                // prepare the layout for one container        getContentPane().setLayout(new BorderLayout());                // create the canvas3d to render on        canvas3d = new Canvas3D(SimpleUniverse.getPreferredConfiguration());                // get the graphics context 3D        gc3D = canvas3d.getGraphicsContext3D();                // stop the renderer for immediate mode        canvas3d.stopRenderer();                // add the cancas3d to the frame        getContentPane().add("Center", canvas3d);                // create the simple universe        simpleUniverse = new SimpleUniverse(canvas3d);                // listen to window events        addWindowListener(this);                // listen to the mouse events on the canvas 3d        canvas3d.addMouseListener(this);        canvas3d.addMouseMotionListener(this);        canvas3d.addMouseWheelListener(this);                // game mouse to off        gameMouse = false;                // create a robot to control the mouse cursor        try {            mouseRobot = new Robot(graphicsDevice);        } catch(AWTException awte) {            System.err.println(awte);            System.exit(1);        }                // listen to the key events        canvas3d.addKeyListener(this);    }        /**     * Method for creating the window screen.     *     * @param width the width of the screen     * @param height the width of the screen     *     * @return true, if the creation was successful     */    final public boolean makeWindowScreen(int width, int height) {        windowed = true;                // resize the frame        setSize(width, height);                // validate the frame        validate();                // make the frame visible        setVisible(true);                return true;    }        /**     * Method for creating the full screen. The method checks, if the graphic     * card supports the given resolution.     *     * @param width the width of the screen     * @param height the width of the screen     * @param bitDepth the bit depth of the color (8, 16, or 32)     * @param refreshRate refresh rate     *     * @return true, if the creation was successful     */    final public boolean makeFullScreen(int width, int height, int bitDepth, int refreshRate) {        windowed = false;                // check, if full screen mode is supported: return        if( !graphicsDevice.isFullScreenSupported() )            return false;                // check, if the given mode is supported        boolean available = false;        int index = 0;                DisplayMode allModes[] = graphicsDevice.getDisplayModes();                // check, if display mode is available        while(!available && index < allModes.length) {            if( allModes[index].getWidth() == width &&            allModes[index].getHeight() == height &&            allModes[index].getBitDepth() == bitDepth &&            allModes[index].getRefreshRate() == refreshRate ) {                                // display mode is available                available = true;            }                        index++;        }                // display mode is not available: return        if(!available)            return false;                // no decorations for the frame        setUndecorated(true);                // do not allow to resize the frame        setResizable(false);                // set the full screen mode to this frame        graphicsDevice.setFullScreenWindow(this);                // create the new display mode        DisplayMode newDisplayMode = new DisplayMode(width, height, bitDepth, refreshRate);                // sets the new display mode        graphicsDevice.setDisplayMode(newDisplayMode);                // resize the frame        setSize(new Dimension(newDisplayMode.getWidth(), newDisplayMode.getHeight()));                // validate the frame        validate();                return true;    }        /**     * Returns the current graphics device.     *     * @return the graphics device     */    final public GraphicsDevice getGraphicsDevice() {        return graphicsDevice;    }        /**     * Start the update and render thread.     */    final private void init() {        if(runThread == null)            runThread = new Thread(this);                runThread.start();    }        /**     * Exit the game frame and the whole application.     */    final protected void exit() {        // stop the thread and theapplication exits        runThread = null;    }        final public void windowActivated(WindowEvent windowEvent) {}        final public void windowClosed(WindowEvent windowEvent) {}        /**     * The method cleans up the application and is directly called by the window listener.     *     * @param windowEvent the passed event     */    final public void windowClosing(WindowEvent windowEvent) {        // clean up the system        exit();    }        final public void windowDeactivated(WindowEvent windowEvent) {}        final public void windowDeiconified(WindowEvent windowEvent) {}        final public void windowIconified(WindowEvent windowEvent) {}        /**     * The method starts the render thread and is directly called by the window listener.     *     * @param windowEvent the passed event     */    final public void windowOpened(WindowEvent windowEvent) {        // start the render thread        init();    }        /**     * The thread for updating the scene.     */    final public void run() {        // center the mouse        mouseRobot.mouseMove(canvas3d.getWidth()/2, canvas3d.getHeight()/2);                    // mouse was not moved        mouseMoved = false;        deltaX = 0;        deltaY = 0;            // mouse wheel was not moved        mouseWheelMoved = false;                // allow the game to initalize itself        initGame();                // clean up what is possible        System.gc();                long gameTime = 0;        long currentTime = System.currentTimeMillis();        long lastTime = currentTime;        while (runThread == Thread.currentThread()) {                        updateGame(gameTime);                        renderGame();                        // swap the scene            canvas3d.swap();            // allow other threads to execute            Thread.yield();            // reset the mouse movement values            if(gameMouse && !mouseMoved) {                deltaX = 0;                deltaY = 0;            }            mouseMoved = false;                        // reset the mouse wheel movement value            if(!mouseWheelMoved)                mouseWheel = 0;            mouseWheelMoved = false;                        // adjust the game time            currentTime = System.currentTimeMillis();            gameTime += currentTime - lastTime;            lastTime = currentTime;        }                // allow the game to clean up itself ...        exitGame();            // ... and now the engine                // clear the universe        if(simpleUniverse != null)            simpleUniverse.removeAllLocales();                // reset the display to the original configuration        if(graphicsDevice != null && windowed == false) {            graphicsDevice.setDisplayMode(originalDisplayMode);            graphicsDevice.setFullScreenWindow(null);        }                // finally exit        System.exit(0);    }        /**     * Overwrite this method for making your own initialization method!     */    protected void initGame() {    }        /**     * Overwrite this method for making your own update method!     *     *@param currentTime the current game time in miliseconds, starting with 0     */    protected void updateGame(long currentTime) {        // exit the application by pressing the ESC key.        if(gameKeys[27])            exit();            }      /**     * Overwritete this method for making your own render method!     */    protected void renderGame() {        gc3D.clear();            }        /**     * Overwrite this method for making your own exit method!     */    protected void exitGame() {    }        /**     * The method updates the mouse position.     *     * @param windowEvent the passed event     */    final private void updateMousePosition(MouseEvent mouseEvent) {                        deltaX = mouseX - mouseEvent.getX();        deltaY = mouseY - mouseEvent.getY();                    if(gameMouse)            mouseRobot.mouseMove(canvas3d.getWidth()/2, canvas3d.getHeight()/2);                    mouseX = mouseEvent.getX();        mouseY = mouseEvent.getY();        mouseMoved = true;        mouseEvent.consume();    }        /**     * The method updates the mouse buttons.     *     * @param windowEvent the passed event     */    final private void updateMouseButton(MouseEvent mouseEvent) {                // pass the button to the engine        if(mouseEvent.getButton() > 0 && mouseEvent.getButton() <= MOUSEBUTTONS) {            if(mouseEvent.getID() == MouseEvent.MOUSE_PRESSED)                mouseButton[mouseEvent.getButton()-1] = true;            else                mouseButton[mouseEvent.getButton()-1] = false;        }                mouseEvent.consume();            }        /**     * The method updates the mouse position.     *     * @param windowEvent the passed event     */    final public void mouseMoved(MouseEvent mouseEvent) {        updateMousePosition(mouseEvent);    }        /**     * The method updates the mouse position.     *     * @param windowEvent the passed event     */    final public void mouseDragged(MouseEvent mouseEvent) {        updateMousePosition(mouseEvent);    }        /**     * The method updates the mouse buttons.     *     * @param windowEvent the passed event     */    final public void mousePressed(MouseEvent mouseEvent) {        updateMouseButton(mouseEvent);    }        /**     * The method updates the mouse buttons.     *     * @param windowEvent the passed event     */    final public void mouseReleased(MouseEvent mouseEvent) {        updateMouseButton(mouseEvent);    }        final public void mouseClicked(MouseEvent mouseEvent) {}        final public void mouseEntered(MouseEvent mouseEvent) {}        final public void mouseExited(MouseEvent mouseEvent) {}        /**     * The method updates the mouse wheel.     *     * @param windowEvent the passed event     */    final public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {        // change the mouse wheel        mouseWheel += mouseWheelEvent.getWheelRotation();                mouseWheelMoved = true;        mouseWheelEvent.consume();    }        final public void keyPressed(KeyEvent keyEvent) {        updateGameKeys(keyEvent);    }        final public void keyReleased(KeyEvent keyEvent) {        updateGameKeys(keyEvent);    }        final public void keyTyped(KeyEvent keyEvent) {}        final private void updateGameKeys(KeyEvent keyEvent) {        // System.out.println(keyEvent.getKeyCode());                // pass the key status to the engine        if(keyEvent.getKeyCode() >= 0 && keyEvent.getKeyCode() < KEYS) {            if(keyEvent.getID() == KeyEvent.KEY_PRESSED)                gameKeys[keyEvent.getKeyCode()] = true;            else                gameKeys[keyEvent.getKeyCode()] = false;        }        keyEvent.consume();    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久91精品国产91久久小草| 极品尤物av久久免费看| 成人h动漫精品一区二区| 琪琪久久久久日韩精品| 7777精品伊人久久久大香线蕉超级流畅 | 欧美在线啊v一区| 91精品国产综合久久国产大片 | 国产色产综合色产在线视频| 欧美一区二区三区四区五区| 日韩亚洲欧美一区| 久久嫩草精品久久久精品一| 久久综合久久99| 欧美日韩久久久一区| 成人午夜av在线| 国产福利91精品一区二区三区| 欧美电视剧免费观看| 久久久久国产精品麻豆ai换脸 | 日韩午夜激情免费电影| 九九热在线视频观看这里只有精品| 日韩精品乱码av一区二区| 日韩中文字幕不卡| 一级日本不卡的影视| 亚洲最大色网站| 久久日一线二线三线suv| 欧美亚洲愉拍一区二区| 中文字幕亚洲在| 久久久久综合网| 久久久噜噜噜久久人人看 | 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美性做爰猛烈叫床潮| 一区二区在线电影| 一本大道av一区二区在线播放| 成人激情午夜影院| 国产高清精品在线| 中文字幕精品一区| 最新国产成人在线观看| 亚洲天堂成人网| 国产·精品毛片| 蜜臀91精品一区二区三区 | 亚洲综合一二区| 国产精品久久久久影院| 中文字幕亚洲一区二区av在线 | 欧美精品一区二区三区很污很色的| 欧美三级日韩在线| 色偷偷88欧美精品久久久| 成人美女在线观看| 97se亚洲国产综合在线| 91精品国产入口在线| 91丨porny丨户外露出| 91免费在线看| 欧美日韩黄色影视| 精品欧美一区二区在线观看| 久久午夜羞羞影院免费观看| 国产三级一区二区| 中文字幕一区二区视频| 亚洲一线二线三线久久久| 亚洲一区二区欧美日韩| 久久99精品久久久久久动态图| 国产99久久精品| 91亚洲精品乱码久久久久久蜜桃| 欧美久久一区二区| 久久午夜色播影院免费高清| 一区二区三区资源| 国产资源在线一区| 99riav一区二区三区| 日韩欧美精品在线视频| 国产精品理论片| 亚洲成人第一页| 欧美国产亚洲另类动漫| 亚洲美女区一区| 国产一区二区网址| 欧美一卡在线观看| 香蕉影视欧美成人| 91搞黄在线观看| 国产夜色精品一区二区av| 亚洲黄色av一区| 波多野结衣亚洲一区| 久久久久久久久久久久久女国产乱| 一卡二卡欧美日韩| 99免费精品在线| 国产精品第五页| 国产成人在线色| 精品国产精品网麻豆系列| 丝袜亚洲另类欧美综合| 欧美精品色一区二区三区| 依依成人精品视频| 在线国产电影不卡| 亚洲成人精品一区| 欧美日韩国产高清一区二区三区| 日韩三级精品电影久久久| 欧美一级久久久| 国产黄色精品网站| 亚洲精品福利视频网站| 欧美日韩午夜影院| 精品一区二区在线观看| 一片黄亚洲嫩模| 日韩一区二区三区视频| 国产 欧美在线| 一区二区三区中文在线| 欧美videos中文字幕| 国产999精品久久久久久绿帽| 1区2区3区国产精品| 欧美日韩一级视频| 九色porny丨国产精品| 国产精品国产三级国产普通话99 | 亚洲影院在线观看| 国产精品成人在线观看| 在线精品视频一区二区| 国产又粗又猛又爽又黄91精品| 亚洲精品视频观看| 国产精品久久久久久一区二区三区 | 色婷婷综合久久久久中文一区二区 | 欧美日韩中字一区| 99re热视频这里只精品| 国内精品伊人久久久久影院对白| 亚洲国产欧美在线| 亚洲精品成人天堂一二三| 国产精品久久久久毛片软件| 欧美成人猛片aaaaaaa| 欧美日韩高清在线播放| 国产精品伦一区二区三级视频| 国产成人在线视频免费播放| 蜜桃久久久久久| 久久er精品视频| 午夜精品久久久久久久99樱桃| 中日韩av电影| 亚洲欧洲在线观看av| 亚洲免费毛片网站| 国产精品久久久久久久久晋中 | 日本一不卡视频| 亚洲18色成人| 另类调教123区| 国产一区二区三区香蕉 | 日韩美女视频19| 亚洲欧美综合网| 亚洲视频一区在线| 亚洲午夜久久久久久久久电影网| 日韩电影网1区2区| 蜜臀av国产精品久久久久| 国产精品亚洲专一区二区三区| 高清不卡一区二区| 精品视频免费看| 26uuu国产在线精品一区二区| 久久久国产精品午夜一区ai换脸| 国产精品你懂的| 亚洲成年人网站在线观看| 日av在线不卡| 91美女视频网站| 久久久综合网站| 成人免费在线播放视频| 亚洲3atv精品一区二区三区| 成人小视频免费在线观看| 欧美日韩视频第一区| 日本一区二区三区视频视频| 五月天久久比比资源色| 国产一区二区免费在线| 欧亚洲嫩模精品一区三区| 国产精品午夜久久| 激情成人综合网| 日韩一区二区电影网| 一区二区三区四区av| 中文字幕免费一区| 精品区一区二区| 看电视剧不卡顿的网站| 欧美一二三区在线| 免费成人深夜小野草| 欧美人与性动xxxx| 另类综合日韩欧美亚洲| 56国语精品自产拍在线观看| 日本亚洲三级在线| 91精品国产综合久久精品麻豆| 亚洲制服丝袜一区| 欧美三级在线播放| 视频一区二区国产| 精品日韩一区二区| 豆国产96在线|亚洲| 亚洲国产精品欧美一二99| 欧美日韩国产高清一区二区| 日日欢夜夜爽一区| 精品国产伦一区二区三区观看方式 | 91麻豆国产福利在线观看| 中文字幕一区视频| 中文字幕在线不卡视频| 国产精品污www在线观看| 国产91精品一区二区麻豆网站 | 亚洲精品成人精品456| 精品欧美黑人一区二区三区| 在线国产亚洲欧美| 成人午夜电影网站| 成人aa视频在线观看| 日本欧洲一区二区| 一区二区三区欧美久久| 久久免费电影网| 欧美mv日韩mv国产| 欧美变态凌虐bdsm| 日韩一区二区不卡| 精品久久久久久久久久久久久久久久久 | 免费看欧美女人艹b| 日韩二区三区四区| 亚洲一区视频在线|