Menu

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.

Show posts Menu

Messages - onumad

#1
I need to make a 'serious' project in a few weeks and want to know if there is any possibility of using GLBasic before going for other options.

Thank you very much!
#2
SOLVED!!! The problems was in GLBASIC Font Creator!.

If I use DingsFont z_print/print functions works ok.

Thank you all for helps!
#3
Ok, not fault of z_print function, I think is a bug of len() function.
This code:
Code (glbasic) Select
GLOBAL myfont
main:
myfont=GENFONT()
LOADFONT "Media/myfont.png", myfont
SETFONT myfont

LOCAL n%, c$, x%
LOCAL t$ = "My little test with PRINT func"
x=10

FOR n = 0 TO LEN(t$) - 1
c$ = MID$(t$, n, 1)
INC x, LEN(c$,1)
PRINT c$, x,200
NEXT

SHOWSCREEN
MOUSEWAIT

END


and the attached result.

[attachment deleted by admin]
#4
Thank you r0ber7. I saw your fix, but it works without kerning.

I made some changes on z_print function. Changes:
Code (glbasic) Select
FUNCTION z_print:  t$,x,y,font=100,centered=1,zoom=1,color=0xFFFFFF,underline=0,italic=0 to
Code (glbasic) Select
FUNCTION z_print: withkerning, t$,x,y,font=100,centered=1,zoom=1,color=0xFFFFFF,underline=0,italic=0and
Code (glbasic) Select
INC x,LEN(c$,1)*zoom*x_zoom to
Code (glbasic) Select
IF withkerning
    INC x,LEN(c$,1)*zoom*x_zoom
ELSE
    INC x, fx*x_zoom
ENDIF


my test:
Code (glbasic) Select
GLOBAL myfont
main:
initZ(1)
SETSCREEN 400,600,0

myfont=GENFONT()
LOADSPRITE "Media/myfont.png", myfont
//LOADFONT "Media/myfont.png", myfont

z_print(1, "My little test with kerning", 150,50,myfont)

z_print(0, "My little test without kerning", 10,150,myfont, 0)

SHOWSCREEN
MOUSEWAIT
END
And attached the output ::)

[attachment deleted by admin]
#5
Thank you for replies, but If I remove the command LOADSPRITE, the text does not appear. If I remove the command LOADFONT, text is more collapsed   :doubt:
#6
I can't get z_print work fine  :help:

Code (glbasic) Select
GLOBAL myfont
main:
initZ(1)
SETSCREEN 400,600,0

myfont=GENFONT()
LOADSPRITE "Media/myfont.png", myfont
LOADFONT "Media/myfont.png", myfont

z_print("My litle test", 150,50,myfont)

SHOWSCREEN
MOUSEWAIT

END


Font file and screen capture attached


[attachment deleted by admin]
#7
 Yes! Now it works fine on Android! Thank you :D
Code (glbasic) Select
GLOBAL  mysprite%=5

main:
RuedaCrear(8,100,100,100,100,RGB(255,255,0))
DRAWSPRITE mysprite, 100,100
SHOWSCREEN
MOUSEWAIT
END

FUNCTION RuedaCrear: Count,x, y, w, h, col%
CREATESCREEN 0, mysprite, (w)*2, (h)*2
USESCREEN 0

//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

USESCREEN -1

ENDFUNCTION
#8
Thank you; I will try ir this night.

Enviado desde mi GT-I9001 usando Tapatalk 2
#9
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 (glbasic) 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
#10
Quote from: kanonet on 2012-Jun-11
Check this out: http://www.glbasic.com/forum/index.php?topic=4498.msg49701#msg49701
Nice!!! Thank you.

I did a fast test and it is ok!
Code (glbasic) Select
DrawOval(100,100,99,99,RGB(255,0,0))
SHOWSCREEN
MOUSEWAIT


FUNCTION DrawOval%: x, y, w, h, col%

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

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

ENDFUNCTION
#11
First of all, sorry for my bad english.

I have this code (Original from Pure Basic) that create a PieChart.
Code (glbasic) 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.
#12
Now, why GLBasic raise this error with the LOADSPRITEMEM example?
Code (glbasic) Select
// --------------------------------- //
// Project: spr2mem2file
// Start: Wednesday, April 11, 2012
// IDE Version: 10.283
// SETCURRENTDIR("Media") // go to media files

LOCAL w%, h%, pix%[]
IF LOADSPRITEMEM("d:/tiles.png", w%, h%, pix%[])
   MEM2SPRITE(0, w%, h%, pix%[])
   DRAWSPRITE 0,0,0
ENDIF
SHOWSCREEN
MOUSEWAIT


Quote*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.9.829 SN:349f8813 - 3D, NET
Wordcount:8 commands
compiling:
C:\Users\ZIKIAD~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\ZIKIAD~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp:60: error: invalid initialization of non-const reference of type '__GLBASIC__::DGNatArray&' from a temporary of type 'int'
D:/program/GLBasic/Compiler/platform/Include/glb.h:1339: error: in passing argument 1 of `DGNat __GLBASIC__::MEM2SPRITE(__GLBASIC__::DGNatArray&, DGNat, DGNat, DGNat)'
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.1 sec. Time: 23:17
Build: 0 succeeded.
*** 1 FAILED ***

[attachment deleted by admin]
#13
First of all, sorry for my bad english :-[
Quote from: Slydog on 2012-Apr-11
"more than one tileset images": do you mean more than one tile image, or more than one tileset?...
more than one tile images for the same map (I put tileA.png, tileB, png.... and Tiled creates a diferent tileset per image file)

Quote from: Slydog on 2012-Apr-11
I can't think of a situation where you can't create a tileset sprite file containing all of your tiles.
well, I'm not sure for now what tiles will use so I loaded 6 diferent files (one per tileset)
Quote from: Slydog on 2012-Apr-11
BTW, can Tiled have animated tiles, such as walls?  That would be a neat concept I've never considered.
I don't know, I installed Tiled this monday.
Quote from: Slydog on 2012-Apr-11
If your level has static tiles, and only your characters / items need animation, you could separate your sprites into two or more files, one for the level tiles, and one for your character/item animations.
Yes, I always do it as you said. But I never used Tiled (always Mappy with unique tileset)
#14
Yes Bdr, I'm using Tiled map editor with more than one tileset images

Kitty, yes, I'll play with Sprite2men. I did not want to reinvent the wheel
#15
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 (glbasic) Select
LOADANIM "../tiles/Tiles001.png", ani_base, sizesprites48, sizesprites48

Something as:
Code (glbasic) Select
APPENDANIM "../tiles/Tiles002.png", ani_base, sizesprites48, sizesprites48

Thank you!