early-access version 2281

This commit is contained in:
pineappleEA
2021-12-07 02:20:09 +01:00
parent c2ae6d480a
commit c4fa174d53
591 changed files with 36978 additions and 18653 deletions

View File

@@ -16,6 +16,8 @@
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
@@ -28,5 +30,7 @@
<string>iOS Launch Screen</string>
<key>UISupportedInterfaceOrientations</key>
<array/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>

View File

@@ -58,7 +58,7 @@ render(SDL_Renderer *renderer, int w, int h, double deltaTime)
ay * SDL_IPHONE_MAX_GFORCE / SINT16_MAX * GRAVITY_CONSTANT *
deltaMilliseconds;
speed = sqrt(shipData.vx * shipData.vx + shipData.vy * shipData.vy);
speed = SDL_sqrt(shipData.vx * shipData.vx + shipData.vy * shipData.vy);
if (speed > 0) {
/* compensate for friction */

View File

@@ -109,7 +109,7 @@ stepParticles(double deltaTime)
}
} else {
float speed =
sqrt(curr->xvel * curr->xvel + curr->yvel * curr->yvel);
SDL_sqrt(curr->xvel * curr->xvel + curr->yvel * curr->yvel);
/* if wind resistance is not powerful enough to stop us completely,
then apply winde resistance, otherwise just stop us completely */
if (WIND_RESISTANCE * deltaMilliseconds < speed) {
@@ -194,15 +194,15 @@ explodeEmitter(struct particle *emitter)
/* come up with a random angle and speed for new particle */
float theta = randomFloat(0, 2.0f * 3.141592);
float exponent = 3.0f;
float speed = randomFloat(0.00, powf(0.17, exponent));
speed = powf(speed, 1.0f / exponent);
float speed = randomFloat(0.00, SDL_powf(0.17, exponent));
speed = SDL_powf(speed, 1.0f / exponent);
/* select the particle at the end of our array */
struct particle *p = &particles[num_active_particles];
/* set the particles properties */
p->xvel = speed * cos(theta);
p->yvel = speed * sin(theta);
p->xvel = speed * SDL_cos(theta);
p->yvel = speed * SDL_sin(theta);
p->x = emitter->x + emitter->xvel;
p->y = emitter->y + emitter->yvel;
p->isActive = 1;
@@ -297,7 +297,7 @@ spawnEmitterParticle(GLfloat x, GLfloat y)
p->y = screen_h;
/* set velocity so that terminal point is (x,y) */
p->xvel = 0;
p->yvel = -sqrt(2 * ACCEL * (screen_h - y));
p->yvel = -SDL_sqrt(2 * ACCEL * (screen_h - y));
/* set other attributes */
p->size = 10 * pointSizeScale;
p->type = emitter;

View File

@@ -111,7 +111,7 @@ loadSound(const char *file, struct sound *s)
if (SDL_ConvertAudio(&cvt) == -1) { /* convert the sound */
fatalError("could not convert .wav");
}
SDL_free(s->buffer); /* free the original (unconverted) buffer */
SDL_free(s->buffer); /* Free the original (unconverted) buffer */
s->buffer = cvt.buf; /* point sound buffer to converted buffer */
s->length = cvt.len_cvt; /* set sound buffer's new length */
}

View File

@@ -21,7 +21,7 @@ void
drawLine(SDL_Renderer *renderer, float startx, float starty, float dx, float dy)
{
float distance = sqrt(dx * dx + dy * dy); /* length of line segment (pythagoras) */
float distance = SDL_sqrt(dx * dx + dy * dy); /* length of line segment (pythagoras) */
int iterations = distance / PIXELS_PER_ITERATION + 1; /* number of brush sprites to draw for the line */
float dx_prime = dx / iterations; /* x-shift per iteration */
float dy_prime = dy / iterations; /* y-shift per iteration */
@@ -81,6 +81,7 @@ main(int argc, char *argv[])
SDL_Event event;
SDL_Window *window; /* main window */
SDL_Renderer *renderer;
SDL_Texture *target;
int done; /* does user want to quit? */
int w, h;
@@ -100,29 +101,38 @@ main(int argc, char *argv[])
initializeTexture(renderer);
/* fill canvass initially with all black */
target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, w, h);
SDL_SetRenderTarget(renderer, target);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
SDL_SetRenderTarget(renderer, NULL);
done = 0;
while (!done && SDL_WaitEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
done = 1;
break;
case SDL_MOUSEMOTION:
state = SDL_GetMouseState(&x, &y); /* get its location */
SDL_GetRelativeMouseState(&dx, &dy); /* find how much the mouse moved */
if (state & SDL_BUTTON_LMASK) { /* is the mouse (touch) down? */
drawLine(renderer, x - dx, y - dy, dx, dy); /* draw line segment */
SDL_RenderPresent(renderer);
while (!done) {
while (SDL_PollEvent(&event) == 1) {
switch (event.type) {
case SDL_QUIT:
done = 1;
break;
case SDL_MOUSEMOTION:
state = SDL_GetMouseState(&x, &y); /* get its location */
SDL_GetRelativeMouseState(&dx, &dy); /* find how much the mouse moved */
if (state & SDL_BUTTON_LMASK) { /* is the mouse (touch) down? */
SDL_SetRenderTarget(renderer, target);
drawLine(renderer, x - dx, y - dy, dx, dy); /* draw line segment */
SDL_SetRenderTarget(renderer, NULL);
}
break;
}
break;
}
SDL_RenderCopy(renderer, target, NULL, NULL);
SDL_RenderPresent(renderer);
}
/* cleanup */
SDL_DestroyTexture(brush);
SDL_DestroyTexture(target);
SDL_Quit();
return 0;