4 ms·
If you are interested in the code behind bitmaps / pixel sprites that scale, pan, and zoom, I'd like to offer up OpenTTD. https://www.openttd.org/ https://www.
by tony 7y ago
If you are interested in the code behind bitmaps / pixel sprites that scale, pan, and zoom, I'd like to offer up OpenTTD.
https://www.openttd.org/ https://www.openttd.org/
Specifically, Viewports, Blitter and Resize handling:
Viewport: https://github.com/OpenTTD/OpenTTD/blob/1.9.3/src/viewport.cpp https://github.com/OpenTTD/OpenTTD/blob/1.9.3/src/viewport.c...
Window resizing: https://github.com/OpenTTD/OpenTTD/blob/1.9.3/src/video/sdl_v.cpp#L149 https://github.com/OpenTTD/OpenTTD/blob/1.9.3/src/video/sdl_...
Zoom: https://github.com/OpenTTD/OpenTTD/blob/1.9.3/src/main_gui.cpp#L136 https://github.com/OpenTTD/OpenTTD/blob/1.9.3/src/main_gui.c...
OpenTTD is interesting because it can have multiple "cameras" following objects on the screen. e.g. a viewport can be opened to follow a bus or train, zoomed in, while the main viewport is zoomed out.
Also I'd like to recommend aseprite (https://www.aseprite.org/ https://www.aseprite.org/), which has even cleaner code with zoom / panning / etc. The GUI itself is also pixel art: https://github.com/aseprite/aseprite/blob/v1.2.16.3/src/render/zoom.cpp https://github.com/aseprite/aseprite/blob/v1.2.16.3/src/rend..., https://github.com/aseprite/aseprite/blob/v1.2.16.3/src/app/modules/gui.cpp https://github.com/aseprite/aseprite/blob/v1.2.16.3/src/app/..., https://github.com/aseprite/aseprite/blob/v1.2.16.3/src/ui/view.cpp https://github.com/aseprite/aseprite/blob/v1.2.16.3/src/ui/v...
- colejohnson66 7y ago> OpenTTD is interesting because it can have multiple "cameras" following objects on the screen. e.g. a viewport can be opened to follow a bus or train, zoomed in, while the main viewport is zoomed out. I have used OpenTTD, so I don’t know the specifics, but from how you describe it, RollerCoaster Tycoon has/had this too. The main viewport would show what you’re zoomed in/out on, while you could have a screen open following a roller coaster train.
- colonwqbang 7y agoThat's because Rollercoaster tycoon and Transport tycoon (of which Openttd is a remake) were made by the same programmer: Chris Sawyer.
- wolfgke 7y ago> were made by the same programmer: Chris Sawyer. ... in x86 assembly language: > https://en.wikipedia.org/w/index.php?title=RollerCoaster_Tycoon_(video_game)&oldid=935210227#Development https://en.wikipedia.org/w/index.php?title=RollerCoaster_Tyc... > https://en.wikipedia.org/w/index.php?title=RollerCoaster_Tycoon_2&oldid=920220654#Development https://en.wikipedia.org/w/index.php?title=RollerCoaster_Tyc...
- paulintrognon 7y agoWow! That game was developed by a single guy? In assembly?? That's incredible!
- r0bbbo 7y agoHow does one even begin to manage a project this large and complex in assembly?
- colejohnson66 7y agoIt’s an achievement, for sure. Maybe it’s just me, but there’s not really anything special about assembly. It does require a different way of thinking than higher level languages, but if you’re used to it, why not continue using what you’re good at?
- lqet 7y agoOr, if you want to loose a few months of your life, instead of looking at the code, just play the game. After 5 years, I am still improving the urban rail system of my metropolis.
- jonahx 7y agoDoes anything similar exist for creating responsive ascii art?