Asciipaint 0.1


Tobriand

Well-Known Member
Joined
Dec 27, 2002
Messages
4,071
Age
39
Location
Croydon (UK)
Website
Visit site
Ok, its my first project for the GP, and second ever bar a few tutorials, so its not what you'd call a very useful or pretty proggie. But it is nice and small, so put it on your GP, and if you ever have a sudden urge to draw in ascii it should fill to spot.

Though it can't save yet, since I haven't worked out how to dump a framebuffer into a .bmp yet, and probably won't for the all that foreseeable future.

Thanks everyone that helped me with it (especially Dom and Herb12) and Mr_Mirko for making his oh-so-much simpler to use than the original one SDK.

I've included the source, since its only one file and I've spent the morning annotating it so that most people who have a rudimentary knowledge of standard loops (if/else/while/for) in whatever language should be able to understand it, and people who have anything more than that will probably be infuriated by how long some of the notes are.

Don't be surprised if the code is very badly written in places - it is my first project after all. Its turned out fairly well, I think :D.
 
Nicely commented code, might be quite a help for beginners. Some ideas for the app: include some reset combination (like L,R, START & SELECT) and, instead of saving it to a bmp file, just export it as a text file (quite easy to do and makes more sense IMO.)
Anyway, good work!
 
Thanks - I spent a while annotating the code mainly so if I don't do anything for months on end, I'll still be able to work out what it does, but as I say, it should be comprehensible enough for almost anyone with even a little bit of coding knowledge :)

don: Any idea how I might actually go about doing that? Most of what I know is taken from the SDK docs and the Hello World tutorial (with anything on loops/switches from a book I got through a fair way in before realising it never left command prompt programming with standard libs) so since framebuffers were only really introduced with said tutorial (and the double buffering one too, which I've had a look through) I've no idea how to go about exporting them tbh...

I'll give a restart bit a shot, though for some reason AND doesn't seem to work properly -
Code:
if ((variablea = 1) AND (variableb = 0))
just threw up a syntax error before AND, so I gave up on it. I imagine it'll be similar for
Code:
if ((gp_ButtonResult()&BSTART) AND (gp_ButtonResult()&BSELECT) AND (gp_ButtonResult()&BL) AND (gp_ButtonResult()&BR))
will probably do so too :(. Still, worth a shot :)
 
You would need to use an array which keeps the characters you have drawn in memory. When using the export function, you'll just need to open a file and write character after character from the array (well and newlines of course).
 
Right... I've got an array (in fact 3 of them - one for colour, one for the brush, and one for the combination of the two since I can't add them together inside the file output function from Mirko's SDK), 2 of which are int (I'm experiementing with char) and the final one seems to have to be a char one, or the text file that results is actually a corruption of the SMC; with a char final array, its not what its supposed to be, but it is a file that is openable.

Problem is, whenever I try to change a char array for some reason it doesn't go in as ASCII - so inputting "\n" doesn't give a new line, oh no - it gives "TT" in the output file, or "$" if the two original arrays are set up as integer ones, and "0" doesn't give a "0", but rather a space. I've had this since first trying to fiddle with the Hello World example, but it hadn't proved a problem before now - anyone got any experience with this sort of issue, or is it as random to you lot as it is to me?

Thats not to say there isn't method to the madness - the symbols produced are related to the original change to the char[x], its just they aren't the same thing at all when outputted...
 
Right... vague update... I've managed to get it saving (and restarting - but not on multiple keys; only on "a"), though loading is proving a substantial wossname. Basically, whilst dumping all the data from the text file into the array it seems to get into another character-or-number issue - I want to load the ascii-code-number of the character; it seems to load the actual thing (since "^" always turns up as "s" etc.)

I've also got a problem with the re-drawing itself, but I think I may have a solution to that (rather than refering using i as between 0 and 935 and doing it linearly, using it as 0-25 and then 0-34 respectively - you'll see what I mean once I release my ever-so-bad code again lol)
 
For them as is interested, here's 0.2.
Its got saving in.
And it changes that fallacy of using an int to store character data that I'd made (though it seemed to work better than with a char at the time).

Oh, and it loads too, every time you open it. If you want to save hit select, and wait a bit :).

Its about 10 times the size though :( (52.6kb lol)

Thanks for helping me out with it everyone as has done; couldn't have done it without you.

EDIT: Updated to 0.3 and announced in the News section. its not big news, but hey :)
 
Hey, I enjoy your program but I have a few recomendations...

1. A cant be reset..I dont know why but sometimes I just hit it.

2. maybe when you hold down a certain button it would erase, not the whole screen just wherever you move the drawing tool.

3. solid filled background option..possibly when you start if it would be easiest.

4. If you could figure out a way to be able to change shape/color on the move that would be fun.

Keep up the good work..this reminds me alot of a prog I did in pascal last year, by the time I was done I had endless amounts of features. Hopefully I can get better in C++ so I can recreate it. That would be really rockin.
 
Tobriand posted on Apr 25 2004 at 12:58 PM said:
I'll give a restart bit a shot, though for some reason AND doesn't seem to work properly -
Code:
if ((variablea = 1) AND (variableb = 0))
just threw up a syntax error before AND, so I gave up on it. I imagine it'll be similar for
Code:
if ((gp_ButtonResult()&BSTART) AND (gp_ButtonResult()&BSELECT) AND (gp_ButtonResult()&BL) AND (gp_ButtonResult()&BR))
will probably do so too :(. Still, worth a shot :)
AFIAIK, AND isn't supposed to work ;) You need to use & or &&. And I think that & is bitwise AND (does bit per bit ANDing ex 101 & 110 = 100), and && just acts like anything greater than zero = 1, zero and less = 0.

But I'm not sure, so someone can tell me if I'm right :)
 
Last edited by a moderator:
rcx21000 posted on Apr 27 2004 at 05:57 AM said:
AFIAIK, AND isn't supposed to work ;) You need to use & or &&. And I think that & is bitwise AND (does bit per bit ANDing ex 101 & 110 = 100), and && just acts like anything greater than zero = 1, zero and less = 0.

But I'm not sure, so someone can tell me if I'm right :)
Thanks! That works - combined button restart and moving backward in colour/brush selections, here I come!
 
Last edited by a moderator:
Righteo... no update from the version in the compo, so I'm not going to bother uploading an .fxe, but here's the code, which I've finally got round to fixing for newer versions of Mr_Mirko's SDK. The commenting in this ver is probably fairly confused, since its gone on a long way from what it originally was (which was when I actually did the commenting), but it should still be comprehensible.
 
Back
Top