-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathImages.cpp
52 lines (40 loc) · 1.06 KB
/
Images.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "s3e.h"
#include "Iw2D.h"
#include <stdio.h>
// Main entry point for the application
int main()
{
// Initialise Iw2D
Iw2DInit();
// Get surface width and height
int surface_width = Iw2DGetSurfaceWidth();
int surface_height = Iw2DGetSurfaceHeight();
// Rotation angle of rectangle
float angle = 0;
// Load the ball image
CIw2DImage* image1 = Iw2DCreateImage("ball.png");
// Wait for a quit request from the host OS
while (!s3eDeviceCheckQuitRequest())
{
// Clear background to blue
Iw2DSurfaceClear(0xff8080);
// Set up a transform
CIwFMat2D mat;
mat.SetRot(angle);
mat.ScaleRot(2.0f);
mat.SetTrans(CIwFVec2((float)surface_width / 2, (float)surface_height / 2));
Iw2DSetTransformMatrix(mat);
angle += 0.01f;
// Draw the ball
Iw2DDrawImage(image1, CIwFVec2(-image1->GetWidth() / 2, -image1->GetHeight() / 2));
// Flip the surface buffer to screen
Iw2DSurfaceShow();
// Sleep to allow the OS to process events etc.
s3eDeviceYield(0);
}
// Clean-up images
delete image1;
// Shut down Iw2D
Iw2DTerminate();
return 0;
}