Oolite
Loading...
Searching...
No Matches
OOJSPlayer.h
Go to the documentation of this file.
1/*
2
3OOJSPlayer.h (QuickJS-ng)
4
5JavaScript proxy for the player.
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#pragma once
28
29#import "PlayerEntity.h"
30#import <Foundation/Foundation.h>
31#include <quickjs.h>
32
33@class PlayerEntity;
34
35void InitOOJSPlayer(JSContext* context, JSValueConst global);
36
37JSClassID JSPlayerClassID(void);
38
39/* The global player object. The returned value is owned by the caller, who
40 must JS_FreeValue() it. (SpiderMonkey's JSPlayerPrototype() is no
41 longer needed; use JS_GetClassProto(context, JSPlayerClassID()).)
42*/
43JSValue JSPlayerObject(void);
44
45/* All JS functions which talk to the player entity should call
46 OOOPlayerForScripting() to ensure that the script target (for the legacy
47 system) is set correctly. Additionally, all such functions should _always_
48 call OOPlayerForScripting(), even if they end up not using it, to ensure
49 consistent state.
50*/
void InitOOJSPlayer(JSContext *context, JSObject *global)
Definition OOJSPlayer.m:151
JSObject * JSPlayerObject(void)
Definition OOJSPlayer.m:170
PlayerEntity * OOPlayerForScripting(void)
Definition OOJSPlayer.m:175
JSClassID JSPlayerClassID(void)
Definition OOJSPlayer.m:155