Hezad wrote:Hum .. I'm beginning to code rendering in an IUP Canvas instead of fb's GFX screen BUT :
Er .. I created a canvas, no problem. How do I draw on it ?! In the official IUP doc, all the examples files are using instructions starting with "cd****" to draw something but I can't find anything like this in the FB's headers.
Once i'll know how to do this, Graph Editor will render, edit, analyse, etc.. in the same window :p
So, any idea ?
You can get extra controls for IUP. There is, for instance, an IupGLCanvas, that can be used for drawing things on using GL (GLX - screen?).
All the extra controls can be found in one file called iupcontrols.dll that is available here:
http://luaforge.net/frs/download.php/24 ... l8_lib.zip
Inside the .zip - file is a file called iupcontrols.dll that you can use. But how to use it in FreeBASIC? There is an include - file for this dll inside the FreeBASIC - distribution (called iupcontrols.bi) but it lacks the declarations you'll need to build a IupGLcanvas.
I could think of two ways to get past this problem:
1. Create a new import - library for the dll containing the extra controls.
2. Call the functions inside the DLL using a combination of Dim function .. As ....., dylibload and dylibsymbol. You'd have to redo the .bi - include file a bit to use this option.
Option 1 is of course the preferred option but do you know how to build an import - library (a .dll.a?) I don't. That's why I use option 2.
It is an option I've used myself and it works. First you have to (partly) redo the original include - file (.bi). Inside the original include - file you see a lot of lines that look like this:
declare function [name] (arguments) as result
To use such a line inside the new include - file you could simply do one big find - and - replace (of course you have given the new include - file a differenct name than the orginial include - file?) replacing
'declare' with 'dim' and replacing
'function' with 'function as'
And there you go, a new include -file. Do not forget to remove the lines "extern c"
from the new include - file.
How to use this include - file?
Just include the new .bi - file inside the .bas - file where you want to use the dll - functions . Inside that .bas - file you put this:
Dim hndl As Any Ptr
and for every function declared inside the .bi that you want to use you do:
functionname = DyLibSymbol( hndl, "functionname" )
Of course you could get a lot of these last lines automatically from the .bi - file by using a regular - expression find-and-replace. However, you usually just need a couple of functions from the dll so that is not really needed.
For instance, I myself have used zlib1.dll and only needed two functions. I didn't even write an include - file for this (two Dim function... As were enough).
Now a vital point: can you read c - header - files? If so, all is well because you just make a copy of the include - library that is already there (iupcontrols.bi), change that in the way I suggested and then add some lines from the c - header - file. Those lines have to be changed to FreeBASIC - syntax.
Since the entire iupgl.h is missing from the freebasic include - library you'll need to add that. Luckily there is not much inside that header - file (and most of it is almost in FreeBASIC - syntax :) ).
If you have any problem reading the c - header - files or getting IUP to work just let me know. And if you somehow find out how to build include - libraries yourself please post it here. I am sure somewhere on this forum the info on building import - libraries can be found but I haven't found this information yet (for instance, where is the swig - fb - file?).
Hope this post was of some help to you. Will be testing the last version of the graph - editor soon...