Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Feedback --- FB.11 and GFX
#11
ok here a simple pure sdl example for you ray.

Code:
option explicit

'$include: "sdl\sdl.bi"

declare sub plot (surfacetemp as sdl_surface ptr,byval x as integer ,byval y as integer,byval R as UBYTE ,byval G as UBYTE,byval B as UBYTE)
Dim result as unsigned integer


result = SDL_Init(SDL_INIT_EVERYTHING)
    if result <> 0 then
          SDL_Quit
       end 1
   end if
  
dim surface1 as sdl_surface ptr
dim x as integer
dim y as integer

dim R as ubyte
dim G as ubyte
dim B as ubyte

surface1 = SDL_SetVideoMode(1280, 1024, 32,SDL_HWSURFACE or SDL_DOUBLEBUF or sdl_fullscreen)

SDL_LockSurface (surface1)
for x = 1 to 1280
   for y = 1 to 1024
      R = X+Y : R = R mod 200
      G = Y-r : G = G mod 200
      B = X+G   : B = B mod 200
    plot surface1,x,y,R,G,B
   next
  next
sdl_Unlocksurface (surface1)


sdl_flip surface1
sleep 1000
sdl_quit
end

sub plot (surfacetemp as sdl_surface ptr,byval x as integer ,byval y as integer, byval R as UBYTE ,byval G as UBYTE,byval B as UBYTE)
dim colkey as uinteger
  colkey = SDL_MapRGB (surfacetemp->format, R, G, B)
  
      dim cl_32bit as uinteger ptr
      cl_32bit = surfacetemp->pixels + y * surfacetemp->pitch + x * len( integer )
      *cl_32bit = colkey
end sub
Reply
#12
Quote:RTFM applies perfectly here. It's at docs/gfxlib.txt, if you can't find it, here is the SCREEN description:

Code:
+--------+--------------------------------------------------------------------
| SCREEN |
+--------+

Statement to set current gfx mode.


Syntax:
    SCREEN mode[,[depth][,[num_pages][,fullscreen]]]


Argument:    Description:

mode        Gfx mode number, see below.

depth        Color depth in bits per pixel. If you omit this argument, the
        default depth for given mode is set.

num_pages    Number of pages, see below. Default if omitted is 1.

fullscreen    Set this argument to 0 to request a windowed mode, 1 to
        request a fullscreen mode. Default if omitted is 0.

If you can't understand simple instructions like Angelo wrote in gfxlib.txt, forget about programming, open up MS-Paint and your problems are over.

And you need to go back to grade 1 and learn to read -- I was talking about sdl not GFX.
Reply
#13
Ray, maybe v3cz0r was answering one of the questions where you really were talking about GFX, like this one:
Quote:Fb 0.11 will still not open a full window with
'$inlude: "sdl\sdl.bi"
screen 1024, 768,8,1
it does in Fb 0.1
If I am missing some code to correct this them I'm listening
Ray.
That looks like a GFX question to me, not an SDL question. "screen" is a GFX command, not an SDL function.

v3cz0r's post shows you the reason why screen isn't opening a full window. It's because the syntax for the screen command changed from 0.10 to 0.11.

No need to be rude or insulting, ok?
Reply
#14
Quote:You only flip once you've drawn all the gfx for that frame.

Flipping after only a single dot is being drawn is extremely wasteful, and will result in your program being slower than it would normally be.

Also, if you use SDL_Flip, make sure to implement a delay, or only flip a certain amount of times per second. Ptherwise your program will suck up 100% CPU, and will slowdown to a crawl.
Use SDL_GetTicks, to get a very highresolution timer (much better than TIMER)
I use SDL_GetTicks, and only flip once every 25th tick (millisecond which gives a nice smooth 40FPS


To get keypresses in SDL:
Code:
dim shared key as ubyte ptr
key = SDL_GetKeystate(0)
Do
SDL_PumpEvents 'enables the user to press keys, and move the window etc.
'Always pump events, especially if you want mouse or keyboard to work properly


If Peek(key + SDLK_ESCAPE) Then
  'Escape was pressed
   Exit Do
End If
Loop

Then I just decided to ignore this topic. Be more specific please rayjohn01
Reply
#15
Rayjohn: Have some fucking decency (GODDAMN FUCKING CENSORSHIP). These people are helping you FOR FREE and have written AMAZING software FOR FREE.

READ THE FUCKING MANUAL

I suggest no one reply to him in any thread similar to this. Just stop talking to him and maybe he will stop being a complete and utter jackass.
·~¹'°¨°'¹i|¡~æthérFòx~¡|i¹'°¨°'¹~·-
avinash.vora - http://www.avinashv.net
Reply
#16
:???: Man, I gotta stop pulling all-nighters...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)