GadgetFunction(#Gadget)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
IMHO it is not very up to date to code for every Gadget or Menu a Select/Case combination.
If a program gets bigger and bigger it can be very messy.
This can be solved better.
(for example look at http://www.lanset.com/dcuny/wxbasic.htm)
In PureBasic can that be: GadgetFunction(#Gadget).
With this command I don't have to look for every Gadget or Menu.
Example:
1.)Create a button with ButtonGadget(#Gadget, x, y, Width, Heigth, Text$)
2.)Create an action behind this Button with :
GadgetFunction(#Gadget)
;Do what ever you want...
EndFunction
3.)That's it! No Select/Case combination for every Button,Menu or whatever.
You can have as much Gadgets you want 10, 20, 30 ... to be continued.
Other Basic's [like http://www.lanset.com/dcuny/wxbasic.htm]
have a command like connect(#Gadget, ProcedureName) to connect a Gadget with a Procedure.
Something like that would be helpful to.
Ether-way is possible I appreciate very much.
Have a nice day...
Franco
IMHO it is not very up to date to code for every Gadget or Menu a Select/Case combination.
If a program gets bigger and bigger it can be very messy.
This can be solved better.
(for example look at http://www.lanset.com/dcuny/wxbasic.htm)
In PureBasic can that be: GadgetFunction(#Gadget).
With this command I don't have to look for every Gadget or Menu.
Example:
1.)Create a button with ButtonGadget(#Gadget, x, y, Width, Heigth, Text$)
2.)Create an action behind this Button with :
GadgetFunction(#Gadget)
;Do what ever you want...
EndFunction
3.)That's it! No Select/Case combination for every Button,Menu or whatever.
You can have as much Gadgets you want 10, 20, 30 ... to be continued.
Other Basic's [like http://www.lanset.com/dcuny/wxbasic.htm]
have a command like connect(#Gadget, ProcedureName) to connect a Gadget with a Procedure.
Something like that would be helpful to.
Ether-way is possible I appreciate very much.
Have a nice day...
Franco
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
; Maybe this could be what you are looking for:
Procedure GadgetEvent(id.l)
messagerequester("click","ButtonGgadget" + str(id) + "was clicked",0)
EndProcedure
InitGadget(3)
#WindowHeight = 400
#WindowWidth = 467
If OpenWindow(0,0,0, #WindowWidth, #WindowHeight, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget,"Your PURE BASIC application")
If CreateGadgetList(WindowID())
;CONTROLS: (GADGETS)
; ------------------------------------------
ButtonGadget(1,81,69,89,25,"ButtonGadget1")
ButtonGadget(2,207,69,89,25,"ButtonGadget2")
EndIf
EndIf
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventGadget
GadgetEvent(EventGadgetID())
EndIf
Until EventID = #PB_EventCloseWindow
End
;Another way (but i dont really understand how to doit within PureBasic
;could be pointers or CALL
;i hope Fred help us with some example : )
; Maybe this could be what you are looking for:
Procedure GadgetEvent(id.l)
messagerequester("click","ButtonGgadget" + str(id) + "was clicked",0)
EndProcedure
InitGadget(3)
#WindowHeight = 400
#WindowWidth = 467
If OpenWindow(0,0,0, #WindowWidth, #WindowHeight, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget,"Your PURE BASIC application")
If CreateGadgetList(WindowID())
;CONTROLS: (GADGETS)
; ------------------------------------------
ButtonGadget(1,81,69,89,25,"ButtonGadget1")
ButtonGadget(2,207,69,89,25,"ButtonGadget2")
EndIf
EndIf
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventGadget
GadgetEvent(EventGadgetID())
EndIf
Until EventID = #PB_EventCloseWindow
End
;Another way (but i dont really understand how to doit within PureBasic
;could be pointers or CALL
;i hope Fred help us with some example : )
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Yes Ricardo, your example is similar to that what I figured out, but:
interesting is the next step -> how to bring the information wich gadget was pressed to an action!
To transform the GadgetID to a string and bring it on a messagebox is easy, but how to call a procedure/sub or whatever that's my question...
Fred told me with asm code like:
CALL MyVariable (will jump to the address than MyVariable contain
CALL ?MyLabel (will jump to the label (but need a Return, like a subroutine
JMP ?MyLabel (jump to the label (and don't return)
but it didn't work (I'm not a asm coder, that's why...)
Has anybody a idea?
Have a nice day...
Franco
Yes Ricardo, your example is similar to that what I figured out, but:
interesting is the next step -> how to bring the information wich gadget was pressed to an action!
To transform the GadgetID to a string and bring it on a messagebox is easy, but how to call a procedure/sub or whatever that's my question...
Fred told me with asm code like:
CALL MyVariable (will jump to the address than MyVariable contain
CALL ?MyLabel (will jump to the label (but need a Return, like a subroutine
JMP ?MyLabel (jump to the label (and don't return)
but it didn't work (I'm not a asm coder, that's why...)
Has anybody a idea?
Have a nice day...
Franco
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
You could do a adress list(pointers to your gadget functions) in the begining of your program and store in a dim list, like so:
;Program begin
#MAX_GADGET = 10 ; or whatever
dim GadFunc.l(#MAX_GADGET)
GadFunc(0) = ?gadget0 ; This stores the adress of label gadget0 in GadFunc(0)
GadFunc(1) = ?gadget1 ; ...
...
GadFunc(10) = ?gadget10; ...
; initialise your gadgets, windows and stuff
...
;
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventGadget
GadgetID.l = EventGadgetID()
Call GadFunc(GadgetID) ; This will jump to the adress stored in GadFunc list
EndIf
Until EventID = #PB_EventCloseWindow
End
gadget0:
... ; some code for gadget 0
Return
gadget1:
... ; some code for gadget 1
Return
...
gadget10:
... ; some code for gadget 10
Return
; End program
I haven't actually testet the code but logicaly i should work
At least it sounds right to me..
Live long and prosper!
/Pupil
You could do a adress list(pointers to your gadget functions) in the begining of your program and store in a dim list, like so:
;Program begin
#MAX_GADGET = 10 ; or whatever
dim GadFunc.l(#MAX_GADGET)
GadFunc(0) = ?gadget0 ; This stores the adress of label gadget0 in GadFunc(0)
GadFunc(1) = ?gadget1 ; ...
...
GadFunc(10) = ?gadget10; ...
; initialise your gadgets, windows and stuff
...
;
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventGadget
GadgetID.l = EventGadgetID()
Call GadFunc(GadgetID) ; This will jump to the adress stored in GadFunc list
EndIf
Until EventID = #PB_EventCloseWindow
End
gadget0:
... ; some code for gadget 0
Return
gadget1:
... ; some code for gadget 1
Return
...
gadget10:
... ; some code for gadget 10
Return
; End program
I haven't actually testet the code but logicaly i should work

Live long and prosper!
/Pupil
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Mr.Skunk.
Hello, the return from hollidayssss
I wrote a small library tonight (and an example...).
In fact it is a test to handle GUI Events.
This is not complete and for the moment it can't connect to procedures, just subs (have to find a simple way to add an undefinied numbers of arguments, perhaps as a list)...
2 functions :
1- ConnectSub(GadgetNumber,Label) : to initialise the connections
2- result.l=WaitGuiEvent() ; the main program.
result.l=the event, so it's always possible to use it manually if a function is not implemented in the library.
It can also replace the window event handler (for the moment just #PB_EventCloseWindow to close the window) for this test. But future release will allow you to simply program the events (for example instead of closing the window, you can choose to hide it whith the close button...)
I mailed Fred to see if it's possible to get the GadgetID without having to click on the gadget. So it will be possible to add events to ConnectSub such has "mouse_move", when the mouse is over a gadget etc...
So you could have more than one ConnectSub for a gadget. One for clicking, one when the mouse is over, and a sub-program for each connection.
If you want to try it, tell me if that's what you want.
http://perso.wanadoo.fr/mr.skunk/Libraries/Gui.zip
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
Hello, the return from hollidayssss

I wrote a small library tonight (and an example...).
In fact it is a test to handle GUI Events.
This is not complete and for the moment it can't connect to procedures, just subs (have to find a simple way to add an undefinied numbers of arguments, perhaps as a list)...
2 functions :
1- ConnectSub(GadgetNumber,Label) : to initialise the connections
2- result.l=WaitGuiEvent() ; the main program.
result.l=the event, so it's always possible to use it manually if a function is not implemented in the library.
It can also replace the window event handler (for the moment just #PB_EventCloseWindow to close the window) for this test. But future release will allow you to simply program the events (for example instead of closing the window, you can choose to hide it whith the close button...)
I mailed Fred to see if it's possible to get the GadgetID without having to click on the gadget. So it will be possible to add events to ConnectSub such has "mouse_move", when the mouse is over a gadget etc...
So you could have more than one ConnectSub for a gadget. One for clicking, one when the mouse is over, and a sub-program for each connection.
If you want to try it, tell me if that's what you want.
http://perso.wanadoo.fr/mr.skunk/Libraries/Gui.zip
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
Ok found the problem...
You have to do it like this it's an assembler issue i guess:
(look at my earlier program to identify variables)
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventGadget
GadgetID.l = EventGadgetID()
DestAdress.l = GadFunc(GadgetID); this is the line missing!!
Call DestAdress ; This will jump to the adress stored in GadFunc list
EndIf
Until EventID = #PB_EventCloseWindow
This worked for me. Seems like you shouldn't feed a "variable function" to the assembler such as a dim or linked list?
I will live long and prosper
/Pupil
Ok found the problem...
You have to do it like this it's an assembler issue i guess:
(look at my earlier program to identify variables)
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_EventGadget
GadgetID.l = EventGadgetID()
DestAdress.l = GadFunc(GadgetID); this is the line missing!!
Call DestAdress ; This will jump to the adress stored in GadFunc list
EndIf
Until EventID = #PB_EventCloseWindow
This worked for me. Seems like you shouldn't feed a "variable function" to the assembler such as a dim or linked list?
I will live long and prosper

/Pupil
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Pupil, you got it. This works fine for me. Thanks!
Mr. Skunk I tested your GUI library and have only one to say:
GREAT!!! Go for it!
It seems to me you are the right guy in the right place!
I appreciate your contributions very much.
As Ricardo suggested, please (if you have time...) enhance your tutorial
for dummies like me
Thanks a lot...
Have a nice day...
Franco
Pupil, you got it. This works fine for me. Thanks!
Mr. Skunk I tested your GUI library and have only one to say:
GREAT!!! Go for it!
It seems to me you are the right guy in the right place!
I appreciate your contributions very much.
As Ricardo suggested, please (if you have time...) enhance your tutorial
for dummies like me
Thanks a lot...
Have a nice day...
Franco
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Mr.Skun
I try your example and its excellent.
But i don't know if i can use a variable as the second parameter,instead a predefinited label's name,example:
ConnectSub(2,?MyVar)
Im looking for some way to direct some event to different procedures depending on the value of some variable.
I know i can use SELECT CASE, but its to larger if my keywords are many.
I have some tokens... one array with 200 words or more. I want to read the first (or any other) word and direct it to some procedure depending of its values.
In Rapid-Q its named 'Function Pointer' and this some explanation of how it works (taked from the Rapid-Q manual):
---------------------------------------------------------------------------------------------
If you have prior experience with function pointers (ie. in C) there are a few differences you'll have to get accustomed to. In Rapid-Q, since function pointers are just numbers, you can use any valid numeric datatype to define your function pointers. Seems odd, yes, but pointers are only numbers. Try avoiding BYTE, since the address of your function may be greater than 255, using BYTE may not be large enough. I suggest sticking with INTEGER/LONG.
DECLARE SUB Test (I AS INTEGER)
DIM FPtr AS INTEGER
BIND FPtr TO Test
Well, we use BIND in Rapid-Q to bind our variable FPtr to the function Test.
It will be clear (once you've used function pointers for a while) that there are times when using function pointers is necessary, and times when they're not. I think every situation is different, but consider this situation:
SELECT CASE I
CASE 1
Process1("1", 44)
CASE 2
Process2("2", 55)
CASE 3
Process3("3", 66)
CASE 4
:
:
etc...
You can generalize this situation, for example, a menu with several options or perhaps a parser, etc (Yes, speed parsers works this way).
As you may notice, that's a lot of comparisons, especially if you're writing a parser where there's so many keywords (over 50 say). We can easily eliminate these comparisons by using function pointers, consequently speeding up your program. See FUNCPTR.BAS for a concrete example.
BIND FPtr(1) AS Process1
BIND FPtr(2) AS Process2
BIND FPtr(3) AS Process3
BIND FPtr(4) AS Process4
BIND FPtr(5) AS Process5
BIND FPtr(6) AS Process6
BIND FPtr(7) AS Process7
x = VAL(INPUT$(1))
CALLFUNC(FPtr(x), 33)
None of the code you see above is executable as is, but I think you get the general idea.
----------------------------------------------------------------------------------------------
I think that this kind of feature can make very speed codes, instead using too many SELECT CASEs,
Im trying to make some kind of parse to my keywords, but this function could be very usefull in other many ways, lets see:
In the case of the Gadgets, now we have to wait for the event of every Gadget:
Case 1
Case 2
etc...
or maybe use your nice function:
ConnectSub(1,?Button1)
ConnectSub(2,?Button2)
(this is usefull, but i think that in some cases we may need to use another way).
Lets imagin that we have this function.
EventGadget(id,?id)
1:
;code
Return
2:
;code
Return
where ID is the number of the Gadget, then we can use only ONE line to redirect every GadgetEvent to its own procedure, i know there is a risk... if the function donot exist the application will crash.
In my case, im looking for some way to redirect my application depending of the content of any element of one array, in the old way it could be done like:
Select var(i)
Case "Argentina"
;code
Case "Brazil"
;code
Case "Canada"
;code
Case "Deutsche"
;code
etc,etc,etc,etc...
But having ONE case for every country (or for every keyword) could make the process something slow, because every keyword have to be compared with all...
If we can BIND some pointer to every function, we can JUMP directly to the function with out having to make hundreds of comparisions.
I am wondering if we can use some kind of array or variable in your function (something similar to the Rapid-Q feature) we can jump directly to the function or the label:
ConnectSub(2,?var(i))
Argentina:
;code
Return
Brazil:
;code
Return, etc, etc...
or
Procedure Argentina()
;code
EndProcedure
Procedure Brazil()
;code
EndProcedure
Thaks for taking the time to read my question and for your examples : )
Ricardo
Mr.Skun
I try your example and its excellent.
But i don't know if i can use a variable as the second parameter,instead a predefinited label's name,example:
ConnectSub(2,?MyVar)
Im looking for some way to direct some event to different procedures depending on the value of some variable.
I know i can use SELECT CASE, but its to larger if my keywords are many.
I have some tokens... one array with 200 words or more. I want to read the first (or any other) word and direct it to some procedure depending of its values.
In Rapid-Q its named 'Function Pointer' and this some explanation of how it works (taked from the Rapid-Q manual):
---------------------------------------------------------------------------------------------
If you have prior experience with function pointers (ie. in C) there are a few differences you'll have to get accustomed to. In Rapid-Q, since function pointers are just numbers, you can use any valid numeric datatype to define your function pointers. Seems odd, yes, but pointers are only numbers. Try avoiding BYTE, since the address of your function may be greater than 255, using BYTE may not be large enough. I suggest sticking with INTEGER/LONG.
DECLARE SUB Test (I AS INTEGER)
DIM FPtr AS INTEGER
BIND FPtr TO Test
Well, we use BIND in Rapid-Q to bind our variable FPtr to the function Test.
It will be clear (once you've used function pointers for a while) that there are times when using function pointers is necessary, and times when they're not. I think every situation is different, but consider this situation:
SELECT CASE I
CASE 1
Process1("1", 44)
CASE 2
Process2("2", 55)
CASE 3
Process3("3", 66)
CASE 4
:
:
etc...
You can generalize this situation, for example, a menu with several options or perhaps a parser, etc (Yes, speed parsers works this way).
As you may notice, that's a lot of comparisons, especially if you're writing a parser where there's so many keywords (over 50 say). We can easily eliminate these comparisons by using function pointers, consequently speeding up your program. See FUNCPTR.BAS for a concrete example.
BIND FPtr(1) AS Process1
BIND FPtr(2) AS Process2
BIND FPtr(3) AS Process3
BIND FPtr(4) AS Process4
BIND FPtr(5) AS Process5
BIND FPtr(6) AS Process6
BIND FPtr(7) AS Process7
x = VAL(INPUT$(1))
CALLFUNC(FPtr(x), 33)
None of the code you see above is executable as is, but I think you get the general idea.
----------------------------------------------------------------------------------------------
I think that this kind of feature can make very speed codes, instead using too many SELECT CASEs,
Im trying to make some kind of parse to my keywords, but this function could be very usefull in other many ways, lets see:
In the case of the Gadgets, now we have to wait for the event of every Gadget:
Case 1
Case 2
etc...
or maybe use your nice function:
ConnectSub(1,?Button1)
ConnectSub(2,?Button2)
(this is usefull, but i think that in some cases we may need to use another way).
Lets imagin that we have this function.
EventGadget(id,?id)
1:
;code
Return
2:
;code
Return
where ID is the number of the Gadget, then we can use only ONE line to redirect every GadgetEvent to its own procedure, i know there is a risk... if the function donot exist the application will crash.
In my case, im looking for some way to redirect my application depending of the content of any element of one array, in the old way it could be done like:
Select var(i)
Case "Argentina"
;code
Case "Brazil"
;code
Case "Canada"
;code
Case "Deutsche"
;code
etc,etc,etc,etc...
But having ONE case for every country (or for every keyword) could make the process something slow, because every keyword have to be compared with all...
If we can BIND some pointer to every function, we can JUMP directly to the function with out having to make hundreds of comparisions.
I am wondering if we can use some kind of array or variable in your function (something similar to the Rapid-Q feature) we can jump directly to the function or the label:
ConnectSub(2,?var(i))
Argentina:
;code
Return
Brazil:
;code
Return, etc, etc...
or
Procedure Argentina()
;code
EndProcedure
Procedure Brazil()
;code
EndProcedure
Thaks for taking the time to read my question and for your examples : )
Ricardo
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Mr.Skunk.
No, you can't use a variable, as ?var point to the adress of the variable. But... it's possible if your variable contains a valid binary program .
There was a good function on my old amstrad computer:
"on i gosub 120 130 140 150", the gosub jump to line 120 or 130 or 140 depending the value of the var i. Is that exactely something like that you want?
The main problem with these type of commands in PB is that libraries functions have a strict numbers of parameters (and you never have the same number of procedures), so i think there is two solutions to resolve the problem :
1- create a library command to initialise a list of subs (like linkedlist).
2- create a PB pre-processor, with a command like preprocess(" ") for example whitch could contain a string with a specific set of commands known by the preprocessor, for example the "on i gosub..." command).
The "preprocess" command will be compiled by the PB compiler and before beeing compiled by Nasm, the asm source will be analysed and the command replaced by valid ASM code to performed desired actions.
I thought about preprocessor because we don't have access to official PB libraries sources, and it's rather impossible to performed actions on these commands (lack of developper docs...).
And some commands can't be easily done in libraries, the only simple solution to write them would be to code them directly in the PB compiler like internal commands (for, next, gosub...).
This pre-processor could be a good idea to test new internal commands and if they are usefull and used by people, Fred could code them directly to PB compiler...
What do you think about this idea???
I'm waiting your feedbacks before starting writing something, to see if there is enough people interested...
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
No, you can't use a variable, as ?var point to the adress of the variable. But... it's possible if your variable contains a valid binary program .
There was a good function on my old amstrad computer:
"on i gosub 120 130 140 150", the gosub jump to line 120 or 130 or 140 depending the value of the var i. Is that exactely something like that you want?
The main problem with these type of commands in PB is that libraries functions have a strict numbers of parameters (and you never have the same number of procedures), so i think there is two solutions to resolve the problem :
1- create a library command to initialise a list of subs (like linkedlist).
2- create a PB pre-processor, with a command like preprocess(" ") for example whitch could contain a string with a specific set of commands known by the preprocessor, for example the "on i gosub..." command).
The "preprocess" command will be compiled by the PB compiler and before beeing compiled by Nasm, the asm source will be analysed and the command replaced by valid ASM code to performed desired actions.
I thought about preprocessor because we don't have access to official PB libraries sources, and it's rather impossible to performed actions on these commands (lack of developper docs...).
And some commands can't be easily done in libraries, the only simple solution to write them would be to code them directly in the PB compiler like internal commands (for, next, gosub...).
This pre-processor could be a good idea to test new internal commands and if they are usefull and used by people, Fred could code them directly to PB compiler...
What do you think about this idea???
I'm waiting your feedbacks before starting writing something, to see if there is enough people interested...
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
One more question: MemoryBank... i dont get exactly how to use it and what for... maybe it can de usefull, because Fred describes it:
"Sometimes, it's very useful have access to the system memory (RAM) to process some time consumming operations and speed them up."
OK, but how to do it.
About the preprocessor... my poor english dont let me understand exactly what you mean and how this works (sorry if i am sometimes slow to understand, but its my english)
You are brilliant !!!
Ricardo
I done this once with RapidQ using some ASMBin, and its very usefull. Could be one solution of this point, the question is... how can i do it?No, you can't use a variable, as ?var point to the adress of the variable. But... it's possible if your variable contains a valid binary program .
Yes !!!, i want to do it in runtime, depending on the user input.There was a good function on my old amstrad computer:
"on i gosub 120 130 140 150", the gosub jump to line 120 or 130 or 140 depending the value of the var i. Is that exactely something like that you want?
One more question: MemoryBank... i dont get exactly how to use it and what for... maybe it can de usefull, because Fred describes it:
"Sometimes, it's very useful have access to the system memory (RAM) to process some time consumming operations and speed them up."
OK, but how to do it.
About the preprocessor... my poor english dont let me understand exactly what you mean and how this works (sorry if i am sometimes slow to understand, but its my english)
You are brilliant !!!
Ricardo
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Mr.Skunk.
for memory bank, for example if someone create a library to modify pictures with filters, to modify them, you can use a memory bank to store the results or intermediate levels of drawing.
You can also use it if, for example, you have to work with a lot numeric values. Instead of using variables you can use banks to store values and peek/poke them, i think this is faster than using variables in that case.
my english is very poor too .
In fact the pre-processor if a PB program witch run after PB compiler and before Nasm compiler. It analyse the ASM source created by the PB compiler and does actions to easily create commands that /can be easily/or can't be at all/ written using libraries.
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
for memory bank, for example if someone create a library to modify pictures with filters, to modify them, you can use a memory bank to store the results or intermediate levels of drawing.
You can also use it if, for example, you have to work with a lot numeric values. Instead of using variables you can use banks to store values and peek/poke them, i think this is faster than using variables in that case.
my english is very poor too .
In fact the pre-processor if a PB program witch run after PB compiler and before Nasm compiler. It analyse the ASM source created by the PB compiler and does actions to easily create commands that /can be easily/or can't be at all/ written using libraries.
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Mr.Skunk.
Hummm, it's a curious way, i think, to do that...
You can use IncludeBinary if you want it resident in your app, or loading the prog to a memorybank, instead of putting it into a variable...
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
Hummm, it's a curious way, i think, to do that...
You can use IncludeBinary if you want it resident in your app, or loading the prog to a memorybank, instead of putting it into a variable...
Mr Skunk
Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st