Fix windows build
This commit is contained in:
parent
4aa6780a8e
commit
f05e0e59f0
2
Makefile
2
Makefile
|
@ -84,7 +84,7 @@ ifeq ($(OS), WIN32)
|
|||
EXT = .exe
|
||||
else
|
||||
LINKER_FLAGS = $(QFLAGS) -L/usr/local/lib -rdynamic
|
||||
ELIBS = engine pthread yughc portaudio asound glfw3 c m dl samplerate
|
||||
ELIBS = engine pthread yughc portaudio asound glfw3 c m dl
|
||||
CLIBS =
|
||||
endif
|
||||
|
||||
|
|
|
@ -341,8 +341,11 @@ void phys2d_dbgdrawbox(struct phys2d_box *box)
|
|||
int n = cpPolyShapeGetCount(box->shape.shape);
|
||||
float points[n * 2];
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
points[i] = bodytransformpoint(cpShapeGetBody(box->shape.shape), cpPolyShapeGetVert(box->shape.shape, i));
|
||||
for (int i = 0; i < n; i++) {
|
||||
cpVect p = bodytransformpoint(cpShapeGetBody(box->shape.shape), cpPolyShapeGetVert(box->shape.shape, i));
|
||||
points[i*2] = p.x;
|
||||
points[i*2+1] = p.y;
|
||||
}
|
||||
|
||||
draw_poly(points, n, shape_color(box->shape.shape));
|
||||
}
|
||||
|
@ -413,8 +416,11 @@ void phys2d_dbgdrawpoly(struct phys2d_poly *poly)
|
|||
int n = cpPolyShapeGetCount(poly->shape.shape);
|
||||
float points[n * 2];
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
points[i*2] = bodytransformpoint(cpShapeGetBody(poly->shape.shape), cpPolyShapeGetVert(poly->shape.shape, i));
|
||||
for (int i = 0; i < n; i++) {
|
||||
cpVect p = bodytransformpoint(cpShapeGetBody(poly->shape.shape), cpPolyShapeGetVert(poly->shape.shape, i));
|
||||
points[i*2] = p.x;
|
||||
points[i*2+1] = p.y;
|
||||
}
|
||||
|
||||
draw_poly(points, n, color);
|
||||
}
|
||||
|
@ -442,7 +448,11 @@ struct phys2d_edge *Make2DEdge(int go)
|
|||
|
||||
float phys2d_edge_moi(struct phys2d_edge *edge, float m)
|
||||
{
|
||||
return m;
|
||||
float moi = 0;
|
||||
for (int i = 0; i < arrlen(edge->points)-1; i++)
|
||||
moi += cpMomentForSegment(m, edge->points[i], edge->points[i+1], edge->thickness);
|
||||
|
||||
return moi;
|
||||
}
|
||||
|
||||
void phys2d_edgedel(struct phys2d_edge *edge)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <chipmunk/chipmunk.h>
|
||||
#include "script.h"
|
||||
|
||||
struct gameobject;
|
||||
|
||||
extern float phys2d_gravity;
|
||||
extern int physOn;
|
||||
extern cpSpace *space;
|
||||
|
|
|
@ -98,6 +98,12 @@ void go_shape_apply(cpBody *body, cpShape *shape, struct gameobject *go)
|
|||
// cpShapeSetSensor(shape, go->sensor);
|
||||
cpShapeSetCollisionType(shape, go2id(go));
|
||||
|
||||
|
||||
// cpShapeSetFilter(shape, go->filter);
|
||||
}
|
||||
|
||||
void go_shape_moi(cpBody *body, cpShape *shape, struct gameobject *go)
|
||||
{
|
||||
float moment = cpBodyGetMoment(go->body);
|
||||
struct phys2d_shape *s = cpShapeGetUserData(shape);
|
||||
if (!s) {
|
||||
|
@ -106,21 +112,25 @@ void go_shape_apply(cpBody *body, cpShape *shape, struct gameobject *go)
|
|||
}
|
||||
|
||||
moment += s->moi(s->data, go->mass);
|
||||
cpBodySetMoment(go->body, moment);
|
||||
// cpShapeSetFilter(shape, go->filter);
|
||||
cpBodySetMoment(go->body, moment);
|
||||
}
|
||||
|
||||
void gameobject_apply(struct gameobject *go)
|
||||
{
|
||||
cpBodySetType(go->body, go->bodytype);
|
||||
cpBodySetMoment(go->body, 0.f);
|
||||
cpBodyEachShape(go->body, go_shape_apply, go);
|
||||
if (go->bodytype == CP_BODY_TYPE_DYNAMIC)
|
||||
|
||||
if (go->bodytype == CP_BODY_TYPE_DYNAMIC) {
|
||||
cpBodySetMass(go->body, go->mass);
|
||||
|
||||
if (cpBodyGetMoment(go->body) <= 0.f) {
|
||||
YughError("Moment for object %d is zero. Setting to one.", go2id(go));
|
||||
cpBodySetMoment(go->body, 1.f);
|
||||
cpBodySetMoment(go->body, 0.f);
|
||||
cpBodyEachShape(go->body, go_shape_moi, go);
|
||||
|
||||
if (cpBodyGetMoment(go->body) <= 0.f) {
|
||||
YughError("Moment for object %d is zero. Setting to one.", go2id(go));
|
||||
cpBodySetMoment(go->body, 1.f);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,8 +156,32 @@ const char *keyname_extd(int key, int scancode) {
|
|||
const char *kkey = NULL;
|
||||
|
||||
if (key > 289 && key < 302) {
|
||||
sprintf(keybuf, "f%d", key-289);
|
||||
return keybuf;
|
||||
switch(key) {
|
||||
case 290:
|
||||
return "f1";
|
||||
case 291:
|
||||
return "f2";
|
||||
case 292:
|
||||
return "f3";
|
||||
case 293:
|
||||
return "f4";
|
||||
case 294:
|
||||
return "f5";
|
||||
case 295:
|
||||
return "f6";
|
||||
case 296:
|
||||
return "f7";
|
||||
case 297:
|
||||
return "f8";
|
||||
case 298:
|
||||
return "f9";
|
||||
case 299:
|
||||
return "f10";
|
||||
case 300:
|
||||
return "f11";
|
||||
case 301:
|
||||
return "f12";
|
||||
}
|
||||
} else {
|
||||
switch(key) {
|
||||
case GLFW_KEY_ENTER:
|
||||
|
@ -298,7 +322,8 @@ int key_is_num(int key) {
|
|||
void win_key_callback(GLFWwindow *w, int key, int scancode, int action, int mods)
|
||||
{
|
||||
char keystr[50] = {'\0'};
|
||||
const char *kkey = keyname_extd(key, scancode);
|
||||
char kkey[50] = {'\0'};
|
||||
snprintf(kkey, 50, "%s", keyname_extd(key,scancode));
|
||||
|
||||
switch (action) {
|
||||
case GLFW_PRESS:
|
||||
|
|
|
@ -26,6 +26,7 @@ struct Texture *texture_pullfromfile(const char *path)
|
|||
if (index != -1)
|
||||
return texhash[index].value;
|
||||
|
||||
YughInfo("Loading texture %s.", path);
|
||||
struct Texture *tex = calloc(1, sizeof(*tex));
|
||||
|
||||
/* Find texture's asset; otherwise load default asset */
|
||||
|
|
4
source/engine/thirdparty/Nuklear/nuklear.h
vendored
4
source/engine/thirdparty/Nuklear/nuklear.h
vendored
|
@ -432,8 +432,8 @@ NK_STATIC_ASSERT(sizeof(nk_int) == 4);
|
|||
NK_STATIC_ASSERT(sizeof(nk_byte) == 1);
|
||||
NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
|
||||
NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
|
||||
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
|
||||
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
|
||||
//NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
|
||||
//NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
|
||||
#ifdef NK_INCLUDE_STANDARD_BOOL
|
||||
NK_STATIC_ASSERT(sizeof(nk_bool) == sizeof(bool));
|
||||
#else
|
||||
|
|
|
@ -129,6 +129,8 @@ int main(int argc, char **args) {
|
|||
}
|
||||
}
|
||||
|
||||
ed = 0;
|
||||
|
||||
|
||||
#if DBG
|
||||
if (logout) {
|
||||
|
|
Loading…
Reference in a new issue