[solved] How i make UI D:
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zoboomafoo
- Prole
- Posts: 7
- Joined: Sun May 19, 2013 9:05 pm
[solved] How i make UI D:
Hi, i don't i will have a problem with making a ui itself i just don't get how to attach it to the camera. I'm using the hump library for the cameras, but that's it because i don't really get what the rest of its for. Currently i have "ui" moving with the camera... But when ever the camera moves the text jitters.... Is there a easier way? Is there a way to overlap cameras like have one at like (900000, 900000) looking at the ui and then have one on my player then merge them? Or can you attach things to the window x,y instead of the world x,y? If not how do i stop the text from jiggling around?
Last edited by zoboomafoo on Sat Jun 01, 2013 12:55 am, edited 1 time in total.
Re: How i make UI D:
simply set the ui outside of the camera drawing range.
i.e
I'm not familiar with the hump camera, but most camera classes work like this.
This solution should work with this one.
i.e
Code: Select all
function love.draw()
camera:set()
drawGame()
camera:unset()
drawUi()
end
This solution should work with this one.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: How i make UI D:
It's as MadByte says. Most camera systems have an "activation period" during which everything you draw is "drawn as viewed from the camera". In hump's lib that's done with set + unset. Anything you draw after unset will be drawn "as usual" - like when there is no camera. It will also be drawn "on top" if you put it after, or "below" if you put it before.
In my library, gamera, you put the part that is drawn by the camera inside a function.
You can see an example with two cameras moving around and a small UI text (the one which says "gamera demo: ... mouse etc etc) on its demo.
In my library, gamera, you put the part that is drawn by the camera inside a function.
Code: Select all
function love.draw()
camera:draw(function())
drawGame()
end)
drawUi()
end
When I write def I mean function.
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 1 guest