The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
don't have frame around window when running in Windows
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
I wrote a C program that uses SDL for graphics. Originally I built and ran it in Ubuntu environment. There is a frame around the SDL window with a title in upper left corner. When my program switches operating mode or the data set being used it writes the status in the upper left (title area) of the frame using

SDL_SetWindowTitle(win1, headr)

It is a very useful feature. Now I have built the program for use with Windows. It works fine except for one thing - in Windows no frame is displawed around the SDL window. So, in Windows I don't have the program status displayed. Can someone here tell me how to get the frame displayed around the the SDL window? When running in Ubuntu I have the frame, when running in Windows I don't have the frame.

TIA. Bill S.
don't have frame around window when running in Windows
David Olofson
Guest

On Mon, Jul 25, 2016 at 4:35 AM, bilsch01 wrote:
[...]
Quote:
It works fine except for one thing - in Windows no frame is
displawed around the SDL window.
[...]

This sounds like a bug... AFAIK, there should always be a border on
platforms with windowing systems, unless you're using
SDL_WINDOW_BORDERLESS.

Do other SDL applications (such as the included tests) get window borders?

Oh, and which Windows version are you using?


--
//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.--- Games, examples, libraries, scripting, sound, music, graphics ---.
| http://consulting.olofson.net http://olofsonarcade.com |
'---------------------------------------------------------------------'
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
I went to your site and downloaded ballfield-1.0.tar.gz. It requires SDL 1.2.0 - not what I need to test SDL-2.0.3. Can you tell me a specific program to use?

DELL N4110, CPU Intel i3, Windows 7 64bit,
Building for 32-bit Windows using 32-bit MinGW and 32-bit libraries and headers

Bill S.
don't have frame around window when running in Windows
David Olofson
Guest

On Mon, Jul 25, 2016 at 5:47 PM, bilsch01 wrote:
Quote:
I went to your site and downloaded ballfield-1.0.tar.gz. It requires SDL
1.2.0 - not what I need to test SDL-2.0.3.

Yeah, those examples are ancient... Unless I'm forgetting something,
my only open source SDL2 project so far is Kobo Redux
(https://github.com/olofson/koboredux), and that's not exactly a
minimal example. :-)


Quote:
Can you tell me a specific
program to use?

Not sure how you've installed SDL, but the library itself comes with a
bunch of test/example programs. There are probably precompiled
binaries of them somewhere, but I've never actually looked for any
myself.

You can either download the source code and compile some test programs
from there;

https://libsdl.org/download-2.0.php

...or look around for tutorials and the like, with source and binaries;

http://lazyfoo.net/tutorials/SDL/

(Wasn't there a massive list of software using SDL somewhere as
well...? I don't know if there is an updated one for SDL2.)


Quote:
DELL N4110, CPU Intel i3, Windows 7 64bit,
Building for 32-bit Windows using 32-bit MinGW and 32-bit libraries and
headers

So, it's not a Windows 10 issue, at least. (It still seems to trigger
or cause issues with a lot of software, so the first thing to try when
having issues on Win10 is testing on any other Windows version to see
if the issue remains.)


--
//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.--- Games, examples, libraries, scripting, sound, music, graphics ---.
| http://consulting.olofson.net http://olofsonarcade.com |
'---------------------------------------------------------------------'
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: don't have frame around window when running in Windows
bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
Please see the program below. Originally I built and ran it in Ubuntu environment. There is a frame around the SDL window with a title in upper left corner. When my program switches operating mode or the data set being used it writes the status in the upper left (title area) of the frame using

SDL_SetWindowTitle(win1, headr)

It is a very useful feature. Now I have built the program for use with Windows. It works fine except for one thing - in Windows no frame is displawed around the SDL window. So, in Windows I don't have the program status displayed. Can someone here tell me how to get the frame displayed around the the SDL window? When running in Ubuntu I have the frame, when running in Windows I don't have the frame.

TIA. Bill S.

Code:

#define SDL_MAIN_HANDLED   // avoids WinMain@16
#include <SDL.h>
// #include <SDL2/SDL.h>
#include <stdio.h>
#include <math.h>

int c1, c2, c3, xof=650, yof=350, xm=200, ym=100, delay=5, glen=300;   
int plotted=0, flag1, flag2, x2, y2;

float t, f1, f2, f3, f4, f5, f6;
float w1=2.668, w2=0.673, w3=0.077, k1=.005;


//  *********************************   main()   ************************************

int main(int argc, char *argv[]){

SDL_SetMainReady();            // avoids WinMain@16
SDL_Init(SDL_INIT_VIDEO);
SDL_DisplayMode vmode;
SDL_GetDisplayMode(0, 0, &vmode);
//  printf("width=%i    height=%i\n",vmode.w,vmode.h);
SDL_Window *win1 = NULL;
win1=SDL_CreateWindow("test1",0,0,vmode.w,vmode.h,SDL_WINDOW_SHOWN);
SDL_Renderer* ren = NULL;
ren =  SDL_CreateRenderer(win1, 0, SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor( ren, 0, 0, 0, 255 );
SDL_RenderClear( ren );
SDL_Event event;

while(1)
{   if(SDL_PollEvent(&event)==1)
   {
      if (event.type == SDL_KEYDOWN && event.key.keysym.scancode == SDL_SCANCODE_END)
      goto x100;
   }            

   flag1 = 0;
   flag2 = 0;

   while (flag1 == 0)         // flag1=1 black pixel is glen pxls behind color pixel
   {   if (flag2 == 0)      // flag2=1 means color pixel has been plotted
                {   
         t  = k1*(plotted+glen);
         c1 = 255;
         c2 = 0;
         c3 = 144;      //  color pixel   
         flag2 = 1;
      }
      else
      {
         t  = k1*plotted;
         c1 = 0;
         c2 = 0;
         c3 = 0;         //  r=g=b=0 = black pixel
         flag1 = 1;
      }

      f1 = sin(w1*t);
      f2 = sin(w2*t);
      f3 = sin(w3*t);
      f4 = cos(w1*t);
      f5 = cos(w2*t);
      f6 = cos(w3*t);

      x2 = xof + (int)(xm*(f1+f2)*f3);
      y2 = yof + (int)(ym*(f4*f5));

      SDL_SetRenderDrawColor(ren,c1,c2,c3,255); 
      SDL_RenderDrawPoint(ren,x2,y2);
      SDL_RenderPresent(ren);
   }
   
   SDL_Delay(delay);
   plotted++;

   if(plotted==10000)
   {
      plotted=0;
      SDL_SetRenderDrawColor( ren, 0, 0, 0, 255 );
      SDL_RenderClear(ren);
   }
}                        //  end of while(1) loop

x100:;
SDL_DestroyRenderer(ren);
SDL_DestroyWindow(win1);
SDL_Quit();
return 0;
}

bilsch01


Joined: 26 Feb 2015
Posts: 55
Location: Seattle, WA, USA
This is SDL 2.0.4

Bill S.