Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Munchor

Pages: 1 ... 9 10 [11] 12 13 ... 424
151
Computer Programming / Re: Help with C++
« on: October 22, 2011, 02:40:09 pm »
ok thanks.  I am a lisle fluent in C++ due to Axe and a month of C.
So SDL then?

I think I wouldn't need to know much to port Sniper101 to computer :P

Sniper 101, hein?. I want to help :D

152
Computer Programming / Re: Help with C++
« on: October 22, 2011, 02:34:47 pm »
Ok  next question.

OpenGL or SDL?
I want something easy to quickly use/ learn.  And, I will probably be able to stay with in the future.

Do you already know the C++ syntax? It's a bit risky to jump right in to image libraries.

Either way, I recommend SDL or SFML too. SFML is younger and doesn't have much documentation. SDL is older (which can be bad) but it has more documentation and more programmers using it.

153
Computer Programming / Re: Reading tilemap algorithm
« on: October 22, 2011, 02:18:58 pm »
Are you casting to an int after you read from the file? Because that might be the problem.

In Daemons I read from a binary file and I read to a memblock equal to the size of the file - 2 bytes for size data.

I then copy that memblock to a vector for use in the game. ;)

Perhaps you could try that. (Is this only going to be C or C++?)

EDIT: Here's my code:

Code: [Select]
fstream map;
    string map_path;//Holds the path to the files

    try
    {


        map_path = "data/maps/visual/" + mapID;

        map.open(map_path.c_str(), ios::in|ios::binary);
        char memblock[2];
        //char* mapblock;
        if(map.is_open())
        {
            //memblock = new char [2];
            //map.seekg(0, ios::beg);
            map.read(memblock, 2);

            MapWidth = memblock[0];
            MapHeight = memblock[1];
            //delete[] memblock;
            char mapblock[MapWidth * MapHeight];
            MapData.resize(MapWidth * MapHeight);
            //map.seekg(2, ios::beg);
            map.read(mapblock, MapWidth * MapHeight);
            for(int i = 0; i < (MapWidth * MapHeight); i++)
                MapData[i] = (int)mapblock[i];
            //cout << MapData[0];
            //cout << map_path.c_str();

            map.close();
        }

}
    catch(exception& e)
        {cout << e.what() << "\n";}
    return;

Actually, the program is C++, but I thought C would be better for this, due to speed and size issues, I want map loading to be fast.

What do you mean by "Are you casting to an int after you read from the file? Because that might be the problem."?

154
Computer Programming / Reading tilemap algorithm
« on: October 22, 2011, 02:06:01 pm »
I have an issue that's been annoying me for some time now. I have to read a file to an bi-dimensional array.

The file looks like this:

Code: [Select]
1111111111111111111111111
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1000000000000000000000001
1111111111111111111111111

I am using the C library ('stdio.h') to read the file, and this is what I have so far.

Code: [Select]
int map[26][24];
int map_width = 26;
int map_height = 24;
int x;
int y;
FILE *map_file = fopen("map.txt", "r");
for (x = 0; x < map_width; x++)
{
  for (y = 0; y map_height; y++)
  {
     fscanf(map_file, "%d", &map[x][y]);
  }
  fscanf(map_file, "\n"); // Skip newlines
}

However, it doesn't really seem to be working, since I'm printing the array right after and it doesn't look like the file:

Code: [Select]
for (x = 0; x < map_width; x++)
{
  for (y = 0; y < map_height; y++)
  {
    printf("%d", map[x][y]);
  }
}

Thanks for the help!

155
Computer Programming / Re: Help with C++
« on: October 22, 2011, 01:59:52 pm »
I hate Visual studios in general.  They lock everything down to be just windows.... just like TI does to their products :\
It reminds me of the Zune :/

Yes, Visual Studio tempts you to develop Windows-only. I think Code::Blocks is the best thing you can use. Later, you might prefer to use a text editor and the command line, it's faster for some people.

156
Computer Programming / Re: Help with C++
« on: October 22, 2011, 01:48:54 pm »
you guys are awesome.  All I get is a bunch of junk about eclipse.  It looks like it was made for linux :/  And Linux programs on Windows just doesn't do well with me :P

What? Eclipse wasn't made for Windows. It wasn't made for anything particular. It was made for everything.

And Eclipse has a C/C++ Plugin that allows you to use it as a C/C++ IDE, I never tried it, but a lot of people like it.

157
Computer Programming / Re: Help with C++
« on: October 22, 2011, 01:43:49 pm »
Can someone plz help me set up a design environment (including a method of compilation) for C++ on Windows 7 computer?

Everything hates me.



Also: anyone know how to draw to the screen.  Like in axe you can use Pt-On() and Pxl-On()

I recommend installing MingW. However, if you're a beginner Code::Blocks installs it together with the Code::Blocks IDE.

Drawing to the screen? You need a graphics library such as OpenGL or SDL. I recommend SDL or SFML. You can also use a GUI Toolkit, such as GTK, Qt or wxWidgets.

On Windows, you'll be tempted to use win32 or DirectX. If you want to keep your program cross-platform, never use those.

158
Computer Programming / Re: Passing a pointer to an array of an array
« on: October 22, 2011, 01:21:36 pm »
That might work, but why not save all the hassle and do this?

Code: [Select]
int my_array[26][24] = {0};

call_function(my_array);

////////////////////////////////

void call_function(int array[26][24])
{
  for (int iii = 0; iii<26; iii++)
  {
    for (int jjj = 0; jjj<24; jjj++)
    {
       array[iii][jjj] = iii*jjj;
    }
  }
}

When you just type the name of an array, like "my_array," that actually is the pointer to the array. You only dereference it when you start to use [].

Also, I would suggest that you use a 1 dimensional array. Two dimensional arrays are just handled like 1 dimensional arrays in memory anyways.


Oh ooops, I forgot arrays are just pointers, how silly of me, thanks for reminding me ;)

159
Computer Programming / Passing a pointer to an array of an array
« on: October 22, 2011, 05:46:06 am »
I need some help with a pointer problem I'm facing. I have this:

Code: [Select]
int my_array[26][24]; /* An 2 dimensions array */

call_function(NEED_HELP_HERE);

call_function() requires an argument, an array. I need to pass my_array. However, I know that passing arrays in functions is memory consuming and not very clean. So, instead, I want to pass a pointer to the array.

So my question is how to declare the pointer to the array, how do I declare it?

Code: [Select]
void call_function(NEED_HELP_HERE)
{
  /* This function receives a pointer to an array as argument */
}

The question is what to put in "NEED_HELP_HERE" places. My issue is that I don't know what type the pointer to the array of arrays is.

Thanks in advance!

160
News / Re: OS 1.03 and PHYSIUM add-in
« on: October 21, 2011, 04:56:46 pm »
Casio is listening to us, but TI is not really... I think these companies should listen more to developers and even have like an infiltrated guy (but we would know who he is) that asks us what we want and need.

161
News / Re: Private Matters Section Added
« on: October 21, 2011, 04:56:39 pm »
Oh this is simply great! Good idea!

162
News / Re: Toki Tori & Ice Slider for the FX-9860G
« on: October 21, 2011, 04:56:31 pm »
It's great to see contests like this for Casio calculators are getting lots of entries, neat entries!

163
News / Re: TCAP, a French version of HCWP!
« on: October 21, 2011, 04:56:23 pm »
Ooh la la, a French version of HCWP, cool! Is Mandarin next?

164
News / Re: Randy Compton releases the first TI-80 emulator
« on: October 21, 2011, 04:56:12 pm »
It's impressive to see (as Ryan said on ticalc.org) how some people put a lot of effort in creating emulators for TI calculators. Especially the TI 80, which is nearly forgotten.

165
News / Re: Members organizes ritual for DJ_O's postcount of 30000
« on: October 21, 2011, 04:56:04 pm »
The ritual went just fine, didn't it?

Pages: 1 ... 9 10 [11] 12 13 ... 424