There's an online doc and a tutorial (in simple English ). Have you read them?
Yes, I did. After reading them, I still didn't understand it. I think I am having trouble with the concepts, for instance: Do I draw to the window coordinates or the view's? Are the window coordinates changed? Or do I keep drawing as usual and the window will just display it according to the view? And when I rotate/zoom/whatever am I changing the view's source or target? Or is it the same thing?
For instance, can someone please explain how the following scenario would translate into window/views code?
A game map of 2000*2000 pixels. The window is 800*600, displaying only a part of the map (say the middle). In the top right corner of it, there is a mini map of 100*100, displaying the entire map, rotated at 45 degrees (so the center of it will actually be at 100 from the top and right, not at 50)
Here is how it seems to me it might go, though I am still unclear on the exact code:
[list=1]
- create a view of zoom 1, center at 1000,1000 and size 800*600, and set it as the window's view
- draw the whole map to the window as usual
- create a view of zoom 1, center at 1000,1000, size 2000*2000, rotation 45 and viewport .75,0,1,.33 and set it as the window's view
[/list:o]
Assuming this is right, some points I am unclear on:
- Should the viewport of the minimap view be 200*200 or 100*100? It is 100*100, but takes up a 200*200 NSEW rectangle on the screen
- Do I need to redraw something after assigning the second view, or doew it draw itself right away?
- Does it take it's info from the whole window, or from the previously assigned view?
- What is the difference between step 3 above, or setting it to half the size and a zoom of 0.5, for example?
- If I now draw another tile to the window (say a 20*20 tile at 0,0) where will it appear? In the main map, in the minimap full size, or in the minimap scaled?
These are some of the things I am unclear about that I can think of off the top of my head. If anyone could clarify them for me, I would appreciate it.
P.S. I know this is probably a terrible way to handle this scenario, as it involves "drawing" the whole map at full resolution to some memory surface every time. It would be much more efficient to draw only the visible area, and draw a reduced resolution one in the minimap, but it seems to me to cover most of the points I don't understand, so for the purpose of this question, please explain how to do it with views, not a better way.