414
Sistemas Operativos / GNU/Linux / Re: [Consulta] Descarga .ISO Linux
en: 26 Junio 2015, 13:44 pm
Acabo de descargar linux mint mediante utorrent y no me aparece el .ISO me aparece el contenido:
¿Está bien la descarga o no?
En caso de estar bien ya lo boteo e usb, pero es raro no me aparece ningún ejecutable :S
Saludos!
415
Sistemas Operativos / GNU/Linux / Re: [Consulta] Descarga .ISO Linux
en: 26 Junio 2015, 13:02 pm
Estoy probando a descargar la distribución linux mint, ¿es buena y se puede hacer de todo en ella? Es para instalarlo en partición.
- ¿cuántos MB necesitaría para crear la partición de linux mint?
*Nunca he usado utorrent pero se está descargando correctamente:
Gracias.
Saludos!
416
Programación / Programación C/C++ / Re: [SFML] Rebote de colisión
en: 26 Junio 2015, 02:09 am
De igual modo al colocar (.top):
if ( rec.getPosition ( ) .x <= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x - 1 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x >= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x + 1 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y <= rect2.top ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y - 1 ) ;
}
if ( rec.getPosition ( ) .y >= rect2.top ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y + 1 ) ;
}
Me da el mismo error que muestra al comenzar el vídeo, intento chocar con la figura pero al chocar se desplaza sola cuando se debería estar quieta sin poder avanzar más hasta que yo cambie de movimiento.
if ( rec.getPosition ( ) .y <= rect2.top ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y - 1 ) ;
}
if ( rec.getPosition ( ) .y >= rect2.top ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y + 1 ) ;
}
Referente a:
Una opción, es, en el código de movimiento, tras moverse, comprobar con intersecs(). En caso verdadero, deshaces el movimiento. Es una forma muy simple, pero efectiva en casos también simples. ¿Te refieres a crear una función?
Saludos!
417
Sistemas Operativos / GNU/Linux / [Consulta] Descarga .ISO Linux
en: 26 Junio 2015, 01:32 am
Buenas, Tengo una pequeña duda y es la siguiente:- ¿Por qué al descargar una distribución de linux en vez de descargarme el .ISO me descarga una carpeta con los archivos y no el .ISO? Me ha pasado al descargar Ubuntu y Elementary OS. (Entre uno de los archivos me aparece una carpeta llamada boot, etc... como si fuera el .ISO descomprimido)
* Aclarado esto si me pudiesen proporcionar el links de descarga de la distribución Linux Mint que descargue el .ISO para bootearlo en PenDrive. (Menciono Linux Mint por que he escuchado que no está nada mal y cumple con todos los requisitos) Sean bienvenidas todas las respuestas que me ofrezcan. Gracias.Saludos!
418
Programación / Programación C/C++ / Re: [SFML] Rebote de colisión
en: 26 Junio 2015, 01:21 am
#ACTUALIZACIÓN Acabo de probar otra forma que da resultado por una parte, pero por la otra no.
Si voy de izquierda a derecha colisiona y no puede avanzar "bien", si voy de derecha a izquierda colisiona y no puede avanzar "bien", eso si quitamos la colisión de "y". Y si añado la colisión de "y" se desplaza el rectángulo a los lados como se ve al principio del siguiente vídeo:
VIDEO Código al que hago referencia en el vídeo:
sf:: FloatRect rect = rec.getGlobalBounds ( ) ;
sf:: FloatRect rect2 = rec2.getGlobalBounds ( ) ;
if ( rect.intersects ( rect2) ) {
if ( rec.getPosition ( ) .x <= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x - 1 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x >= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x + 1 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y <= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y - 1 ) ;
}
if ( rec.getPosition ( ) .y >= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y + 1 ) ;
}
}
Por una parte parece que funciona:
if ( rec.getPosition ( ) .x <= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x - 1 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x >= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x + 1 , rec.getPosition ( ) .y ) ;
}
Ya que colisionan y no pueden avanzar bien, eso si están solo estas funciones.
Si añado las demás funciones que hace referencia a "y" ya al colisionar se desplaza solo.
f( rec.getPosition ( ) .x <= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x - 1 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x >= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x + 1 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y <= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y - 1 ) ;
}
if ( rec.getPosition ( ) .y >= rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y + 1 ) ;
}
Saludos!
419
Programación / Programación C/C++ / Re: [SFML] Rebote de colisión
en: 25 Junio 2015, 23:28 pm
Probé como me dijiste y por una parte responde bien entre sí...
De nuevo un corto vídeo del funcionamiento.
Solo funciona si voy de izquierda a derecha. <-->
VIDEO #include <SFML/Graphics.hpp>
#include <iostream>
int main( ) {
//Creamos la ventana
sf:: RenderWindow window( sf:: VideoMode ( 800 , 600 ) , "Colision" ) ;
//Rectangualo
sf:: RectangleShape rec( sf:: Vector2f ( 50 , 50 ) ) ;
rec.setFillColor ( sf:: Color :: Cyan ) ;
//Otro rectangulo
sf:: RectangleShape rec2( sf:: Vector2f ( 50 , 50 ) ) ;
rec2.setFillColor ( sf:: Color :: Magenta ) ;
rec2.setPosition ( 400 , 300 ) ;
window.setFramerateLimit ( 200 ) ;
//Si la ventana está abierta
while ( window.isOpen ( ) ) {
//Creamos un evento
sf:: Event ventana;
//Llamamos a los eventos
while ( window.pollEvent ( ventana) ) {
//Cerramos la ventana cuando se solicite
if ( ventana.type == sf:: Event :: Closed ) {
window.close ( ) ;
}
}
//Movimiento rectangulo
if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Up ) ) {
rec.move ( 0 , - 1 ) ;
}
if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Down ) ) {
rec.move ( 0 , 1 ) ;
}
if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Left ) ) {
rec.move ( - 1 , 0 ) ;
}
if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Right ) ) {
rec.move ( 1 , 0 ) ;
}
//Colisiones
if ( rec.getPosition ( ) .x < 0 ) {
rec.setPosition ( 0 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x > 750 ) {
rec.setPosition ( 750 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y < 0 ) {
rec.setPosition ( rec.getPosition ( ) .x , 0 ) ;
}
if ( rec.getPosition ( ) .y > 550 ) {
rec.setPosition ( rec.getPosition ( ) .x , 550 ) ;
}
sf:: FloatRect rect = rec.getGlobalBounds ( ) ;
sf:: FloatRect rect2 = rec2.getGlobalBounds ( ) ;
if ( rect.intersects ( rect2) ) {
if ( rec.getPosition ( ) .x == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x - 50 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x + 50 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y - 50 ) ;
}
if ( rec.getPosition ( ) .y == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y + 50 ) ;
}
}
//Limpiamos ventana
window.clear ( ) ;
//Dibujamos el rectangulo
window.draw ( rec) ;
window.draw ( rec2) ;
//Actualizamos ventana
window.display ( ) ;
}
}
Parte que modifiqué:
if ( rect.intersects ( rect2) ) {
if ( rec.getPosition ( ) .x == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x - 50 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x + 50 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y - 50 ) ;
}
if ( rec.getPosition ( ) .y == rect2.left ) {
rec.setPosition ( rec.getPosition ( ) .x , rec.getPosition ( ) .y + 50 ) ;
}
}
Gracias.
Saludos!
420
Programación / Programación C/C++ / Re: [SFML] Rebote de colisión
en: 25 Junio 2015, 16:08 pm
He probado tu forma pero no funcionaba y al igual con tu idea intente hacer algo similar haber si funcionaba al principio parecía que iba a funcionar pero al final no.
Probé con algo así:
sf:: FloatRect rect = rec.getGlobalBounds ( ) ;
sf:: FloatRect rect2 = rec2.getGlobalBounds ( ) ;
if ( rect.intersects ( rect2) ) {
if ( rec.getPosition ( ) .x < rect2.left ) {
rec.setPosition ( rec2.getPosition ( ) .x - 50 , rec2.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x > rect2.left ) {
rec.setPosition ( rec2.getPosition ( ) .x + 50 , rec2.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y < rect2.left ) {
rec.setPosition ( rec2.getPosition ( ) .x , rec2.getPosition ( ) .y - 50 ) ;
}
if ( rec.getPosition ( ) .y > rect2.left ) {
rec.setPosition ( rec2.getPosition ( ) .x , rec2.getPosition ( ) .y + 50 ) ;
}
}
Puse rect2.left ya que tenia que declararla y no valía rec2.left Disculpa que te esté dando trabajo, te agradezco la mano que intentas echarme. He estado buscando información y tal y encontré alguna otra forma también posible de hacerlo:
#include <SFML/Graphics.hpp>
#include <iostream>
void comprobarIntersecta( ) ;
int main( ) {
//Creamos la ventana
sf:: RenderWindow window( sf:: VideoMode ( 800 , 600 ) , "Colision" ) ;
//Rectangualo
sf:: RectangleShape rec( sf:: Vector2f ( 50 , 50 ) ) ;
rec.setFillColor ( sf:: Color :: Cyan ) ;
//Otro rectangulo
sf:: RectangleShape rec2( sf:: Vector2f ( 50 , 50 ) ) ;
rec2.setFillColor ( sf:: Color :: Magenta ) ;
rec2.setPosition ( 400 , 300 ) ;
window.setFramerateLimit ( 200 ) ;
//Si la ventana está abierta
while ( window.isOpen ( ) ) {
//Creamos un evento
sf:: Event ventana;
//Llamamos a los eventos
while ( window.pollEvent ( ventana) ) {
//Cerramos la ventana cuando se solicite
if ( ventana.type == sf:: Event :: Closed ) {
window.close ( ) ;
}
}
//Colisiones ventana bordes
if ( rec.getPosition ( ) .x < 0 ) {
rec.setPosition ( 0 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .x > 750 ) {
rec.setPosition ( 750 , rec.getPosition ( ) .y ) ;
}
if ( rec.getPosition ( ) .y < 0 ) {
rec.setPosition ( rec.getPosition ( ) .x , 0 ) ;
}
if ( rec.getPosition ( ) .y > 550 ) {
rec.setPosition ( rec.getPosition ( ) .x , 550 ) ;
}
sf:: FloatRect rect = rec.getGlobalBounds ( ) ;
sf:: FloatRect rect2 = rec2.getGlobalBounds ( ) ;
bool chocar [ 4 ] = { false ,false ,false ,false } ; //Norte, sur, este y oeste
if ( rect.intersects ( rect2) ) {
comprobarIntersecta( ) ;
}
if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Up ) ) {
if ( ! chocar[ 0 ] )
rec.move ( 0 , - 1 ) ;
}
else if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Down ) ) {
if ( ! chocar[ 1 ] )
rec.move ( 0 , 1 ) ;
}
else if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Left ) ) {
if ( ! chocar[ 2 ] )
rec.move ( - 1 , 0 ) ;
}
else if ( sf:: Keyboard :: isKeyPressed ( sf:: Keyboard :: Right ) ) {
if ( ! chocar[ 3 ] )
rec.move ( 1 , 0 ) ;
}
//Limpiamos ventana
window.clear ( ) ;
//Dibujamos el rectangulo
window.draw ( rec) ;
window.draw ( rec2) ;
//Actualizamos ventana
window.display ( ) ;
}
}
void comprobarIntersecta( ) {
sf:: RectangleShape rec( sf:: Vector2f ( 50 , 50 ) ) ;
rec.setFillColor ( sf:: Color :: Cyan ) ;
if ( rec.getPosition ( ) .x < 400 ) {
chocar[ 0 ] = true ;
}
}
Pero de igual modo supuestamente hay que modificar el bool por true cuando colisione o tal así.
Gracias.
Saludos!