DGL
https://delphigl.com/forum/

Starting with EasySDL
https://delphigl.com/forum/viewtopic.php?f=19&t=6363
Seite 1 von 1

Autor:  Gowen [ So Feb 11, 2007 11:14 ]
Betreff des Beitrags:  Starting with EasySDL

Hello:
I'm i newbie on this area and have some problems with EasySDL. I'm modifying the template, changing things, adding others, but can't set fullscreen. I tried to set FULL_SCREEN const to TRUE on EasySDL.pas but don't work, and add MyProgram.SetDisplay(800,600,TRUE) before MyProgram.Create, between MyProgram.Create and MyProgram.Start, after MyProgram.Start, and so on until before MyProgram.Stop. The first time i get an SDL error, because i changed it before construct it, but the next ones, SetDisplay don't work, it stays with 640*480 default size. How can i use SetDisplay method correctly? Or is there another way? I don't want to set it calling SDL directly because it's like use a hammer, and want to do the rigth way.


Code:
  1.  
  2. //Tried here Error
  3. MyProgram := TMyProgram.Create('www.delphigl.com .:. Template');
  4. //Tried here
  5.   MyProgram.Start;
  6. //Tried here
  7.   Color.r:=255;//Tried here
  8.   Color.g:=255;//Tried here
  9.   Color.b:=255;//Tried here
  10.   Color.unused:=0;//Tried here
  11.  
  12.   MyProgram.FPSFont:=TFont.Create(DATA_LOC+'fonts/monofont.ttf',16, Color, 0);//Tried here
  13.   Textures.Load(DATA_LOC+'gfx/wiki.jpg','Wiki');//Tried here
  14.  
  15.   MyProgram.Loop;//Tried here
  16.   MyProgram.Stop;


Thanks

Autor:  Gowen [ So Feb 11, 2007 13:22 ]
Betreff des Beitrags: 

I also tried to modify EasySDL code, in TEasySDL.InitSDL method, changing

Code:
  1. videoFlags := SDL_OPENGL or SDL_DOUBLEBUF or SDL_HWPALETTE;


to

Code:
  1. videoFlags := SDL_OPENGL or SDL_DOUBLEBUF or SDL_HWPALETTE or SDL_FULLSCREEN;


as Jedi-SDL documentation says but nothing changes, perhaps it's hardcoded on another site, but changing consts

Code:
  1. const
  2.   DEFAULT_WINDOW_WIDTH   = 640;
  3.   DEFAULT_WINDOW_HEIGHT  = 480;
  4.   DEFAULT_WINDOW_BPP     = 32;
  5.  
  6.   DEFAULT_WINDOW_CAPTION  = 'www.delphigl.com';
  7.   DEFAULT_WINDOW_ICON     = '../data/gfx/dgl_icon.png';
  8.  
  9.   WINDOW_FULLSCREEN = FALSE;
  10.   WINDOW_RESIZE   = FALSE;


don't work, nor width, height, nor fullscreen :(

Also i forgot to say that i use Freepascal 2.0.4, and DGLSDK 2006.1 under WinXP but will compile code also under FreeBSD6 later.

Thanks[/pascal]

Autor:  i0n0s [ Mo Feb 12, 2007 10:39 ]
Betreff des Beitrags: 

That with Fullscreen seems to be left on the road will coding.
You have to add the following code before SDL_SetVideoMode:
Code:
  1.  
  2.   if WINDOW_FULLSCREEN then
  3.     videoFlags := videoFlags or SDL_FULLSCREEN;
  4.  
  5.   if WINDOW_RESIZE then
  6.     videoFlags := videoFlags or SDL_RESIZABLE;
  7.  

This solve this problem for me.
I hope it will be fixed in the next release.

Autor:  Gowen [ Mi Feb 14, 2007 00:36 ]
Betreff des Beitrags: 

Now fullscreen works, but i found what seems an error. Citing JEDI-SDL help docs (included on dglsdk 2006.1)

Zitat:
if you wish to use double buffering you must specify it as a GL attribute, not by passing the SDL_DOUBLEBUF flag to SDL_SetVideoMode.


But EasySDL code does
Code:
  1. videoFlags := SDL_OPENGL or SDL_DOUBLEBUF or SDL_HWPALETTE;
and
Code:
  1.   SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
some lines below, so it's using 2 times a double buffer.

Erasing SDL_DOUBLEBUF makes few fps more (from 680 avg to 695 avg) on simple scenes, perhaps it's unnoticiable on complex ones.

Also i have updated EasySDL with a new creator for manage Width, Height, FullScreen and Resizable, and fps average.

Autor:  i0n0s [ Mi Feb 14, 2007 14:41 ]
Betreff des Beitrags: 

Thanks for the correction.
Can you send me the corrected code, so I can update it in the SVN?

Autor:  Gowen [ Do Feb 15, 2007 12:45 ]
Betreff des Beitrags: 

I sended you a pm with the url where is my EasySDL.pas version. Don't know if i break other things, as i don't know OpenGL.

HTH

Autor:  i0n0s [ Do Feb 15, 2007 15:08 ]
Betreff des Beitrags: 

I've read the PM and took the code into the svn, no code breaks happened.
But I simple forgot to answer your PM, so sorry for that and thanks for the code.

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/