Author Topic: Createscreen broken for thin sprites/screens  (Read 1563 times)

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Createscreen seems to be broken. The following code creates a screen 10x30 and fills it with yellow. Afterwards it draws 100 of them on the screen.
If you change the "X=10" to make the rectangle smaller, it works for "X=9", but when X=8, all the rectangles disappear.

This has been causing me a lot of problems over the past day as the Kerned Font routine I'm writing is using CREATESCREEN to create a sprite 1 pixel wide and by the looks of it, this is the cause.

Can people please test if this breaks on their computers? (Confirm it works as written, then change "X=10" to "X=8" and see if the yellow boxes no longer appear) - ESC to quit.
I'm running WinXP SP3, GLBasic IDE, Version: 7.322

Code: (glbasic) [Select]
LOCAL ScreenImage
ScreenImage=GENSPRITE()

LOCAL X
X=10


CREATESCREEN 1, ScreenImage, X, 30 // First pass, we create our sprite to do collision checks against as a single pixel
USESCREEN 1
DRAWRECT 0, 0, X, 30, RGB (255,255,0)
USESCREEN -1

CLEARSCREEN RGB(255,0,0)
LOCAL Loop
LOCAL Done = 0
WHILE Done = 0
FOR Loop = 1 TO 100
DRAWSPRITE ScreenImage,Loop,Loop
NEXT

IF KEY(1) THEN Done = 1
SHOWSCREEN
WEND
END


Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10815
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Createscreen broken for thin sprites/screens
« Reply #1 on: 2010-Apr-19 »
You can't make that small textures. Make then at least 8x8, fill the remaining with the transparent colour.

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Re: Createscreen broken for thin sprites/screens
« Reply #2 on: 2010-Apr-20 »
Ahh! At least that problem's solved - thanks Gernot!