Guest requiem Posted June 9, 2020 Share Posted June 9, 2020 (edited) Hello Guys, I am currently working on a Custom Map and have never done it, I looked at other scripts and tried to learn from them, but now I have the problem that the Map in the RenderTarget is smaller than the background. HUDRadar = inherit(Object) inherit(GUIFontContainer, HUDRadar) inherit(GUIColorable, HUDRadar) function HUDRadar:constructor() GUIFontContainer.constructor(self, "", 1, FontRoboto(10)) GUIColorable.constructor(self, Color.White) -- VARIABLES -- self.m_Texture = dxCreateTexture("res/images/Radar/Map.jpg", "dxt5", true, "clamp") self.m_ImageWidth, self.m_ImageHeight = dxGetMaterialSize(self.m_Texture) self.m_Width, self.m_Height = 394, 224 self.m_RenderTarget = dxCreateRenderTarget(self.m_Width, self.m_Height, true) -- HANDLER -- addEventHandler("onClientRender", root, bind(self.draw, self)) end function HUDRadar:draw() local rot = {getElementRotation(getLocalPlayer())} local pos = {getElementPosition(getLocalPlayer())} local cam = {getCameraMatrix()} local rotation = findRotation(cam[1] ,cam[2], cam[4], cam[5]) local mapX = pos[1] / (6000 / self.m_ImageWidth) + self.m_ImageWidth / 2 - self.m_Width / 2 local mapY = pos[2] / (-6000 / self.m_ImageHeight) + self.m_ImageHeight / 2 - self.m_Height / 2 -- BACKGROUND -- dxDrawRectangle(20, screenHeight - 260, 400, 230, Color.Black) -- MAP -- if self.m_RenderTarget then dxSetRenderTarget(self.m_RenderTarget, true) dxDrawImageSection(0, 0, self.m_Width, self.m_Height, mapX, mapY, self.m_Width, self.m_Height, self.m_Texture, rotation) dxSetRenderTarget() dxDrawImage(23, screenHeight - 257, self.m_Width, self.m_Height, self.m_RenderTarget) end -- LOCAL PLAYER -- dxDrawRectangle(20 + self.m_Width / 2, screenHeight - 257 + self.m_Height / 2, 5, 5, Color.Red) end Screenshot of them what i mean: https://gyazo.com/50a8492cb1e201ea0dd415fb5732339d - requiem Edited June 9, 2020 by requiem Link to comment
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