MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / init_system_cursor

Function init_system_cursor

deps/SDL2/test/testcustomcursor.c:100–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100static SDL_Cursor*
101init_system_cursor(const char *image[])
102{
103 int i, row, col;
104 Uint8 data[4*32];
105 Uint8 mask[4*32];
106 int hot_x, hot_y;
107
108 i = -1;
109 for (row=0; row<32; ++row) {
110 for (col=0; col<32; ++col) {
111 if (col % 8) {
112 data[i] <<= 1;
113 mask[i] <<= 1;
114 } else {
115 ++i;
116 data[i] = mask[i] = 0;
117 }
118 switch (image[4+row][col]) {
119 case 'X':
120 data[i] |= 0x01;
121 mask[i] |= 0x01;
122 break;
123 case '.':
124 mask[i] |= 0x01;
125 break;
126 case ' ':
127 break;
128 }
129 }
130 }
131 sscanf(image[4+row], "%d,%d", &hot_x, &hot_y);
132 return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);
133}
134
135static SDLTest_CommonState *state;
136int done;

Callers 1

mainFunction · 0.85

Calls 2

sscanfFunction · 0.85
SDL_CreateCursorFunction · 0.85

Tested by

no test coverage detected