Re: don't have frame around window when running in Windows
"bilsch01" <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
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;
}
_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org