mirror of
https://github.com/AntoineHX/LivingMachine.git
synced 2025-05-04 05:40:46 +02:00
pull+merge
This commit is contained in:
commit
668734cffd
4 changed files with 27 additions and 6 deletions
|
@ -51,7 +51,7 @@ int main(int argc, char* argv[])
|
||||||
sf::Texture txFlux;
|
sf::Texture txFlux;
|
||||||
sf::Sprite spFlux;
|
sf::Sprite spFlux;
|
||||||
sf::Image imFlux;
|
sf::Image imFlux;
|
||||||
sf::Event event;
|
sf::Event event;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
#ifdef SFML
|
#ifdef SFML
|
||||||
//Création de la fenetre principale
|
//Création de la fenetre principale
|
||||||
sf::RenderWindow window(sf::VideoMode(width, height), "KirbyTrack");
|
sf::RenderWindow window(sf::VideoMode(width+300, height), "KirbyTrack");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize different images that are going to be used in the program
|
// Initialize different images that are going to be used in the program
|
||||||
|
@ -153,7 +153,7 @@ int main(int argc, char* argv[])
|
||||||
#ifdef SFML
|
#ifdef SFML
|
||||||
//Affichage SFML
|
//Affichage SFML
|
||||||
/* Clear the screen */
|
/* Clear the screen */
|
||||||
window.clear(sf::Color::Black);
|
window.clear(sf::Color::White);
|
||||||
|
|
||||||
//Conversion de la frame en image smfl
|
//Conversion de la frame en image smfl
|
||||||
/*if(image_CV2SFML(frame, imFlux)){
|
/*if(image_CV2SFML(frame, imFlux)){
|
||||||
|
@ -162,19 +162,39 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
//Enregistrement de la frame openCV
|
//Enregistrement de la frame openCV
|
||||||
cvSaveImage("temp.jpg", frame);
|
cvSaveImage("Stock SFML/temp.jpg", frame);
|
||||||
|
|
||||||
//Chargement de la frame en texture SFML
|
//Chargement de la frame en texture SFML
|
||||||
if (!txFlux.loadFromFile("temp.jpg")){
|
if (!txFlux.loadFromFile("Stock SFML/temp.jpg")){
|
||||||
printf("Erreur chargement image SFML\n" );
|
printf("Erreur chargement image SFML\n" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
spFlux.setTexture(txFlux);
|
spFlux.setTexture(txFlux);
|
||||||
|
|
||||||
|
window.draw(spFlux);
|
||||||
|
|
||||||
window.draw(spFlux);
|
//TEST SFML
|
||||||
|
sf::Texture texture;
|
||||||
|
if (!texture.loadFromFile("Stock SFML/red_button.jpeg")){
|
||||||
|
printf("Erreur chargement image SFML\n" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
sf::Sprite sprite;
|
||||||
|
sprite.setTexture(texture);
|
||||||
|
|
||||||
|
sprite.setPosition(sf::Vector2f(width, 0));
|
||||||
|
|
||||||
|
window.draw(sprite);
|
||||||
|
|
||||||
|
sf::Vector2i PosMouse = sf::Mouse::getPosition(window);
|
||||||
|
|
||||||
|
if (sf::Mouse::isButtonPressed(sf::Mouse::Left)&&(PosMouse.x>640)&&(PosMouse.x<760)&&(PosMouse.y>0)&&(PosMouse.y<120)){
|
||||||
|
printf("\n\n\n OK \n\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Pos Mouse : %d %d \n", PosMouse.x, PosMouse.y);
|
||||||
|
|
||||||
/* Update the window */
|
/* Update the window */
|
||||||
window.display();
|
window.display();
|
||||||
|
@ -186,6 +206,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
maj_angle(ajust_pos(posX-width/2,width), ajust_pos(posY-height/2,height), height/8, angle);
|
maj_angle(ajust_pos(posX-width/2,width), ajust_pos(posY-height/2,height), height/8, angle);
|
||||||
controle_moteur(angle);
|
controle_moteur(angle);
|
||||||
|
|
||||||
cvWaitKey(100);
|
cvWaitKey(100);
|
||||||
|
|
||||||
#ifdef CONFIG
|
#ifdef CONFIG
|
||||||
|
|
BIN
Code/Stock SFML/green_button.jpeg
Normal file
BIN
Code/Stock SFML/green_button.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
Code/Stock SFML/red_button.jpeg
Normal file
BIN
Code/Stock SFML/red_button.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
Code/Stock SFML/temp.jpg
Normal file
BIN
Code/Stock SFML/temp.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Loading…
Add table
Add a link
Reference in a new issue