Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

243
Views
Leer y usar datos del archivo js en C++

Tengo un proyecto de juego C++ usando SDL. Además, tengo un archivo .js para el mapa en mosaico (adjunto un enlace de pastebin para obtener más detalles: https://pastebin.com/GKqs3km5 ). ¿Cómo puedo usar esto para crear un mapa en mi proyecto? Intento ifstream para leer este archivo, pero parece que no funciona bien.

 //from lesson 39 Lazyfoo for (int i = 0; i < TOTAL_TILES; ++i) { //Determines what kind of tile will be made int tileType = -1; //Read tile from file js >> tileType; //If the was a problem in reading the map if (js.fail()) { //Stop loading map printf("Error loading map: Unexpected end of file!\n"); tilesLoaded = false; break; } //If the number is a valid tile number if ((tileType >= 0) && (tileType < TOTAL_TILE_SPRITES)) { tiles[i] = new Tile(x, y, tileType); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Deshazte del formato .js . Se exportó desde Tiled, así que ábralo en Tiled y vuelva a exportarlo como JSON (o XML). Luego use cualquier biblioteca de análisis JSON (o XML).

Probablemente haya bibliotecas especializadas para analizar los mapas en mosaico JSON/XML, pero dado que el formato es tan simple, también podría usar una biblioteca genérica.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!