GTAMP.com

Grand Theft Auto Media Press
It is currently Tue May 21, 2013 10:19 am

All times are UTC




Post new topic Reply to topic  [ 345 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 18  Next
Author Message
PostPosted: Thu Feb 11, 2010 12:27 am 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 407
Location: Estonia
Nice work.
I found a bug in user prompt.

For example your app waits for user to press: y or n.
If he get's big Y or N then it doesn't care.

If you are reading input from user then use this: _strlwr_s to convert the input string to lowercase.
That way it will work for both small and capital letters / chars and it will not care about if the input is in uppercase or lowercase.

You must:
Code:
#include <string.h>


More about _strlwr_s.

http://msdn.microsoft.com/en-us/library ... 80%29.aspx
http://java.functionx.com/cppbcb/Lesson19.htm


Also one recommendation:
When creating new images, your app should detect if there is already result.png in folder.
If there is, it should add one nr to new image filename each time user creates a new image.
For example: result1.png, result2.png etc.

So it doesn't rewrite the old image. It would be really good feature.
And it's very easy to implement.


And if i were you: i would pack each exe and dll in imagemagick folder with UPX.
You can decrease the archive size pretty alot with that.


Top
 Profile  
 
PostPosted: Thu Feb 11, 2010 10:02 am 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
Nice suggestions, but I cannot get them working.... :(

First the, result01.png, result02.png, etc. This requires a lot of more code, because now I'm working like this:

Code:
string theMessage; //this goes to system(), or the .exe
theMessage = "imagemagick\\convert.exe ";
theMessage += theAdding;
theMessage +=" +append result.png";
const char *realMessage = theMessage.c_str(); // get const char * representation for stupid system() to work
system(realMessage);


In Python you can do this:
Code:
>>> print '%(language)s has %(#)03d quote types.' % \
...       {'language': "Python", "#": 2}
Python has 002 quote types.


I don't know how you do that in C++.
I also don't know how to read in a folder if there is a file with a certain name...
String/char* functions don't like each other...


----
The Y and N bug, requires something like this and still gives me an error.

Code:
int autoAdjust = 0;
   cout << "Do you want background to auto adjust to text size? Enter y/n: ";
   cin.clear();
   string autoStringTemp;
   getline(cin, autoStringTemp);

   const char *autoString = autoStringTemp.c_str();
   char *autoStringFin = strlwr(autoString);

   if (autoStringFin == "y") autoAdjust = 1;

getline() only accepts a string, strlwr() only accepts char* (no strings), so I convert it, but it only converts it into const char*.... not working and weird stuff compared to Python...

I will take a look at UPX.
Thanks for testing and help. :)

edit: I should do some more C++ learning anyway, because I still don't know that much about class/array (string/char).

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Thu Feb 11, 2010 2:24 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 407
Location: Estonia
Because i corrupted 3 of my core partitions by fckng up partition tables and lost all the data that im trying to restore at the moment, i can't immediately help you.

Knowing that all that hard work i have done (my map editor src, SCR tool src etc) is gone somewhere and may never get back to me, really hurts.

Im on my old XP PC atm. I will try to setup the VC++ on it and will get back here.


Pray for me, lol.


Top
 Profile  
 
PostPosted: Thu Feb 11, 2010 5:30 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
I have prayed for you. :)

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Thu Feb 11, 2010 8:14 pm 
Offline

Joined: Sat May 16, 2009 6:14 am
Posts: 781
Location: London, UK
Take it somewhere professional. The data will still be on the disk surface. You might end up making things worse.

_________________
Multiplayer Levels | Mission Code Tutorials | Multiplayer Videos


Top
 Profile  
 
PostPosted: Thu Feb 11, 2010 10:52 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 407
Location: Estonia
To professional? Hell no. I don't need this. I have done it alot by myself and always getting successful result. I have experience with this stuff.

Everything is restored now. Including my XP partition thankfully. I don't have to reinstall everything. As always thanks goes to Power Data Recovery.
I love this tool. He helped me once again and got everything back. I have used it also earlier and it helped me also without any problems. Just let it to scan for 60 min and when i came back, everything was back where it should be.
This software really should get award (even now when it already has many of them).

So: Cuban-Pete, i can offer some help soon. Maybe i will even code some examples for you.
If you have any other problems with this, post them here.


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 9:40 am 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 407
Location: Estonia
Cuban-Pete.

Are you using these:
Code:
const char *autoString = autoStringTemp.c_str();
   char *autoStringFin = strlwr(autoString);


for something else also? Other than putting "y" and "n" into them?


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 11:36 am 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
Great that you got everything back. :) Perhaps now that it's working again, also make a backup of your important files on an external HDD?

B-$hep wrote:
Cuban-Pete.

Are you using these:
Code:
const char *autoString = autoStringTemp.c_str();
   char *autoStringFin = strlwr(autoString);


for something else also? Other than putting "y" and "n" into them?


Only for y/n. Or more correct, what the user puts in.

You know what, perhaps it helps if I give you the code. I think I do certain things not 'clean' or write them unclear. Perhaps if you like you, you can give information and I can adjust it to better code. It are only 300 lines (and that is with comment junk and "GUI" text)
Attachment:
File comment: ***You may not release a new version without my written permission!***
main.zip [3.07 KiB]
Downloaded 66 times
(if something is unclear, I can add more information) (do you work in visual studio 2008?, else I can give whole project - but I don't know which files are needed exactly)

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 11:50 am 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 407
Location: Estonia
Yes i use Visual Studio. Including 2008.
Project is not needed, i can create my own to compile it.

I will take a look.


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 3:12 pm 
Offline
Lunatic

Joined: Sat Jul 19, 2008 2:14 pm
Posts: 421
Location: Poland / Szczecin
Image

Created by Kamil ofc :)


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 3:34 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
Thank you for the polish font and thanks Kamil (does Kamil not have forum account?).

I don't think I can add support to this version because DOS only supports ASCII letters (unless B-$shep knows a way). But, I will make version 3 with a real windows GUI and then I will be able add polish support (finally). :D

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 3:43 pm 
Offline
Lunatic

Joined: Sat Jul 19, 2008 2:14 pm
Posts: 421
Location: Poland / Szczecin
sweet add cool gta2 layout and some sweet options like coloring words/letters (i mean not all txt in one color) like in this topic (first post): http://www.gtatwo.fora.pl/konstruktorzy ... ,3553.html


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 4:14 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
Razor wrote:
sweet add cool gta2 layout and some sweet options like coloring words/letters (i mean not all txt in one color) like in this topic (first post): http://www.gtatwo.fora.pl/konstruktorzy ... ,3553.html


yes, I was planning to do that, but I am not yet sure how to do it exactly. Perhaps something like with this website:

TXT2GTA2

is this in code
Code:
[color=#4000FF]TXT2[/color][color=#FF0000]GTA2[/color]


but it is not very clear, so I need to think of better solution, you got idea?

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Fri Feb 12, 2010 11:30 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
I made some huge progress with a real GUI. I now know how to add functions and use them. In fact, I already got a textbox with button working that can generate GTA2 text. :D

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Sat Feb 13, 2010 10:35 am 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 407
Location: Estonia
So there is no point anymore mess with that console app code ??


Top
 Profile  
 
PostPosted: Sat Feb 13, 2010 1:18 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
B-$hep wrote:
So there is no point anymore mess with that console app code ??


No point in fix y/n, but the result.png to result01, result02 still is. I don't know how to do that... I need to check if there is already a result file in the folder, and also if there is already a result01 or result 02 etc....

edit: I use a lot of console app code in this version 3.
the include <iostream> makes .exe very big, while I only need system(). Is there a way to import/include only the system() part?

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Sat Feb 13, 2010 3:51 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
Polish letters will work in version 3 (thanks to kamil en razor). See here my proof:

Attachment:
result.png
result.png [ 673 Bytes | Viewed 936 times ]


There is still a long way to go... (new color system, good GUI, rename all letters to latin (argh, just renamed to ascii, but GUI works with latin))

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
PostPosted: Sat Feb 13, 2010 4:51 pm 
Offline
Lunatic

Joined: Sat Jul 19, 2008 2:14 pm
Posts: 421
Location: Poland / Szczecin
najs :) cant wait :P


Top
 Profile  
 
PostPosted: Sat Feb 13, 2010 10:02 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 407
Location: Estonia
Cuban-Pete.

Sorry for delay. I was busy messing with my PC here. Now it's fine.


Did you really tested that <iostream> makes exe alot bigger?
How much bigger?

I compiled your code in Visual C++ Express and my EXE is 21KB in release mode.
Yours 51.5KB. I think if something makes your exe big then it's your icon.

Im modifying your code at the moment to include this check for Result1, Result2 etc.
I will mark all the changes i made or code that i have added and then will give it to you.
So you can see how it's done. And hopefully you can integrate this to your GUI version.

EDIT: btw, are you using the image generation code in same way in your GUI app?
I mean, if you rewrote something in imagemagik code or something in there that generates that result.png then you must probably modify my written code also a bit.
But i don't know yet.

Anyway...
I will complete this and then we will see how the integration goes.


Top
 Profile  
 
PostPosted: Sat Feb 13, 2010 10:54 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:03 pm
Posts: 795
B-$hep wrote:
Did you really tested that <iostream> makes exe alot bigger?
How much bigger?

I compiled your code in Visual C++ Express and my EXE is 21KB in release mode.
Yours 51.5KB. I think if something makes your exe big then it's your icon.

Im modifying your code at the moment to include this check for Result1, Result2 etc.
I will mark all the changes i made or code that i have added and then will give it to you.
So you can see how it's done. And hopefully you can integrate this to your GUI version.

EDIT: btw, are you using the image generation code in same way in your GUI app?
I mean, if you rewrote something in imagemagik code or something in there that generates that result.png then you must probably modify my written code also a bit.
But i don't know yet.

Anyway...
I will complete this and then we will see how the integration goes.

I thought the <iostream> makes version 3 (GUI in visual basic 2008, .net it's called??) bigger, but I tested it again and perhaps it was something else (image I think). Or #include <string> ??

I'm using the same image generate code in GUI app. Small problem is that every time you use system() you get a dos (black box) popping up for half a second. I call system() once for append all text images together, once for coloring, once for adding background. If I want to add better color system, there will be more calls. I want to get that black box popping up gone. So I searched for alternative to call imagemagick.exe. I found CreateProcess(), got it working after lots of trying, but this also pops up a black box... :| So I'm not sure how to fix that... one option is to use source files of imagemagick (you can get them free from website), but I have no idea how it works and how to use it...


The code below you gave works nice. Why did you remove it from post?
Code:
string IntToString(int intValue){
   char buffer[65];
   _itoa_s(intValue, buffer, 65, 10);
   return buffer;
}

_________________
"Only Silky Milky implants by Zaibatsu feel and taste like the real thing."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 345 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 18  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group