Thanks for the quick reply there Jeremy. You took the words right out of my keyboard.
I understand that you have to make a comparision to give the statement a meaning.
This might be an error in the Jedi-SDL documentation.
Edit:
I took a second look at your statement and I think you did not consider that and expects integer as operands and even your altered code fragment won't compile.Code:if (image.format.palette and screen_.format.palette) = screen_.format.palette then
I typed too soon
If you have the 0.5 archive anywhere, have a look @
JEDI-SDL/Demos/2D/SDLTests/testwin/
That Delphi project makes use of SDL_SetColors()
The fix to your code is obvious if I had paid attention to what you had typed earlier about palette being a PSDL_Palette...
Code:if (image.format.palette <> nil ) and ( screen_.format.palette <> nil ) then begin SDL_SetColors(screen_, @image.format.palette.colors[0], 0, image.format.palette.ncolors); end;
Actually I have never used SDL and made the mistake of taking for granted that .palette was an integer or an integer typeable item (such as a set witch you can also and on). Looks like savage posted what should be the proper version though .Originally Posted by IaxFenris
- Jeremy
- Jeremy
http://www.eonclash.com/
This way it does work
Many thanks for all the great help.
Maybe the example in the documentation should be altered to prevent future problems.
Thanks for pointing it out and I will update the documentation appropriately for the official 1.0 release.
If you find any other mistakes in the docs, please let me know.
Finally i managed to have a working fpc, Lazarus and Jedi-SDL under Linux
The only downside is, that Lazarus crashes whenever I compile one of the included NeHe Demos, but using fpc via commandline it compiles just fine. :?
However it is sufficient to start with the basics.
Btw, when refering to documentation, please use the HTML files from 0.5, as that is what I plan to update and release with v1.0 and not the chm file. It's also less hassle to maintain. So if anyone spots any typos/error and out right lies, please let me know.
The html documentation will be migrated to the JEDI-SDLv1.0 branch this week-end.
Ok, I have switched to the html files of the documentation and I will tell you whenever I find an error.
At the moment I am working through it using Lazarus as IDE. Unfortunaltey I was not able to set up the included textbased IDE to properly use the Jedi-SDL. When I entered the SDL direcotries under Options|Directories it seams that the compiler can't find all the other units as he suddenly asks for pthreads which is located in fpcs own units directory (and he does not ask for it if I leave the directories blank).
However when typing the following code using Lazarus :
I get the error that screen_.format is an illegal qualifier. Using the code completion with screen_ I always get the result screen_.PSDL_Surface;Code:program SDLTest; {$mode objfpc}{$H+} uses sysutils, sdl; // All SDL App's need this var screen_ : PSDL_Surface; begin // Initialize the SDL library if (SDL_Init(SDL_INIT_VIDEO) < 0) then begin WriteLn(PChar(Format('Couldn''t initialize SDL : %s', [SDL_GetError]))); // Clean up on exit SDL_Quit; exit; end; // Have a preference for 8-bit, but accept any depth screen_ := SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE or SDL_ANYFORMAT); if (screen_ = nil) then begin WriteLn(PChar(Format('Couldn''t set 640x480x8 video mode : %s', [SDL_GetError]))); SDL_Quit; halt(1); end; WriteLn(PChar(Format('Set 640x480 at %d bits-per-pixel mode', [screen_.format.BitsPerPixel]))); end.
This happens with Lazarus under Windows as well but Delphi 6 does not have any problems with it. Does anyone have an idea whats the problem with this? Oh and I tried to turn the Delphi compatibility mode on but it did not change the result.
A little side question: is open kylix worth the download?
thanks
Michael
Sorry I can't help with Lazarus as I use Delphi or Kylix for my coding and then I use FPC via command line on both Win32 and Linux to test compilation and that the resulting exes work.
Bookmarks