Skip to content

Commit 53e06b3

Browse files
committed
first WebARKitLogi methods
1 parent a8e1d82 commit 53e06b3

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

include/WebARKit/WebARKitLog.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef WEBARKIT_LOG_H
2+
#define WEBARKIT_LOG_H
3+
4+
#include <emscripten.h>
5+
6+
void webarkitLOGi(char* message);
7+
8+
void webarkitLOGi(char* message, double * format);
9+
10+
void webarkitLOGi(char* message, float * format);
11+
12+
void webarkitLOGi(char* message, char * format);
13+
14+
void webarkitLOGi(char* message, int format);
15+
16+
17+
#endif // #ifndef WEBARKIT_LOG_H

lib/SRC/WebARKit/WebARKitLog.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#include <WebARKit/WebARKitLog.h>
2+
3+
const char * WARKTinfo = "%c[webarkit-info]: ";
4+
const char * WARKTstyle = "color: #664400; background-color: #ffff99; border-radius: 4px; padding: 2px";
5+
6+
void webarkitLOGi(char* message) {
7+
EM_ASM ({
8+
var message = UTF8ToString($0);
9+
var info = UTF8ToString($1);
10+
var style = UTF8ToString($2);
11+
console.log(info + message, style);
12+
},
13+
message,
14+
WARKTinfo,
15+
WARKTstyle
16+
);
17+
}
18+
19+
void webarkitLOGi(char* message, double * format) {
20+
EM_ASM ({
21+
var message = UTF8ToString($0);
22+
var info = UTF8ToString($1);
23+
var style = UTF8ToString($2);
24+
console.log(info + message, style, $3);
25+
},
26+
message,
27+
WARKTinfo,
28+
WARKTstyle,
29+
format
30+
);
31+
}
32+
33+
void webarkitLOGi(char* message, float * format) {
34+
EM_ASM ({
35+
var message = UTF8ToString($0);
36+
var info = UTF8ToString($1);
37+
var style = UTF8ToString($2);
38+
console.log(info + message, style, $3);
39+
},
40+
message,
41+
WARKTinfo,
42+
WARKTstyle,
43+
format
44+
);
45+
}
46+
47+
void webarkitLOGi(char* message, char * format) {
48+
EM_ASM ({
49+
var message = UTF8ToString($0);
50+
var info = UTF8ToString($1);
51+
var style = UTF8ToString($2);
52+
console.log(info + message, style, $3);
53+
},
54+
message,
55+
WARKTinfo,
56+
WARKTstyle,
57+
format
58+
);
59+
}
60+
61+
void webarkitLOGi(char* message, int format) {
62+
EM_ASM ({
63+
var message = UTF8ToString($0);
64+
var info = UTF8ToString($1);
65+
var style = UTF8ToString($2);
66+
console.log(info + message, style, $3);
67+
},
68+
message,
69+
WARKTinfo,
70+
WARKTstyle,
71+
format
72+
);
73+
}

0 commit comments

Comments
 (0)