[Cuis-dev] Mixing BitBlt and Vector PlacedMorphs
Juan Vuletich
JuanVuletich at zoho.com
Wed Feb 16 15:03:38 PST 2022
Hi Tommy,
On 15/02/2022 08:52 p.m., Tommy Pettersson via Cuis-dev wrote:
> Hi,
>
> Can I use PlacedMorphs with requireVectorCanvas=false when I
> have loaded the vector graphics feature?
Yes. For instance, all SystemWindows requiresVectorCanvas=false, and
continue to work OK after loading vector graphics.
> What I want to do is to first load all the extra fonts,
> which loads the vector graphics, and then load and run the
> Spacewar! package, but I want the game to use the BitBlt
> canvas.
There is only one canvas installed at a time. At image startup, it is a
BitBltCanvas. When loading VectorGraphics, it is set to VectorCanvas (if
the VM plugin is present) or to HybridCanvas (for better performance if
the plugin is not present).
You can set the active canvas like this:
`MorphicCanvas activeSubclass: BitBltCanvas.`
`MorphicCanvas activeSubclass: HybridCanvas.`
`MorphicCanvas activeSubclass: VectorCanvas.`
The active canvas will be used for all morphs. If you set BitBltCanvas,
and then try to use morphs that #requiresVectorCanvas, expect trouble!
> Is that possible? When I start the game it appears
> on screen, and runs with normal speed, but does not respond
> to mouse and key events.
That is a bug, somewhere. The game should work with any of them.
> I tried to investigate what I need to change by subclassing
> a PlacedMorph and give it requiresVectorCanvas ^false. The
> debugger said it didn't understand morphLocalBounds, so I
> added that, and morphExtent and a lot of other things.
> Eventually I got a blue square that renders mostly fine when
> I open it in the hand and place it somewhere, but it does
> not redraw properly when on the world, and it does not
> respond to the mouse, like the vectorcanvas PlacedMorph
> does.
Yes. Morphs that answer false to #requiresVectorCanvas need to provide
extra methods, because BitBltCanvas is not smart enough to find about
morph geometry by itself.
> /Tommy
Hope this helps.
Cheers,
--
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
https://independent.academia.edu/JuanVuletich
https://www.researchgate.net/profile/Juan-Vuletich
https://patents.justia.com/inventor/juan-manuel-vuletich
@JuanVuletich
More information about the Cuis-dev
mailing list