Exemple #1
0
Fichier : gx.c Projet : LWSS/gx
void init_game(struct GameMemory *memory)
{
    ASSERT(memory->game_memory_size >= sizeof(struct GameState));
    struct GameState *game_state = (struct GameState *)memory->game_memory;

    struct Camera *camera = &game_state->camera;
    camera->zoom = 20.0f;

    game_state->ship_id_map = create_uint_hash_map();

    uint32 unit_count = 5;
    for (uint32 i = 0; i < unit_count; ++i)
    {
        struct Ship *ship = create_ship(game_state);

        ship->size = vec2_new(1, 1);
        ship->move_velocity = vec2_new(0, 0);

        float xp = 2.0f * ((float)i - unit_count/2.0f);
        float yp = -camera->zoom/4.0f;
        ship->position = vec2_new(xp, yp);

        ship->health = 5;
        ship->fire_cooldown = 2.0f;

        ship->team = TEAM_ALLY;
    }

#if 0
    for (uint32 i = 0; i < unit_count; ++i)
    {
        struct Ship *ship = create_ship(game_state);
        ship->size = vec2_new(1, 1);
        ship->move_velocity = vec2_new(0, 0);

        float xp = 2.0f * ((float)i - unit_count/2.0f);
        float yp = camera->zoom/4.0f;
        ship->position = vec2_new(xp, yp);

        ship->health = 5;
        ship->fire_cooldown = 2.0f;

        ship->team = TEAM_ENEMY;
    }
#endif

    for (uint32 i = 0; i < 4; ++i)
    {
        struct Building *building = create_building(game_state);
        building->position = vec2_new(random_int(-16, 16), random_int(-16, 16));
        building->size = vec2_new(2, 2);
    }

    calc_visibility_graph(game_state, &game_state->visibility_graph);
}
Exemple #2
0
void simulation::initial_scr(WINDOW* scr)
{
    //clear the console and print the introduction and choices
    console.clear();
    console_print("Un-versioned, in development");
    console_print("Welcome to Sim Curses");
    console_print("Waiting for input..");
    status_message = "(1) Object Creation       (q) Quit";
    //update screen prints the console as part of its function
    update_screen(scr);
    //declarations before switch statement
    generic_menu object_menu(scr);
    switch (wgetch(scr))
    {
        //n is for new object
        case '1':
            //in the future, we will post a menu here with object choices
            //but for now its just buildings
            //the future is now!
            //generic_menu object_menu(scr);
            object_menu.add_choice("New building", 0);
            object_menu.add_choice("New item", 1);
            object_menu.add_choice("New sim", 2);
            object_menu.set_pos(2, 0);
            switch (object_menu.get_choice())
            {
                case 0:
                    master_building.push_back(create_building(scr));
                    break;
                case 1:
                    //todo
                    break;
                case 2:
                    //todo
                    break;
            }
            break;
        case 'q':
            break;
    }
}