0
\$\begingroup\$

I making a 3D game like Minecraft in LWJGL 2 and now, I want to move player camera with mouse like Minecraft.

Here are the codes I have:

com/kg/kgcraft/KGCraft.java:

package com.kg.kgcraft;

import org.lwjgl.LWJGLException;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;

public class KGCraft {
    private static void createGameWindow() throws LWJGLException {
        Display.setTitle("KGCraft");
        Display.setFullscreen(true);
        Display.create();
    }
    public static void main(String[] args) throws LWJGLException {
        KGCraft.createGameWindow();
        while (!Display.isCloseRequested()) {
            Mouse.setCursorPosition(1920 / 2, 1080 / 2);
            Display.update();
            Display.sync(60);
        }
    }
}

com/kg/kgcraft/Block.java:

package com.kg.kgcraft;

import org.lwjgl.opengl.GL11;

public class Block {
    public void create(int x, int y, int z) {
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        GL11.glBegin(GL11.GL_QUADS);
        /* Incomplete */
        GL11.glEnd();
    }
}

com/kg/kgcraft/Player.java:

package com.kg.kgcraft;

public class Player {
    public void spawn(int x, int y, int z) {
        /* Incomplete */
    }
}
\$\endgroup\$
2
  • 1
    \$\begingroup\$ What have you tried? \$\endgroup\$
    – user35344
    Commented Jun 1, 2021 at 9:48
  • \$\begingroup\$ Welcome to GDSE. Your post could be improved by describing what you've tried & how the results differed from the intended goal. As currently written this reads like a request for someone else to implement a feature for you. \$\endgroup\$
    – Pikalek
    Commented Jun 1, 2021 at 16:17

0

You must log in to answer this question.

Browse other questions tagged .