us fxengine as functionnal lib
This commit is contained in:
parent
01f0d7186a
commit
9e755bd4fb
868
build-fx/map
868
build-fx/map
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
|
@ -16,7 +16,7 @@ ICON_CG_SEL = assets-cg/icon-cg-sel.png
|
|||
# Additional compiler flags
|
||||
CFLAGS = -std=c11 -Os
|
||||
# Additional linker flags
|
||||
LDFLAGS = -lfxengine -lgint-fx -lprof
|
||||
LDFLAGS = -llog -lfxengine -lgint-fx -lprof
|
||||
|
||||
# FxEngine font
|
||||
# FONT.FxEngine.png = charset:print grid.size:3x5 grid.padding:1 proportional:true
|
||||
|
|
117
src/main.c
117
src/main.c
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
#include <gint/display.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include <gint/std/stdio.h>
|
||||
#include <gint/std/stdlib.h>
|
||||
#include <gint/clock.h>
|
||||
#include <fxengine/point.h>
|
||||
|
||||
*/
|
||||
/*
|
||||
int main(void)
|
||||
{
|
||||
|
@ -48,11 +49,11 @@ int main(void)
|
|||
#include <gint/std/stdlib.h>
|
||||
#include <gint/clock.h>
|
||||
|
||||
#include <fxengine/point.h>
|
||||
#include <fxengine/texture.h>
|
||||
#include <fxengine/triangle.h>
|
||||
#include <fxengine/camera.h>
|
||||
#include <fxengine/object.h>
|
||||
|
||||
#include <liblog.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//init_controls();
|
||||
|
@ -99,49 +100,115 @@ int main(void)
|
|||
|
||||
fe_texture_rich * bmp = fe_texture_new_rich(32, 32, color, 0, 0, 0);
|
||||
|
||||
fe_texture_debug(bmp);
|
||||
/*
|
||||
fe_integer_point points[3]=
|
||||
//fe_texture_debug(bmp);
|
||||
|
||||
fe_ivertex v[3]=
|
||||
{
|
||||
{
|
||||
{1,1,0},
|
||||
{54,6,5}
|
||||
{1,1,2},
|
||||
{0,0,0}
|
||||
},
|
||||
{
|
||||
{0,1,0},
|
||||
{5,3,8}
|
||||
{2,1,3},
|
||||
{0,0,0}
|
||||
},
|
||||
{
|
||||
{1,0,0},
|
||||
{5,3,64}
|
||||
{1,4,2},
|
||||
{0,0,0}
|
||||
}
|
||||
};
|
||||
|
||||
fe_object object;
|
||||
fe_object_init(&object);
|
||||
fe_object_set_points(&object, points, 3, 0);
|
||||
fe_object_set_points(&object, &v, 3, 0);
|
||||
fe_triangle triangle =
|
||||
{
|
||||
&points[0].translated,
|
||||
&points[1].translated,
|
||||
&points[2].translated,
|
||||
fe_object_get_vertex(&object, 0),
|
||||
fe_object_get_vertex(&object, 1),
|
||||
fe_object_get_vertex(&object, 2),
|
||||
bmp,
|
||||
0,
|
||||
0
|
||||
};
|
||||
fe_object_set_faces(&object, &triangle, 1, 0);
|
||||
|
||||
fe_render_update(1);
|
||||
//fe_object_debug(&object);
|
||||
fe_camera cam = {{0,0,0},{0,0,0},0,0,0};
|
||||
while (1)
|
||||
{
|
||||
|
||||
//fe_object_display(&object);
|
||||
int key = getkey().key;
|
||||
char str[40];
|
||||
/* sprintf(str, "S1 %d %d %d",
|
||||
fe_object_get_vertex(&object, 0)->x,
|
||||
fe_object_get_vertex(&object, 0)->y,
|
||||
fe_object_get_vertex(&object, 0)->z);
|
||||
fe_log(str);
|
||||
|
||||
sprintf(str, "S2 %d %d %d",
|
||||
fe_object_get_vertex(&object, 1)->x,
|
||||
fe_object_get_vertex(&object, 1)->y,
|
||||
fe_object_get_vertex(&object, 1)->z);
|
||||
fe_log(str);
|
||||
|
||||
fe_render_update(1);
|
||||
|
||||
|
||||
|
||||
dupdate();
|
||||
getkey();
|
||||
sprintf(str, "S3 %d %d %d",
|
||||
fe_object_get_vertex(&object, 2)->x,
|
||||
fe_object_get_vertex(&object, 2)->y,
|
||||
fe_object_get_vertex(&object, 2)->z);
|
||||
*/
|
||||
sprintf(str, "cam %d %d %d",
|
||||
cam.pos.x,
|
||||
cam.pos.y,
|
||||
cam.pos.z);
|
||||
ll_log(str);
|
||||
|
||||
//ll_log(str);
|
||||
if (key == KEY_LEFT)
|
||||
cam.dh -= 0.1;
|
||||
if (key == KEY_RIGHT)
|
||||
cam.dh += 0.1;
|
||||
cam.dh = fe_modulo_2pi(cam.dh);
|
||||
|
||||
if (key == KEY_UP)
|
||||
cam.dv += 0.1;
|
||||
if (key == KEY_DOWN)
|
||||
cam.dv -= 0.1;
|
||||
cam.dv = fe_modulo_2pi(cam.dv);
|
||||
|
||||
if (key == KEY_6)
|
||||
{
|
||||
cam.pos.x = cam.pos.x + (int32_t)(5*fe_cos(cam.dh));
|
||||
cam.pos.y = cam.pos.y + (int32_t)(5*fe_sin(cam.dh));
|
||||
}
|
||||
if (key == KEY_4)
|
||||
{
|
||||
cam.pos.x = cam.pos.x + (int32_t)(5*fe_cos(cam.dh+pi));
|
||||
cam.pos.y = cam.pos.y + (int32_t)(5*fe_sin(cam.dh+pi));
|
||||
}
|
||||
if (key == KEY_8)
|
||||
{
|
||||
cam.pos.x = cam.pos.x + (int32_t)(5*fe_cos(cam.dh+pi_sur_2));
|
||||
cam.pos.y = cam.pos.y + (int32_t)(5*fe_sin(cam.dh+pi_sur_2));
|
||||
}
|
||||
if (key == KEY_2)
|
||||
{
|
||||
cam.pos.x = cam.pos.x + (int32_t)(5*fe_cos(cam.dh-pi_sur_2));
|
||||
cam.pos.y = cam.pos.y + (int32_t)(5*fe_sin(cam.dh-pi_sur_2));
|
||||
}
|
||||
cam.dv = fe_modulo_2pi(cam.dv);
|
||||
|
||||
fe_view_set(&cam);
|
||||
fe_object_display(&object);
|
||||
|
||||
if (key == KEY_EXIT)
|
||||
break;
|
||||
if (key==KEY_F1)
|
||||
ll_display_log();
|
||||
else
|
||||
fe_render_update(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue