MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / SetCursor

Method SetCursor

Source/Graphics/Cursor.cpp:53–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void GameCursor::SetCursor(_cursor_type t) {
54 // std::pair<int, int> dimensions;
55 switch (t) {
56 case DEFAULT_CURSOR:
57 if (!default_cursor_asset.valid()) {
58 default_cursor_asset = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>("Data/Textures/Cursors/cursor_nocompress.png", PX_SRGB | PX_NOREDUCE, 0x0);
59 }
60 m_texture_ref = default_cursor_asset->GetTextureRef();
61 m_type = DEFAULT_CURSOR;
62 m_offset_x = 12;
63 m_offset_y = 15;
64 m_size = 32.0f;
65 break;
66 case TRANSLATE_CURSOR:
67 if (!translate_cursor_asset.valid()) {
68 translate_cursor_asset = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>("Data/Textures/Cursors/translate_nocompress.png", PX_SRGB | PX_NOREDUCE, 0x0);
69 }
70 m_texture_ref = translate_cursor_asset->GetTextureRef();
71 m_type = TRANSLATE_CURSOR;
72 m_size = 32.0f;
73 m_offset_x = 12;
74 m_offset_y = 15;
75 break;
76 case SCALE_CURSOR:
77 if (!scale_cursor_asset.valid()) {
78 scale_cursor_asset = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>("Data/Textures/Cursors/scale_nocompress.png", PX_SRGB | PX_NOREDUCE, 0x0);
79 }
80 m_texture_ref = scale_cursor_asset->GetTextureRef();
81 m_type = SCALE_CURSOR;
82 m_size = 32.0f;
83 m_offset_x = 12;
84 m_offset_y = 15;
85 break;
86 case ROTATE_CURSOR:
87 if (!rotate_cursor_asset.valid()) {
88 rotate_cursor_asset = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>("Data/Textures/Cursors/rotate_nocompress.png", PX_SRGB | PX_NOREDUCE, 0x0);
89 }
90 m_texture_ref = rotate_cursor_asset->GetTextureRef();
91 m_type = ROTATE_CURSOR;
92 m_size = 32.0f;
93 m_offset_x = 12;
94 m_offset_y = 15;
95 break;
96 case ROTATE_CIRCLE_CURSOR:
97 if (!rotate_circle_cursor_asset.valid()) {
98 rotate_circle_cursor_asset = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>("Data/Textures/Cursors/rotate_circle_nocompress.png", PX_SRGB | PX_NOREDUCE, 0x0);
99 }
100 m_texture_ref = rotate_circle_cursor_asset->GetTextureRef();
101 m_type = ROTATE_CIRCLE_CURSOR;
102 m_size = 36.0f;
103 m_offset_x = m_offset_y = 0;
104 break;
105 case ADD_CURSOR:
106 if (!add_cursor_asset.valid()) {
107 add_cursor_asset = Engine::Instance()->GetAssetManager()->LoadSync<TextureAsset>("Data/Textures/Cursors/plus_nocompress.png", PX_SRGB | PX_NOREDUCE, 0x0);
108 }
109 m_texture_ref = add_cursor_asset->GetTextureRef();
110 m_type = ADD_CURSOR;

Callers 6

UpdateMethod · 0.45
InitializeMethod · 0.45
UpdateCursorMethod · 0.45
GetRotationFunction · 0.45
UpdateCursorMethod · 0.45
HandleSunRotateMethod · 0.45

Calls 3

GetAssetManagerMethod · 0.80
GetTextureRefMethod · 0.80
validMethod · 0.45

Tested by

no test coverage detected