MisterQuestions Posted January 6, 2015 Posted January 6, 2015 Hey, can somebody explain me how to scscroll it, as i understand i need to make just a part visible but how to make that? (Sorry for asking this again) "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Gallardo9944 Posted January 6, 2015 Posted January 6, 2015 Scrolling can be achieved by creating a global variable. You should change it every time you need to scroll. Set this variable as Y position offset in your render function. local offset = 0 -- change this up or down to change dxDrawText's position dxDrawText("Hello world",px,py+offset,x,y) -- the variables are made up, the important part is "+offset" Code Debugger - Minimalistic MTA debug line replacement
MisterQuestions Posted January 6, 2015 Author Posted January 6, 2015 On scroll up i should use offset = offset + --what i want to increment no? But if get outs from a window, make it dissapear? (Last ddude) "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Dealman Posted January 6, 2015 Posted January 6, 2015 Don't mind my terrible photoshop But this might help you figure out how to work the offsets; As for if it goes outside of a window and you want it to disappear, I believe you'll have to use dxCreateRenderTarget. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
MisterQuestions Posted January 6, 2015 Author Posted January 6, 2015 So should create a render target, and draw the image/rectangle over it? Can you make me an example with it? "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Dealman Posted January 6, 2015 Posted January 6, 2015 Try it yourself first and I'll help you from there. You'll learn the most by trying yourself and reading the examples provided on the wiki. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
MisterQuestions Posted January 6, 2015 Author Posted January 6, 2015 Scroll, successfull ! Dissapear when leave rectangle, fail.... The code: local x, y = guiGetScreenSize() local myRenderTarget = dxCreateRenderTarget(732, 628, true) local offset = 0 function lobby() dxDrawText("Fast Fucking War Multi-Room", 7, 9, 372, 55, tocolor(255, 158, 0, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) if myRenderTarget then ---Start using render target.... dxSetRenderTarget( myRenderTarget ) ---Start drawing on it. dxDrawRectangle((x - 732) / 2, (y - 628) / 2, 732, 628, tocolor(0, 0, 0, 168), false) dxSetRenderTarget() --Stop Drawing on it. --//Draw inner background... dxDrawImage(0, 0, x, y, ":guieditor/images/bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) --//Render target, suposes when images get out from here, will dissapear dxDrawImage(146, 70, 732, 628, myRenderTarget, 0, 0, 0, tocolor(255, 255, 255, 255), false) --//Draw the rest of it. dxDrawImage(230, 80+offset, 564, 95, ":guieditor/images/deathmatch.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(230, 200+offset, 564, 95, ":guieditor/images/oldschool.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(230, 320+offset, 564, 95, ":guieditor/images/derby.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(230, 440+offset, 564, 95, ":guieditor/images/hunter.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(230, 560+offset, 564, 95, ":guieditor/images/shooter.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) --//Scrolling bar.... dxDrawRectangle(878, 70, 22, 530, tocolor(68, 68, 68, 255), false) end end addEventHandler("onClientRender", root, lobby) function scrollUP() offset = offset - 20 end function scrollDOWN() offset = offset + 20 end bindKey("mouse_wheel_up","down",scrollUP) bindKey("mouse_wheel_down","down",scrollDOWN) "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
MisterQuestions Posted January 6, 2015 Author Posted January 6, 2015 Bug, it works the images dont get out of rectangle, it looks horrible at top, it looks like duplicated .-. "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Gallardo9944 Posted January 6, 2015 Posted January 6, 2015 replace dxSetRenderTarget( myRenderTarget ) with dxSetRenderTarget( myRenderTarget, true ) -- 2nd argument set to true means "clean the render target" Code Debugger - Minimalistic MTA debug line replacement
MisterQuestions Posted January 6, 2015 Author Posted January 6, 2015 worked thanks..., but if i scroll up, doesn't dissapear, any reason? "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
Gallardo9944 Posted January 6, 2015 Posted January 6, 2015 Funny thing is that according to the code, the images are outside of the render target. Code Debugger - Minimalistic MTA debug line replacement
MisterQuestions Posted January 7, 2015 Author Posted January 7, 2015 Thanks all , you helped me a lot. Here's the result: http://youtu.be/KUHuUc4Fne8 "El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más". Att: -|TG|-Mister[Q]<.
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