Documentation ¶
Overview ¶
Provides the Game Jolt API support as object gj
Index ¶
- func DefaultError()
- func FetchScore(gameid, limit, table_id, privatekey string) map[string]string
- func RegError(verf *Erf)
- func SubmitGuestScore(guestname, gameid, privatekey, score, sort, table_id string) bool
- type Erf
- type GJUser
- func (me *GJUser) AwardTrophy(id string) bool
- func (me *GJUser) CloseSession()
- func (me *GJUser) FetchScore(limit, table_id string) map[string]string
- func (me *GJUser) OpenSession()
- func (me *GJUser) Ping()
- func (me *GJUser) StartSession()
- func (me *GJUser) SubmitScore(score, sort, table_id string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchScore ¶
Fetches scores in general Note: The first score will just come with the fieldnames alone, and all next ones will have a number suffixed to it 1, 2, 3, etc...
func RegError ¶
func RegError(verf *Erf)
By default the GJ API will just print the error onto the output with a simple fmt.Print kind of command. However if you have a full graphic game or GUI based application, you may not want to go down that road. Here you can register an alternate function to throw the error to the user. Please note, the API will NOT crash anything. It will only display the error and then resume the program like nothing happened.
func SubmitGuestScore ¶
Submit score as a guest
Types ¶
type Erf ¶
type Erf struct { // This field must contain the function in question EFUN func(reportedby, errmessage string) }
Used to store the registered error function
type GJUser ¶
type GJUser struct { // contains 'true' if succesfully logged in. LoggedIn bool // contains filtered or unexported fields }
This type is used to log in a user, and also contains the methods to send all the data a user can send or receive from Game Jolt through this API.
func (*GJUser) AwardTrophy ¶
Awards a trophy and returns "true" if succesful!
func (*GJUser) CloseSession ¶
func (me *GJUser) CloseSession()
func (*GJUser) FetchScore ¶
Fetches the score for a user Only use this if you want to fetch the scores for that specific user! Note: The first score will just come with the fieldnames alone, and all next ones will have a number suffixed to it 1, 2, 3, etc...
func (*GJUser) OpenSession ¶
func (me *GJUser) OpenSession()
Opens a game session for a particular user. Allows you to tell Game Jolt that a user is playing your game. You must ping the session to keep it active and you must close it when you're done with it. Note that you can only have one open session at a time. If you try to open a new session while one is running, the system will close out your current one before opening a new one.
func (*GJUser) Ping ¶
func (me *GJUser) Ping()
Pings to the GJ server It is adviced to do this every 30 seconds Please note that it might be possible this is brought under a "go" sequence in future versions, and by that time this will be an empty function to prevent errors. This is however not a promise ;)
func (*GJUser) SubmitScore ¶
Submits a score as a user. If you give up an empty string for table_id, Game Jolt will use the "primary" table. The only reason why you MUST at least put in something even if it's an empty string is because Go does not support optional parameters, and the dev crew also showed no interest to implement the feature (for reasons that are downright stupid if you ask me).