block cursor custom textures
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
7fb0f5a489
commit
3173f1f2e9
@ -1553,6 +1553,7 @@ Align voxel lookups for movement audio and interaction targeting
|
|||||||
Align block lookups for interaction targeting
|
Align block lookups for interaction targeting
|
||||||
Cursor logic around blocks
|
Cursor logic around blocks
|
||||||
Block destruction work
|
Block destruction work
|
||||||
|
Block cursor custom textures
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import electrosphere.collision.PhysicsUtils;
|
|||||||
import electrosphere.collision.collidable.Collidable;
|
import electrosphere.collision.collidable.Collidable;
|
||||||
import electrosphere.controls.cursor.CursorState;
|
import electrosphere.controls.cursor.CursorState;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
@ -278,7 +279,7 @@ public class ClientInteractionEngine {
|
|||||||
short type = blockChunkData.getType(blockPos.x, blockPos.y, blockPos.z);
|
short type = blockChunkData.getType(blockPos.x, blockPos.y, blockPos.z);
|
||||||
String text = Globals.gameConfigCurrent.getBlockData().getTypeFromId(type).getName();
|
String text = Globals.gameConfigCurrent.getBlockData().getTypeFromId(type).getName();
|
||||||
InteractionTargetMenu.setInteractionTargetString(text);
|
InteractionTargetMenu.setInteractionTargetString(text);
|
||||||
CursorState.makeBlockVisible();
|
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
|
||||||
Globals.cursorState.hintClampToExistingBlock();
|
Globals.cursorState.hintClampToExistingBlock();
|
||||||
set = true;
|
set = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public class CursorState {
|
|||||||
Globals.playerCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.playerCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.playerCursor, AssetDataStrings.UNITSPHERE);
|
EntityCreationUtils.makeEntityDrawable(Globals.playerCursor, AssetDataStrings.UNITSPHERE);
|
||||||
Actor cursorActor = EntityUtils.getActor(Globals.playerCursor);
|
Actor cursorActor = EntityUtils.getActor(Globals.playerCursor);
|
||||||
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
|
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
|
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
|
||||||
EntityUtils.getScale(Globals.playerCursor).set(0.2f);
|
EntityUtils.getScale(Globals.playerCursor).set(0.2f);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
||||||
@ -103,7 +103,7 @@ public class CursorState {
|
|||||||
Globals.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.playerBlockCursor, AssetDataStrings.UNITCUBE);
|
EntityCreationUtils.makeEntityDrawable(Globals.playerBlockCursor, AssetDataStrings.UNITCUBE);
|
||||||
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
|
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
|
||||||
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
|
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerBlockCursor);
|
DrawableUtils.makeEntityTransparent(Globals.playerBlockCursor);
|
||||||
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
@ -112,7 +112,7 @@ public class CursorState {
|
|||||||
Globals.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.playerAreaCursor, AssetDataStrings.UNITCUBE);
|
EntityCreationUtils.makeEntityDrawable(Globals.playerAreaCursor, AssetDataStrings.UNITCUBE);
|
||||||
Actor areaCursorActor = EntityUtils.getActor(Globals.playerAreaCursor);
|
Actor areaCursorActor = EntityUtils.getActor(Globals.playerAreaCursor);
|
||||||
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
|
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerAreaCursor);
|
DrawableUtils.makeEntityTransparent(Globals.playerAreaCursor);
|
||||||
EntityUtils.getScale(Globals.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
EntityUtils.getScale(Globals.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
||||||
@ -121,7 +121,7 @@ public class CursorState {
|
|||||||
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
|
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
EntityCreationUtils.makeEntityDrawable(playerFabCursor, AssetDataStrings.UNITCUBE);
|
EntityCreationUtils.makeEntityDrawable(playerFabCursor, AssetDataStrings.UNITCUBE);
|
||||||
Actor fabCursorActor = EntityUtils.getActor(playerFabCursor);
|
Actor fabCursorActor = EntityUtils.getActor(playerFabCursor);
|
||||||
fabCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
|
fabCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(playerFabCursor);
|
DrawableUtils.makeEntityTransparent(playerFabCursor);
|
||||||
Globals.clientSceneWrapper.getScene().removeEntityFromTag(playerFabCursor, EntityTags.DRAWABLE);
|
Globals.clientSceneWrapper.getScene().removeEntityFromTag(playerFabCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
@ -166,8 +166,10 @@ public class CursorState {
|
|||||||
/**
|
/**
|
||||||
* Makes the block position cursor visible
|
* Makes the block position cursor visible
|
||||||
*/
|
*/
|
||||||
public static void makeBlockVisible(){
|
public static void makeBlockVisible(String texture){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
|
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
|
||||||
|
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{texture})));
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@ public class AssetDataStrings {
|
|||||||
* Fundamental textures of the engine
|
* Fundamental textures of the engine
|
||||||
*/
|
*/
|
||||||
public static final String TEXTURE_TEAL_TRANSPARENT = "Textures/color/transparent_teal.png";
|
public static final String TEXTURE_TEAL_TRANSPARENT = "Textures/color/transparent_teal.png";
|
||||||
|
public static final String TEXTURE_RED_TRANSPARENT = "Textures/transparent_red.png";
|
||||||
public static final String TEXTURE_DEFAULT = "Textures/color/Testing1.png";
|
public static final String TEXTURE_DEFAULT = "Textures/color/Testing1.png";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import java.util.List;
|
|||||||
import electrosphere.collision.PhysicsEntityUtils;
|
import electrosphere.collision.PhysicsEntityUtils;
|
||||||
import electrosphere.controls.cursor.CursorState;
|
import electrosphere.controls.cursor.CursorState;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
import electrosphere.entity.ClientEntityUtils;
|
import electrosphere.entity.ClientEntityUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
@ -183,7 +184,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
CursorState.makeRealVisible();
|
CursorState.makeRealVisible();
|
||||||
} else if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
} else if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
||||||
Globals.cursorState.setClampToExistingBlock(true);
|
Globals.cursorState.setClampToExistingBlock(true);
|
||||||
CursorState.makeBlockVisible();
|
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user