Move player entity into static
This commit is contained in:
parent
f196440112
commit
c02068f1ba
28
app/main.c
28
app/main.c
@ -117,6 +117,17 @@ static const unsigned impassable[] = {
|
|||||||
};
|
};
|
||||||
static objtype_t objtypes[MAXOBJTYPES];
|
static objtype_t objtypes[MAXOBJTYPES];
|
||||||
static objcol_t objcol;
|
static objcol_t objcol;
|
||||||
|
static entity_t p = {
|
||||||
|
.svar = SPRITE_DIR_DOWN,
|
||||||
|
.animlen = PANIMLEN,
|
||||||
|
.animstep = { .x = PWIDTH },
|
||||||
|
.svarstep = { .y = PHEIGHT },
|
||||||
|
.fbox = {
|
||||||
|
.off = { .x = PFBOFFX, .y = PFBOFFY },
|
||||||
|
.ext = { .x = PFBWIDTH, .y = PFBHEIGHT },
|
||||||
|
},
|
||||||
|
.src = { .w = PWIDTH, .h = PHEIGHT },
|
||||||
|
};
|
||||||
|
|
||||||
static inline double mag(dvec_t v)
|
static inline double mag(dvec_t v)
|
||||||
{
|
{
|
||||||
@ -459,7 +470,7 @@ int main(int argc, char *argv[])
|
|||||||
tstex = IMG_LoadTexture(renderer, path);
|
tstex = IMG_LoadTexture(renderer, path);
|
||||||
assert(NULL != tstex);
|
assert(NULL != tstex);
|
||||||
|
|
||||||
// Load player spritesheets
|
// Load player spritesheets and initialize texture
|
||||||
assert(strlen(assetdir) + strlen(PIDLE_ASSET) < MAX_PATH_LEN);
|
assert(strlen(assetdir) + strlen(PIDLE_ASSET) < MAX_PATH_LEN);
|
||||||
strcpy(path, assetdir);
|
strcpy(path, assetdir);
|
||||||
strcat(path, PIDLE_ASSET);
|
strcat(path, PIDLE_ASSET);
|
||||||
@ -470,20 +481,7 @@ int main(int argc, char *argv[])
|
|||||||
strcat(path, PWALK_ASSET);
|
strcat(path, PWALK_ASSET);
|
||||||
pwalk = IMG_LoadTexture(renderer, path);
|
pwalk = IMG_LoadTexture(renderer, path);
|
||||||
assert(NULL != pwalk);
|
assert(NULL != pwalk);
|
||||||
|
p.tex = pidle;
|
||||||
// Initialize player
|
|
||||||
entity_t p = {
|
|
||||||
.svar = SPRITE_DIR_DOWN,
|
|
||||||
.animlen = PANIMLEN,
|
|
||||||
.tex = pidle,
|
|
||||||
.animstep = { .x = PWIDTH },
|
|
||||||
.svarstep = { .y = PHEIGHT },
|
|
||||||
.fbox = {
|
|
||||||
.off = { .x = PFBOFFX, .y = PFBOFFY },
|
|
||||||
.ext = { .x = PFBWIDTH, .y = PFBHEIGHT },
|
|
||||||
},
|
|
||||||
.src = { .w = PWIDTH, .h = PHEIGHT },
|
|
||||||
};
|
|
||||||
|
|
||||||
bool f = true;
|
bool f = true;
|
||||||
SDL_SetRenderDrawColor(renderer, 0xff, 0x00, 0x00, 0xff);
|
SDL_SetRenderDrawColor(renderer, 0xff, 0x00, 0x00, 0xff);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user