Sprites and MultiWin

Discussions related to graphics (2D and 3D), animation and games programming
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Sprites and MultiWin

Post by KenDown »

I would like to create a sprite and have it moved as I move the mouse. My Display program uses multiple windows. At the point where I want to display the sprite, window 2 is covering over @hwnd% (which has a value of window 0). The sprite does not appear. However when I close down window 2, there is the sprite showing in window 0.

The help states that a sprite will show over whatever else is in the BASIC window. Does that not apply to multi-wins?

If anyone has some experience, I would be grateful for a pointer. (Window 2 is selected, because when I hold down the mouse button, I can draw on the screen. I just can't display a sprite.)
Ric
Posts: 200
Joined: Tue 17 Apr 2018, 21:03

Re: Sprites and MultiWin

Post by Ric »

Morning Ken,
I think the problem is that the second window is not displaying in the first window, but on top of the window. Try checking the current window status while hovering over the second window. If you want the sprite to appear I think you will have to change @hwnd% and draw the sprite on to window 2

Kind regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: Sprites and MultiWin

Post by KenDown »

Thanks for the suggestion. Yes, hw2% is on top of everything else at the point where I would want the sprite to appear. In the procedure where hw1% - hw8% are defined, I set @hwnd%=hw2%, but unfortunately the sprite still did not appear in the top window and did appear in hw0% which is @hwnd% at the start of the program.
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: Sprites and MultiWin

Post by KenDown »

Hah! But thanks again for the clue.

I loaded in the SPRITELIB and sure enough, @hwnd% was hardwired into it everywhere and obviously I didn't want to muck up the library. So I saved a copy of it in my program directory as SPRITELIB2, replaced every reference to @hwnd% with hw2%, then installed with INSTALL @dir$+"SPRITELIB2". I delayed initialising the library until hw2% had been defined and now the sprite appears in the second window.

Yippee!