An enhancement for the CustomFilterCallback

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

An enhancement for the CustomFilterCallback

Post by Seymour Clufley »

Could an optional parameter be added to the CustomFilterCallback? This could be used to store the pointer to a structure containing custom information about what's being drawn. Without this, the only way seems to be global variables.

Code: Select all

Structure MYPAINTExtraInformation
  age.i
  name.s
  weight.i
  height.i
EndStructure

Procedure.i MYPAINT(x.i,y.i,topcolor.i,bottomcolor.i,pointer.i)
  *extra.MYPAINTExtraInformation = pointer
  If *extra\name = "Dave"
      ProcedureReturn #Red
  Else
      ProcedureReturn #Green
  EndIf
EndProcedure

DrawingMode(#PB_2DDrawing_CustomFilter)
more.MYPAINTExtraInformation
more\name = "Dave"
more\height = 185
CustomFilterCallback(@MYPAINT(),@more)
I think that would be very useful.

Thanks either way for v4.4 (which is brilliant!),
Seymour.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."