Load/Saving of triggers is a go

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 746c91ec85
commit 2f87d8b763
  1. BIN
      C++ProjectTemplate
  2. 42
      main.cpp

Binary file not shown.

@ -14,22 +14,23 @@ public:
public:
Decal*box;
void DrawBorderBox(const vd2d&pos,const vd2d&size) {
DrawPartialDecal(pos,box,{0,0},{13,13}); //Upper-Left Corner
vd2d ULOffset={13,0};
DrawPartialDecal(pos+ULOffset,{(float)size.x-26,13},box,{13,0},{91,13}); //Top
vd2d UROffset={size.x-13,0};
DrawPartialDecal(pos+UROffset,box,{104,0},{13,13}); //Upper-Right Corner
vd2d ULBottomOffset={0,13};
DrawPartialDecal(pos+ULBottomOffset,{13,(float)size.y-25},box,{0,13},{13,73});//Left
vd2d BLOffset={0,size.y-13};
DrawPartialDecal(pos+BLOffset,box,{0,86},{13,13}); //Bottom-Left Corner
vd2d BLLeftOffset={13,size.y-13+0.05};
DrawPartialDecal(pos+BLLeftOffset,{(float)size.x-26,13},box,{13,86},{91,13}); //Bottom
vd2d BROffset={size.x-13,size.y-13};
DrawPartialDecal(pos+BROffset,box,{104,86},{13,13}); //Bottom-Right Corner
vd2d TROffset={size.x-13,13};
DrawPartialDecal(pos+TROffset,{13,(float)size.y-25},box,{104,13},{13,73});//Right
void DrawBorderBox(const vd2d&pos,const vd2d&size,const vd2d&borderScale={1,1}) {
vd2d scaledCorner={13*(float)borderScale.x,13*(float)borderScale.y};
DrawPartialDecal(pos,scaledCorner,box,{0,0},{13,13}); //Upper-Left Corner
vd2d ULOffset={13*(float)borderScale.x,0};
DrawPartialDecal(pos+ULOffset,{(float)size.x-26*(float)borderScale.x,13*(float)borderScale.y},box,{13,0},{91,13}); //Top
vd2d UROffset={size.x-13*(float)borderScale.x,0};
DrawPartialDecal(pos+UROffset,scaledCorner,box,{104,0},{13,13}); //Upper-Right Corner
vd2d ULBottomOffset={0,13*(float)borderScale.y};
DrawPartialDecal(pos+ULBottomOffset,{13*(float)borderScale.x,(float)size.y-25*(float)borderScale.y},box,{0,13},{13,73});//Left
vd2d BLOffset={0,size.y-13*(float)borderScale.y};
DrawPartialDecal(pos+BLOffset,scaledCorner,box,{0,86},{13,13}); //Bottom-Left Corner
vd2d BLLeftOffset={13*(float)borderScale.x,size.y-(13+0.05)*(float)borderScale.y};
DrawPartialDecal(pos+BLLeftOffset,{(float)size.x-26*(float)borderScale.x,13*(float)borderScale.y},box,{13,86},{91,13}); //Bottom
vd2d BROffset={size.x-13*(float)borderScale.x,size.y-13*(float)borderScale.y};
DrawPartialDecal(pos+BROffset,scaledCorner,box,{104,86},{13,13}); //Bottom-Right Corner
vd2d TROffset={size.x-13*(float)borderScale.x,13*(float)borderScale.y};
DrawPartialDecal(pos+TROffset,{13*(float)borderScale.x,(float)size.y-25*(float)borderScale.y},box,{104,13},{13,73});//Right
}
bool OnUserCreate() override
@ -38,12 +39,19 @@ public:
return true;
}
vd2d borderSize={1,1};
bool OnUserUpdate(float fElapsedTime) override
{
if (GetMouseWheel()!=0) {
borderSize.x+=GetMouseWheel()*0.1;
borderSize.y+=GetMouseWheel()*0.1;
}
vd2d boxPos={24,24};
vd2d boxSize=GetMousePos()-boxPos;
FillRectDecal(boxPos,boxSize,GREY);
DrawBorderBox(boxPos,boxSize);
DrawBorderBox(boxPos,boxSize,borderSize);
return true;
}
};

Loading…
Cancel
Save