[ Login | Register ]

The Shining Source

« previous next »
Pages: [1] Print
Fix this stupid display for SDL!   (Read 12178 times)
Old Post December 04, 2005, 06:02:55 am
#1
Shining Dude *

Posts: 156

Logged
Fix this stupid display for SDL!
I am having one heck of a time with SDL. I've tried everything that I can think of, but I can't get it to even display a simple image! I'm going to just put the source out here, and hope someone knows what the problem is.
(language is FreeBasic.)

Code:
'$INCLUDE: "SDL/SDL.BI"


'init:def
const SCR_WIDTH = "640"
const SCR_HEIGHT = "480"
dim bitmap AS SDL_Surface ptr
dim video AS SDL_Surface ptr

'init:act
SDL_Init ( SDL_INIT_VIDEO )
video = SDL_SetVideoMode( 640, 480, 32, 0 ) 'sets the video mode to 640x480x32

'Init ended
MenuScreen = SDL_LoadBMP("bitmap.bmp")


SUB BlitImage(x as integer, y as integer, image as sdl_surface ptr)
    DIM Rectangle as SDL_Rect
    DIM Rectangle2 as SDL_Rect
   
    Rectangle.x = 0
    Rectangle.y = 0
    Rectangle.w = image->w
    Rectangle.h = image->h
    Rectangle2.x = x
    Rectangle2.y = y
   
    SDL_BlitSurface image, @Rectangle, ScreenSurface, @Rectangle2
   
   

END SUB

SLEEP 1000

SDL: SDL_Quit ()

ave the Kyantol



Old Post December 04, 2005, 12:08:58 pm
#2
Ty
Administrator
Shining Sideburns *

Posts: 837

Logged
Fix this stupid display for SDL!
I can see a few:

1) BlitImage is never called. You need to call it in your main display loop. If it's never called, nothing will happen.
2) I can't find the main display loop. Related to above. This is the place where the BlitImage functions would be called.

You might want to check out the examples in the examples/SDL folder. In particular, image_test1.bas seems to have what you're looking for. It has a good example of a main display loop, and also shows how to double buffer. It's certainly a much better example than the tutorial you got this code from Wink


Old Post December 04, 2005, 06:17:55 pm
#3
Administrator
Shining Spammer *

Posts: 1,208

Logged
Fix this stupid display for SDL!
Actually, this language looks 00gly :s

Like Basic and stuff :s

Devlyn

Great news for Shining fangame developers! Wink

Correcting your non-working <img> tags since 1982 Wink


Old Post February 27, 2006, 07:50:01 pm
#4
Blahian *

Posts: 22

Logged
Fix this stupid display for SDL!
Kill the bastich

hat you gonna do, brother, when Rockinmania is running wild on you.


Pages: [1] Print 
« previous next »
Jump to:  

Powered by SMF 1.1.21 | SMF © 2013, Simple Machines