GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2016-Apr-21

Title: Getpixel on Android
Post by: MrPlow on 2016-Apr-21
Hi Guys

I am trying to use getpixel on android but it returns zero with my virtual screen using USESCREEN -1 for my virtual screen.

Anyone got an alternative ?

Title: Re: Getpixel on Android
Post by: MrPlow on 2016-Apr-21
Okay, this is sorted now - made my own color picker in the end  by just creating the colours with code
:)

Code (glbasic) Select
TYPE colsect

x=0
y=0
col% = 0

ENDTYPE
GLOBAL colsects[] AS colsect


LOCAL cx = 0
LOCAL cy = 0
LOCAL counter=0

FOR r= 255 TO 0 STEP -64

FOR g=255 TO 0 STEP -63

FOR b = 255 TO 0 STEP -63

LOCAL cc AS colsect

cc.col = RGB(r,g,b)
cc.x = cx
cc.y = counter*10

DIMPUSH colsects[],cc

INC counter,1

IF counter = 9

counter = 0
INC cx,10

ENDIF
NEXT
NEXT

NEXT
Title: Re: Getpixel on Android
Post by: UBERmonkeybot on 2016-Apr-21
In the past i have used spritetomem() and then accessed the array as  if it were the screen.
Title: Re: Getpixel on Android
Post by: spacefractal on 2016-Apr-21
As im aware GETPIXELS might not work on all platforms. Im thinks its due Android uses 16bit colors, not 24.
Title: Re: Getpixel on Android
Post by: Ian Price on 2016-Apr-22
GETPIXEL also doesn't work in several versions of GLBasic on a number of formats, not just Android. v10 worked on OK on most/all platforms IIRC.
Title: Re: Getpixel on Android
Post by: MrPlow on 2016-Apr-28
Thanks Guys,
I got it sorted anyhow - GETPIXEL was a lazy way out for me, but the best solutions is the one I coded - which can't go wrong on any device... So likely much better off with the work around :)