|
Post by Nicky Peter Hollyoake on Apr 6, 2008 12:08:09 GMT -5
All commands can go out the current dictionary, or just make them stay in.
CreateFolder!
EXAMPLE:
CreateFolder("MyFolder")
Put that in B4GL without saving the program anywhere else it should go in the "Program" folder of B4GL and make a folder called "MyFolder".
Next command ...
Rename! - You can rename folders and files!
To rename a folder.
Rename("MyFolder", "NewName")
and file ...
Rename("WriteFileDemo.GB", "LearnHowToWriteToAFile.GB")
last one,
Delete!
Ok, theres a problem in this one because we can only do files, hopefully I can get it setup to folders soon.
Delete("WriteFileDemo.GB")
There you have it.
Theres no return errors, but I could put them if anyone would want that. But you could always just mak a filecheck in B4GL ...
if not findfirstfile(file) <> "" then '... endif
thanks,
Nicky
|
|
|
Post by Nicky Peter Hollyoake on Apr 6, 2008 12:21:23 GMT -5
Oops forgot to put the link! Plugin
|
|
|
Post by DJLinux on Apr 6, 2008 13:07:50 GMT -5
Good job this are in curent ToolBox Plugin Joshy ' test for: ' ExePath() ' CurentPath() ' ChangePath() ' CreatePath() ' DeletePath() printr "Exe Path:" + ExePath() printr "Current Path:" + CurentPath() CreatePath("c:\test01") ChangePath("c:\test01") printr "Current Path:" + CurentPath() DeletePath("c:\test01") ChangePath(ExePath()) printr "Current Path:" + CurentPath()
|
|
|
Post by Nicky Peter Hollyoake on Apr 6, 2008 13:53:28 GMT -5
Good job this are in curent ToolBox Plugin ... Thanks! Is it possible (I should really write it in the toolbox thread you made) to make it so you can use windows text? Instead of the graphical text. If you know what I mean. Nicky
|
|
|
Post by DJLinux on Apr 6, 2008 14:11:42 GMT -5
This will be implemented if i put support for Multiply Windows in the ToolBox Plugin. (The GDI Flag of the PixelFormat descriptor must be set to enable GDI gfx and text/font commands)
Joshy
|
|
|
Post by DJLinux on Apr 6, 2008 14:17:48 GMT -5
|
|
|
Post by Nicky Peter Hollyoake on Apr 6, 2008 21:44:24 GMT -5
Thanks! i'll be sure to look at that.
By the way, I forgot to mention the "Rename" if you do this ...
Rename("AsteroidDemo2.GB", "C:\AsteroidDemo2.GB")
It will move your files and rename them!
Then reverse it to take it back ...
Rename("C:\AsteroidDemo2.GB", "AsteroidDemo2.GB")
Thanks,
Nicky
|
|
|
Post by Empyrion Martyr on Apr 7, 2008 13:34:13 GMT -5
nicky there is a way to write text other than the classic way. It allows to write opengl text in anyplace on screen (you give coordinates in pixels, so you can for eg. write a text at 123,417) Its inside one of the nehe lessons.. anywayz i edited it and transformed it into an "include library". here are the links of the 2 files basic4gl.wikispaces.com/space/showimage/opengl_font_v10.incbasic4gl.wikispaces.com/space/showimage/glfont.png1st is the include library, second is the charset which you can replace with whatever charset you may wish. it's still using the gosub stuff (i adapted it a while back for some of my projects.. i think it's Tom's code btw) fx = VALUE: fy = VALUE: ' these two set the position of your text string$ = "your string goes here" gosub glPrint: ' will print your text at the desired position if you're using with 3d, make sure you encompass the above within calls to glEnable(GL_BLEND) glDisable(GL_BLEND) to allow the letters to blend in with your background. nice text shadows can be created by calling glPrint twice with an offset of 1 or 2 pixels and setting different colors with color(x,y,z) or glcolor3f...
|
|
|
Post by DJLinux on Apr 7, 2008 16:12:06 GMT -5
 I added FontCreate(), FontTrans(), FontScale(), FontRotate() font8demo.zipJoshy type FONT_TYPE dim Texture,List,w,h,Trans dim Size#,Rotation end type
Function FONT_TYPE CreateFont(File$,w,h,n) dim NewFont as FONT_TYPE dim i,w# NewFont.Texture = glGenTexture() NewFont.List = glGenLists(n) NewFont.Texture = LoadTexture(File$) NewFont.W = w NewFont.H = h NewFont.Size# = 1 NewFont.Rotation = 0 NewFont.Trans = True w#=1.0/(n*1.0) for i=0 to n-1 glNewList(NewFont.List+i,GL_COMPILE) glBegin(GL_QUADS) glTexCoord2f(i*w# ,0):glVertex2i(0 ,0) glTexCoord2f(i*w# ,1):glVertex2i(0 ,h) glTexCoord2f(i*w#+w#,1):glVertex2i(w,h) glTexCoord2f(i*w#+w#,0):glVertex2i(w,0) glEnd() glTranslated(w,0,0) glEndList() next return NewFont End Function
sub FontTrans(&f as FONT_TYPE,OnOff) f.Trans=(OnOff<>0) end sub
sub FontRotate(&f as FONT_TYPE,degree) while degree>359:degree=degree-360:wend while degree< 0:degree=degree+360:wend f.Rotation=degree end sub
sub FontScale(&f as FONT_TYPE,Size#) if Size#<0.01 then Size#=0.01:end if if Size#>10.0 then Size#=10.0:end if f.Size#=Size# end sub
Sub To2D() glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() glOrtho(0,WindowWidth(),0,WindowHeight(),-1,1) glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() End Sub
Sub To3D() glMatrixMode(GL_PROJECTION) glPopMatrix() glMatrixMode(GL_MODELVIEW) glPopMatrix() End Sub
Sub PrintXY(x#,y#,Text$,f as FONT_TYPE) dim Char,nChars nChars=Len(Text$) if nChars=0 then return:end if ' set render mode To2D() glDisable(GL_DEPTH_TEST) glBindTexture(GL_TEXTURE_2D,f.Texture) glEnable(GL_TEXTURE_2D)
if f.Trans=True then glBlendFunc(GL_SRC_ALPHA,GL_ONE) glEnable(GL_BLEND) else glDisable(GL_BLEND) end if glTranslatef(x#,(WindowHeight()-f.h)-y#,0) if f.Rotation then glRotatef(f.Rotation,0,0,-1) end if if f.Size#<>1.0 then glScalef(f.Size#,f.Size#,0) end if for Char=1 to nChars glCallList(f.List+Asc(Mid$(Text$,Char,1))) next ' reset render mode To3D() if f.Trans=True then glDisable(GL_BLEND) end if glEnable(GL_DEPTH_TEST) glDisable(GL_TEXTURE_2D) end sub
' ' main ' dim i dim Font8 as FONT_TYPE
Font8=CreateFont("font8x8.bmp",8,8,256)
PrintXY(0,0,"Test",Font8)
FontTrans(Font8,False) for i=0 to 270 step 30 FontRotate(Font8,i) PrintXY(100,100," degree " + i,Font8) next
FontRotate(Font8,0) FontTrans(Font8,True)
FontScale(Font8,2) PrintXY(0,220,"Size: 2",Font8)
FontScale(Font8,1) PrintXY(0,240,"Size: 1",Font8)
SwapBuffers()
|
|
|
Post by DJLinux on Apr 14, 2008 14:23:42 GMT -5
why are the textures dimension are wrong if you scale it?
i mean Size: 2 in "font8.gb"
Joshy
|
|
|
Post by El_Dorado on May 24, 2008 5:57:46 GMT -5
Downloading this plugin. Definately using it in something
|
|