Andy Gilbert Posted February 10, 2012 Share Posted February 10, 2012 HI, im drawing a couple of rectangles for a simple GUI. They show "levels" of dynamic values withing the game. Problem im having is i keep getting "lines" going from 0,0 (top left corner) to where the rectangle cooords are? They keep jumping from showing the rectangle correctly to then lines going to 0,0? Ive checked my code but cant even see how they would goto 0,0 becasue the function to draw the rect is Xpos,Ypos,width,height and my Xpos and Y pos are static values which never change, along with width too. Only "height" changes. --GUI SetColor(Vec4(0,1,0,0.6)) DrawRect(GraphicsWidth()-50,GraphicsHeight()-100,10,roll*100) DrawRect(GraphicsWidth()-90,GraphicsHeight()-100,10,0-(roll*100)) Why would it be doing this? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted February 10, 2012 Share Posted February 10, 2012 what is the value of roll usually? And put a screenshot of it. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 10, 2012 Author Share Posted February 10, 2012 HI, roll is just : roll = Curve(KeyDown(KEY_LEFT) - KeyDown(KEY_RIGHT),roll,40) Which when printed is long number generally below 1 like 0.0023345 (example) Ive tried getting screent shots but it "flickers" from line to normal and everytime it never gets it, it isnt "all" the time, like once every 2 - 3 seconds? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Clackdor Posted February 10, 2012 Share Posted February 10, 2012 Convert roll to the closest int value and try. Quote Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted February 10, 2012 Share Posted February 10, 2012 Well not roll perse. You need to convert roll*100 to the nearest int... otherwise he'll only ever get 100 or 0. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
macklebee Posted February 10, 2012 Share Posted February 10, 2012 the DrawRect() doesnt appear to like width and height values less than 2 for whatever reason... granted a width or height value of 1 is essentially a line. so to get around it just do a simple check to determine that the value of the roll is greater than 0.02 and it should work fine... if roll>0.02 or roll<-0.02 then DrawRect(gx-50,gy-100,10,roll*100) DrawRect(gx-90,gy-100,10,0-(roll*100)) end Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Paul Thomas Posted February 10, 2012 Share Posted February 10, 2012 if roll < 0.02 then roll = 0.02 end Otherwise wouldn't it just disappear if roll was below 0.02? Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 10, 2012 Share Posted February 10, 2012 well i was assuming based on the code he provided that was what he was wanting... but yes if he wanted to keep at least some sort of rectangle shown then that would be the way to go Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 10, 2012 Author Share Posted February 10, 2012 Ok thanks, I'll implement that and see how it goes. Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.