-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathforthCallbacks.cpp
More file actions
56 lines (39 loc) · 1.17 KB
/
forthCallbacks.cpp
File metadata and controls
56 lines (39 loc) · 1.17 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
#include "forthCallbacks.h"
extern "C"
{
#include "pforth/pf_all.h"
}
#include "World.h"
#include "SingleWorldConfiguration.h"
#include <sstream>
#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
static void pfcbTest()
{
PF_FLOAT n1 = POP_FLOAT_STACK;
PF_FLOAT n2 = POP_FLOAT_STACK;
PUSH_FLOAT_STACK(n1*n2);
MSG("praxis PForth C Test!");
}
static void pfcbDrawLine()
{
PF_FLOAT x1 = POP_FLOAT_STACK;
PF_FLOAT y1 = POP_FLOAT_STACK;
PF_FLOAT z1 = POP_FLOAT_STACK;
PF_FLOAT x2 = POP_FLOAT_STACK;
PF_FLOAT y2 = POP_FLOAT_STACK;
PF_FLOAT z2 = POP_FLOAT_STACK;
glBegin(GL_LINES);
glVertex3f(x1,y1,z1);
glVertex3f(x2,y2,z2);
glEnd();
}
//////////////////////////////////////////////////////////////////////////////////////////
void forthInitCallbacks()
{
void praxisDefinePForthCFunction(const char * name, CFunc0 func);
praxisDefinePForthCFunction( "ctest", (CFunc0)pfcbTest );
praxisDefinePForthCFunction( "drawline", (CFunc0)pfcbDrawLine );
}