Skip to content

Instantly share code, notes, and snippets.

@jorarmarfin
Created October 14, 2024 13:54
Show Gist options
  • Save jorarmarfin/ecdd02e59b5e7a1116904daed80d50fe to your computer and use it in GitHub Desktop.
Save jorarmarfin/ecdd02e59b5e7a1116904daed80d50fe to your computer and use it in GitHub Desktop.
#include "miniwin.h"
#include "cmath"
using namespace miniwin;
void Cabecera(const char* titulo) {
color(AZUL);
rectangulo(10, 10, 690, 50);
color(VERDE);
texto(25, 35, titulo);
}
void enterprise(int y_offset) {
// Cuerpo principal de la nave
color(BLANCO);
rectangulo_lleno(300, 300 + y_offset, 400, 350 + y_offset);
// Cabina de la nave
color(AZUL);
circulo_lleno(350, 280 + y_offset, 30);
// Alas laterales
color(ROJO);
rectangulo_lleno(270, 320 + y_offset, 300, 340 + y_offset); // Ala izquierda
rectangulo_lleno(400, 320 + y_offset, 430, 340 + y_offset); // Ala derecha
// Propulsor
color(VERDE);
rectangulo_lleno(340, 350 + y_offset, 360, 380 + y_offset);
}
int main() {
vredimensiona(700, 630);
Cabecera("NAVE ESPACIAL");
int y_offset = 0;
int tecla;
do {
borra();
Cabecera("NAVE ESPACIAL");
enterprise(y_offset);
refresca();
tecla = miniwin::tecla();
if (tecla == ARRIBA && y_offset > -250) {
y_offset -= 10;
} else if (tecla == ABAJO && y_offset < 250) {
y_offset += 10;
}
espera(30); // Pausa para evitar parpadeo
} while (tecla != ESCAPE);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment