diff --git a/GameEngine/resources/ComponentView.png b/GameEngine/resources/ComponentView.png index 2a2c4f5..124ec17 100644 --- a/GameEngine/resources/ComponentView.png +++ b/GameEngine/resources/ComponentView.png Binary files differ diff --git a/GameEngine/src/main/java/gameEngine/GameEditor.java b/GameEngine/src/main/java/gameEngine/GameEditor.java index 15915d4..1d4b30e 100644 --- a/GameEngine/src/main/java/gameEngine/GameEditor.java +++ b/GameEngine/src/main/java/gameEngine/GameEditor.java @@ -15,9 +15,6 @@ private Button playButton; private Text playButtonText; - private Button createObjectButton; - private Text createObjectButtonText; - private Button createComponentViewButton; private Text createComponentViewButtonText; @@ -35,14 +32,11 @@ playButton = new Button(Window.get().width/ 2 -16 , 3, 1, 0.4f); playButtonText = new Text(Window.get().width/ 2 - 11.25f, 1, "Play", 24); - createObjectButton = new Button(20, 33, 3.2f, 0.5f); - createObjectButtonText = new Text(20 +5.25f, 30.4f, "Add GameObject", 24); + createComponentViewButton = new Button(20, 33, 3.2f, 0.5f); + createComponentViewButtonText = new Text(20 +5.25f, 30.4f, "Add Component", 24); - createComponentViewButton = new Button(20, 73, 3.2f, 0.5f); - createComponentViewButtonText = new Text(20 +5.25f, 70.4f, "Add Component", 24); - - createEntityViewButton = new Button(20, 113, 3.2f, 0.5f); - createEntityViewButtonText = new Text(20 +5.25f, 110.4f, "Add Entity", 24); + createEntityViewButton = new Button(240, 33, 3.2f, 0.5f); + createEntityViewButtonText = new Text(240 +5.25f, 30.4f, "Add Entity", 24); setButtonListeners(); } @@ -51,9 +45,6 @@ playButton.clearListeners(); playButton.addListener(scene::changeSceneStart); - createObjectButton.clearListeners(); - createObjectButton.addListener(scene::addNewObject); - createComponentViewButton.clearListeners(); createComponentViewButton.addListener(scene::addNewComponent); @@ -70,8 +61,6 @@ for(Sprite editorFrameSprites : EditorFrameSprite) editorFrameSprites.update(); playButton.update(); playButtonText.update(); - createObjectButton.update(); - createObjectButtonText.update(); createComponentViewButton.update(); createComponentViewButtonText.update(); createEntityViewButton.update(); diff --git a/GameEngine/src/main/java/gameEngine/entites/gameComponents/ComponentView.java b/GameEngine/src/main/java/gameEngine/entites/gameComponents/ComponentView.java index 154b859..6ee4bc3 100644 --- a/GameEngine/src/main/java/gameEngine/entites/gameComponents/ComponentView.java +++ b/GameEngine/src/main/java/gameEngine/entites/gameComponents/ComponentView.java @@ -27,7 +27,7 @@ sprite.setRotation(parent.transform.rotation); sprite.setScale(parent.transform.scale); sprite.update(); - Vector3f pos = new Vector3f(parent.transform.position.x+82,parent.transform.position.y+12,parent.transform.position.z); + Vector3f pos = new Vector3f(parent.transform.position.x+82,parent.transform.position.y+4,parent.transform.position.z); portviewA.update(pos, parent.transform.rotation, parent.transform.scale); portviewA.handleDragging(); } diff --git a/GameEngine/src/main/java/gameEngine/entites/gameComponents/Connection.java b/GameEngine/src/main/java/gameEngine/entites/gameComponents/Connection.java index 6929785..7144b2e 100644 --- a/GameEngine/src/main/java/gameEngine/entites/gameComponents/Connection.java +++ b/GameEngine/src/main/java/gameEngine/entites/gameComponents/Connection.java @@ -26,7 +26,7 @@ linePosition.x -= (float) (lineLength / 2 * Math.cos(Math.toRadians(angle))); linePosition.y -= (float) (lineLength / 2 * Math.sin(Math.toRadians(angle))); - lineSprite.setPosition(linePosition.x+8, linePosition.y+16); + lineSprite.setPosition(linePosition.x+8, linePosition.y+8); lineSprite.setRotation(new Vector3f(0, 0, angle)); // z軸の回転を設定 lineSprite.setScale(new Vector3f(lineLength, 3, 1)); // 長さをスケールで調整 diff --git a/GameEngine/src/main/java/gameEngine/scenes/Scene.java b/GameEngine/src/main/java/gameEngine/scenes/Scene.java index d80364f..4bdb091 100644 --- a/GameEngine/src/main/java/gameEngine/scenes/Scene.java +++ b/GameEngine/src/main/java/gameEngine/scenes/Scene.java @@ -128,47 +128,28 @@ GameObject object = createGameObject(); object.transform.setPosition((float) Window.get().width / 2 ,(float) Window.get().height /2, 0); object.addComponent(new ComponentView(object)); - object.addComponent(new TextMesh(object, "Mesh", 24)); - object.getComponent(TextMesh.class).setLocalPosition(new Vector3f(10,5,0)); + object.addComponent(new TextMesh(object, "Mesh", 20)); + object.getComponent(TextMesh.class).setLocalPosition(new Vector3f(10,2,0)); } - - - /** - * Adds a component to the specified GameObject. - * This method enqueues a task to add the given GameComponent to the GameObject's component list. - * - * @param gameObject The GameObject to which the component will be added. - * @param component The GameComponent to be added to the GameObject. - */ public void addComponentToGameObject(GameObject gameObject, GameComponent component) { enqueueTask(() -> gameObject.addComponent(component)); } - /** - * Removes a component from the specified GameObject. - * This method enqueues a task to remove the given GameComponent from the GameObject's component list. - * - * @param gameObject The GameObject from which the component will be removed. - * @param component The GameComponent to be removed from the GameObject. - */ public void removeComponentFromGameObject(GameObject gameObject, GameComponent component) { enqueueTask(() -> gameObject.removeComponent(component)); } - // タスクを登録 private synchronized void enqueueTask(Runnable task) { taskQueue.add(task); } - // タスクの実行 public synchronized void processTasks() { while (!taskQueue.isEmpty()) { taskQueue.poll().run(); } } - //現状一つのEntityからしか呼び出せない public void Instantiate(GameObject original) { enqueueTask(() -> { @@ -207,7 +188,6 @@ if(!changingScene) changingScene = true; } - //シーン切り替え時の演出 public void changeScene(int scene, float dt){ if(!changingScene && Input.GetKeyDown(KeyEvent.VK_SPACE)){ changingScene = true; diff --git a/GameEngine/src/main/java/gameEngine/views/Window.java b/GameEngine/src/main/java/gameEngine/views/Window.java index 57aa0ce..da3684e 100644 --- a/GameEngine/src/main/java/gameEngine/views/Window.java +++ b/GameEngine/src/main/java/gameEngine/views/Window.java @@ -168,15 +168,11 @@ currentScene.update(dt); currentScene.processTasks(); - connectionManager.update(); - if(currentScene instanceof EditorScene) { + connectionManager.update(); for (Entity entity : currentScene.entities.values()) { if (entity instanceof GameObject) { GameObject gameObject = (GameObject) entity; - if(gameObject.getComponent(Mesh.class) != null){ - gameObject.getComponent(Mesh.class).update(); - } if(gameObject.getComponent(EntityView.class) != null){ gameObject.getComponent(EntityView.class).update(); }