Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A certain BMP loader
#1
I got the loader from toonski a while back when the forums qb45.com were big.

All it was was the simple loading and pallete changing code, and it looped through the file and read the numbers from it one by one. If anyone has it, I would appreciate it if they posted the code.
Reply
#2
You should actually PM him about it. But anyway if you want to have a look at other BMP loaders head over to www.qbasic.com.
Reply
#3
Here's a simple one I wrote. You can easily adapt it to draw to an off-screen buffer.


SUB LoadBMP (FileName$)

'320x200 256 color BMP loader.

OPEN FileName$ FOR BINARY AS #1

PalColors$ = SPACE$(1024)
GET #1, 55, PalColors$

FOR Col = 0 TO 255
OUT &H3C8, Col
OUT &H3C9, ASC(MID$(PalColors$, Col * 4 + 3, 1)) \ 4
OUT &H3C9, ASC(MID$(PalColors$, Col * 4 + 2, 1)) \ 4
OUT &H3C9, ASC(MID$(PalColors$, Col * 4 + 1, 1)) \ 4
NEXT Col

LOCATE 1, 1: PRINT "Initializing..."

LocOfData$ = SPACE$(4)
GET #1, 11, LocOfData$
LocOfData = CVL(LocOfData$) + 1

LineExtract$ = SPACE$(320)

FOR Y = 0 TO 199
GET #1, LocOfData + ((199 - Y) * 320&), LineExtract$
FOR X = 0 TO 319
PSET (X, Y), ASC(MID$(LineExtract$, X + 1, 1))
NEXT X
NEXT Y

CLOSE #1

END SUB
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)