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!
Thank you very much!
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 MenuGLOBAL 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
FUNCTION z_print: t$,x,y,font=100,centered=1,zoom=1,color=0xFFFFFF,underline=0,italic=0
to FUNCTION z_print: withkerning, t$,x,y,font=100,centered=1,zoom=1,color=0xFFFFFF,underline=0,italic=0
andINC x,LEN(c$,1)*zoom*x_zoom
to IF withkerning
INC x,LEN(c$,1)*zoom*x_zoom
ELSE
INC x, fx*x_zoom
ENDIF
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 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
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
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
Quote from: kanonet on 2012-Jun-11Nice!!! Thank you.
Check this out: http://www.glbasic.com/forum/index.php?topic=4498.msg49701#msg49701
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
// --------------------------------- //
// 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
// --------------------------------- //
// 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 ***
Quote from: Slydog on 2012-Apr-11more than one tile images for the same map (I put tileA.png, tileB, png.... and Tiled creates a diferent tileset per image file)
"more than one tileset images": do you mean more than one tile image, or more than one tileset?...
Quote from: Slydog on 2012-Apr-11well, I'm not sure for now what tiles will use so I loaded 6 diferent files (one per tileset)
I can't think of a situation where you can't create a tileset sprite file containing all of your tiles.
Quote from: Slydog on 2012-Apr-11I don't know, I installed Tiled this monday.
BTW, can Tiled have animated tiles, such as walls? That would be a neat concept I've never considered.
Quote from: Slydog on 2012-Apr-11Yes, I always do it as you said. But I never used Tiled (always Mappy with unique tileset)
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.
LOADANIM "../tiles/Tiles001.png", ani_base, sizesprites48, sizesprites48
APPENDANIM "../tiles/Tiles002.png", ani_base, sizesprites48, sizesprites48