-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsbot.h
More file actions
58 lines (50 loc) · 1.57 KB
/
Copy pathjsbot.h
File metadata and controls
58 lines (50 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef jsbot_h
#define jsbot_h
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#import <JavaScriptCore/JavaScriptCore.h>
@class jsBot, jsVector, jsConsole, jsGame;
@protocol BotJSExport <JSExport>
-(void) driveSpeed: (int) speed Angle: (int) angle;
-(int) scanInDirection: (int) direction WithResolution: (int) resolution;
-(int) shootInDirection: (int) direction atDistance: (int) distance;
@property (strong, readonly) jsVector* position;
@property (readonly) int speed;
@property (readonly) int angle;
@property (nonatomic, copy) NSString* name;
@end
// used when calling the method on the game class on the main thread
typedef struct{
int direction;
int distance;
}shootArg;
@interface jsBot: NSObject <BotJSExport>{
jsConsole* _console;
JSContext* _jsContext;
jsVector* _position;
NSString* _name;
int _speed;
int _angle;
float _x,_y;
}
@property int index; //the index in the array that the bots are stored in in jsGame
@property int scanAngle;
@property int scanResolution;
@property shootArg shootArguments;
@property (weak) jsGame *game;
@property int returnValues; //used when returning values from the main thread
@property (nonatomic, retain) JSContext* jsContext;
@property (strong) NSThread *thread;
- (void) update;
- (id) initWithFile: (NSString *) botFile Position: (jsVector*) pos;
- (void) main;
- (void) makeSimpleFunction;
@end
@interface jsBullet: NSObject
@property (nonatomic, weak) jsBot *fromBot;
@property (nonatomic, strong) jsVector *startPosition;
@property (nonatomic, strong) jsVector *position;
@property shootArg shootArguments;
@end
#endif