Patch: zoom window

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
connan
Engineer
Engineer
Posts: 18
Joined: 08 May 2007 20:46
Location: Germany, Dresden

Patch: zoom window

Post by connan »

Hello,

its my first patch so forbear with me please.

What it does:
-Opens a zoom window by pessing ctrl + d

I think it has some glitches esp. with overlapping windows. Hopefully someone can
help to sort out. I think i need to know how Z-order is changed and how the update
regions are determined. Thank you. Have fun.
screenshot
screenshot
zoom_window.png (164.99 KiB) Viewed 1085 times
zoom_window.diff
diff file
(9.04 KiB) Downloaded 155 times
Edit: works not for the animated blitter atm. fixed
Last edited by connan on 05 Jun 2008 12:31, edited 2 times in total.
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Patch: zoom window

Post by Wolf01 »

Nice patch, I missed the double size feature since somebody decided that working on Windows only was racist :P
Maybe I'll use it...
connan
Engineer
Engineer
Posts: 18
Joined: 08 May 2007 20:46
Location: Germany, Dresden

Re: Patch: zoom window

Post by connan »

Thank you! For me the reason was that i like to play in the higher resolutions but then its often hard to see the details exactly (semaphores, slopes etc.).

Btw. it would be nice to let the zoom window stay on the highest 'real' zoom level but that would need a possibility to render a viewport to a virtual window (somewhat like a memory DC, for the MFC- guys). Can someone help with that?

Regards,

connan.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: Patch: zoom window

Post by TrueBrain »

It would be cool if you can introduce zoom-in on a general scope.

When creating the zoom-levels for the blitters as they are now in OpenTTD, I at first also planned a zoom-in mode (2x and 4x). Sadly enough, this completely failed because of how the internals of OpenTTD work. They can't handle the fact that 1 pixel becomes 2 pixels (or in fact, 2x2). I could fix most things (and most things for it are in trunk in fact), but several remained, of which the most noticeable one: when moving a window over a viewport at 2x or 4x zoom-in, it leaves a single pixel-line of graphical glitches. This turned out to be almost impossible to fix.

It has to be said that this was several months, almost a year ago. So who knows what changed. Just my 2 penny to let you know that ZoomByLevel does support most of it, and that it in fact is just a matter of adding the zoom-level... and fixing the nasty graphical glitches ;)

I tried to find my old patch which basically introduced zoom-in-levels, but I guess I removed it long ago ;) Either way, good luck :) I hope you can get it to work correctly, as it would be really useful for many people!
The only thing necessary for the triumph of evil is for good men to do nothing.
connan
Engineer
Engineer
Posts: 18
Joined: 08 May 2007 20:46
Location: Germany, Dresden

Re: Patch: zoom window

Post by connan »

Update:
-works with animated blitters now (diff file in first post updated)
-optimzed for faster drawing
TrueLight wrote:It would be cool if you can introduce zoom-in on a general scope.
Thank you, i try. :)
TrueLight wrote: when moving a window over a viewport at 2x or 4x zoom-in, it leaves a single pixel-line of graphical glitches.
I cannot confirm this, what i've found is some kind of flickering when a window overlapps esp. the newspaper. To fix this i have to look deeper into the window managment, how to change z-order, updateregions etc..
LordAzamath
Tycoon
Tycoon
Posts: 1656
Joined: 08 Jun 2007 08:00

Re: Patch: zoom window

Post by LordAzamath »

Well.. GeekToo's patch has somehow managed to get rid of pixel lines..
PS: And I stopped the propaganda to support Dave Worley since he got a nice new red hat now.[/color]
I know I have a BBCode error in my signature but I really cba to fix it.
connan
Engineer
Engineer
Posts: 18
Joined: 08 May 2007 20:46
Location: Germany, Dresden

Re: Patch: zoom window

Post by connan »

LordAzamath wrote:Well.. GeekToo's patch has somehow managed to get rid of pixel lines..
Can you give me a link please? Searching this forum for GeekToo is.. well. ;)
connan
Engineer
Engineer
Posts: 18
Joined: 08 May 2007 20:46
Location: Germany, Dresden

Re: Patch: zoom window

Post by connan »

Oh, these one was ment? Of course I know off and i love it. I won't bother you (GeekToo) its a totally different thing you are working on (btw. great work!!). But seems it needs a while before we see this one in trunk. In spite of playing higher resolutions i needed a simple solution till we get the real thing.

Regards,

connan.
sootynz
Traffic Manager
Traffic Manager
Posts: 181
Joined: 24 Jan 2007 02:07

Re: Patch: zoom window

Post by sootynz »

How is this zoom coming along? Will it be in a nightly?

At about the same time as you first posted, I asked

I'm not sure what you call the small windows that follow a train, vehicle etc, but they were a brilliant idea by Chris Sawyer. And many people have done some outstanding graphics of new vehicles that have added to everyone's enjoyment.

So, would it be possible to (optionally) increase the scale of the window to get a closer view of an engine. (I'm not talking about dragging and enlarging its size). I appreciate that I'm really just asking for "eye-candy" - but I have a sweet tooth."

Would your zoom patch do this?

Thanks.
connan
Engineer
Engineer
Posts: 18
Joined: 08 May 2007 20:46
Location: Germany, Dresden

Re: Patch: zoom window

Post by connan »

sootynz wrote:How is this zoom coming along? Will it be in a nightly?
Oh, i don't think so, needs much more effort in coding style and documentation and seems rather disliked by the dev's cause its not the appropriate way a zoom should work. Its only usefull for people with glasses (like me) and/or ones who want to play in high res. Btw. comes along as diff file for now.
sootynz wrote: So, would it be possible to (optionally) increase the scale of the window to get a closer view of an engine.
Would your zoom patch do this?
That was my first intention. What i would need to do that is a possibility to render a viewport into memory and not onto screen. That would also allow for staying on highest native zoom level while zooming the map out and some other cool postprocessing effects :) . But: That will never work in the way GeekToo's patch works, you can compare it with a digital zoom from a cam.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 11 guests