趣味で作ってるロボット用ソフトウェア
 All Classes Files Functions Enumerations Enumerator Friends Pages
image_surface_example.cpp

Image_surface の動作サンプル

#include <SDL.h>
#include "Main_window.h"
#include "View.h"
#include "Scene.h"
#include "Layer.h"
#include "Label.h"
#include "Image_surface.h"
#include "delay.h"
using namespace hrk;
int main(int argc, char *argv[])
{
static_cast<void>(argc);
static_cast<void>(argv);
Main_window main_window;
main_window.show(SizeF(640, 480));
View view(main_window);
Scene* scene = view.front();
Layer* layer = scene->front();
Image_surface png_surface("png_image.png");
Image_surface jpg_surface("jpg_image.jpg");
Label png_label(&png_surface);
Label png_label_2nd(&png_surface);
Label jpg_label(&jpg_surface);
Label jpg_label_2nd(&jpg_surface);
layer->push_front(&png_label);
layer->push_front(&jpg_label);
layer->push_front(&png_label_2nd);
layer->push_front(&jpg_label_2nd);
int image_width = png_label.width();
png_label_2nd.set_position(PointF(100, 100));
jpg_label.set_position(PointF(image_width, 0));
jpg_label_2nd.set_position(PointF(100 + image_width, 100));
view.redraw();
view.redraw();
delay_sec(1.5);
return 0;
}