I'm making a sort of paint editor, it creates an infinite window, but you have to define which area from the infinite image is displayed, so let's say you set cursor pos to (3, 2) and you define the X display limit to 10 and Y dysplay limit to 8. This program will create a window that is 10 - 3 in width and 8 - 2 in height. I need to find a way to be able to scroll this window of view all around the infinite image. The display limits are optional, and if you don't have them, it's going to display, 51 - 3 in width and 19 - 2 in height for the terminal's size.

So I've been thinking but getting stuck constantly, and I'm just thinking about X currently. So so far I have something like if xDislimit and xDislimit + cursorX - 1 < screenW then it's limited. This means if there is a limit and it's smaller than from the Xpos to the screenX then you will draw the image's selected portion by this limit, ELSE you draw from the cursorX to the screenX without worrying about the xDislimit. It's like xmin, ymin are cursorX and cursorY and xmax and ymax are yours to customise by using parameters. The xmin and ymin are set by you before running the editor by setting cursor pos.

I'm stuck on the part where if there's a valid Xlimit, then you draw from the Xpos of the image you're currently on to the YDislimit.
Can anybody help. Thanks

Basically, you can think of it as a notepad, open notepad or text editor or whatever, and the way you can write characters, I'm gonna do so for the drawing the scene, so you can move right and left, down and up. But in this case, you can design not How far up or right you can write, it's about how much is displayed, it's like resizing your notepad, whereas it's xmin and ymin will stay unless you move the notepad window around your desktop.

This also means if for example there is no display limit or it's very high, and your xpos on the image itself is beyond the terminal's limit, if you start going back you it will not scroll until you scrolled the amount of the terminal's width. Basically, all the functionality of a notepad editor like in windows, completely that, but then you can add your Ydisplay and Xdisplay limits!

It's like creating a terminal inside a terminal, with two different sets of x and y axis, one of where the inner terminal is designed to be in the outer terminal, and the other of where you are in the inner terminal. Image:



At point 1 it's original terminal's 1, 1 position
At point 2 it's cursor pos which is 3, 2
At point 3 it's terminal's furthest area 51, 19
At point 4 it's x and y display limits position

Point 2 is also xpos and ypos of the image editor's view of the image.
Point 4 is point's 2 x and y added with x and y display limit numbers - 1.

Regards,
Augustas