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

#841
It would probably compile without errors, but it just wouldn't map to the "DOCUMENTS" folder as you intended, which would be required on the iPad / iPhone.  It would map to your default directory, with the file name "save_config$".
#842
I noticed that you typed:

Code (glbasic) Select
LOADSPRITE"save_config$",1

instead of (no quotes):

Code (glbasic) Select
LOADSPRITE save_config$, 1

Was that just a typo converting to the forum post?
If not, that may be your problem.
#843
I'm not too sure of the details of what you are converting.
But, you don't have to worry about triangles if you already have quad coordinates.
Just create a 'CreateQuad()' routine and pass it the four corners, and add the four vertices of the quad, and it will create a quad for you, consisting of two triangles, but you don't have to worry about creating two triangles as GLBasic will do this for you.

Just make sure you add them in the proper order (ie. top-left, top-right, bottom-left, bottom-right).

Being new to game programming myself, I find GLBasic extremely easy to use, and very intuitive to what I want to achieve.  I've tried other game programming languages, and it doesn't get any easier than GLBasic, for both 2D and 3D.

I'd say give GLBasic a try, and if you have any problems / questions, the GLBasic community if very knowledgeable and willing to help.

Good luck
#844
Right, you actually create two triangles, and there is no way to create a quad directly.

Using the 'X_OBJADDVERTEX' command, you would specify the four corners of the quad (top-left, top-right, bottom-left, bottom-right for example) and it will automatically create two triangles.
Then use 'X_OBJNEWGROUP' to lift your 'pen' to begin your next triangle/quad.
#845
Try breaking your .gbas file into multiple files, each with a specific function / purpose.
Then when recompiling, only the modified .gbas files will recompile, saving time.
#846
How large is large?
My current project is 3300 'commands', and contains 18 .gbas files (10 are my libraries).
It compiles and runs just fine.  (slow sometimes when it has to recompile everything)

Prior to version 8, I had to move my TYPES and CONSTANTS and GLOBALS to my main .gbas file because I had a hard time with my libraries accessing other libraries and constants, and didn't realize GLOBALS were global only to that module.  Plus I was just starting out with GLBasic.  Much has been improved since version 7 in regards to TYPEs, but I have yet to try to move everything back to how I would like it (ie. my TYPES to their corresponding library).
#847
I wonder if the 'Explicit Declarations' checkbox default was changed between versions?
It should default to force explicit declarations in my opinion, saves on potential head-aches!

I remember that day, it felt like the end of the 60's!  (kidding, wasn't born till LATER that year - which I vaguely remember!)

And that date is the '0' date for some systems (what you get when you convert a date value of '0').
Must be a bug somewhere.
#848
For the 2D, are you using only one tile texture file for all tiles?
Then also only using one initial STARTPOLY and one final ENDPOLY, and using POLYNEWSTRIP for each new tile?
This should get your draw calls down to one for the map, about as fast as you can get.
Maybe tighten up your map drawing routine/loop.

Just curious, do textures files of size power-of-two versus not power-of-two make any speed difference?  (ie: 512x512 versus 500x500)

And for the 3D, if you are using X_CULLMODE 0 (for 'both') try using '1' for front, or '-1' for back.
This may save some processing.

Just some random thoughts.

[Edit]
But still doesn't explain why the iPad is slower.
#849
Announcements / Re: V8 beta
2010-Aug-24
Does that mean your normal code keeps running after a GLB_ON_PAUSE is triggered?
(and therefore need to implement GameState logic, like GS_RUNNING = 1, GS_PAUSED = 2, etc to be called in your main loop)
Or does all your code stop until a GLB_ON_RESUME is encountered?
#850
For your font questions, I don't think a scaled font would look good, although I've never tried it.
I would think the best option would be to render each font size to a separate file.
I looked at Moru's font routines, and they would probably be what you are looking for.
You can render them to an area, and it flows properly to the next line, etc.
Search the forum, or here's his website (wasn't working just a second ago tho):
http://gamecorner.110mb.com/

I ended up writing my own using fonts generated from the Bitmap Font Generator here:
http://www.angelcode.com/products/bmfont/
It packs the fonts tightly and creates a text file that describes each character (ie location, size, etc).

Here's some GLB code to read this file:

Code (glbasic) Select
GLOBAL _Fonts[] AS TFont
CONSTANT FILE_MODE_READ = 1

TYPE TFontChar
xy AS TPoint // x,y position of character in font texture
size AS TSize // Size (w,h) of character
offset AS TPoint // x,y offset amount when drawing character
xadvance% // Move this many pixels left to draw next character, don't use character width
ENDTYPE

TYPE TFont
id% // ID of this font definition
sprite_id% // The sprite that holds this font texture
sprite_size  AS TSize // Width / Height of font texture
spacing%
height% // General height of a font character
chars[] AS TFontChar
ENDTYPE

FUNCTION Font_New%: fn$, font_id%, height%, spacing%
CONSTANT PATH$ = "Graphics/Fonts/" // Path to 'Fonts' folder
LOCAL fh% // File Handle
LOCAL font AS TFont // Temporary 'TFont' type
LOCAL ascii% // Ascii value of current character
LOCAL line$ // Current line data from '.fnt' file
DEBUG ">Font_New: " + fn$ + ", id:" + font_id + "\n"
font.id = font_id // Unique id to reference this font for drawing
font.sprite_id = Sprite_Load(PATH$ + fn$ + "_0.png") // Load font texture sprite
font.spacing = spacing // Default spacing between characters
font.height = height                                                                       // If you want a general line height (and not calculated)
Sprite_GetSize(font.sprite_id, font.sprite_size) // Get font texture width, height
DIM font.chars[ASCII_MAX + 1] // Initialize character array

// --------------------------------------------------------------------
// PARSE ".FNT" FILE
// --------------------------------------------------------------------
fh = GENFILE() // Get available file handle
IF OPENFILE(fh, PATH$ + fn$ + ".fnt", FILE_MODE_READ) = FALSE // Open font's '.fnt' file
RETURN FALSE // Exit and return 'FALSE' if can't open
ENDIF

// First 4 lines aren't needed
READLINE fh, line$
READLINE fh, line$
READLINE fh, line$
READLINE fh, line$

// Read and parse character data from file
WHILE ENDOFFILE(fh) = FALSE
READLINE fh, line$ // Read next line of data for the next character
IF LEN(line$) <= 0 THEN BREAK // End of the character data (skip any kerning data)
IF MID$(line$, 0, 4) <> "char" THEN GOTO SKIP // Character data begins with 'char', skip to next line
ascii = MID$(line$,   8, 3) // Ascii value
IF (ascii < 0) OR (ascii > ASCII_MAX) THEN GOTO SKIP // Ascii value is out of range, skip to next line
font.chars[ascii].xy.x = MID$(line$,  15, 4) // [X Position]
font.chars[ascii].xy.y = MID$(line$,  23, 4) // [Y Position]
font.chars[ascii].size.w = MID$(line$,  35, 4) // [Width]
font.chars[ascii].size.h = MID$(line$,  48, 4) // [Height]
font.chars[ascii].offset.x = MID$(line$,  62, 4) // [X Offset]
font.chars[ascii].offset.y = MID$(line$,  76, 4) // [Y Offset]
font.chars[ascii].xadvance = MID$(line$,  91, 4) // [X Advance]
SKIP:
WEND
CLOSEFILE fh // Close '.fnt' file

//Debug_Font(font)

DIMPUSH _Fonts[], font // Add new font definition to global font list
RETURN TRUE // Font added successfully
ENDFUNCTION


It uses other code from my project (ie 'Sprite_Load(), and Sprite_GetSize()) but that's easily worked around.
And it uses two other TYPES TPoint, and TSize, which are just (x, y) and (w, h) but can be recode too.
I could post those functions / types too if you need them.

But then you have to write some routines to actually plot the text, using polyvectors for speed and flexibility (ie. easily change the colors (including gradient effects)).  I guess you could easily change the scale too to stretch the font, but non-pixel perfect fonts may look ugly. 

Oh, and if you want to save draw calls (which I did), buffer your text writing to one routine.  (ie. each 'TextDraw()' call only actually adds your text to a queue, then have a final 'TextDrawAll()' to generate the polys.)
Use only one STARTPOLY / ENDPOLY for ALL your font writing, then use POLYNEWSTRIP to start each new character / string.

Then to reflow your text to predefined areas, just plot each word in the string (space delimited) and calculate the width of the next word, and if the running total has enough room to fit the word, draw it and update the running total, or reset the running total and move to the next line and draw the word.  This is my next routine to write for my project!

Good luck,
#851
Announcements / Re: V8 beta
2010-Aug-19
Yep, the links work fine from home, but I'm using 8.064 (and 8.050 at work because I can't upgrade).
#852
Announcements / Re: V8 beta
2010-Aug-18
I use Firefox (3.6.3).

I'm in Canada, could it be a regional thing (it shouldn't because URLs are universal).
Or other setting?  (ha, but what?  Security?)

Do your URLs come out as: (slashes backwards, with preceding slashes too, without the 'http://')
\\www.glbasic.com\main.php

That may explain my update problem too perhaps, as maybe the update URL is causing a problem.

But I also use Firefox on both my home computers and update works fine.
But, I can't remember checking the 'Web' menu's other links, I'll try tonight when I get home.  (I'm 6 hours behind Germany!)

[Edit]
In case it matters, I use XP at work, and Windows 7 at home.
#853
Announcements / Re: V8 beta
2010-Aug-18
The link in the first post is to version 8.050, but the current beta is 8.064.
I understand that you just download the older version, and run an update from GLBasic and it will find and install the lastest beta.
Except, my computer at work might have a firewall setup (or other security) and GLBasic keeps saying I have the latest version.

Is there a manual / alternative way to install the 8.064 update?  Is it available as a file?
Not a problem as I do my programming from home, would just like the new Extended Type features at work in case I need to do a quick edit to see / test something.

And, am I the only one who gets errors clicking any of the links in the 'Web' menu?
It comes up as this (in Firefox):
http://\\www.glbasic.com\main.php/?site=news&lang=en
The slashes are the wrong ones (plus 2 additional).
No problem, as I know where to go by hand, just wondering.
#854
Weird!
Does it still do that if you use 'LOADANIM' and 'DRAWANIM' specifying the 'page' number as the animation frame?

Is the iPad version of the app in native iPad mode (4x the resolution), or simulated iPhone mode (stretched)?

[Edit]
I see by your iPad image dimensions that it is probably in 320x480 mode.
#855
Do you still get the error if you add spacing around the '+' signs?
Code (glbasic) Select
DEBUG test + " " + test2 + "\n"

Could be a bug in the overloaded '+' operator.

Plus, the line: test2=256, is that allowed? ie. a direct integer to assign an ascii value?  And/or is it out of range? (255 max?)
(Never tried, so I don't know).
Or do you need to assigned it with test2 = CHR$(255).

[Edit]
Is a char type a numerical type, like a byte, or a string type?
If its a string type, do we need to use a '$'?