Jump to content

Making scrolling in dx


Recommended Posts

hey if i wanted to make say some sort of gridlist(did it already but it always loops through tables and its really stupid imo) which has images,rectangles,etc not just texts and had some columns for instance, how could i make it so that when i scroll with mouse that everything moves? just like on the scoreboard

is there a way to have a rectangle or something and if anything is outside it that it doesnt get rendered because its cut off or something? i would appreciate some help :)

Link to comment

Thanks for reply. I've made one topic already regarding render targets, but nobody answered.

hey what are render targets? how do i use them? how can they help me, or be useful in some way? how do they work? i don't get it..

I would really appreciate if you, or someone else could explain to me what exactly are render targets, how are they used(with example if you got time to show the example) and when do they become useful c:

Sorry if i am asking too much, it's just that i don't understand how does it work nor what happens after dxSetRenderTarget() with no arguments is called, and what happens when e.g i do dxSetRenderTarget(something,true)..

So if you, or someone can explain to me this things about render targets and what they are, it would make it easier for me to start working on them, and learning how to work with them :D

Link to comment

Rather than relying on people to try and explain it to you, sit down, and try it out. Trial and error is arguably the best way you'll learn scripting and/or programming - you just need the patience and don't give up just because your first few attempts didn't succeed.

The wiki already explains to you what a render target actually is, but I guess it could use some clarification;

Think of it like a canvas, or a layer like in photoshop. You can draw things inside this canvas using your usual drawing functions such as dxDrawText, dxDrawRectangle, dxDrawImage and so on. And since the render target returns a texture, you can also apply stuff like shader effects onto this render target.

dxSetRenderTarget is a bit more difficult to try and explain in such a way it would make sense. But essentially, you'll want to use this before you start drawing stuff onto the render target, by supplying this function with your render target - you're telling MTA to draw onto that render target. Otherwise, it will just be drawn onto the screen like usual(since the render target is actually an invisible texture, this might be a bit confusing).

So when you don't provide any arguments, you're telling MTA to draw onto the screen, instead of your previously set render target.

They can be used for a variety of things, including things such as DX editboxes, DX gridlists, DX scrollbars and etc etc. Not necessarily the most efficient way of doing this, but since it's a DX element - you can manipulate it pretty much however you'd like.

I won't give you any examples just yet, go ahead and try it for yourself. Start simple and go from there. For example, start with drawing an image onto the render target - and try and make it so half of the image is cut off(because it's outside the render target) using dxSetRenderTarget and the clear argument.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...