Changes for beta release #20

Merged
Mergul merged 4 commits from beta-release into master 2021-03-06 23:51:11 +01:00
9 changed files with 100 additions and 42 deletions
Showing only changes of commit 2107f3908c - Show all commits

View file

@ -58,7 +58,7 @@ struct CBall
{ {
mixin ECS.Component; mixin ECS.Component;
ubyte radius; //ubyte radius;
} }
struct CHitPoints struct CHitPoints
@ -394,12 +394,15 @@ void brickBreakerStart()
launcher.gui_manager.addComponent(CTexCoords(), "Tex Coords"); launcher.gui_manager.addComponent(CTexCoords(), "Tex Coords");
launcher.gui_manager.addComponent(CTexCoordsIndex(), "Tex Coords Index"); launcher.gui_manager.addComponent(CTexCoordsIndex(), "Tex Coords Index");
launcher.gui_manager.addComponent(CVelocity(), "Velocity"); launcher.gui_manager.addComponent(CVelocity(), "Velocity");
launcher.gui_manager.addComponent(CInput(), "Velocity"); launcher.gui_manager.addComponent(CInput(), "Input");
launcher.gui_manager.addComponent(CPaddle(), "Paddle");
launcher.gui_manager.addComponent(CDamping(), "Damping"); launcher.gui_manager.addComponent(CDamping(), "Damping");
launcher.gui_manager.addComponent(CBall(), "Ball"); launcher.gui_manager.addComponent(CBall(), "Ball");
launcher.gui_manager.addComponent(CBVH(), "BVH"); launcher.gui_manager.addComponent(CBVH(), "BVH");
launcher.gui_manager.addComponent(CAABB(), "AABB"); launcher.gui_manager.addComponent(CAABB(), "AABB");
launcher.gui_manager.addComponent(CStatic(), "Static Flag"); launcher.gui_manager.addComponent(CStatic(), "Static Flag");
launcher.gui_manager.addComponent(CVelocityFactor(), "Velocity Factor");
launcher.gui_manager.addComponent(CHitPoints(), "Hit Points");
launcher.gui_manager.addSystem(becsID!MoveSystem, "Move System"); launcher.gui_manager.addSystem(becsID!MoveSystem, "Move System");
launcher.gui_manager.addSystem(becsID!EdgeCollisionSystem, "Edge Collision System"); launcher.gui_manager.addSystem(becsID!EdgeCollisionSystem, "Edge Collision System");

View file

@ -402,12 +402,20 @@ void particlesStart()
launcher.gui_manager.addSystem(becsID!MouseAttractSystem,"Mouse Attract System"); launcher.gui_manager.addSystem(becsID!MouseAttractSystem,"Mouse Attract System");
launcher.gui_manager.addSystem(becsID!DampingSystem,"Damping System"); launcher.gui_manager.addSystem(becsID!DampingSystem,"Damping System");
launcher.gui_manager.addSystem(becsID!ParticleLifeSystem,"Particle Life System"); launcher.gui_manager.addSystem(becsID!ParticleLifeSystem,"Particle Life System");
launcher.gui_manager.addSystem(becsID!GravitySystem,"Gravity System");
// launcher.gui_manager.addComponent(CColor(),"Color (white)"); // launcher.gui_manager.addComponent(CColor(),"Color (white)");
// launcher.gui_manager.addComponent(CColor(0xFF101540),"Color (red)"); // launcher.gui_manager.addComponent(CColor(0xFF101540),"Color (red)");
// launcher.gui_manager.addComponent(CColor(0xFF251010),"Color (blue)"); // launcher.gui_manager.addComponent(CColor(0xFF251010),"Color (blue)");
// launcher.gui_manager.addComponent(CColor(0xFF102010),"Color (green)"); // launcher.gui_manager.addComponent(CColor(0xFF102010),"Color (green)");
launcher.gui_manager.addComponent(CColor(0xFF101540),"Color"); launcher.gui_manager.addComponent(CLocation(),"Location");
launcher.gui_manager.addComponent(CScale(),"Scale");
launcher.gui_manager.addComponent(CTexCoords(),"Texture Coords");
launcher.gui_manager.addComponent(CTexCoordsIndex(),"Texture Coords Index");
launcher.gui_manager.addComponent(CRotation(),"Rotation");
launcher.gui_manager.addComponent(CDepth(),"Depth");
launcher.gui_manager.addComponent(CMaterialIndex(),"Material ID");
launcher.gui_manager.addComponent(CVelocityFactor(),"Velocity Factor");
launcher.gui_manager.addComponent(CAttractor(0.1),"Attractor"); launcher.gui_manager.addComponent(CAttractor(0.1),"Attractor");
launcher.gui_manager.addComponent(CForceRange(vec2(5,40)),"ForceRange"); launcher.gui_manager.addComponent(CForceRange(vec2(5,40)),"ForceRange");
launcher.gui_manager.addComponent(CVelocity(),"Velocity"); launcher.gui_manager.addComponent(CVelocity(),"Velocity");

View file

@ -19,6 +19,7 @@ import ecs_utils.utils;
import game_core.basic; import game_core.basic;
import gui.attributes;
//import std.array : staticArray; //import std.array : staticArray;
enum float px = 1.0/512.0; enum float px = 1.0/512.0;
@ -133,7 +134,7 @@ struct CAnimation
mixin ECS.Component; mixin ECS.Component;
vec4[] frames; vec4[] frames;
float time = 0; @GUIRangeF(0,float.max)float time = 0;
} }
//CIlocation is integer location used as grid cell coordination //CIlocation is integer location used as grid cell coordination
@ -203,7 +204,7 @@ struct CSnake
} }
Parts parts; Parts parts;
CMovement.Direction direction; @GUIRange(0,3)CMovement.Direction direction;
} }
//flag for apple //flag for apple
@ -241,7 +242,7 @@ struct CMovement
right right
} }
Direction direction; @GUIRange(0,3)Direction direction;
} }
// struct CInput // struct CInput
@ -373,8 +374,10 @@ struct AnimationRenderSystem
draw_data.depth = -1; draw_data.depth = -1;
foreach(i;0..data.length) foreach(i;0..data.length)
{ {
uint frame = cast(uint)(data.animation[i].time);
if(frame >= data.animation[i].frames.length)frame = cast(uint)data.animation[i].frames.length - 1;
draw_data.position = data.location[i]; draw_data.position = data.location[i];
draw_data.coords = data.animation[i].frames[cast(int)(data.animation[i].time)]; draw_data.coords = data.animation[i].frames[frame];
launcher.renderer.draw(draw_data); launcher.renderer.draw(draw_data);
} }
} }
@ -910,8 +913,9 @@ void snakeStart()
launcher.gui_manager.addComponent(CParticleVector(vec2(0,1)),"Particle Vector"); launcher.gui_manager.addComponent(CParticleVector(vec2(0,1)),"Particle Vector");
launcher.gui_manager.addComponent(CInput(),"Input"); launcher.gui_manager.addComponent(CInput(),"Input");
launcher.gui_manager.addComponent(CMovement(CMovement.Direction.up),"Movement"); launcher.gui_manager.addComponent(CMovement(CMovement.Direction.up),"Movement");
//launcher.gui_manager.addComponent(CAnimation(),"Movement"); launcher.gui_manager.addComponent(CAnimation(),"Animation");
launcher.gui_manager.addComponent(CILocation(),"Int Location"); launcher.gui_manager.addComponent(CILocation(),"Int Location");
launcher.gui_manager.addComponent(CLocation(),"Location");
launcher.gui_manager.addSystem(becsID!MoveSystem,"Move System"); launcher.gui_manager.addSystem(becsID!MoveSystem,"Move System");
launcher.gui_manager.addSystem(becsID!InputSystem,"Input System"); launcher.gui_manager.addSystem(becsID!InputSystem,"Input System");
@ -922,6 +926,9 @@ void snakeStart()
launcher.gui_manager.addSystem(becsID!ParticleMovementSystem,"Particle Movement System"); launcher.gui_manager.addSystem(becsID!ParticleMovementSystem,"Particle Movement System");
launcher.gui_manager.addSystem(becsID!DrawAppleSystem,"Draw Apple System"); launcher.gui_manager.addSystem(becsID!DrawAppleSystem,"Draw Apple System");
launcher.gui_manager.addSystem(becsID!DrawSnakeSystem,"Draw Snake System"); launcher.gui_manager.addSystem(becsID!DrawSnakeSystem,"Draw Snake System");
launcher.gui_manager.addSystem(becsID!CopyLocationSystem,"Copy Location System");
//launcher.gui_manager.addSystem(becsID!AppleSystem,"Apple System");
//launcher.gui_manager.addSystem(becsID!SnakeSystem,"Snake System");
snake.snake_destroy_particle_frames = Mallocator.makeArray([vec4(64,144,16,16)*px,vec4(80,144,16,16)*px,vec4(96,144,16,16)*px,vec4(112,144,16,16)*px].staticArray); snake.snake_destroy_particle_frames = Mallocator.makeArray([vec4(64,144,16,16)*px,vec4(80,144,16,16)*px,vec4(96,144,16,16)*px,vec4(112,144,16,16)*px].staticArray);

View file

@ -20,6 +20,8 @@ import game_core.basic;
import game_core.rendering; import game_core.rendering;
import game_core.collision; import game_core.collision;
import gui.attributes;
private enum float px = 1.0/512.0; private enum float px = 1.0/512.0;
@ -222,8 +224,8 @@ struct CWeapon
} }
float shoot_time = 0; float shoot_time = 0;
Type type; @GUIRange(0, 4) Type type;
ubyte level = 1; @GUIRange(0, 11) ubyte level = 1;
} }
struct CWeaponLocation struct CWeaponLocation
@ -237,7 +239,7 @@ struct CShootDirection
{ {
mixin ECS.Component; mixin ECS.Component;
Direction direction; @GUIRange(0, 3) Direction direction;
} }
struct CSideMove struct CSideMove
@ -304,8 +306,8 @@ struct CAnimation
mixin ECS.Component; mixin ECS.Component;
vec4[] frames; vec4[] frames;
float time = 0; @GUIRangeF(0, float.max)float time = 0;
float speed = 1; @GUIRangeF(0, float.max)float speed = 1;
} }
struct CAnimationLooped struct CAnimationLooped
@ -350,7 +352,7 @@ struct CParts
{ {
mixin ECS.Component; mixin ECS.Component;
ubyte count; @GUIDisabled ubyte count;
} }
struct CInit struct CInit
@ -364,7 +366,7 @@ struct CInit
boss boss
} }
Type type; @GUIRange(0, 2)Type type;
} }
struct CParticleEmitter struct CParticleEmitter
@ -373,9 +375,8 @@ struct CParticleEmitter
vec2 range = vec2(0,0); vec2 range = vec2(0,0);
vec2 time_range = vec2(500,1000); vec2 time_range = vec2(500,1000);
///due to multithreading there should be separate template for every thread.
///It can be array of tempaltes or (like in this demo) simply index of template; ///It can be array of tempaltes or (like in this demo) simply index of template;
uint tmpl_id; //uint tmpl_id;
//EntityTemplate* tmpl; //EntityTemplate* tmpl;
} }
@ -404,7 +405,7 @@ struct CSpawnUponDeath
//EntityID parent; //EntityID parent;
//EntityTemplate* tmpl; //EntityTemplate* tmpl;
Type type; @GUIRange(0,0) Type type;
} }
///This component can be replaced by "CSpawnUponDeath" but I want to gives possibility to add this component to every entity ///This component can be replaced by "CSpawnUponDeath" but I want to gives possibility to add this component to every entity
@ -413,7 +414,7 @@ struct CShootWaveUponDeath
{ {
mixin ECS.Component; mixin ECS.Component;
CWeapon.Type bullet_type; @GUIRange(0, 4) CWeapon.Type bullet_type;
} }
/*####################################################################################################################### /*#######################################################################################################################
@ -1582,7 +1583,7 @@ struct PartsDestroySystem
becsID!CVelocity, becsID!CLocation, becsID!CParticleEmitter, becsID!CVelocity, becsID!CLocation, becsID!CParticleEmitter,
becsID!CParticleEmitterTime, becsID!CTargetParent, becsID!CDepth becsID!CParticleEmitterTime, becsID!CTargetParent, becsID!CDepth
].staticArray); ].staticArray);
*flashes_emitter.getComponent!CParticleEmitter() = CParticleEmitter(vec2(0,0), vec2(800,1600), 0); *flashes_emitter.getComponent!CParticleEmitter() = CParticleEmitter(vec2(0,0), vec2(800,1600));
} }
void onDestroy() void onDestroy()
@ -1783,7 +1784,8 @@ struct AnimationSystem
{ {
data.animation[i].time += dt * data.animation[i].speed; data.animation[i].time += dt * data.animation[i].speed;
while(cast(uint)data.animation[i].time >= data.animation[i].frames.length)data.animation[i].time -= cast(float)data.animation[i].frames.length; while(cast(uint)data.animation[i].time >= data.animation[i].frames.length)data.animation[i].time -= cast(float)data.animation[i].frames.length;
if(cast(uint)(data.animation[i].time) >= data.animation[i].frames.length)assert(0); //if(cast(uint)(data.animation[i].time) >= data.animation[i].frames.length)assert(0);
assert(cast(uint)(data.animation[i].time) < data.animation[i].frames.length);
uint index = cast(uint)(data.animation[i].time); uint index = cast(uint)(data.animation[i].time);
if(index < data.animation[i].frames.length)data.texcoords[i].value = data.animation[i].frames[index]; if(index < data.animation[i].frames.length)data.texcoords[i].value = data.animation[i].frames[index];
} }
@ -2102,9 +2104,13 @@ void spaceInvadersStart()
draw_system.default_data.color = 0x80808080; draw_system.default_data.color = 0x80808080;
draw_system.default_data.texture = space_invaders.texture; draw_system.default_data.texture = space_invaders.texture;
launcher.gui_manager.addComponent(CLocation(),"Location");
launcher.gui_manager.addComponent(CRotation(),"Rotation");
launcher.gui_manager.addComponent(CTexCoords(),"TexCoords");
launcher.gui_manager.addComponent(CInput(),"Input"); launcher.gui_manager.addComponent(CInput(),"Input");
launcher.gui_manager.addComponent(CShip(),"Ship"); launcher.gui_manager.addComponent(CShip(),"Ship");
launcher.gui_manager.addComponent(CEnemy(),"Enemy"); launcher.gui_manager.addComponent(CEnemy(),"Enemy");
launcher.gui_manager.addComponent(CShootDirection(),"Shoot Direction");
launcher.gui_manager.addComponent(CAutoShoot(),"Auto Shoot"); launcher.gui_manager.addComponent(CAutoShoot(),"Auto Shoot");
launcher.gui_manager.addComponent(CWeapon(0, CWeapon.Type.laser),"Weapon (laser)"); launcher.gui_manager.addComponent(CWeapon(0, CWeapon.Type.laser),"Weapon (laser)");
launcher.gui_manager.addComponent(CVelocity(vec2(0,0)),"Velocity (0,0)"); launcher.gui_manager.addComponent(CVelocity(vec2(0,0)),"Velocity (0,0)");
@ -2112,6 +2118,7 @@ void spaceInvadersStart()
launcher.gui_manager.addComponent(CSideMove(),"Side Move"); launcher.gui_manager.addComponent(CSideMove(),"Side Move");
launcher.gui_manager.addComponent(CSideMove(0),"Side Move (g1)"); launcher.gui_manager.addComponent(CSideMove(0),"Side Move (g1)");
launcher.gui_manager.addComponent(CSideMove(1),"Side Move (g2)"); launcher.gui_manager.addComponent(CSideMove(1),"Side Move (g2)");
launcher.gui_manager.addComponent(CDepth(),"Depth");
launcher.gui_manager.addComponent(CShootGrid(),"Shoot Grid"); launcher.gui_manager.addComponent(CShootGrid(),"Shoot Grid");
launcher.gui_manager.addComponent(CGuild(),"Guild (Player)"); launcher.gui_manager.addComponent(CGuild(),"Guild (Player)");
launcher.gui_manager.addComponent(CGuild(1),"Guild (Enemy)"); launcher.gui_manager.addComponent(CGuild(1),"Guild (Enemy)");
@ -2119,24 +2126,29 @@ void spaceInvadersStart()
launcher.gui_manager.addComponent(CHitMark(),"Hit Mark"); launcher.gui_manager.addComponent(CHitMark(),"Hit Mark");
launcher.gui_manager.addComponent(CUpgrade(CUpgrade.Upgrade.laser),"Upgrade (laser)"); launcher.gui_manager.addComponent(CUpgrade(CUpgrade.Upgrade.laser),"Upgrade (laser)");
launcher.gui_manager.addComponent(CParticle(1000),"Particle (1s)"); launcher.gui_manager.addComponent(CParticle(1000),"Particle (1s)");
//launcher.gui_manager.addComponent(CMaxHitPoints(),"Max Hit Points"); launcher.gui_manager.addComponent(CMaxHitPoints(),"Max Hit Points");
launcher.gui_manager.addComponent(CAnimation(),"Animation");
launcher.gui_manager.addComponent(CDamping(0),"Damping (0)"); launcher.gui_manager.addComponent(CDamping(0),"Damping (0)");
launcher.gui_manager.addComponent(CDamping(4),"Damping (4)"); launcher.gui_manager.addComponent(CDamping(4),"Damping (4)");
launcher.gui_manager.addComponent(CDamping(8),"Damping (8)"); launcher.gui_manager.addComponent(CDamping(8),"Damping (8)");
launcher.gui_manager.addComponent(CAnimationLooped(),"Animation loop flag");
launcher.gui_manager.addComponent(CTargetParent(),"Target Parent"); launcher.gui_manager.addComponent(CTargetParent(),"Target Parent");
launcher.gui_manager.addComponent(CTargetPlayerShip(),"Target Player Ship"); launcher.gui_manager.addComponent(CTargetPlayerShip(),"Target Player Ship");
launcher.gui_manager.addComponent(CTarget(),"Target"); launcher.gui_manager.addComponent(CTarget(),"Target");
launcher.gui_manager.addComponent(CChildren(),"Children"); launcher.gui_manager.addComponent(CChildren(),"Children");
launcher.gui_manager.addComponent(CVelocityFactor(),"Velocity Factor");
launcher.gui_manager.addComponent(CWeaponLocation(vec2(0,16)),"Weapon Location (0,16)"); launcher.gui_manager.addComponent(CWeaponLocation(vec2(0,16)),"Weapon Location (0,16)");
launcher.gui_manager.addComponent(CInit(CInit.Type.space_ship),"Init (Ship)"); launcher.gui_manager.addComponent(CInit(CInit.Type.space_ship),"Init (Ship)");
launcher.gui_manager.addComponent(CInit(CInit.Type.boss),"Init (Boss)"); launcher.gui_manager.addComponent(CInit(CInit.Type.boss),"Init (Boss)");
launcher.gui_manager.addComponent(CInit(CInit.Type.tower),"Init (Tower)"); launcher.gui_manager.addComponent(CInit(CInit.Type.tower),"Init (Tower)");
launcher.gui_manager.addComponent(CBoss(),"Boss"); launcher.gui_manager.addComponent(CBoss(),"Boss");
launcher.gui_manager.addComponent(CParts(),"Parts");
launcher.gui_manager.addComponent(CColliderScale(),"Collider Scale"); launcher.gui_manager.addComponent(CColliderScale(),"Collider Scale");
launcher.gui_manager.addComponent(CParticleEmitter(),"Particle Emitter"); launcher.gui_manager.addComponent(CParticleEmitter(),"Particle Emitter");
launcher.gui_manager.addComponent(CParticleEmitterTime(),"Particle Emitter Time"); launcher.gui_manager.addComponent(CParticleEmitterTime(),"Particle Emitter Time");
//launcher.gui_manager.addComponent(CSpawnUponDeath(),"Spawn Upon Death"); launcher.gui_manager.addComponent(CSpawnUponDeath(),"Spawn Upon Death");
launcher.gui_manager.addComponent(CShootWaveUponDeath(CWeapon.Type.canon),"Wave Upon Death"); launcher.gui_manager.addComponent(CShootWaveUponDeath(CWeapon.Type.canon),"Wave Upon Death");
launcher.gui_manager.addComponent(CShootGridMask(),"Shoot grid mask");
launcher.gui_manager.addSystem(becsID!DrawSystem,"Draw System"); launcher.gui_manager.addSystem(becsID!DrawSystem,"Draw System");
launcher.gui_manager.addSystem(becsID!InputMovementSystem,"Input Movement"); launcher.gui_manager.addSystem(becsID!InputMovementSystem,"Input Movement");
@ -2165,6 +2177,7 @@ void spaceInvadersStart()
launcher.gui_manager.addSystem(becsID!ChildDestroySystem,"Child Destroy System"); launcher.gui_manager.addSystem(becsID!ChildDestroySystem,"Child Destroy System");
launcher.gui_manager.addSystem(becsID!ShootWaveSystem,"Shoot Wave System"); launcher.gui_manager.addSystem(becsID!ShootWaveSystem,"Shoot Wave System");
//launcher.gui_manager.addSystem(becsID!SpawnUponDeathSystem,"Child Destroy System"); //launcher.gui_manager.addSystem(becsID!SpawnUponDeathSystem,"Child Destroy System");
//launcher.gui_manager.addSystem(becsID!CollisionMaskSystem,"Collision Mask");
//gEntityManager.getSystem(becsID!CleanSystem).disable(); //gEntityManager.getSystem(becsID!CleanSystem).disable();
{ {

View file

@ -11,6 +11,7 @@ import ecs_utils.utils;
import game_core.basic; import game_core.basic;
import gui.attributes;
void registerCollisionModule(EntityManager* manager) void registerCollisionModule(EntityManager* manager)
{ {
@ -46,7 +47,7 @@ struct CBVH
{ {
mixin ECS.Component; mixin ECS.Component;
uint index; @GUIDisabled uint index;
} }
struct CAABB struct CAABB
@ -64,7 +65,7 @@ struct CShootGridMask
alias value this; alias value this;
ubyte value; @GUIDisabled ubyte value;
} }
struct CColliderScale struct CColliderScale

View file

@ -4,17 +4,20 @@ enum GUIColor = "GUIColor";
struct GUIRange struct GUIRange
{ {
union
{
struct struct
{ {
int min; int min;
int max; int max;
} }
}
struct GUIRangeF
{
struct struct
{ {
float minf; float minf;
float maxf; float maxf;
} }
}
} }
enum GUIDisabled = "GUIDisabled";

View file

@ -54,6 +54,7 @@ struct VariableGUI
Type type; Type type;
const (char)* name; const (char)* name;
ushort offset; ushort offset;
bool disabled = false;
union union
{ {
Int int_; Int int_;

View file

@ -152,6 +152,7 @@ struct GUIManager
//pragma(msg,member_type); //pragma(msg,member_type);
//pragma(msg,__traits(getMember, T, member).offsetof); //pragma(msg,__traits(getMember, T, member).offsetof);
ushort offset = member.offsetof;//cast(ushort)__traits(getMember, T, member).offsetof; ushort offset = member.offsetof;//cast(ushort)__traits(getMember, T, member).offsetof;
static if(is(member_type == vec2)) static if(is(member_type == vec2))
{ {
comp_edit.variables[comp_edit.used++] = VariableGUI(VariableGUI.Type.vec2,member_str,offset); comp_edit.variables[comp_edit.used++] = VariableGUI(VariableGUI.Type.vec2,member_str,offset);
@ -236,14 +237,20 @@ struct GUIManager
} }
static if(hasUDA!(member,GUIRange)) static if(hasUDA!(member,GUIRange))
{ {
comp_edit.variables[comp_edit.used-1].float_.min = getUDAs!(member,GUIRange)[0].minf; comp_edit.variables[comp_edit.used-1].float_.min = getUDAs!(member,GUIRange)[0].min;
comp_edit.variables[comp_edit.used-1].float_.max = getUDAs!(member,GUIRange)[1].maxf; comp_edit.variables[comp_edit.used-1].float_.max = getUDAs!(member,GUIRange)[0].max;
} }
else static if(hasUDA!(member,GUIRangeF))
{ {
comp_edit.variables[comp_edit.used-1].float_.min = getUDAs!(member,GUIRangeF)[0].minf;
comp_edit.variables[comp_edit.used-1].float_.max = getUDAs!(member,GUIRangeF)[0].maxf;
}
else {
comp_edit.variables[comp_edit.used-1].float_.min = -float.max; comp_edit.variables[comp_edit.used-1].float_.min = -float.max;
comp_edit.variables[comp_edit.used-1].float_.max = float.max; comp_edit.variables[comp_edit.used-1].float_.max = float.max;
} }
} }
static if(hasUDA!(member,GUIDisabled))comp_edit.variables[comp_edit.used - 1].disabled = true;
} }
edit_components[becsID(comp)] = comp_edit; edit_components[becsID(comp)] = comp_edit;
} }
@ -256,12 +263,14 @@ struct GUIManager
igIndent(8); igIndent(8);
foreach(ref SystemGUI system;systems) foreach(ref SystemGUI system;systems)
{ {
igPushIDPtr(&system);
if(igCheckbox(system.name,&system.enabled)) if(igCheckbox(system.name,&system.enabled))
{ {
System* sys = gEntityManager.getSystem(system.id); System* sys = gEntityManager.getSystem(system.id);
if(system.enabled)sys.enable(); if(system.enabled)sys.enable();
else sys.disable(); else sys.disable();
} }
igPopID();
} }
igUnindent(8); igUnindent(8);
} }
@ -337,13 +346,15 @@ struct GUIManager
{ {
vec4 color; vec4 color;
if(comp_id >= edit_components.length)return; if(comp_id >= edit_components.length)return;
if(edit_components[comp_id].used) //if(edit_components[comp_id].used)
if(edit_components[comp_id].name)
{ {
if(igCollapsingHeader(edit_components[comp_id].name, ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_DefaultOpen)) if(igCollapsingHeader(edit_components[comp_id].name, ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_DefaultOpen))
{ {
igIndent(8); igIndent(8);
foreach(ref VariableGUI var;edit_components[comp_id].variables[0 .. edit_components[comp_id].used]) foreach(ref VariableGUI var;edit_components[comp_id].variables[0 .. edit_components[comp_id].used])
{ {
igPushIDPtr(&var); igPushIDPtr(&var);
switch(var.type) switch(var.type)
{ {
@ -351,7 +362,12 @@ struct GUIManager
igDragScalarClamp(var.name, ImGuiDataType_S8, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1); igDragScalarClamp(var.name, ImGuiDataType_S8, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1);
break; break;
case VariableGUI.Type.ubyte_: case VariableGUI.Type.ubyte_:
igDragScalarClamp(var.name, ImGuiDataType_U8, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1); if(var.disabled)
{
ubyte v = *cast(ubyte*)(data_ptr+var.offset);
igDragScalarClamp(var.name, ImGuiDataType_U8, &v, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1);
}
else igDragScalarClamp(var.name, ImGuiDataType_U8, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1);
break; break;
case VariableGUI.Type.short_: case VariableGUI.Type.short_:
igDragScalarClamp(var.name, ImGuiDataType_S16, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1); igDragScalarClamp(var.name, ImGuiDataType_S16, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1);
@ -363,7 +379,12 @@ struct GUIManager
igDragScalarClamp(var.name, ImGuiDataType_S32, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1); igDragScalarClamp(var.name, ImGuiDataType_S32, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1);
break; break;
case VariableGUI.Type.uint_: case VariableGUI.Type.uint_:
igDragScalarClamp(var.name, ImGuiDataType_U32, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1); if(var.disabled)
{
uint v = *cast(uint*)(data_ptr+var.offset);
igDragScalarClamp(var.name, ImGuiDataType_U32, &v, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1);
}
else igDragScalarClamp(var.name, ImGuiDataType_U32, data_ptr+var.offset, 0.1, cast(void*)&var.int_.min, cast(void*)&var.int_.max, null, 1);
break; break;
case VariableGUI.Type.float_: case VariableGUI.Type.float_:
igDragScalarClamp(var.name, ImGuiDataType_Float, data_ptr+var.offset, 0.1, cast(void*)&var.float_.min, cast(void*)&var.float_.max, "%2.2f", 1); igDragScalarClamp(var.name, ImGuiDataType_Float, data_ptr+var.offset, 0.1, cast(void*)&var.float_.min, cast(void*)&var.float_.max, "%2.2f", 1);

View file

@ -448,6 +448,7 @@ struct Renderer
void draw(scope ref const(DrawData) data) void draw(scope ref const(DrawData) data)
{ {
if(prepared_items >= MaxObjects)return; if(prepared_items >= MaxObjects)return;
if(threads[data.thread_id].blocks.length <= data.material_id)return;
__draw(this,data);//tex,pos,size,coords,depth,color,angle,material_id,mesh_id,thread_id); __draw(this,data);//tex,pos,size,coords,depth,color,angle,material_id,mesh_id,thread_id);
} }