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.


Messages - Slydog

Pages: 1 2 [3] 4 5 ... 62
31
GLBasic - en / Re: Questions about GLBasic
« on: 2016-Aug-09 »
Gernot has still been active in these forums, but I'm not sure of his intentions with GLBasic.  Development seems to have slowed down as of lately. It's a big job maintaining a language that has grown this large by himself, while adding new platforms, and keeping the platforms up-to-date.  He has had a lot of help from members of this community, but even so, it's probably getting hard to maintain.  And it's not like he's making money doing this, maybe enough to cover the server costs (I have no idea really).

Physics Engine: There is no built in physics engine.  People have ported Box2D to GLBasic, but I haven't tried it, or know its current status.  And for 3D, some people were dabbling with iXors(sp?), but I don't think that made it too far.

Particle System: There is no built in particle system. Some people have implemented their own 3D systems in these forums.  They look quite capable in my opinion.  Do a search and you should find something. Not sure about 2D.

32
GLBasic - en / Re: GLBasic line continuation?
« on: 2016-Jul-15 »
Quote
One version of BASIC uses the underscore character, "_"

Come on, you can say it - it's VB6!  =D

Ha, I loved that language, despite its reputation.
Actually have it open at work right now fixing a bug in an older project of mine!

33
GLBasic - en / Re: BUSY function
« on: 2016-Jul-15 »
Not much details in the manual:
http://www.glbasic.com/xmlhelp.php?lang=en&id=419&action=view

Just:
Skips the next call of HIBERNATE.

34
GLBasic - en / Re: setting up large arrays
« on: 2016-Jul-08 »
Gary, to check if the file exists in your current directory, use (copied from the GLBasic User Manual):

Code: (glbasic) [Select]
ok=DOESFILEEXIST("test.txt")
IF ok
 PRINT "Test.txt exists", 100, 100
ELSE
 PRINT "Test.txt does not exist", 100, 100
ENDIF

You may not be reading from the directory you think you are.
Try specifying an absolute path for testing.
Or use the GETCURRENTDIR$() to see which one you're in.

35
Announcements / Re: new retro breakout
« on: 2016-Jun-08 »
Re: Easing Library
I found this post where I added most of my tween / easing library:
http://www.glbasic.com/forum/index.php?topic=5643.msg44318#msg44318

It at least has all the easing functions ready to use at a low level.
Just add your own wrapper if you want, or use it directly.

To using it directly:
Code: (glbasic) [Select]
Tween_Get(TWEEN_TRANSITION_BOUNCE, startValue, endValue, elapsedTime / duration)

36
GLBasic - en / Re: INTEGER64
« on: 2016-Mar-01 »
I need to use it for keeping track of how much money I've made programming games!   :P

37
GLBasic - de / Re: GETTIMER/GETTIMERALL
« on: 2016-Feb-23 »
I found this library code I used for my timing:

Code: (glbasic) [Select]
// Countdown Timer
// Pass this function an integer that holds the current timer value.
// Timer variable is updated byref
// Returns TRUE if the timer is still running
// Returns FALSE if the timer has expired
// EXAMPLE:
//   LOCAL wait% = 1000
//   LOCAL delay% = 2000
//   IF Timer_Down(wait) = FALSE
//     . . . 'wait' timer has expired
//     wait = 1000    // reset timer
//   ENDIF
//   IF Timer_Down(delay) = FALSE
//     . . . 'delay' timer has expired
//     delay = 1000   // reset timer
//   ENDIF
FUNCTION Timer_Down%: BYREF time%
DEC time, GETTIMER()
IF time <= 0
time = 0
RETURN FALSE
ELSE
RETURN TRUE
ENDIF
ENDFUNCTION

Or this one may be more useful for your needs:
It auto resets the timer for you also.
Code: (glbasic) [Select]
// Same as 'Timer_Down()' except you pass the 'timer_length' as it automatically resets the timer when expired
// EXAMPLE:
//   LOCAL wait% = 1000
//   LOCAL delay% = 2000
//   IF Timer_Down(wait, 1000) = FALSE
//     . . . 'wait' timer has expired
//   ENDIF
//   IF Timer_Down(delay, 2000) = FALSE
//     . . . 'delay' timer has expired
//   ENDIF
FUNCTION Timer_Repeat%: BYREF time%, timer_length%
DEC time, GETTIMER()
IF time <= 0
time = timer_length // Reset timer
//time = timer_length-time // Reset timer  (Optional to above to prevent timer drifting)
RETURN TRUE // Timer has ended
ELSE
RETURN FALSE // Timer still executing
ENDIF
ENDFUNCTION

38
Bug Reports / Re: IF/THEN problem with "\"
« on: 2015-Dec-02 »
Strange problem.
Is it interpreting the escape characters \" before (or after) the \\ is interpreted?

You could change it to:
Code: (glbasic) [Select]
IF a$=CHR$(92) THEN DEBUG "Hello"

39
GLBasic - en / Re: Strange numbers returning
« on: 2015-Nov-26 »
I'm not too clear what you are saying.
The number is always a correct, valid number, even though sometimes it displays in scientific notation (without formatting).
You only need to use the FORMAT command when you want to display the value, not when storing it into the array.



40
GLBasic - en / Re: Strange numbers returning
« on: 2015-Nov-26 »
Have you tried formatting the number?  Such as (4 characters wide, 2 decimals):
Code: (glbasic) [Select]
DEBUG "\n" + FORMAT$(4, 2, alpha#)

41
One thing you may look out for is the various aspect ratios on different devices.
Wider screens may reveal too much of the level, if that is unwanted.
You may just want to black out the edges to reflect your minimum aspect ratio.
Can't wait to actually play this!

42
To compile for iOS, you could try MacInCloud:
http://www.macincloud.com/

They rent you an online virtual Mac (to compile your xCode project, for example).
It costs $1 per hour, but you need to buy at least $30 prepaid credit.
I have never tried it, but may be more viable than buying a Mac.

43
GLBasic - en / Re: how to convert 4 bytes to
« on: 2015-Oct-28 »
If you're not reading this from a file, can you use an INLINE C++ Union? (Map the four bytes to a float).
I haven't programmed in C++ in 10+ years, no idea if this is an option, or even what you're looking for.

44
GLBasic - en / Re: ?Topic on Save?
« on: 2015-Oct-01 »
I think what you want is to just save the player's progress through your game.
If the player just finished Level 6, you want to save that progress info to a file.
Then the next time the player plays the game, you start him / her from that level.

For that, just save the highest level the player reached to a file.
Each time he finished a new level, update the save file.
When the game starts, read that progress file to know which level to start the player.

You need to know how to read and write to a file for this.
Choose a file name such as "player_level.txt" or something meaningful.

If you want to see some file reading and writing code, take a look at my FILE library (below the following example).
To use it for your problem, try something like:

[EDIT] This doesn't allow for skipping levels, and knowing which levels where done, and which were skipped.

Code: (glbasic) [Select]
LOCAL playerLevel AS TFile
LOCAL levelAchieved% = 0
playerLevel.name$ = "player_level.txt"

// Read Player Level Progress
FUNCTION PlayerLevelRead:
IF playerLevel.Get()
levelAchieved = playerLevel.data$ // Converts data$ string into a number
ELSE
levelAchieved = 0
LOG("*** Error Getting PlayerLevel! ***")
ENDIF
ENDFUNCTION

// Write Player Level Progress
FUNCTION PlayerLevelWrite:
playerLevel.data$ = levelAchieved
playerLevel.Write()
ENDFUNCTION

// To read the player's progress (such as at the start of the game):
// ('levelAchieved' will now be which level to start with.)
PlayerLevelRead()

// To write new player's progress (such as when he finished a new level):
// (make sure 'levelAchieved' already has the new level number)
PlayerLevelWrite()


My TFile Library code:

Code: (glbasic) [Select]
//---------------------------------------------------------------------- F i l e
CONSTANT FILE_MODE_APPEND = -1
CONSTANT FILE_MODE_WRITE = 0
CONSTANT FILE_MODE_READ = 1

CONSTANT EOF$ = "<EOF>"

TYPE TFile
fh% // File Handle
name$ // File Name
data$ // File Contents
eof% // File is at end?

// Reads entire file into 'self.data$'.  Closes file when finished.
// 'name$' > Optional.  Will use previously set 'self.name$' if blank.
// Returns > [TRUE if succeed | FALSE if fail]
FUNCTION Get%: name$=""
IF name$ <> "" THEN self.name$ = name$
self.data$ = ""
LOCAL line$ = ""
IF self.Open(FILE_MODE_READ)
WHILE ENDOFFILE(self.fh) = FALSE
READLINE self.fh, line$
INC self.data$, line$
WEND
CLOSEFILE self.fh
ELSE
LOG(">FIL:{TFile.Get$      } *** Error Getting File: [" + self.name$ + "] ***")
RETURN FALSE
ENDIF
self.Close()
RETURN TRUE
ENDFUNCTION

// Reads the next line in an already opened file.  Closes file when end is reached.
// Returns > [line data if succeed | 'EOF$' if fail]
FUNCTION GetLine$:
LOCAL line$
IF ENDOFFILE(self.fh)
line$ = EOF$
self.eof = TRUE
self.Close()
ELSE
self.eof = FALSE
READLINE self.fh, line$
ENDIF
RETURN line$
ENDFUNCTION

// Writes 'self.data$' to file
// 'name$' > Optional.  Will use previously set 'self.name$' if blank.
// Returns > [TRUE if succeed | FALSE if fail]
FUNCTION Write%: name$=""
IF name$ <> "" THEN self.name$ = name$
IF self.Open(FILE_MODE_WRITE)
WRITESTR self.fh, self.data$
ELSE
LOG(">FIL:{TFile.Write$    } *** Error Writting File: [" + self.name$ + "] ***")
RETURN FALSE
ENDIF
self.Close()
RETURN TRUE
ENDFUNCTION

// Appends string to end of file.
// 'extra$'> Data to append
// 'name$' > Optional.  Will use previously set 'self.name$' if blank.
// Returns > [TRUE if succeed | FALSE if fail]
FUNCTION Append%: extra$, name$=""
IF name$ <> "" THEN self.name$ = name$
IF self.Open(FILE_MODE_APPEND)
INC self.data$, extra$
WRITESTR self.fh, extra$
ELSE
LOG(">FIL:{TFile.Append$   } *** Error Appending File: [" + extra$ + "] ***")
RETURN FALSE
ENDIF
self.Close()
RETURN TRUE
ENDFUNCTION

// Opens file for procesing.
// 'mode%' > [FILE_MODE_APPEND | FILE_MODE_WRITE | FILE_MODE_READ]
// 'name$' > Optional.  Will use previously set 'self.name$' if blank.
// Returns > [TRUE if succeed | FALSE if fail]
FUNCTION Open%: mode%, name$=""
IF name$ <> "" THEN self.name$ = name$
self.fh = GENFILE()
self.eof = FALSE
IF OPENFILE(self.fh, self.name$, mode) = FALSE
LOG(">FIL:{TFile.Open      } *** Error Opening File: [" + self.name$ + "] ***")
self.eof = TRUE
RETURN FALSE
ENDIF
RETURN TRUE
ENDFUNCTION

// Closes file to further processing
FUNCTION Close%:
IF self.fh >= 0 THEN CLOSEFILE self.fh
self.fh = -1
self.eof = TRUE
ENDFUNCTION

// Checks if file exists
// Returns > [TRUE if exists | FALSE if doesn't]
FUNCTION Exists%:
RETURN DOESFILEEXIST(self.name$)
ENDFUNCTION

// Returns file name portion from a longer file path
// eg. For a 'self.name$' of [C:/Programs/GLBasic/glbasic.exe] will return [glbasic.exe]
// 'slash$' > Optional.  Folder Seperator.  Use if your path uses '\' instead. Uses '/' as default
FUNCTION GetName$: slash$="/"
LOCAL slash%
slash = REVINSTR(self.name$, slash$)
IF slash <=0 THEN RETURN self.name$
RETURN MID$(self.name$, slash+1)
ENDFUNCTION

ENDTYPE


FUNCTION LOG: message$, add_linefeed% = TRUE, show_time% = TRUE
STATIC datetime% = -1 // Log timer
LOCAL elapsed# // How much time has elapsed since program start (or manual reset)
IF datetime < 0 THEN datetime = GETTIMERALL() // Initialize log timer if not already set
IF message$ = "RESET" THEN datetime = GETTIMERALL() // Manually reset log timer
elapsed = (GETTIMERALL() - datetime) / 1000.0
?IFDEF WIN32
//?IFDEF GLB_DEBUG
//?ENDIF
IF show_time = TRUE THEN DEBUG "[" + FORMAT$(8, 3, elapsed) + "] "
DEBUG message$
IF add_linefeed THEN DEBUG "\n"
?ELSE
INLINE
STDOUT(message_Str);
ENDINLINE
?ENDIF
ENDFUNCTION

45
GLBasic - en / Re: PROTOTYPEs, Grrr!
« on: 2015-Sep-15 »
Here's where I used PROTOTYPEs for my Gui - buttons specifically:

Code: (glbasic) [Select]
@PROTOTYPE PGui_Button_Click: id%

TYPE TGui_Button
xy[] AS TXyXy
fn_click AS PGui_Button_Click

@FUNCTION Set%: caption$, x%, y%, w%, fn_click AS PGui_Button_Click
// Removed other code for readability
self.fn_click = fn_click
ENDFUNCTION
ENDTYPE

This appears close to what your code is doing - I'm setting the prototype inside my TYPE.
One difference is I don't use an array (ha, don't think this is the problem), and the function that is passed is external to the TYPE.  You may have to have a separate TYPE for setting up your Eases, and one TYPE for implementing the Ease?  Just a thought.

[Edit] Not sure what the '@' symbols are for, been a long time.  It may just be to hide something from the navigation / jump panel to the right in the IDE.

Pages: 1 2 [3] 4 5 ... 62