wander36 0 Newbie Poster

Hey,
I'm trying to create a program that displays a map and allows the user to put coordinates on the map and enter what the coordinate is. I want the user part to be in a console window, but I want the map to be displayed using SDL.

I can't figure out how to get them to work together. Please help.

#define MAP_RANGE 2999

#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <SDL/SDL.h>

using namespace std;

void ClearScreen()
{
    cout << string( 100, '\n' );
}

int main()
{
    int x = 3000, y = 3000;
    vector< vector<string> > mapCoords;
    mapCoords.resize(x);
    for (int i=0; i<mapCoords.size(); i++)
    mapCoords[i].resize(y);

    cout << "\n\n\n\nPRESS ENTER TO CONTINUE..." << endl;
    cin.get();
    ClearScreen();

    cout << "Type 'a' to add a location.\nType 'e' to erase a location.\nType 'd' to display the map." << endl;
    char choice;
    cin >> choice;
    if (choice == 'a') {
        int xChoice = 0;
        int yChoice = 0;
        cout << "Please enter the 'x' coordinate to add: ";
        cin >> xChoice;
        cout << "Please enter the 'y' coordinate to add: ";
        cin >> yChoice;
        cout << "Please enter the description of the point: ";
        string message;
        cin.ignore();
        getline(cin,message);
        mapCoords[xChoice][yChoice] = message;
        cout << xChoice << " " << yChoice << endl;
        cout << mapCoords[xChoice][yChoice];
    }
    if (choice == 'e') {

    }
    if (choice == 'd') {

    }

    return 0;
}

int displayMap(int argc, char* args[])
{

    return 0;
}

As you can see at the moment, the SDL doesn't even do anything. I just need it to accept the function before I can do anything.

Thanks,
Tyler Petresky
tyler.is.number.one@gmail.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.