Author Topic: Fancy-Dress  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Fancy-Dress
« on: December 20, 2013, 04:11:50 PM »
 :D  :D  :D
« Last Edit: January 10, 2014, 11:10:20 AM by peter »

JRS

  • Guest
Re: Fancy-Dress
« Reply #1 on: December 20, 2013, 07:00:28 PM »
Peter,

I think our Ellipse functions are different. I'm getting a segmentation fault passing your parameters.

I attached a screen shot of your O2 example that you forgot.

Quote
void Draw_Ellipse(SDL_Surface *super,
                  Sint16 x0, Sint16 y0,
                  Uint16 Xradius, Uint16 Yradius,
                  Uint32 color);

  Draw a ellipse with center in x0,y0. Xradius is the major axis and Yradius is
  the minor axis.

Code: [Select]
' ScriptBasic Ellipse

DECLARE SUB Window ALIAS "SB_Window" LIB "sdl"
DECLARE SUB WaitKey ALIAS "SB_WaitKey" LIB "sdl"
DECLARE SUB UpdateRect ALIAS "SB_UpdateRect" LIB "sdl"
DECLARE SUB RGB ALIAS "SB_RGB" LIB "sdl"
DECLARE SUB CLS ALIAS "SB_CLS" LIB "sdl"
DECLARE SUB Draw_Ellipse ALIAS "SB_Draw_Ellipse" LIB "sdl"

Window 800, 600, "ScriptBasic Ellipse"
width = 400
height= 300
CLS(RGB(255, 255, 255))
black = RGB(0, 0, 0)
FOR i = 0 to 260 step 10
  IF i % 20 = 0 THEN
    Draw_Ellipse width, height, -i, -i, black
    Draw_Ellipse width, height,  i,  i, black
  ELSE
    Draw_Ellipse width + i, height, -i, -i, black
    Draw_Ellipse width -i, height, i, i, black
  END IF
NEXT  
UpdateRect
WaitKey
                 

.
« Last Edit: December 20, 2013, 07:17:01 PM by John »

JRS

  • Guest
Re: Fancy-Dress
« Reply #2 on: December 20, 2013, 09:46:21 PM »
I went with Mike's (FBSL) direction and used Draw_Circle() instead. I would still like to get the Draw_Ellipse() function to work if possible.



Code: [Select]
' ScriptBasic Circle

DECLARE SUB Window ALIAS "SB_Window" LIB "sdl"
DECLARE SUB WaitKey ALIAS "SB_WaitKey" LIB "sdl"
DECLARE SUB UpdateRect ALIAS "SB_UpdateRect" LIB "sdl"
DECLARE SUB RGB ALIAS "SB_RGB" LIB "sdl"
DECLARE SUB CLS ALIAS "SB_CLS" LIB "sdl"
DECLARE SUB Draw_Circle ALIAS "SB_Draw_Circle" LIB "sdl"

Window 800, 600, "ScriptBasic Circle"
w = 400
h = 300
CLS(RGB(255, 255, 255))
black = RGB(0, 0, 0)
FOR i = 0 TO 130 STEP 10
  Draw_Circle w - i, h + i, i, black
  Draw_Circle w + i, h - i, i, black
  Draw_Circle w + i, h + i, i, black
  Draw_Circle w - i, h - i, i, black
NEXT
UpdateRect
WaitKey

« Last Edit: December 20, 2013, 10:55:58 PM by John »