Fix rendering current entity
This commit is contained in:
@@ -102,9 +102,6 @@ compare_engine_entity_def :: proc(a, b : engine_entity_def) -> bool
|
||||
//ret &= a.vertices[:] == b.vertices[:]
|
||||
ret &= a.name_buf == b.name_buf
|
||||
|
||||
if a.entity_flags != b.entity_flags{
|
||||
fmt.println("Hello world")
|
||||
}
|
||||
ret &= a.entity_flags == b.entity_flags
|
||||
ret &= a.index == b.index
|
||||
|
||||
|
||||
@@ -71,6 +71,14 @@ handle_entity_mode :: proc(
|
||||
input := &state.input
|
||||
mpos := draw.camera_convert_screen_to_world(&state.draw.cam, input.mouse)
|
||||
|
||||
if interface.selected_entity != -1
|
||||
{
|
||||
def := &level.entity_defs[interface.selected_entity]
|
||||
{
|
||||
draw.solid_circle_add(&interface.state.draw.solid_circles, {p = def.body_def.position, q = {c = 1} }, 0.2, {1, 0, 0, 1})
|
||||
}
|
||||
}
|
||||
|
||||
//Setlect entity
|
||||
if is_key_pressed(state, glfw.MOUSE_BUTTON_LEFT)
|
||||
{
|
||||
|
||||
@@ -189,11 +189,15 @@ interface_all :: proc($E: typeid, interface: ^interface_state, game_data : $G) -
|
||||
|
||||
if mu.begin_window(&state.mu_ctx, "B2d Interface", {1630, 170, 250, 450})
|
||||
{
|
||||
|
||||
if interface.edit_mode == .ENTITY
|
||||
{
|
||||
if .ACTIVE in mu.header(&state.mu_ctx, "Entity", {.AUTO_SIZE})
|
||||
{
|
||||
if interface_entity(interface) do ret = true
|
||||
}
|
||||
}
|
||||
mu.end_window(&state.mu_ctx)
|
||||
}
|
||||
|
||||
//if interface_joints(interface) do ret = true
|
||||
|
||||
+12
-2
@@ -375,6 +375,8 @@ interface_entity :: proc(interface: ^interface_state) -> bool
|
||||
{
|
||||
entity_selected := (interface.selected_entity != -1) && len(interface.entity_defs) > 0
|
||||
|
||||
ctx := &interface.state.mu_ctx
|
||||
|
||||
if entity_selected
|
||||
{
|
||||
def := interface.entity_defs[interface.selected_entity]
|
||||
@@ -386,8 +388,16 @@ interface_entity :: proc(interface: ^interface_state) -> bool
|
||||
//Flags
|
||||
for flag in engine_entity_flags_enum
|
||||
{
|
||||
//contains := flag in def.entity_flags
|
||||
//if mu.checkbox(fmt.tprint(flag), &contains) do def.entity_flags ~= {flag}
|
||||
contains := flag in def.entity_flags
|
||||
if .CHANGE in mu.checkbox(ctx, fmt.tprint(flag), &contains)
|
||||
{
|
||||
def.entity_flags ~= {flag}
|
||||
}
|
||||
}
|
||||
|
||||
//Draw circle on selected entity
|
||||
{
|
||||
draw.solid_circle_add(&interface.state.draw.solid_circles, {p = def.body_def.position, q = {c = 1} }, 0.2, {1, 0, 0, 1})
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user