Skip to content

Instantly share code, notes, and snippets.

@jorarmarfin
Last active October 9, 2024 03:36
Show Gist options
  • Save jorarmarfin/bb7dcdb404e9bf921981e2213929adbe to your computer and use it in GitHub Desktop.
Save jorarmarfin/bb7dcdb404e9bf921981e2213929adbe to your computer and use it in GitHub Desktop.
Mini win y movimiento
#include "miniwin.h"
using namespace miniwin;
const int ANCHO = 600;
const int ALTO = 600;
void barra(int x, int y, int ancho, int largo){
color(VERDE);
for(int i=x; i<x+largo; i+=10){
espera(50);
rectangulo_lleno(i,y-ancho/2,i+10,y+ancho/2);
refresca();
}
}
void Tierra(int x, int y,double radio){
color(AZUL);
circulo_lleno(x,y,radio);
}
void Orbita(int centro_x, int centro_y, int radio_mayor, int radio_menor) {
color(VERDE);
for (double angulo = 0; angulo < 2 * M_PI; angulo += 0.01) {
int x = centro_x + (radio_mayor * cos(angulo));
int y = centro_y + (radio_menor * sin(angulo));
punto(x, y);
}
}
void Luna(int centro_x, int centro_y, int radio_mayor, int radio_menor){
for (double angulo = 0; angulo < 2 * M_PI; angulo += 0.01) {
borra();
int x = centro_x + (radio_mayor * cos(angulo));
int y = centro_y + (radio_menor * sin(angulo));
color(ROJO);
circulo_lleno(x, y,25);
refresca();
espera(10);
}
circulo_lleno(200,100,20);
}
void Luna2(int centro_x, int centro_y, int longitud){
for (int i = 0; i < longitud; ++i) {
color(ROJO);
circulo_lleno(centro_x+i,centro_y,25);
refresca();
espera(10);
borra();
}
circulo_lleno(200,100,20);
}
int main(){
vredimensiona(ANCHO,ALTO);
barra(100,300,20,400);
refresca();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment