Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Di Jul 15, 2025 07:48

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 7 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Starting with EasySDL
BeitragVerfasst: So Feb 11, 2007 11:14 
Offline
DGL Member

Registriert: So Jan 28, 2007 20:31
Beiträge: 6
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


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Feb 11, 2007 13:22 
Offline
DGL Member

Registriert: So Jan 28, 2007 20:31
Beiträge: 6
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]


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Feb 12, 2007 10:39 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2068
Programmiersprache: C++
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.

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Feb 14, 2007 00:36 
Offline
DGL Member

Registriert: So Jan 28, 2007 20:31
Beiträge: 6
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.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Feb 14, 2007 14:41 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2068
Programmiersprache: C++
Thanks for the correction.
Can you send me the corrected code, so I can update it in the SVN?

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Feb 15, 2007 12:45 
Offline
DGL Member

Registriert: So Jan 28, 2007 20:31
Beiträge: 6
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


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Feb 15, 2007 15:08 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2068
Programmiersprache: C++
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.

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 7 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.011s | 16 Queries | GZIP : On ]