Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Jedi-SDL & FPC

  1. #11

    Jedi-SDL & FPC

    Thanks for the quick reply there Jeremy. You took the words right out of my keyboard.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #12

    Jedi-SDL & FPC

    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:
    Code:
    if &#40;image.format.palette and screen_.format.palette&#41; = screen_.format.palette then
    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.

  3. #13

    Jedi-SDL & FPC

    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 &#40;image.format.palette <> nil &#41; and &#40; screen_.format.palette <> nil &#41; then
      begin
        SDL_SetColors&#40;screen_, @image.format.palette.colors&#91;0&#93;, 0, image.format.palette.ncolors&#41;;
      end;
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #14

    Jedi-SDL & FPC

    Quote Originally Posted by IaxFenris
    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:
    Code:
    if &#40;image.format.palette and screen_.format.palette&#41; = screen_.format.palette then
    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.
    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 .

    - Jeremy

  5. #15

    Jedi-SDL & FPC

    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.

  6. #16

    Jedi-SDL & FPC

    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.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  7. #17

    Jedi-SDL & FPC

    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.

  8. #18

    Jedi-SDL & FPC

    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.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  9. #19

    Jedi-SDL & FPC

    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 :


    Code:
    program SDLTest;
    
    &#123;$mode objfpc&#125;&#123;$H+&#125;
    
    uses
      sysutils,
      sdl; // All SDL App's need this
    
    var
       screen_ &#58; PSDL_Surface;
    begin
         // Initialize the SDL library
         if &#40;SDL_Init&#40;SDL_INIT_VIDEO&#41; < 0&#41; then
         begin
              WriteLn&#40;PChar&#40;Format&#40;'Couldn''t initialize SDL &#58; %s',
                &#91;SDL_GetError&#93;&#41;&#41;&#41;;
              // Clean up on exit
              SDL_Quit;
              exit;
         end;
    
         // Have a preference for 8-bit, but accept any depth
         screen_ &#58;= SDL_SetVideoMode&#40;640, 480, 8, SDL_SWSURFACE or SDL_ANYFORMAT&#41;;
         if &#40;screen_ = nil&#41; then
         begin
              WriteLn&#40;PChar&#40;Format&#40;'Couldn''t set 640x480x8 video mode &#58; %s',
                &#91;SDL_GetError&#93;&#41;&#41;&#41;;
    
              SDL_Quit;
    
              halt&#40;1&#41;;
         end;
         WriteLn&#40;PChar&#40;Format&#40;'Set 640x480 at %d bits-per-pixel mode',
           &#91;screen_.format.BitsPerPixel&#93;&#41;&#41;&#41;;
    end.
    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;
    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

  10. #20

    Jedi-SDL & FPC

    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.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •