DSC Engine
Loading...
Searching...
No Matches
include
DSCEngine
sprites
obj_size.hpp
1
#pragma once
2
3
#include "DSCEngine/types/size.hpp"
4
5
namespace
DSC
6
{
10
enum
ObjSize
11
{
12
SIZE_8x8 = 0,
13
SIZE_16x16 = 1,
14
SIZE_32x32 = 2,
15
SIZE_64x64 = 3,
16
SIZE_16x8 = 4,
17
SIZE_32x8 = 5,
18
SIZE_32x16 = 6,
19
SIZE_64x32 = 7,
20
SIZE_8x16 = 8,
21
SIZE_8x32 = 9,
22
SIZE_16x32 = 10,
23
SIZE_32x64 = 11
24
};
25
30
inline
static
Size<int> obj_get_size(ObjSize objsize)
31
{
32
int
val = (int)objsize;
33
int
shape = val/4;
34
int
sz = val & 3;
35
36
if
(shape==0)
37
{
38
sz = 8<<sz;
39
return
{sz, sz};
40
}
41
42
int
d1 = sz<2 ? sz+1 : sz;
43
int
d2 = sz<1 ? sz+1 : sz;
44
45
if
(shape==1)
46
return
{8*(1<<d1), 4<<d2};
47
else
48
return
{4<<d2, 8*(1<<d1)};
49
}
50
}
Generated by
1.9.5