[RESOLVED] resizable window

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

[RESOLVED] resizable window

Post by dafhi »

anybody have an example of how to do this?

I'm looking for one with a buffer all set up, and an animation loop running

I think I'd prefer SDL, but open to suggestions

== UPDATE: The solution I was hoping for

Code: Select all

''
'' SDL pixel ploting example
''

#include  "SDL\SDL.bi"

Dim Shared As Integer WIN_WID = 320, WIN_HGT = 240

sub doRender( byval video as SDL_Surface ptr )
	dim buffer as uinteger ptr
	dim x as integer, y as integer
	dim c as uinteger
	dim i as integer
	
	SDL_LockSurface( video )
	
	for i = 1 to 1
		x = rnd * (WIN_WID-1)
		y = rnd * (WIN_HGT-1)
		c = (rnd * 256) shl 8 ' 2^24
	
		buffer = video->pixels + y * video->pitch + x * len( integer )
	
		*buffer = c
	next i
    
	SDL_UnlockSurface( video )		
end sub

dim result as unsigned integer
dim video as SDL_Surface ptr
dim event as SDL_Event

result = SDL_Init(SDL_INIT_EVERYTHING)
if result <> 0 then
	end 1
end if

video = SDL_SetVideoMode( WIN_WID, WIN_HGT, 32, SDL_RESIZABLE ) 'or SDL_FULLSCREEN
if video = 0 then 
	SDL_Quit
	end 1
end if

Do	
	if(event.type = SDL_VIDEORESIZE) then
		WIN_wid = event.resize.w
		WIN_hgt = event.resize.h
		video = SDL_SetVideoMode( WIN_WID, WIN_HGT, 32, SDL_RESIZABLE )
	End If
	doRender video
	SDL_Flip video	
	SDL_PumpEvents
loop until( (SDL_PollEvent( @event ) <> 0) and ((event.type = SDL_KEYDOWN) or (event.type = SDL_MOUSEBUTTONDOWN)) )

SDL_Quit
Last edited by dafhi on Sep 15, 2010 16:55, edited 3 times in total.
rolliebollocks
Posts: 2655
Joined: Aug 28, 2008 10:54
Location: new york

Post by rolliebollocks »

This is all fbgfx

http://www.freebasic.net/forum/viewtopic.php?t=16297

You can animate, rotate, scale, alpha blending...
dafhi
Posts: 1640
Joined: Jun 04, 2005 9:51

Post by dafhi »

thanks rollie. I changed the subject to reflect what I really mean. I've seen your work though. Great stuff
Post Reply