Struggling to understand how to render to GtkLayout in a GtkScrolledWindow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm trying to build a little top-down level editor for a game I'm working on. I'm pretty much aiming for a clone of http://doombuilder.com - from the screenshots you should be able to see the map editor is mostly about drawing lines on a big grid.

I have my basic rendering code working on a GtkLayout, and the next step is to expand the canvas so that I can create larger levels. It seems that the recommended process here is to take a GtkLayout and embed it in a GtkScrolledWindow. However, I'm unclear on what that actually does.

I tried this approach, and tried rendering the entire 10000x10000 pixel map on my GtkLayout, but bizzarely this ends up "leaking out" of the GtkLayout - the menubar and toolbar of my application also have a grid background. This suggests that when I render to GtkLayout, my rendering isn't actually clipped.

Does this mean I must take care to clip the rendering myself? If so, that would also suggest I have to take care about offsetting the rendering appropriately, and this all becomes a lot more complicated than I hoped. Is there a way to just render the whole scene naively, and have some container deal with the clipping? Or is the idiomatic aproach here to do the offsetting myself?

I hope this question is clear, please let me know if I can provide any more information. For reference, I'm using the gtk3 bindings in Haskell, and rendering via the diagrams library onto the Cairo surface of the GtkLayout's bin window.

- ocharles
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux