Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: JEDI-Sdl + dglOpenGL crash on Windows

  1. #11

    JEDI-Sdl + dglOpenGL crash on Windows

    Hax :* Thanks guys.

  2. #12

    JEDI-Sdl + dglOpenGL crash on Windows

    Sorry for double post. But i have one more question. When i change display method on sdl_opengl, my ttf unit doesn't work.

    Code:
    unit fonts;
    interface
    
    uses
    	sdl in 'lib/sdl.pas',
    	sdl_image in 'lib/sdl_image.pas',
    	sdl_ttf in 'lib/sdl_ttf.pas',
    	classes,
    	sysUtils;
    	
    type
    	TFonts = class
    	private
    		fOffset : tsdl_rect;
    		fFont : pttf_font;
    		fFontColor : tsdl_color;
    		fFontSurface : psdl_surface;
    		fScreen : psdl_surface;
    		fAlign : integer;
    		function getX : integer;
    		function getY : integer;
    		procedure setX(ax : integer);
    		procedure setY(ay : integer);
    	public
    		property x : integer read getX write setX;
    		property y : integer read getY write setY;
    		property offset : tsdl_rect read fOffset write fOffset;
    		property fontColor : tsdl_color read fFontColor write fFontColor;
    		property align : integer read fAlign write fAlign;
        
    		constructor create(aScreen : psdl_surface);
    		procedure loadFont(aFile : string; aSize : integer);
    		procedure drawText(Atext : string);
    	end;
    	
    const
    	ALIGN_LEFT = 1;
    	ALIGN_CENTER = 2;
    	ALIGN_RIGHT = 3;
    
    implementation
    	
    uses globals;
    	
    function TFonts.getX: integer;
    begin
    	result := fOffset.x;
    end;
    
    function TFonts.getY: integer;
    begin
    	result := fOffset.y;
    end;
    
    procedure TFonts.setX(ax: integer);
    begin
    	fOffset.x := ax;
    end;
    
    procedure TFonts.setY(ay: integer);
    begin
    	fOffset.y := ay;
    end;
    
    constructor TFonts.create(aScreen: psdl_surface);
    begin
    	fScreen := aScreen;
    	fAlign := ALIGN_LEFT;
    	fontColor.r := 255;
    	fontColor.g := 255;
    	fontColor.b := 255;
      
    	if ttf_init < 0 then writeln&#40;'Could not load font'&#41;;
    end;
    
    procedure TFonts.loadFont&#40;aFile&#58; string; aSize&#58; integer&#41;;
    begin
    	fFont &#58;= ttf_openFont&#40;pChar&#40;aFile&#41;, aSize&#41;;
    end;
    
    procedure TFonts.drawText&#40;aText&#58; string&#41;;
    var
    	_tempOffset &#58; tsdl_rect;
    begin
    	fFontSurface &#58;= ttf_renderText_solid&#40;fFont, pChar&#40;aText&#41;, fFontColor&#41;;
    
    	case fAlign of
    	ALIGN_LEFT&#58;
    		_tempOffset.x &#58;= 0;
    	ALIGN_CENTER&#58;
    		_tempOffset.x &#58;= -fFontSurface^.w div 2;
    	ALIGN_RIGHT&#58;
    		_TempOffset.x &#58;= -FFontSurface^.w;
    	end;
        
    	_tempOffset.x &#58;= _tempOffset.x + fOffset.x;
    	_tempOffset.y &#58;= fOffset.y;
        
    	
    	sdl_blitSurface&#40;fFontSurface, nil, fScreen, @_tempOffset&#41;;
    	sdl_freeSurface&#40;fFontSurface&#41;;
    end;
    	
    end.
    I am pwned by opengl

  3. #13

    JEDI-Sdl + dglOpenGL crash on Windows

    If you are using OpenGL with SDL_ttf, check out the OpenGL/SDL_ttf demo that is part of the beta. That will show you how to use it with OpenGL.

    The latest beta and demos can be found at http://jedi-sdl.pascalgamedevelopment.com
    <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 + dglOpenGL crash on Windows

    I have made my own bitmap font engine with help of "FontStudio 4.1"
    From brazil (:

    Pascal pownz!

Page 2 of 2 FirstFirst 12

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
  •