void pge_init() { // Start the game pge_begin(GColorBlack, game_logic, game_draw, game_click); // Keep a Window reference for adding other UI s_game_window = pge_get_window(); }
void pge_init() { // Start the game pge_begin(GColorWhite, game_logic, game_draw, game_click); // Keep a Window reference for adding other UI sg_window = pge_get_window(); sg_window_layer = window_get_root_layer(sg_window); sg_bounds = layer_get_bounds(sg_window_layer); sg_center = grect_center_point(&sg_bounds); // Create players player1.color = GColorBlue; player1.inset = GEdgeInsets(10); player1.velocity = 0; player1.loc = 0; player1.len = 10000; player2.color = GColorRed; player2.inset = GEdgeInsets(10); player2.velocity = 0.0; player2.loc = 0.0; player2.len = 10000; // create ball ball.color = GColorDarkCandyAppleRed; ball.center = sg_center; ball.vx = 1; ball.vy = 1; }
void pge_init() { fpsTimer = app_timer_register(fpsOutputFrequency, (AppTimerCallback)show_fps, NULL); //srand(get_milli_time()); load_kerb_bitmaps(); // Load the results backdrop race_result_load_title_fonts(); // Load the finishing line bitmap load_finish_line_bitmap(); set_up_distance_markers(); // The number represents the difficulty (range 0-9) race_create_cars(); race_set_difficulty(DIFFICULTY); // Start the game // Keep a Window reference for adding other UI pge_begin(GColorBrass, game_logic, game_draw, game_click); gameWindow = pge_get_window(); create_splashscreen(); show_splashscreen(gameWindow); set_current_state(STATE_SPLASH); }
void pge_init() { // Allocate for(int z = 0; z < GRID_DEPTH; z++) { for(int y = 0; y < GRID_HEIGHT; y++) { for(int x = 0; x < GRID_WIDTH; x++) { s_block_array[vec2i(Vec3(x, y, z))] = block_create(Vec3(x * BLOCK_SIZE, y * BLOCK_SIZE, z * BLOCK_SIZE), GSize(BLOCK_SIZE, BLOCK_SIZE), COLOR_INVISIBLE); } } } for(int i = 0; i < MAX_CLOUDS; i++) { s_cloud_array[i] = cloud_create(Vec3(0, 0, SKY_HEIGHT), GSize(BLOCK_SIZE, BLOCK_SIZE), Vec3(GRID_WIDTH * BLOCK_SIZE, GRID_HEIGHT * BLOCK_SIZE, SKY_HEIGHT)); } // Set up world generate_world(); // Set up engine pge_isometric_set_projection_offset(PBL_IF_ROUND_ELSE(GPoint(90, 110), GPoint(72, 80))); pge_isometric_set_enabled(true); pge_set_framerate(FRAME_RATE_IDLE); pge_begin(GColorBlack, logic, render, click); s_main_window = pge_get_window(); s_status_layer = text_layer_create(grect_inset( layer_get_bounds((window_get_root_layer(s_main_window))), PBL_IF_ROUND_ELSE(GEdgeInsets(30, 0, 130, 0), GEdgeInsets(0, 0, 150, 0)))); text_layer_set_background_color(s_status_layer, GColorBlack); text_layer_set_text_color(s_status_layer, GColorWhite); text_layer_set_text_alignment(s_status_layer, PBL_IF_ROUND_ELSE(GTextAlignmentCenter, GTextAlignmentLeft)); layer_add_child(window_get_root_layer(s_main_window), text_layer_get_layer(s_status_layer)); update_status_text(); #ifdef BENCHMARK APP_LOG(APP_LOG_LEVEL_INFO, "Heap free: %dB after creating %d blocks (Size: %dB)", (int)heap_bytes_free(), (GRID_WIDTH * GRID_HEIGHT * GRID_DEPTH), get_world_size()); #endif }