소스 검색

Update Militant

Add some missing parts.
feature/data-structs
부모
커밋
a2f8cc224f
6개의 변경된 파일49개의 추가작업 그리고 8개의 파일을 삭제
  1. BIN
      assets_src/gfx/weapons-rigged.cdr
  2. +2
    -2
      src/packages/game/IZ_app.c
  3. +7
    -0
      src/packages/game/core/IZ_entity.c
  4. +5
    -0
      src/packages/game/core/IZ_entity.h
  5. +0
    -1
      src/packages/game/core/IZ_object.h
  6. +35
    -5
      src/packages/game/memory/memory.test.c

BIN
assets_src/gfx/weapons-rigged.cdr 파일 보기


+ 2
- 2
src/packages/game/IZ_app.c 파일 보기

@@ -120,7 +120,7 @@ IZ_AppResult IZ_AppRun(struct IZ_App* app, u8 argc, const char* argv[]) {

char asset_dir[255];
IZ_AssetResolveDir("weapon-operator", asset_dir);
u16 sprite_slot_index = IZ_VideoGetNextFreeSpriteSlot(&app->video_state);
u16 sprite_slot_index = IZ_VideoGetNextFreeSpriteSlot(&app->video_state, IZ_VIDEO_SPRITE_PRIORITY_MEDIUM);
IZ_VideoLoadSprite(&app->video_state, (IZ_VideoLoadSpriteParams) {
.dir = asset_dir,
.filename = "sprite.svg",
@@ -130,7 +130,7 @@ IZ_AppResult IZ_AppRun(struct IZ_App* app, u8 argc, const char* argv[]) {
app->video_state.active_sprites[sprite_slot_index].sprite.position = (IZ_Vector2D) { 100.f, 100.f };

IZ_AssetResolveDir("weapon-specialist", asset_dir);
sprite_slot_index = IZ_VideoGetNextFreeSpriteSlot(&app->video_state);
sprite_slot_index = IZ_VideoGetNextFreeSpriteSlot(&app->video_state, IZ_VIDEO_SPRITE_PRIORITY_MEDIUM);
IZ_VideoLoadSprite(&app->video_state, (IZ_VideoLoadSpriteParams) {
.dir = asset_dir,
.filename = "sprite.svg",


+ 7
- 0
src/packages/game/core/IZ_entity.c 파일 보기

@@ -1 +1,8 @@
#include "IZ_entity.h"

IZ_Entity* IZ_EntityNew(IZ_Entity attrs) {
// TODO let pool allocate memory for entity instead of malloc!
IZ_Entity* new_entity = (IZ_Entity*) malloc(sizeof(IZ_Entity));

return new_entity;
}

+ 5
- 0
src/packages/game/core/IZ_entity.h 파일 보기

@@ -1,11 +1,16 @@
#ifndef IZ_ENTITY_H
#define IZ_ENTITY_H

#include <stdlib.h>
#include "../geometry/IZ_vector2d.h"

typedef struct {
IZ_Vector2D pos;

IZ_Vector2D speed;
// TODO object appearance (sprite, sprites contain bounding boxes, collisions contain bounding boxes)
} IZ_Entity;

IZ_Entity* IZ_EntityNew(IZ_Entity);

#endif

+ 0
- 1
src/packages/game/core/IZ_object.h 파일 보기

@@ -9,7 +9,6 @@ typedef struct {
IZ_Entity as_entity;

IZ_Rect collision_rect;
IZ_Vector2D speed;
} IZ_Object;

#endif

+ 35
- 5
src/packages/game/memory/memory.test.c 파일 보기

@@ -109,7 +109,7 @@ spec("memory") {
it("deallocates old items to make way for new ones when the memory is full") {
IZ_PoolInitialize(&pool, sizeof(u32));

IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){
void* p1 = IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){
.size = sizeof(u16),
.priority = 0,
.timestamp = 0,
@@ -117,18 +117,48 @@ spec("memory") {
IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){
.size = sizeof(u8),
.priority = 0,
.timestamp = 0,
.timestamp = 1,
});
IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){
.size = sizeof(u8),
.priority = 0,
.timestamp = 0,
.timestamp = 2,
});
IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){

void* p2 = IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){
.size = sizeof(u8),
.priority = 0,
.timestamp = 0,
.timestamp = 3,
});

check(
p1 == p2,
"Old memory not properly deallocated."
);

void* p3 = IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){
.size = sizeof(u8),
.priority = 0,
.timestamp = 4,
});

// FIXME here onwards

check(
p3 == p2 + sizeof(u8),
"Free memory not properly utilized."
);

void* p4 = IZ_PoolAllocate(&pool, (IZ_PoolAllocationArgs){
.size = sizeof(u8),
.priority = 0,
.timestamp = 5,
});

check(
p4 == p3 + sizeof(u8),
"Free memory not properly utilized."
);
}
}



불러오는 중...
취소
저장