void Gamestate_Draw(struct Game *game, struct MenuResources* data) { al_set_target_bitmap(al_get_backbuffer(game->display)); al_clear_to_color(al_map_rgb(3, 213, 255)); al_draw_bitmap(data->bg, 0, 0, 0); al_draw_bitmap(data->monster, data->monster_pos, 10, 0); if (!data->starting) { al_draw_bitmap(data->title, 123, 25 - (pow(sin(data->title_pos), 2) * 16) - data->screen_pos, 0); } DrawMenuState(game, data); }
void display_menu(struct Menu * menu ){ if(menu!=NULL){ al_draw_bitmap(menu->bg_picture,0,0,0); for(int i=0 ;i<(menu->title_nb);i++){ if (menu->title_selection != i ){ al_draw_bitmap(menu->titles[i].image_deselection,menu->position[i][1],menu->position[i][0],0); } else { al_draw_bitmap(menu->titles[i].image_selection,menu->position[i][1],menu->position[i][0],0); } } } }
void Menu::RenderNetwork(int X) { if( X - (MENU_SPACING / 2) >= DISPLAY->GetWidth() || X + (MENU_SPACING / 2) <= 0 ) { return; } al_draw_bitmap( BitmapCache::LoadBitmap( "resources/pcBlack.png" ), X - 220, 124, 0 ); al_draw_bitmap( BitmapCache::LoadBitmap( "resources/pcWhite.png" ), X - 224, 120, 0 ); al_draw_bitmap( BitmapCache::LoadBitmap( "resources/pcBlack.png" ), X + 8, 124, 0 ); al_draw_bitmap( BitmapCache::LoadBitmap( "resources/pcWhite.png" ), X + 4, 120, 0 ); optionfont->DrawString( X + 4, 424, "Network", FontHAlign::CENTRE, al_map_rgb( 0, 0, 0 ) ); optionfont->DrawString( X, 420, "Network", FontHAlign::CENTRE, al_map_rgb( 255, 255, 255 ) ); }
void penguin::draw() { for(int i=0;i<NUM_BULLETS;i++) { if(bullets[i].isAlive()) al_draw_bitmap(bullets[i].getImage(), bullets[i].getX(), bullets[i].getY(), 0); } // draw everything else unique to penguin for(int i = 0; i < lives; i++) { al_draw_bitmap(lives_icon.getBitmapPointer(),al_get_bitmap_width(lives_icon.getBitmapPointer())*i, 0, 0); } object::draw(); }
void drawLevelTres(LevelTres *levelTres){ al_draw_bitmap(levelTres->circ_off, 0, 0 , 0); al_draw_bitmap(levelTres->circ1, 0, 0 , 0); al_draw_bitmap(levelTres->circ2, 0, 0 , 0); al_draw_bitmap(levelTres->circ3, 0, 0 , 0); al_draw_bitmap(levelTres->circ4, 0, 0 , 0); if(levelTres->isOn[0])al_draw_bitmap(levelTres->circ5, 0, 0 , 0); if(levelTres->isOn[1])al_draw_bitmap(levelTres->circ6, 0, 0 , 0); if(levelTres->isOn[2])al_draw_bitmap(levelTres->saida, 0, 0 , 0); al_draw_bitmap(levelTres->portas, 0, 0 , 0); }
void Loading_Draw(struct Game *game) { float fadeloop=0; while (fadeloop<256) { ALLEGRO_EVENT ev; al_wait_for_event(game->event_queue, &ev); if ((ev.type == ALLEGRO_EVENT_TIMER) && (ev.timer.source == game->timer)) { fadeloop+=10; } if (al_is_event_queue_empty(game->event_queue)) { al_draw_tinted_bitmap(game->loading.loading_bitmap,al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1),0,0,0); DrawConsole(game); al_flip_display(); } } al_draw_bitmap(game->loading.loading_bitmap,0,0,0); al_stop_timer(game->timer); PreloadGameState(game, &Progress); al_wait_for_vsync(); al_start_timer(game->timer); /* fadeloop=0; while (fadeloop<256) { ALLEGRO_EVENT ev; al_wait_for_event(game->event_queue, &ev); if ((ev.type == ALLEGRO_EVENT_TIMER) && (ev.timer.source == game->timer)) { fadeloop+=10; } if (al_is_event_queue_empty(game->event_queue)) { al_draw_bitmap(game->loading.loading_bitmap,0,0,0); al_draw_filled_rectangle(0, game->viewportHeight*0.985, game->viewportWidth, game->viewportHeight, al_map_rgba(255,255,255,255)); al_draw_filled_rectangle(0, 0, game->viewportWidth, game->viewportHeight, al_map_rgba_f(0,0,0,fadeloop/255.0)); DrawConsole(game); al_flip_display(); } } al_clear_to_color(al_map_rgb(0,0,0));*/ al_draw_bitmap(game->loading.image4,0,0,0); //DrawConsole(game); //al_flip_display(); LoadGameState(game); al_draw_bitmap(game->loading.image4,0,0,0); }
void drawLevelQuatro(LevelQuatro *LevelQuatro){ al_draw_bitmap(LevelQuatro->circ_base, 0, 0, 0); al_draw_bitmap(LevelQuatro->circ1, 0, 0, 0); al_draw_bitmap(LevelQuatro->circ2, 0, 0, 0); al_draw_bitmap(LevelQuatro->circ3, 0, 0, 0); if(LevelQuatro->isOn[0])al_draw_bitmap(LevelQuatro->circ4, 0, 0, 0); if(LevelQuatro->isOn[1])al_draw_bitmap(LevelQuatro->circ5, 0, 0, 0); if(LevelQuatro->isOn[2])al_draw_bitmap(LevelQuatro->circ6, 0, 0, 0); if(LevelQuatro->isOn[3])al_draw_bitmap(LevelQuatro->circ7, 0, 0, 0); al_draw_bitmap(LevelQuatro->portas, 0, 0, 0); }
void Animator::DrawBuffer(float x, float y, ALLEGRO_BITMAP* destination) { //FRAME current = AnimationList[cur_anim].GetCurrentFrame(); //std::cout << "Drawing Requested: " << current.column << " : " << current.row << "\n"; al_set_target_bitmap(destination); //al_draw_bitmap_region(framesheet,framew*current.column, frameh*current.row, // framew, frameh,.0f,.0f,0); if(enableBlur || enableColorDecomposition){ al_draw_bitmap(blurBuffer3.GetBitmap(), x, y, 0); al_draw_bitmap(blurBuffer2.GetBitmap(), x, y, 0); al_draw_bitmap(blurBuffer.GetBitmap(), x, y, 0); } al_draw_bitmap(buffer.GetBitmap(), x, y, 0); return; }
void Image::print() { ALLEGRO_DISPLAY *display = al_get_current_display(); switch (mode) { case IMAGE_MODE_DEFAULT: al_draw_bitmap(image, x, y, flag); break; case IMAGE_MODE_FULLSCREEN: al_draw_scaled_bitmap( image, 0, 0, al_get_bitmap_width(image), al_get_bitmap_height(image), 0, 0, al_get_display_width(display), al_get_display_height(display), flag); break; case IMAGE_MODE_REGION: //al_convert_mask_to_alpha(image, al_map_rgb(255,0,255)); al_draw_bitmap_region( image, region_x, region_y, region_w, region_h, x, y, flag); break; } }
void Tile::render() { if (type == TILE_TELEPORT) al_draw_filled_rectangle(x - boundX, y - boundY, x + boundX, y + boundY, al_map_rgb(0, 0, 0)); else al_draw_bitmap(image, x - boundX, y - boundY, 0); }
void Message::Draw(int a_nX, int a_nY) { al_draw_filled_rectangle(a_nX, a_nY, a_nX + 800, a_nY + 60,m_pOwner->m_Color); al_draw_bitmap(m_pImage, a_nX+4, a_nY + 4, 0); al_draw_text(FontManager::GetFont(FONT::TEXT),al_map_rgb(255,255,255),a_nX + 80, a_nY + 10, 0, m_strMessage.c_str()); al_draw_rectangle(a_nX, a_nY, a_nX + 800, a_nY + 60, al_map_rgb(255,255,255), 2); }
void c_minimap::draw(void) { if(!map_list.biome_map) return; al_draw_bitmap(minimap_bitmap, user_config.res_x - user_config.minimap_size, user_config.res_y - user_config.minimap_size, 0); int tempx = bind_to_range(user_config.map_x + (user_config.map_width / 2) , al_get_bitmap_width(map_list.biome_map)); int tempy = bind_to_range(user_config.map_y + (user_config.map_height / 2) , al_get_bitmap_height(map_list.biome_map)); al_draw_line( user_config.res_x - user_config.minimap_size, user_config.res_y - user_config.minimap_size + (tempy * scale), user_config.res_x, user_config.res_y - user_config.minimap_size + (tempy * scale), al_map_rgb(255,0,0), 0); al_draw_line( user_config.res_x - user_config.minimap_size + (tempx * scale), user_config.res_y - user_config.minimap_size, user_config.res_x - user_config.minimap_size + (tempx * scale), user_config.res_y, al_map_rgb(255,0,0), 0); al_draw_rectangle( user_config.res_x - user_config.minimap_size + ((tempx - ((float)user_config.map_width / 2.0)) * scale), user_config.res_y - user_config.minimap_size + ((tempy - ((float)user_config.map_height / 2.0)) * scale), user_config.res_x - user_config.minimap_size + ((tempx + ((float)user_config.map_width / 2.0)) * scale), user_config.res_y - user_config.minimap_size + ((tempy + ((float)user_config.map_height / 2.0)) * scale), al_map_rgb(255,0,0), 0); }
void GameScreen::updateContent(ALLEGRO_EVENT ev) { userPlayer->setStageSpeed(timeIncrementaleValue); speed = speed + timeIncrementaleValue; if(++time % 5 == 0) score++; imageXValue = speed*-2; platformXValue = (800 - speed*2); if (imageXValue < -800) { if(imageXValue < -1600) { imageXValue = 0; if(timeIncrementaleValue <= 8) { timeIncrementaleValue = timeIncrementaleValue + 0.5; } speed = 0; } else al_draw_bitmap(bitmap, (imageXValue+1600), 0, 0); } userPlayer->update(ev, input); obstacles.testForCollision(userPlayer, isPlayerDead); if (isPlayerDead) ScreenManager::GetInstance().addScreen(new DeathScreen(score)); }
void wz_def_draw_image(struct WZ_THEME* theme, float x, float y, float w, float h, ALLEGRO_BITMAP* image) { float ix = x + (w - al_get_bitmap_width(image)) / 2; float iy = y + (h - al_get_bitmap_height(image)) / 2; al_draw_bitmap(image, ix, iy, 0); }
static void Skins_Background_Draw_Center(ALLEGRO_BITMAP *bmp) { const int pos_x = (gui.info.screen.x - al_get_bitmap_width(bmp)) >> 1; const int pos_y = (gui.info.screen.y - al_get_bitmap_height(bmp)) >> 1; Skins_Background_Redraw_Grid(); al_draw_bitmap(bmp, pos_x, pos_y, 0x0000); }
void StartMenu::draw(){ al_draw_bitmap(background, 0, 0, 0); al_draw_rectangle(mouseX-5, mouseY-5, mouseX+5, mouseY+5, al_map_rgb(255,0,0), 5); //testing purposes al_draw_text(font36, al_map_rgb(100,0,100), 25,25,0, "Press Space to make game Lobby"); al_draw_textf(font36, al_map_rgb(100,0,100), 25,60,0, "This is the START MENU."); int tempY = windowHeight/2 - (fontHeight * 2); if(selected == START_GAME_HOST) al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Host game"); else al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Host game"); tempY += fontHeight; if(selected == START_GAME_CLIENT) al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Connect to game"); else al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Connect to game"); tempY += fontHeight; if(selected == HELP) al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Help"); else al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Help"); tempY += fontHeight; if(selected == EXIT) al_draw_text(font36, al_map_rgb(0,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Exit"); else al_draw_text(font36, al_map_rgb(255,0,255), windowWidth/2, tempY, ALLEGRO_ALIGN_CENTRE, "Exit"); }
void Player::draw() { if(weaponPickup != -1 && currentWeaponIndex != -1) { currentWeapon->draw(); } int blackoutAlpha = (int)(((LOSE_TIME - loseTimer)/LOSE_TIME)*255.0f); /* if(blackoutAlpha > 255) { blackoutAlpha = 255; } if(blackoutAlpha < 0) { blackoutAlpha = 0; } */ //This allows the death screen to be shown if (blackoutAlpha > 255 || blackoutAlpha < 0) { blackoutAlpha = 0; } al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); al_draw_filled_rectangle(0, 0, 1280, 720, al_map_rgba(100, 0, 0, blackoutAlpha)); hurtOverlay.setTransparency(health + sin(time*4.0f)*(1.0f-health)/2); hurtOverlay.draw(); al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); if(displayHealthTimer > 0) { for(int i = 0; i < healthpacks; i++) { al_draw_bitmap(healthBitmap, 50.0 + 90*i, 580, 0); } } }
void Tanque::Render(){ ALLEGRO_BITMAP *image = al_load_bitmap("tanque.png"); if(this->inimigo == 0 || this->atingido == 1){ al_draw_bitmap(image,this->posicao_x,this->posicao_y,0); } al_destroy_bitmap(image); }
bool InputField::Print() { al_set_target_bitmap(bmp); al_clear_to_color(bckground_color); float tx = (text_width <= width ? (center == true ? (width - text_width)/2 : 0) : width - text_width); al_draw_text(font, text_color, tx, (height - text_height) / 2.0f, 0, text.c_str()); if(detectingbutton->is_button_clicked() == true) { if(bling > 30) { al_draw_line(tx + text_width -2, (height - text_height) / 2.0f, tx + text_width -2, (height + text_height) / 2.0f, text_color, 2); if(bling > 60) { bling = 0; } } bling++; } al_set_target_backbuffer(al_get_current_display()); al_draw_bitmap(bmp, x1, y1, 0); al_draw_rounded_rectangle(x1, y1, x2, y2, 5, 5, outline_color, 2); return true; }
void Player::render_extra(void) { ResourceManager& rm = ResourceManager::getInstance(); if (lives <= 0) { int w = al_get_bitmap_width(highscoreBitmap); int h = al_get_bitmap_height(highscoreBitmap); al_draw_bitmap(highscoreBitmap, (BB_W-w)/2, (BB_H-h)/2, 0); return; } al_draw_bitmap(icon, 2, 2, 0); ALLEGRO_FONT *small_font = (ALLEGRO_FONT *)rm.getData(RES_SMALLFONT); al_draw_textf(small_font, al_map_rgb(255, 255, 255), 20, 2, 0, "x%d", lives); al_draw_textf(small_font, al_map_rgb(255, 255, 255), 2, 18, 0, "%d", score); }
static void redraw(void) { ALLEGRO_COLOR color; int w = al_get_display_width(display); int h = al_get_display_height(display); int pw = al_get_bitmap_width(picture); int ph = al_get_bitmap_height(picture); int th = al_get_font_line_height(font); float cx = (w - pw) * 0.5; float cy = (h - ph) * 0.5; ALLEGRO_COLOR white = al_map_rgb_f(1, 1, 1); color = al_map_rgb_f(0.8, 0.7, 0.9); al_clear_to_color(color); color = al_map_rgb(255, 0, 0); al_draw_line(0, 0, w, h, color, 0); al_draw_line(0, h, w, 0, color, 0); al_draw_bitmap(picture, cx, cy, 0); al_draw_textf(font, white, w / 2, cy + ph, ALLEGRO_ALIGN_CENTRE, "Press Space to toggle fullscreen"); al_draw_textf(font, white, w / 2, cy + ph + th, ALLEGRO_ALIGN_CENTRE, "Press Enter to toggle window size"); al_draw_textf(font, white, w / 2, cy + ph + th * 2, ALLEGRO_ALIGN_CENTRE, "Window: %dx%d (%s)", al_get_display_width(display), al_get_display_height(display), (al_get_display_flags(display) & ALLEGRO_FULLSCREEN_WINDOW) ? "fullscreen" : "not fullscreen"); al_flip_display(); }
void blocks_draw() { struct listNode *current = first; while (current != NULL) { al_draw_bitmap(current->bitmap, current->x, current->y, 0); current = current->next; } }
void mapper_import_tiles(ALLEGRO_BITMAP * bp) { int i, j; T3F_ANIMATION * ap = NULL; ALLEGRO_BITMAP * newbp = NULL; ALLEGRO_STATE old_state; ALLEGRO_TRANSFORM identity; al_store_state(&old_state, ALLEGRO_STATE_TARGET_BITMAP | ALLEGRO_STATE_BLENDER | ALLEGRO_STATE_TRANSFORM); al_identity_transform(&identity); al_use_transform(&identity); for(i = 0; i < al_get_bitmap_height(bp) / mapper_tile_height; i++) { for(j = 0; j < al_get_bitmap_width(bp) / mapper_tile_width; j++) { ap = t3f_create_animation(); if(ap) { newbp = al_create_bitmap(mapper_tile_width, mapper_tile_height); if(newbp) { al_set_target_bitmap(newbp); al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); al_draw_bitmap(bp, -j * mapper_tile_width, -i * mapper_tile_height, 0); t3f_animation_add_bitmap(ap, newbp); t3f_animation_add_frame(ap, 0, 0, 0, 0, mapper_tile_width, mapper_tile_height, 0, 1, 0); t3f_add_tile(mapper_tileset, ap); } } } } al_restore_state(&old_state); }
/* Converts a display bitmap to a memory bitmap preserving its contents. * Driver specific resources occupied by the display bitmap are freed. * A converted sub bitmap is invalid until its parent is converted. */ void _al_convert_to_memory_bitmap(ALLEGRO_BITMAP *bitmap) { ALLEGRO_BITMAP *tmp; ALLEGRO_STATE backup; size_t old_size; /* Do nothing if it is a memory bitmap already. */ if (bitmap->flags & ALLEGRO_MEMORY_BITMAP) return; if (bitmap->parent) { _al_vector_find_and_delete(&bitmap->display->bitmaps, &bitmap); //al_realloc(bitmap, sizeof(ALLEGRO_BITMAP)); bitmap->display = NULL; bitmap->flags |= ALLEGRO_MEMORY_BITMAP; return; } ALLEGRO_DEBUG("converting display bitmap %p to memory bitmap\n", bitmap); /* Allocate a temporary bitmap which will hold the data * during the conversion process. */ al_store_state(&backup, ALLEGRO_STATE_BITMAP | ALLEGRO_STATE_BLENDER); al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); al_set_new_bitmap_format(bitmap->format); tmp = _al_create_memory_bitmap(bitmap->w, bitmap->h); /* Preserve bitmap contents. */ al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); al_set_target_bitmap(tmp); al_draw_bitmap(bitmap, 0, 0, 0); tmp->cb_excl = bitmap->cb_excl; tmp->cr_excl = bitmap->cr_excl; tmp->cl = bitmap->cl; tmp->ct = bitmap->ct; al_restore_state(&backup); /* Destroy the display bitmap to free driver-specific resources. */ if (bitmap->vt) bitmap->vt->destroy_bitmap(bitmap); _al_vector_find_and_delete(&bitmap->display->bitmaps, &bitmap); /* Do not shrink the bitmap object. This way we can convert back to the * display bitmap. */ /*al_realloc(bitmap, tmp->size); bitmap->size = tmp->size*/ /* Put the contents back to the bitmap. */ old_size = bitmap->size; memcpy(bitmap, tmp, tmp->size); bitmap->size = old_size; al_free(tmp); }
char * input(void) { int count=0; int i=0; char name[15]=""; al_set_target_bitmap(background); al_clear_to_color(al_map_rgb(0,0,0)); al_draw_text(font,al_map_rgb(100,100,100), 640/2+2, 480/4+2,ALLEGRO_ALIGN_CENTRE, "You Got Highscore Enter your name:"); al_draw_text(font,al_map_rgb(255,255,255), 640/2, 480/4,ALLEGRO_ALIGN_CENTRE, "You Got Highscore Enter your name:"); al_register_event_source(event_queue, al_get_keyboard_event_source()); al_set_target_bitmap(al_get_backbuffer(display)); while(1) { ALLEGRO_EVENT ev; al_wait_for_event(event_queue,&ev); al_clear_to_color(al_map_rgb(0,0,0)); al_draw_bitmap(background,0,0,0); al_draw_text(font,al_map_rgb(255,255,255), 640/2, 480,ALLEGRO_ALIGN_CENTRE, name);; al_flip_display(); if(ev.type==ALLEGRO_EVENT_KEY_DOWN) { if(ev.keyboard.keycode==ALLEGRO_KEY_ENTER) { al_play_sample(enter, 1.0, -1.0,1.0,ALLEGRO_PLAYMODE_ONCE,NULL); break; } if(ev.keyboard.keycode==ALLEGRO_KEY_BACKSPACE && i>0) { al_play_sample(_type, 1.0, -1.0,1.0,ALLEGRO_PLAYMODE_ONCE,NULL); i--; name[i]=' '; name[i+1]='\0'; } if(ev.keyboard.keycode>=ALLEGRO_KEY_A && ev.keyboard.keycode<=ALLEGRO_KEY_Z) { al_play_sample(_type, 1.0, -1.0,1.0,ALLEGRO_PLAYMODE_ONCE,NULL); for(count=0; count<26; count++) { if(ev.keyboard.keycode==ALLEGRO_KEY_A+count) { name[i]='A'+count; name[i+1]='\0'; i++; } } } }// End of key detection } // End of while loop level_running=false; game_running=false; return(name); }
void dot_privacy_render(void * data) { APP_INSTANCE * app = (APP_INSTANCE *)data; int i; al_clear_to_color(app->level_color[0]); al_hold_bitmap_drawing(true); dot_bg_objects_render(data); al_draw_bitmap(app->bitmap[DOT_BITMAP_BG], 0, 0, 0); for(i = 0; i < 128; i++) { if(privacy_text[i]) { dot_shadow_text(app->font[DOT_FONT_16], t3f_color_white, al_map_rgba_f(0.0, 0.0, 0.0, 0.5), 8, i * 16, DOT_SHADOW_OX, DOT_SHADOW_OY, 0, privacy_text[i]); } else { break; } } if(!app->desktop_mode) { t3f_render_gui(app->menu[app->current_menu]); } al_hold_bitmap_drawing(false); dot_intro_render_split(data); }
static void SkinFx_UpdateHearts() { // Create a new heart if (RandomInt(60) == 0) gui_applet_blood_create (RandomInt(2), RandomInt(gui.info.screen.x), gui.info.screen.y - gui.info.bars_height); // Floating hearts for (int i = 0; i < MAX_HEARTS; i ++) { t_skinfx_particle* p = &g_skinfx_particles[i]; p->y += p->vy; p->sin_phase += p->sin_speed; p->x = p->ix + p->sin_amp * sinf(p->sin_phase); } // Save old graphics const int w = al_get_bitmap_width(Graphics.Misc.Heart1); const int h = al_get_bitmap_height(Graphics.Misc.Heart1); for (int i = 0; i < MAX_HEARTS; i ++) { t_skinfx_particle* p = &g_skinfx_particles[i]; al_set_target_bitmap(hearts_save[i]); al_draw_bitmap_region(gui_buffer, p->x, p->y, w, h, 0, 0, 0x0000); } // Draw hearts al_set_target_bitmap(gui_buffer); for (int i = 0; i < MAX_HEARTS; i ++) { t_skinfx_particle* p = &g_skinfx_particles[i]; al_draw_bitmap(p->v ? Graphics.Misc.Heart1 : Graphics.Misc.Heart2, p->x, p->y, 0); } }
static void flip(void) { al_set_target_backbuffer(display); al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); al_draw_bitmap(dbuf, 0.0, 0.0, 0); al_flip_display(); }
void Menu::GenerateBackground() { backgroundindex = rand() % 3; if( background == nullptr ) { background = al_create_bitmap( 1024, 512 ); } DISPLAY->SetTarget( background ); int iw = al_get_bitmap_width( GameResources::BackgroundTiles.at(backgroundindex) ); int ih = al_get_bitmap_height( GameResources::BackgroundTiles.at(backgroundindex) ); int bx = 0; int by = 0; al_hold_bitmap_drawing( true ); while( by < 512 ) { while( bx < 1024 ) { al_draw_bitmap( GameResources::BackgroundTiles.at(backgroundindex), bx, by, 0 ); bx += iw; } by += ih; bx = 0; } al_hold_bitmap_drawing( false ); DISPLAY->ClearTarget(); }
void render_playing_state() { // Render the background. al_clear_to_color( al_map_rgb( 105, 230, 255 ) ); for( int i = 0; i < block_map->getLength(); ++i ) { for( int j = 0; j < block_map->getHeight(); ++j ) { if( block_map->getBlock( i, j ).getBlockType() ) { al_draw_bitmap( tiles[ block_map->getBlock( i, j ).getBlockType() - 1 ], i * 32 + GLOBAL_RENDER_OFFSET, j * 32, 0 ); } } } // Rendering code goes here BOOST_FOREACH( m_element tmp, objs ) { ((GameObject*)(tmp.second))->render(); } BOOST_FOREACH( m_element tmp, enemies ) { EnemyObject* enemy = ((EnemyObject*)(tmp.second)); std::cerr << (int)enemy->getID() << " " <<(int)enemy->getX() << std::endl; enemy->render(); }