Re: Need Win Guru/Tester
- Posted by jordah at btopenworld.com Jan 14, 2003
- 467 views
BTW, Why is it you lock the surface and unlock it?. Is that to prevent flicker or some other app drawing on the windowed surface. Also, why do you lock and unlock the surface twice in every pumped message? check out the code below and in initme(). It would be best/faster if you locked and unlocked once ----------------------------------- procedure initme() r1=0 g1=0 b1=0 rt=rand(3) gt=rand(3) bt=rand(3) ns=rand(7)+2 count=0 -- dummy = SDL_LockSurface(surface) if dummy = -1 then puts(1, "SDL_LockSurface had a hissy fit!\n") end if poke(rect,{0,0,0,0,128,2,224,1}) dummy=SDL_FillRect(surface,rect,SDL_MapRGB(format,0,0,0)) if dummy = -1 then puts(1, "SDL_FillRect had a hissy fit!\n") end if --SDL_UnlockSurface(surface) end procedure ----------------------------------- global procedure sdl_show() dummy = SDL_Init(SDL_INIT_VIDEO) if dummy = -1 then puts(1, "SDL_Init had a hissy fit!\n") end if --surface = SDL_SetVideoMode(640,480,32,SDL_FULLSCREEN) surface = SDL_SetVideoMode(640,480,32,SDL_RESIZABLE) format=peek4u(surface+4) pixels=peek4u(surface+20) rect=allocate(8) initme() done=0 -- use the PumpEvents and GetMouseState to see if a mouse button has been pressed while done=0 do SDL_PumpEvents() keystate=SDL_GetKeyState(NULL) if peek(keystate+SDLK_SPACE)>0 then count=10001 end if SDL_PumpEvents() dummy=SDL_GetMouseState(0,0) if dummy = -1 then puts(1, "SDL_GetMouseState had a hissy fit!\n") end if dummy = SDL_LockSurface(surface) if dummy = -1 then puts(1, "SDL_LockSurface had a hissy fit!\n") end if a=rand(1000)-500 a=(a/500)*PI a=a/ns r=rand(160)+rand(160) s=ptor(a,r) x=s[1]+320 y=s[2]+240 if rt=1 then r1=floor(a*256/PI) end if if rt=2 then r1=x+y end if if rt=3 then b1=floor(r) end if if gt=1 then g1=floor(a*256/PI) end if if gt=2 then g1=x+y end if if gt=3 then g1=floor(r) end if if bt=1 then b1=floor(a*256/PI) end if if bt=2 then b1=x+y end if if bt=3 then b1=floor(r) end if c=SDL_MapRGB(format,remainder(r1,256),remainder(g1,256),remainder(b1,256)) if c = -1 then puts(1, "SDL_MapRGB had a hissy fit!\n") end if cs=int_to_bytes(c) for a1=0 to ns-1 do s=ptor(a+(a1*PI)/(ns/2),r) x=s[1]+320 if x<0 then x=0 end if if x>639 then x=639 end if y=s[2]+240 if y<0 then y=0 end if if y>479 then y=479 end if poke(pixels+(x+(y*640))*4,cs) s=ptor((a1*PI)/(ns/2)-a,r) x=s[1]+320 if x<0 then x=0 end if if x>639 then x=639 end if y=s[2]+240 if y<0 then y=0 end if if y>479 then y=479 end if poke(pixels+(x+(y*640))*4,cs) end for -- OK, let's unlock the screen surface SDL_UpdateRect(surface,0,0,0,0) SDL_UnlockSurface(surface) count += 1 if count>10000 then initme() end if end while end procedure ----- Original Message ----- From: "C. K. Lester" <cklester at yahoo.com> To: "EUforum" <EUforum at topica.com> Sent: Monday, January 13, 2003 6:10 PM Subject: Need Win Guru/Tester > > Windows gurus... Please go here and test the available code: > > http://www.cklester.com/euphoric/win32lib_sdl_test.htm > > The program simply attempts to open an SDL resizable window from within a > IDE-generated win32lib program. When I click <Close> the program crashes > with some memory error. RobC, could you please check this as well?! > > Thanks, > ck > > > > TOPICA - Start your own email discussion group. FREE! >