blitzbasic

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - onumad

Pages: [1]
1
This code will display a nice color wheel in Windows 7, but shows a nice (but unwanted) Android  white square
Any ideas?

Thank you!

Code: [Select]
GLOBAL  mysprite%=5

main:

RuedaCrear(8,200,200,100,100,RGB(255,255,0))

DRAWSPRITE mysprite, 100,100
SHOWSCREEN
MOUSEWAIT
END



FUNCTION RuedaCrear: Count,x, y, w, h, col%


//INC x, w/2
//INC y, h/2

LOCAL parteengrados# = (360/(Count))

LOCAL phi

CLEARSCREEN 0//RGB(255,100,100)
ALPHAMODE 0
STARTPOLY -1, 0
POLYVECTOR x,y, 0,0,col

FOR phi = 0 TO 360 //STEP 5 // how poly do you want it?
IF phi>0 AND phi<360 AND MOD(phi,parteengrados)=0
col = RGB(RND(255),RND(255),RND(255))
ENDIF
POLYVECTOR x+COS(phi)*w, y-SIN(phi)*h, 0,0,col
NEXT
ENDPOLY

GRABSPRITE mysprite, x-w, y-h, w*2, h*2
//
// SHOWSCREEN
// MOUSEWAIT
// END

ENDFUNCTION

2
First of all, sorry for my bad english.

I have this code (Original from Pure Basic) that create a PieChart.
Code: [Select]
// --------------------------------- //
// Project: PIECHART
// Start: Monday, June 11, 2012
// IDE Version: 10.283


// SETCURRENTDIR("Media") // go to media files

SETSCREEN 400,400, 1

GLOBAL mychart = 0
PieChartMake(9,0,0,200)
CLEARSCREEN 0
DRAWSPRITE mychart,100,100
SHOWSCREEN
MOUSEWAIT

FUNCTION PieChartMake: Parts, x, y, Width

  // Initial values
  LOCAL PI# = ACOS(0)*2

  STATIC Resolution = 100     // Resolution is the part used FOR the pie-chart IN percent, the other part is used FOR the description on the right side
  STATIC Border = 0           // Border (IN pixel) on left AND right side of the pie-chart
  LOCAL AngleStart# = 0    // needed later FOR calculating the circle-parts
  LOCAL AngleEnd# = 0         // defines where the drawing starts: 0 = right, #Pi = left, #Pi/2 = bottom, -#Pi/2 = top
  LOCAL Radius#
  LOCAL parteengrados#
  LOCAL id,px%,py%
  LOCAL Height% = Width
  // Calculate initial chart values
  LOCAL LeftWidth = Width * Resolution / 100
  LOCAL temp1% = (LeftWidth ) / 2
  LOCAL temp2% = (Height) /2
   IF temp1 < temp2
    Radius = temp1
  ELSE
    Radius = temp2
  ENDIF
  LOCAL MX = x + Border + ((LeftWidth-Border) / 2)
  LOCAL MY = y + temp2


  parteengrados = (360/(Parts))

  FOR id=1 TO Parts
    AngleStart = AngleEnd
    AngleEnd = AngleStart + (parteengrados * 2 * PI / 360)

    // Set black AS DEFAULT color FOR all border lines
    //FrontColor(RGB(0,0,0))

    // Draw the lines from inside the circle TO the border
    IF id<Parts
    DRAWLINE MX,MY,COS(AngleStart)*(Radius+1)+MX,SIN(AngleStart)*(Radius+1)+MY, RGB(255,255,0) // note: Radius must be increases by 1 here,
    DRAWLINE MX,MY,COS(AngleEnd)*(Radius+1)+MX,SIN(AngleEnd)*(Radius+1)+MY, RGB(255,255,0) // because otherwise sometimes misses a pixel
    ENDIF



    // Draw the circle
    FOR a = AngleStart * Radius TO AngleEnd * Radius  //Step 2
      px = COS(a / Radius) * Radius + MX
      py = SIN(a / Radius) * Radius + MY
      SETPIXEL px, py, RGB(255,255,0)
    NEXT

    // Calc the coordinates for filling point and finally fill the selected area
    px = COS((AngleEnd + AngleStart) / 2)*(Radius / 2) + MX
    py = SIN((AngleEnd + AngleStart) / 2)*(Radius / 2) + MY
    //FillArea(px,py,0,Stats(id)\Color)
  NEXT

  GRABSPRITE mychart, x, y, Width, Height+5
 
ENDFUNCTION

My question: Are there any fast function to fill each portion of the circle with different colour? (I already searched in forum for 'flood fill', 'fill area', ..., but I can't find anything.

Thank you in advance.

3
I have 2 tiles files (Tiles001.png and Tiles002.png)

Is there  any way to add the tiles of the second image to the variable 'ani_base'?

Code: [Select]
LOADANIM "../tiles/Tiles001.png", ani_base, sizesprites48, sizesprites48
Something as:
Code: [Select]
APPENDANIM "../tiles/Tiles002.png", ani_base, sizesprites48, sizesprites48
Thank you!

Pages: [1]