Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Point(X,Y)
#1
I'd like to do what point(x,y) does, but instead of giving it a place on the screen, give a place on the picture that bloaded into an array. can someone please tell me an awesome way to do this?
to explain this differently,
I'd like to use something like point, but at that exact same second, stay in console mode, and get the point of a picture that's not being showed on the screen.

another way I could solve this issue is to use point, but in order to do this, I was wondering if there was a way to close the window opened by screenres, but not end the program. the only way I want to do this method is if there's absolutely no other way to do what I want to do.

In other words, I would be very happy if one of you could give me great advice on how to do this. Thanks
Reply
#2
If you've already got the data loaded into an array, just pick the right array element and pull the data out yourself.

Assuming an 8bpp PUT buffer:

Code:
function bufpoint(bufferseg as integer, bufferoff as integer, x as long, y as long, w as long) as integer
def seg = bufferseg
bufpoint = peek(bufferoff + 4 + w * y + x)
def seg
end function
i.e. for a 320-pixel-wide image stored in an array "buffer":
Code:
c = bufpoint(varseg(buffer(0)), varptr(buffer(0)), x, y, 320)

I haven't tested this, but something close should work...

EDIT: wait, are you using FB?
Reply
#3
Yes DrV, I am using FB
Sorry for posting in wrong section.
Reply
#4
Okay, now we're in FB land. Tongue

In FB, you can do the same kind of thing:

Code:
function bufpoint8(buffer as byte ptr, x as integer, y as integer, w as integer) as integer
    bufpoint = buffer[4 + w * y + x]
end function

For other bit depths, change the "byte ptr" to "short ptr" (16 bpp) or "integer ptr" (32 bpp) and the 4 to 2 (16 bpp) or 1 (32 bpp).
Reply
#5
Thanks a lot for this advice. You rock.
Reply
#6
Waiiiiit.

in fb land you can do this:

Code:
Screen 13
Dim As Any Ptr r = ImageCreate( 10, 10, 15 )


? Point( 0, 0, r )

Sleep

^^
Reply
#7
I'm sorry about this. I suspected something like this, but to be honest didn't actually check. Once again, thank you for helping me, but at the exact same second, sorry.
Reply
#8
It's fine. It's not like QB where you could just hit "f1"...

I don't mind taking the time to tell people about FB. Don't you agree that things like this blow QB out of the water? ;p
Reply
#9
Bah, I forgot about that... Good catch. Smile This is a much cleaner solution.
Reply
#10
What is with the question marks? Is that some new command I'm unaware of?
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)