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
|
EXT = .exe
|
||||||
else
|
else
|
||||||
LINKER_FLAGS = $(QFLAGS) -L/usr/local/lib -rdynamic
|
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 =
|
CLIBS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -341,8 +341,11 @@ void phys2d_dbgdrawbox(struct phys2d_box *box)
|
||||||
int n = cpPolyShapeGetCount(box->shape.shape);
|
int n = cpPolyShapeGetCount(box->shape.shape);
|
||||||
float points[n * 2];
|
float points[n * 2];
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++) {
|
||||||
points[i] = bodytransformpoint(cpShapeGetBody(box->shape.shape), cpPolyShapeGetVert(box->shape.shape, 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));
|
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);
|
int n = cpPolyShapeGetCount(poly->shape.shape);
|
||||||
float points[n * 2];
|
float points[n * 2];
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++) {
|
||||||
points[i*2] = bodytransformpoint(cpShapeGetBody(poly->shape.shape), cpPolyShapeGetVert(poly->shape.shape, 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);
|
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)
|
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)
|
void phys2d_edgedel(struct phys2d_edge *edge)
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <chipmunk/chipmunk.h>
|
#include <chipmunk/chipmunk.h>
|
||||||
#include "script.h"
|
#include "script.h"
|
||||||
|
|
||||||
|
struct gameobject;
|
||||||
|
|
||||||
extern float phys2d_gravity;
|
extern float phys2d_gravity;
|
||||||
extern int physOn;
|
extern int physOn;
|
||||||
extern cpSpace *space;
|
extern cpSpace *space;
|
||||||
|
|
|
@ -98,6 +98,12 @@ void go_shape_apply(cpBody *body, cpShape *shape, struct gameobject *go)
|
||||||
// cpShapeSetSensor(shape, go->sensor);
|
// cpShapeSetSensor(shape, go->sensor);
|
||||||
cpShapeSetCollisionType(shape, go2id(go));
|
cpShapeSetCollisionType(shape, go2id(go));
|
||||||
|
|
||||||
|
|
||||||
|
// cpShapeSetFilter(shape, go->filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void go_shape_moi(cpBody *body, cpShape *shape, struct gameobject *go)
|
||||||
|
{
|
||||||
float moment = cpBodyGetMoment(go->body);
|
float moment = cpBodyGetMoment(go->body);
|
||||||
struct phys2d_shape *s = cpShapeGetUserData(shape);
|
struct phys2d_shape *s = cpShapeGetUserData(shape);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
|
@ -106,21 +112,25 @@ void go_shape_apply(cpBody *body, cpShape *shape, struct gameobject *go)
|
||||||
}
|
}
|
||||||
|
|
||||||
moment += s->moi(s->data, go->mass);
|
moment += s->moi(s->data, go->mass);
|
||||||
cpBodySetMoment(go->body, moment);
|
cpBodySetMoment(go->body, moment);
|
||||||
// cpShapeSetFilter(shape, go->filter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameobject_apply(struct gameobject *go)
|
void gameobject_apply(struct gameobject *go)
|
||||||
{
|
{
|
||||||
cpBodySetType(go->body, go->bodytype);
|
cpBodySetType(go->body, go->bodytype);
|
||||||
cpBodySetMoment(go->body, 0.f);
|
|
||||||
cpBodyEachShape(go->body, go_shape_apply, go);
|
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);
|
cpBodySetMass(go->body, go->mass);
|
||||||
|
cpBodySetMoment(go->body, 0.f);
|
||||||
if (cpBodyGetMoment(go->body) <= 0.f) {
|
cpBodyEachShape(go->body, go_shape_moi, go);
|
||||||
YughError("Moment for object %d is zero. Setting to one.", go2id(go));
|
|
||||||
cpBodySetMoment(go->body, 1.f);
|
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;
|
const char *kkey = NULL;
|
||||||
|
|
||||||
if (key > 289 && key < 302) {
|
if (key > 289 && key < 302) {
|
||||||
sprintf(keybuf, "f%d", key-289);
|
switch(key) {
|
||||||
return keybuf;
|
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 {
|
} else {
|
||||||
switch(key) {
|
switch(key) {
|
||||||
case GLFW_KEY_ENTER:
|
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)
|
void win_key_callback(GLFWwindow *w, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
char keystr[50] = {'\0'};
|
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) {
|
switch (action) {
|
||||||
case GLFW_PRESS:
|
case GLFW_PRESS:
|
||||||
|
|
|
@ -26,6 +26,7 @@ struct Texture *texture_pullfromfile(const char *path)
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
return texhash[index].value;
|
return texhash[index].value;
|
||||||
|
|
||||||
|
YughInfo("Loading texture %s.", path);
|
||||||
struct Texture *tex = calloc(1, sizeof(*tex));
|
struct Texture *tex = calloc(1, sizeof(*tex));
|
||||||
|
|
||||||
/* Find texture's asset; otherwise load default asset */
|
/* 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_byte) == 1);
|
||||||
NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
|
NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
|
||||||
NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
|
NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
|
||||||
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
|
//NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
|
||||||
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
|
//NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
|
||||||
#ifdef NK_INCLUDE_STANDARD_BOOL
|
#ifdef NK_INCLUDE_STANDARD_BOOL
|
||||||
NK_STATIC_ASSERT(sizeof(nk_bool) == sizeof(bool));
|
NK_STATIC_ASSERT(sizeof(nk_bool) == sizeof(bool));
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -129,6 +129,8 @@ int main(int argc, char **args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ed = 0;
|
||||||
|
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
if (logout) {
|
if (logout) {
|
||||||
|
|
Loading…
Reference in a new issue