Ejemplo n.º 1
0
Entity *newCube(Vec3D position,const char *name)
{
    Entity * ent;
    char buffer[255];
    int i;
    ent = entity_new();
    if (!ent)
    {
        return NULL;
    }
    /*for (i = 0; i < 24;i++)
    {
        //sprintf(buffer,"models/robot/walk_bot_%06i.obj",i + 1);
        ent->objAnimation[i] = obj_load(buffer);
    }*/
    ent->objModel = obj_load("models/cube.obj");//ent->objAnimation[0];
	if( !ent->objModel )
		slog( "test" );
    ent->texture = LoadSprite("models/cube_text.png",1024,1024); //LoadSprite("models/robot/robot.png",1024,1024);
    vec3d_cpy(ent->body.position,position);
	vec3d_set(ent->scale,1,1,1);
	vec3d_set(ent->rotation,0,0,0);
	vec4d_set(ent->color,1,1,1,1);
    cube_set(ent->body.bounds,-1,-1,-1,2,2,2);
    ent->rotation.x = 90;
    sprintf(ent->name,"%s",name);
    ent->think = think;
    ent->state = 0;
    mgl_callback_set(&ent->body.touch,touch_callback,ent);
    return ent;
}
Ejemplo n.º 2
0
/*function definitions*/
void button_configure()
{
    Line buf;
    Line buttonfile,buttonhitfile,buttonhighfile,buttonsleepfile;

    __component_button_offset_x = 0;
    __component_button_offset_y = 0;
    __component_button_press_active = 0;
    __component_button_hold_active = 0;
    __component_button_release_active = 1;
    __component_button_font_size = 3;
    vec3d_set(__component_button_color[0],0.8,0.8,0.8);
    vec3d_set(__component_button_color[1],1,1,0);
    vec3d_set(__component_button_color[2],0.6,0.6,0.6);
    vec3d_set(__component_button_color[3],0.3,0.2,0.3);
    strcpy(buttonfile,"images/btn.png");
    strcpy(buttonhitfile,"images/btn_hit.png");
    strcpy(buttonhighfile,"images/btn_high.png");
    strcpy(buttonsleepfile,"images/btn_sleep.png");

    __component_stock_button[0] = sprite_load(buttonfile,-1,-1);
    __component_stock_button[1] = sprite_load(buttonhighfile,-1,-1);
    __component_stock_button[2] = sprite_load(buttonhitfile,-1,-1);
    __component_stock_button[3] = sprite_load(buttonsleepfile,-1,-1);
}
Ejemplo n.º 3
0
/* Sets the first player's data */
void InitEntity(entity* e, long character)
{
	vec3d_set(e->position, 0, 0, 0);
	vec3d_set(e->velocity, 0, 0, 0);
	vec3d_set(e->rotation, 0, 0, 0);
	e->hb.x = 0;
	e->hb.y = 0;
	e->hb.z = 0;
	Vec3d_set(e->hb.bounding.vmax, 1, 1, 1);
	Vec3d_set(e->hb.bounding.vmin, -1, -1, -1);
	e->gravity = 5;
}
Ejemplo n.º 4
0
Entity *entity_new()
{
    int i;
    for (i = 0; i < __entity_max;i++)
    {
        if (!__entity_list[i].inuse)
        {
            memset(&__entity_list[i],0,sizeof(Entity));
            __entity_list[i].inuse = 1;
            vec3d_set(__entity_list[i].scale,1,1,1);
            vec4d_set(__entity_list[i].color,1,1,1,1);
            return &__entity_list[i];
        }
    }
    return NULL;
}