Euflorium: The Eufloria Community
Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: annikk.exe on December 20, 2010, 05:46:15 AM
-
How do I draw a fixed line in the level, so that it appears to be part of the background?
-
Here is what I thought would work, but apparently does not:
function ScreenDraw()
-- left line
Line1x1 = -16000 - GetCameraX() / GetCameraScale()
Line1y1 = -16000 - GetCameraY() / GetCameraScale()
Line1x2 = -16000 - GetCameraX() / GetCameraScale()
Line1y2 = 16000 - GetCameraY() / GetCameraScale()
-- bottom line
Line2x1 = -16000 - GetCameraX() / GetCameraScale()
Line2y1 = -16000 - GetCameraY() / GetCameraScale()
Line2x2 = 16000 - GetCameraX() / GetCameraScale()
Line2y2 = -16000 - GetCameraY() / GetCameraScale()
-- right line
Line3x1 = 16000 - GetCameraX() / GetCameraScale()
Line3y1 = -16000 - GetCameraY() / GetCameraScale()
Line3x2 = 16000 - GetCameraX() / GetCameraScale()
Line3y2 = 16000 - GetCameraY() / GetCameraScale()
-- top line
Line4x1 = -16000 - GetCameraX() / GetCameraScale()
Line4y1 = 16000 - GetCameraY() / GetCameraScale()
Line4x2 = 16000 - GetCameraX() / GetCameraScale()
Line4y2 = 16000 - GetCameraY() / GetCameraScale()
DrawLine(Line1x1,Line1y1,Line1x2,Line1y2,0,0,1,1,0,1,0,1,3)
DrawLine(Line2x1,Line2y1,Line2x2,Line2y2,0,0,1,1,0,1,0,1,3)
DrawLine(Line3x1,Line3y1,Line3x2,Line3y2,0,0,1,1,0,1,0,1,3)
DrawLine(Line4x1,Line4y1,Line4x2,Line4y2,0,0,1,1,0,1,0,1,3)
end
-
If you want it to be part of the background and static in the world like an asteroid or something, draw it in the LevelDraw function and use fixed world coords (not camera-relative).
The ScreenDraw function has everything in screen coordinates where 0,0 is the top left. you can use GetScreenWidth() and GetScreenHeight() to get the screen's width and height in pixels. So if you want to draw e.g. a user interface element you could use DrawBox(1, 8, 100, 100, GetScreenWidth() - 100, GetScreenHeight() - 100, r, g, b, a) where 8 is the border thickness and 1 means use the spot texture for the box. You don't need things to be camera-relative in the screen draw function.
-
Doh !
-
Ok got my primitive level-bound box in now. :> Thanks dude. This will also be super-helpful for the Parallax scrolling project!