From 10f3a25c5468a4f1d40e957f0a7af916e59b547a Mon Sep 17 00:00:00 2001 From: andreja6 Date: Wed, 25 Apr 2018 14:17:33 -0700 Subject: [PATCH] Changed how selection boxes are rendered --- content/cursor2.png | Bin 0 -> 637 bytes main.cpp | 45 +++++++++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 content/cursor2.png diff --git a/content/cursor2.png b/content/cursor2.png new file mode 100644 index 0000000000000000000000000000000000000000..f9f972a033e521424792b5a563a5095d04db5315 GIT binary patch literal 637 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r51|<6gKdl8)Ea{HEjtmSN`?>!lvI6;>1s;*b z3=Dh+L6~vJ#O${~LCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33JtM=93Yk+G7#M$f zx;TbZ#J#;4o%hN?#N}d7Q>KC3vxDZr-+eu=bDU8VS(e*(_v)on$?A%)gybv#@EjJ9 zKOkY(^YAe3h=`-_FLtLb>%Y%*OsnMO;fDru{FZNj`Ffh1zd_i-?(7~*_xSB!Dw;NS z?PQ*J{`qU;58rKU^1LNh&oF-Qv`Dh=_+zcdoX51D@vNAf{-C~?{YqrEOHXKx(SmbQ z%1LV;U1ltuCMTFIs>^mIvIr=#MJgbDrJ!Nh#Uh8fs%}RjTwgPmM)h}W?0VVoOL6DX zOiQI>T6yeOmVT9Pi`#Co7O0|CZ@G8Yk&m0IVl#pIUnFfm76xVnEzVqT1XNwJFnxN^ zdIKOUE_T_W4vFngZYw9*n7w zdIjI_dnmV6F0lT_h2%bEyPCtcS*A(T&mXwBT=`N(QSD;(V)q)ed3W|+ZZ3EKlWkMU zVO!u{V>&P4&B4`zb3d{q>(A?b(Wfp^Z6x~<#LYh@nE(H``QJI|2H!ju_b!wF&3!Cx hul2kHp6eez^G|k`Ev(W$s|idh44$rjF6*2UngDLF9UTAw literal 0 HcmV?d00001 diff --git a/main.cpp b/main.cpp index af16561..6e1e94a 100644 --- a/main.cpp +++ b/main.cpp @@ -812,7 +812,6 @@ void Demo::onUserInput(UserInput* ui) { mousex = ui->getMouseX(); mousey = ui->getMouseY(); mouseButton1Down = ui->keyDown(SDL_LEFT_MOUSE_KEY); - messageTime = System::time(); if(ui->keyDown(SDLK_UP)) { forwards = true; @@ -914,28 +913,28 @@ void drawButtons(RenderDevice* rd) } } -void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos) +void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c) { //rd->setLight(0, NULL); //rd->setAmbientLightColor(Color3(1,1,1)); Color3 outline = Color3::cyan();//Color3(0.098F,0.6F,1.0F); float offsetSize = 0.05F; //X - Draw::box(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize)), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, from.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, from.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, to.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, to.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x - offsetSize, from.y + offsetSize, to.z + offsetSize), Vector3(to.x + offsetSize, from.y - offsetSize, to.z - offsetSize))), rd, outline, Color4::clear()); //Y - Draw::box(Box(Vector3(from.x + offsetSize, from.y - offsetSize, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize, from.z - offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(to.x + offsetSize, from.y - offsetSize, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize, from.z - offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(to.x + offsetSize, from.y - offsetSize, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize, to.z - offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(from.x + offsetSize, from.y - offsetSize, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize, to.z - offsetSize)), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, from.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize - 0.1, from.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(to.x - offsetSize, to.y + offsetSize-0.1, to.z - offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y - offsetSize + 0.1, to.z + offsetSize), Vector3(from.x - offsetSize, to.y + offsetSize - 0.1, to.z - offsetSize))), rd, outline, Color4::clear()); //Z - Draw::box(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(from.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, to.y - offsetSize, to.z + offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(to.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, from.y - offsetSize, to.z + offsetSize)), rd, outline, Color4::clear()); - Draw::box(Box(Vector3(to.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, to.y - offsetSize, to.z + offsetSize)), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(from.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(from.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, from.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, from.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear()); + Draw::box(c.toWorldSpace(Box(Vector3(to.x + offsetSize, to.y + offsetSize, from.z - offsetSize), Vector3(to.x - offsetSize, to.y - offsetSize, to.z + offsetSize))), rd, outline, Color4::clear()); mode = RESIZE; @@ -1057,7 +1056,7 @@ void Demo::onGraphics(RenderDevice* rd) { Draw::box(c.toWorldSpace(box), app->renderDevice, part->color, Color4::clear()); if(selectedInstance == part) { - drawOutline(pos2, pos3, rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x/2, pos.y/2, pos.z/2)); + drawOutline(Vector3(0+size.x/4, 0+size.y/4, 0+size.z/4) ,Vector3(0-size.x/4,0-size.y/4,0-size.z/4), rd, lighting, Vector3(size.x/2, size.y/2, size.z/2), Vector3(pos.x/2, pos.y/2, pos.z/2), c); } } @@ -1189,7 +1188,7 @@ void App::main() { go = Texture::fromFile(GetFileInPath("/content/images/Run.png")); go_ovr = Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png")); go_dn = Texture::fromFile(GetFileInPath("/content/images/Run_dn.png")); - cursor = Texture::fromFile(GetFileInPath("/content/cursor.png")); + cursor = Texture::fromFile(GetFileInPath("/content/cursor2.png")); fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt")); fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt")); sky = Sky::create(NULL, ExePath() + "/content/sky/"); @@ -1341,10 +1340,22 @@ int main(int argc, char** argv) { //SetWindowLong(hwnd, GWL_STYLE, WS_VISIBLE | WS_CHILD); SetWindowLongPtr(hwndMain, GWL_USERDATA, (LONG)&app); - HICON hicon = (HICON)LoadImage(GetModuleHandleW(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE); SendMessage(hwndMain, WM_SETICON, ICON_BIG, (LPARAM)hicon); + + + SetWindowPos(hwndMain, NULL, 0, 0, 800, 600, NULL); + HMONITOR monitor = MonitorFromWindow(hwndMain, MONITOR_DEFAULTTONEAREST); + MONITORINFO lpmi; + GetMonitorInfo( monitor, &lpmi); + + int widthMON = lpmi.rcMonitor.bottom; + int heightMON = lpmi.rcMonitor.right; + + //message = Convert(widthMON) + ", " + Convert(heightMON); + //messageTime = G3D::System::time(); + app.run(); return 0; }