Oh darn. I was basing that collision off something I wrote in C++. Because in C++ using SDL library doesn't need the images to be rendered to check pixel color.
Anyways, how could I get pixel collision fast without using any plugins?
EDIT:
Well I decided to use memblocks and being that I've never used them before, I have a good understanding of them. However my code doesn't detect colors in the image which is quite odd.
Function PixelCollision(spr1,spr2,spr2Img)
col$=""
Make memblock from image 1,Spr2Img
memWidth=Sprite Width(spr2)
memHeight=Sprite Height(spr2)
memSize=Get memblock size(1)
Col$=GetPixels(spr1,spr2,memSize,MemWidth)
delete memblock 1
Endfunction col$
Function GetPixels(spr1,spr2,memSize,MemWidth)
col$=""
Xpos=sprite x(spr1)
Ypos=sprite y(spr1)
Width=Sprite width(spr1)
Height=Sprite height(spr1)
dim PointLoc(2,4,3)
Pos=(3+Xpos+1+(Ypos-1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(1,1,1)=memblock byte(1,Pos)
PointLoc(1,1,2)=memblock byte(1,Pos+1)
PointLoc(1,1,3)=memblock byte(1,Pos+2)
text 0,0,"Pos: "+str$(Xpos+1)+", "+str$(Ypos-1)+" ->"+str$(Pos)
text 0,10,"Blue: "+str$(PointLoc(1,1,1))
text 0,20,"Green: "+str$(PointLoc(1,1,2))
text 0,30,"Red: "+str$(PointLoc(1,1,3))
endif
Pos=((3+Xpos+Width-1)+(Ypos-1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(2,1,1)=memblock byte(1,Pos)
PointLoc(2,1,2)=memblock byte(1,Pos+1)
PointLoc(2,1,3)=memblock byte(1,Pos+2)
endif
Pos=(3+Xpos+1+(Ypos+Height+1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(1,4,1)=memblock byte(1,Pos)
PointLoc(1,4,2)=memblock byte(1,Pos+1)
PointLoc(1,4,3)=memblock byte(1,Pos+2)
endif
Pos=(3+Xpos+Width-1+(Ypos+Height+1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(2,4,1)=memblock byte(1,Pos)
PointLoc(2,4,2)=memblock byte(1,Pos+1)
PointLoc(2,4,3)=memblock byte(1,Pos+2)
endif
Pos=(3+Xpos-1+(Ypos+1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(1,2,1)=memblock byte(1,Pos)
PointLoc(1,2,2)=memblock byte(1,Pos+1)
PointLoc(1,2,3)=memblock byte(1,Pos+2)
endif
Pos=(3+Xpos-1+(Ypos+Height-1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(1,3,1)=memblock byte(1,Pos)
PointLoc(1,3,2)=memblock byte(1,Pos+1)
PointLoc(1,3,3)=memblock byte(1,Pos+2)
endif
Pos=(3+Xpos+Width+1+(Ypos+1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(2,2,1)=memblock byte(1,Pos)
PointLoc(2,2,2)=memblock byte(1,Pos+1)
PointLoc(2,2,3)=memblock byte(1,Pos+2)
endif
Pos=(3+Xpos+Width+1+(Ypos+Height-1)*memWidth)*4
if Pos<MemSize and Pos>11
PointLoc(2,3,1)=memblock byte(1,Pos)
PointLoc(2,3,2)=memblock byte(1,Pos+1)
PointLoc(2,3,3)=memblock byte(1,Pos+2)
endif
local black as byte
Bground=0
black=3
x=1:y=1
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"TopL"
black=3
x=2:y=1
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"TopR"
black=3
x=1:y=4
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"BotL"
black=3
x=2:y=4
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"BotR"
black=3
x=1:y=2
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"LefT"
black=3
x=1:y=3
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"LefB"
black=3
x=2:y=2
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"RigT"
black=3
x=2:y=3
for color=1 to 3
if PointLoc(x,y,color)<>Bground then dec black
next PointLoc
if black<3 then Col$=Col$+"RigB"
Endfunction col$
My computer can render anything no matter the complexity of it in real time.
The memory is enormous. My computer is unique to everyone else’s. What computer do I have?