Skip to content

Commit e06800b

Browse files
committed
Remove some C garbage.
1 parent 5987145 commit e06800b

File tree

1 file changed

+17
-17
lines changed
  • native-activity/app/src/main/cpp

1 file changed

+17
-17
lines changed

native-activity/app/src/main/cpp/main.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct SavedState {
7777
* Shared state for our app.
7878
*/
7979
struct Engine {
80-
struct android_app* app;
80+
android_app* app;
8181

8282
ASensorManager* sensorManager;
8383
const ASensor* accelerometerSensor;
@@ -89,7 +89,7 @@ struct Engine {
8989
EGLContext context;
9090
int32_t width;
9191
int32_t height;
92-
struct SavedState state;
92+
SavedState state;
9393

9494
void CreateSensorListener(ALooper_callbackFunc callback) {
9595
CHECK_NOT_NULL(app);
@@ -109,7 +109,7 @@ struct Engine {
109109
/**
110110
* Initialize an EGL context for the current display.
111111
*/
112-
static int engine_init_display(struct Engine* engine) {
112+
static int engine_init_display(Engine* engine) {
113113
// initialize OpenGL ES and EGL
114114

115115
/*
@@ -209,7 +209,7 @@ static int engine_init_display(struct Engine* engine) {
209209
/**
210210
* Just the current frame in the display.
211211
*/
212-
static void engine_draw_frame(struct Engine* engine) {
212+
static void engine_draw_frame(Engine* engine) {
213213
if (engine->display == nullptr) {
214214
// No display.
215215
return;
@@ -226,7 +226,7 @@ static void engine_draw_frame(struct Engine* engine) {
226226
/**
227227
* Tear down the EGL context currently associated with the display.
228228
*/
229-
static void engine_term_display(struct Engine* engine) {
229+
static void engine_term_display(Engine* engine) {
230230
if (engine->display != EGL_NO_DISPLAY) {
231231
eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
232232
EGL_NO_CONTEXT);
@@ -247,9 +247,9 @@ static void engine_term_display(struct Engine* engine) {
247247
/**
248248
* Process the next input event.
249249
*/
250-
static int32_t engine_handle_input(struct android_app* app,
250+
static int32_t engine_handle_input(android_app* app,
251251
AInputEvent* event) {
252-
auto* engine = (struct Engine*)app->userData;
252+
auto* engine = (Engine*)app->userData;
253253
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
254254
engine->animating = 1;
255255
engine->state.x = AMotionEvent_getX(event, 0);
@@ -262,14 +262,14 @@ static int32_t engine_handle_input(struct android_app* app,
262262
/**
263263
* Process the next main command.
264264
*/
265-
static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
266-
auto* engine = (struct Engine*)app->userData;
265+
static void engine_handle_cmd(android_app* app, int32_t cmd) {
266+
auto* engine = (Engine*)app->userData;
267267
switch (cmd) {
268268
case APP_CMD_SAVE_STATE:
269269
// The system has asked us to save our current state. Do so.
270-
engine->app->savedState = malloc(sizeof(struct SavedState));
271-
*((struct SavedState*)engine->app->savedState) = engine->state;
272-
engine->app->savedStateSize = sizeof(struct SavedState);
270+
engine->app->savedState = malloc(sizeof(SavedState));
271+
*((SavedState*)engine->app->savedState) = engine->state;
272+
engine->app->savedStateSize = sizeof(SavedState);
273273
break;
274274
case APP_CMD_INIT_WINDOW:
275275
// The window is being shown, get it ready.
@@ -311,7 +311,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
311311

312312
int OnSensorEvent(int /* fd */, int /* events */, void* data) {
313313
CHECK_NOT_NULL(data);
314-
Engine* engine = reinterpret_cast<struct Engine*>(data);
314+
Engine* engine = reinterpret_cast<Engine*>(data);
315315

316316
CHECK_NOT_NULL(engine->accelerometerSensor);
317317
ASensorEvent event;
@@ -332,8 +332,8 @@ int OnSensorEvent(int /* fd */, int /* events */, void* data) {
332332
* android_native_app_glue. It runs in its own thread, with its own
333333
* event loop for receiving input events and doing other things.
334334
*/
335-
void android_main(struct android_app* state) {
336-
struct Engine engine {};
335+
void android_main(android_app* state) {
336+
Engine engine {};
337337

338338
memset(&engine, 0, sizeof(engine));
339339
state->userData = &engine;
@@ -346,15 +346,15 @@ void android_main(struct android_app* state) {
346346

347347
if (state->savedState != nullptr) {
348348
// We are starting with a previous saved state; restore from it.
349-
engine.state = *(struct SavedState*)state->savedState;
349+
engine.state = *(SavedState*)state->savedState;
350350
}
351351

352352
// loop waiting for stuff to do.
353353

354354
while (true) {
355355
// Read all pending events.
356356
int events;
357-
struct android_poll_source* source;
357+
android_poll_source* source;
358358

359359
// If not animating, we will block forever waiting for events.
360360
// If animating, we loop until all events are read, then continue

0 commit comments

Comments
 (0)