void sceneShow::run_viewpoint_scene(CURRENT_FILE_FORMAT::file_scene_show_viewpoint viewpoint) { std::cout << "** sceneShow::run_image_scene::START" << std::endl; float x = viewpoint.ini_x; float y = viewpoint.ini_y; graphicsLib_gSurface image; graphLib.surfaceFromFile(FILEPATH + "images/scenes/" + viewpoint.filename, &image); //std::cout << "** sceneShow::run_image_scene::total_dist: " << total_dist << std::endl; while (total_dist > 0) { input.read_input(); //std::cout << "total_dist: " << total_dist << std::endl; timer.delay(viewpoint.move_delay); std::cout << "rect - x[" << x << "], .y[" << y << "], w[" << viewpoint.w << "], h[" << viewpoint.h << "]" << std::endl; //void graphicsLib::showSurfacePortion(graphicsLib_gSurface *surfaceOrigin, const st_rectangle origin_rect, st_rectangle destiny_rect) graphLib.showSurfacePortion(&image, st_rectangle(x, y, viewpoint.w, viewpoint.h), st_rectangle(viewpoint.pos_x, viewpoint.pos_y, viewpoint.w, viewpoint.h)); graphLib.updateScreen(); x += speed_x; y += speed_y; total_dist--; } graphLib.showSurfacePortion(&image, st_rectangle(x, y, viewpoint.w, viewpoint.h), st_rectangle(viewpoint.pos_x, viewpoint.pos_y, viewpoint.w, image.height)); timer.delay(viewpoint.move_delay); graphLib.updateScreen(); }
void gfx_sin_wave::show(int x, int y) { float angle_max = 3.14 * SIN_STEPS; float angle_step = angle_max / surface->width; float angle = 0; for (int j=0; j<max_amplitude; j++) { graphLib.clear_area(x, y, surface->width, surface->height, 0, 0, 0); for (int i=0; i<surface->height; i++) { float pos_x = (sin(angle) + x)*amplitude; int pos_y = i + y; angle += angle_step; //std::cout << "i[" << i << "], pos_x[" << pos_x << "], pos_y[" << pos_y << "]" << std::endl; graphLib.showSurfacePortion(surface, st_rectangle(0, i, surface->width, 1), st_rectangle(pos_x, pos_y, surface->width, 1)); } amplitude--; graphLib.updateScreen(); timer.delay(40); } }