forked from kdx/jtmm2-old
Cleaner code, slight vector progress. dgray still doesn't work and I don't know why
This commit is contained in:
parent
97b60ce24f
commit
c850984a72
|
@ -1,7 +1,10 @@
|
|||
#ifndef _DEF_INIT
|
||||
#define _DEF_INIT
|
||||
|
||||
#ifdef FX9860G
|
||||
#include <gint/gray.h>
|
||||
#endif /* FX9860G */
|
||||
|
||||
void init();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _DEF_VEC2D
|
||||
#define _DEF_VEC2D
|
||||
|
||||
typedef struct Vec
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} Vec;
|
||||
|
||||
/* apply a force on a vector */
|
||||
void vec_add(Vec *vector, Vec force);
|
||||
|
||||
/* apply the opposite of a force on a vector */
|
||||
void vec_sub(Vec *vector, Vec force);
|
||||
|
||||
#endif
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef _DEF_VEC2D
|
||||
#define _DEF_VEC2D
|
||||
|
||||
struct Vec2D
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,9 +1,10 @@
|
|||
#include "init.h"
|
||||
#include <gint/gray.h>
|
||||
|
||||
void init()
|
||||
{
|
||||
#ifdef FX9860G
|
||||
gray_start();
|
||||
dgray(DGRAY_ON);
|
||||
#endif /* FX9860G */
|
||||
#ifdef FXCG50
|
||||
#endif /* FXCG50*/
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
#include <gint/display.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include "init.h"
|
||||
#include "vec2d.h"
|
||||
#include "vec.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init(); /* initialise gint */
|
||||
|
||||
struct Vec2D vector_test = {
|
||||
.x = 20,
|
||||
.y = -50
|
||||
};
|
||||
Vec vector_test = {20, -50};
|
||||
vec_add(&vector_test, (Vec){5, -10});
|
||||
dclear(C_WHITE);
|
||||
dprint(1, 1, C_BLACK, "vector_test: x = %d, y = %d", vector_test.x, vector_test.y);
|
||||
dupdate();
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#include "vec.h"
|
||||
|
||||
void vec_add(Vec *vector, Vec force)
|
||||
{
|
||||
vector->x += force.x;
|
||||
vector->y += force.y;
|
||||
}
|
||||
|
||||
void vec_sub(Vec *vector, Vec force)
|
||||
{
|
||||
vector->x -= force.x;
|
||||
vector->y -= force.y;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
#include "vec2d.h"
|
Loading…
Reference in New Issue