LabiVila Posted August 24, 2015 Posted August 24, 2015 local fonts = dxCreateFont ("fonts.ttf", 20) local x,y = guiGetScreenSize () local nm function mapInformations (mapInfo) startingPositionOfMapRectangle = 0 name = mapInfo.name or "Not defined" lengthOfCurrentMap = (string.len (name)*10) - (string.len (name) + (string.len (name) / 2)) startingPositionOfMapName = ( - string.len (name) * 10) addEventHandler ("onClientRender", root, animation) addEventHandler ("onClientRender", root, drawThisMap) end addEvent ("onClientMapStarting", true) addEventHandler ("onClientMapStarting", getRootElement(), mapInformations) function removeMapInfo () removeEventHandler ("onClientRender", root, drawThisMap) removeEventHandler ("onClientRender", root, animation) removeEventHandler ("onClientRender", root, drawNextmap) removeEventHandler ("onClientRender", root, animTextNM) end addEvent ("onClientMapStopping", true) addEventHandler ("onClientMapStopping", getRootElement(), removeMapInfo) function drawThisMap () dxDrawRectangle (0, (740/768)*y, (startingPositionOfMapRectangle/1366)*x, (25/768)*y, tocolor (0, 0, 0, 155)) -- current map dxDrawRectangle ((startingPositionOfMapRectangle/1366)*x, (740/768)*y, (5/1366)*x, (25/768)*y, tocolor (255, 113, 3, 155)) -- current map dxDrawText (name, (startingPositionOfMapName/1366)*x, (744/768)*y, x, y, tocolor (255, 255, 255, 175), 0.5, fonts) end function drawNextmap () dxDrawRectangle (0, (710/768)*y, (lengthOfNextmap/1366)*x, (25/768)*y, tocolor (0, 0, 0, 155)) -- next map dxDrawRectangle ((lengthOfNextmap/1366)*x, (710/768)*y, (5/1366)*x, (25/768)*y, tocolor (255, 113, 3, 155)) -- next map dxDrawText (nm, (startingPositionOfNextmap/1366)*x, (714/768)*y, x, y, tocolor (255, 255, 255, 175), 0.5, fonts) end function passMapName (nextmap) nextMapRectangleStart = 0 nm = nextmap lengthOfNextmap = (string.len (nm)*10) - (string.len (nm) + (string.len (nm) / 2)) startingPositionOfNextmap = ( - string.len (nm) * 10) addEventHandler ("onClientRender", root, drawNextmap) addEventHandler ("onClientRender", root, animTextNM) end addEvent ("nextMapName", true) addEventHandler ("nextMapName", getRootElement(), passMapName) function animation () if (startingPositionOfMapRectangle < lengthOfCurrentMap) then startingPositionOfMapRectangle = startingPositionOfMapRectangle + 4 end if (startingPositionOfMapName < 10) then -- stops at 10 coord startingPositionOfMapName = startingPositionOfMapName + 4 end end function animTextNM () if (startingPositionOfNextmap < 10) then startingPositionOfNextmap = startingPositionOfNextmap + 4 end if (nextMapRectangleStart < lengthOfNextmap) then nextMapRectangleStart = nextMapRectangleStart + 4 end end I was just wondering, what's wrong here? Why isn't it working?
LabiVila Posted August 29, 2015 Author Posted August 29, 2015 Bumping this, I've been told to not but... I have no reason to repost it
JR10 Posted August 29, 2015 Posted August 29, 2015 No one's gonna go through the whole code looking for the reason it doesn't work. Tell us what's not working, and post any errors output.
LabiVila Posted August 29, 2015 Author Posted August 29, 2015 Thanks for answering, I see it was my bad for not writing the reason (I'm surprised with myself lol, I thought I did)... however, the code is working so well, however, it doesn't fit in every screen resolution. It is supposed to fit every, but I really don't know what's wrong. I've already searched a lot of topics about this but couldn't really find the problem (almost all were same as mine)
UserToDelete Posted August 29, 2015 Posted August 29, 2015 Because your code is getting absolute calculates. NOTE: 800x600 resolution fonts are more smaller than 1920x1080 resolution
LabiVila Posted August 29, 2015 Author Posted August 29, 2015 And how can I fix that? Any tip maybe? As far as I know, it should be absolute coordinates, shouldn't it?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now