Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Input field, data readed from file, using tables with paths  (Read 2450 times)

0 Members and 1 Guest are viewing this topic.

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Input field, data readed from file, using tables with paths
« on: October 23, 2010, 03:52:09 pm »
Hello, today I have couple of question:
1)I made input field for my game but it's showing really weird type of letters, like when I click D it's showing FF>>oo
Code:
Code: [Select]

sfUint32* test;
if (Wydarzenie.Type == sfEvtTextEntered)
{
test+= Wydarzenie.Text.Unicode;
sfString_SetUnicodeText(Wyjscie, test);
}


2)I want to make a field where You have two arrows and by clikcing one of them You go to next or previous picture.
I want to use char* table with fields filled with paths to files.
Like that:
char * test[1] = {"Graphics/Bla.png"};
And then:
sfImage_CreateFromFile(Glowne, test[1]);
Will it work?

3)The same as 2 but after clicking on an arrow I want to load text from file to string and draw it. File looks like it:

Darek
17
2
3
1

Every text has to be a single string so it's going to be 5 string in total.

I really need help with this, I know I please for a lot but just give em some hint, tips anythign that will help me.[/code]

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Input field, data readed from file, using tables with paths
« Reply #1 on: October 25, 2010, 07:54:09 am »
Anyone?
Problem number 2 is fixed.
I need help with that input and can someone say how to calculate amount of memery that need to be allocated based on number of characters in file?

NoIdea

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Input field, data readed from file, using tables with paths
« Reply #2 on: October 25, 2010, 11:02:26 am »
I guess you are using CSFML ?
In that case, this lign seems very strange :

Quote
test+= Wydarzenie.Text.Unicode;


What are you expecting it to do ?

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Input field, data readed from file, using tables with paths
« Reply #3 on: October 25, 2010, 04:10:46 pm »
If I got to be honest I don't know because I tried something from other topic.

So how should it looks in CSFML?
Does CSFML have some function to it or I need to wirte my own?

NoIdea

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Input field, data readed from file, using tables with paths
« Reply #4 on: October 25, 2010, 07:42:20 pm »
In C, you cannot do operator overloading (hope that's the term in english).
You should read a full C tutorial before doing that kind of thing :
There might be helper function in CSFML but if there isn't, you must allocate memory and then add your character. You basicly do the same thing as when using char* to manipulate characters.
Furthermore, I recommend you switch to c++ because c++ permits you to do this kind of thing without advanced knowledge. However, nothing stops you to do it in C, but you will need a bit more practice.

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Input field, data readed from file, using tables with paths
« Reply #5 on: October 25, 2010, 09:14:58 pm »
Okey. man I will code this shit, no metter how many nights it will take.

So bassicly first I need to alloc free memonry with malloc and then put there characters?

I don't like C++

 

anything