My first programming book arrived :D
[img]http://i32.tinypic.com/r04a6f.jpg[/img]
[editline]05:22PM[/editline]
Ugh, bad quality
What luck. I was thinking of getting it on Safari (that's the eBook peddler) but they didn't have it, so I got it from a questionable online dealer.
[img]http://www.cubeupload.com/files/421400picture6.png[/img]
C++ Primer Plus representin'
[QUOTE=Swebonny;16374301]My first programming book arrived :D
[editline]05:22PM[/editline]
Ugh, bad quality[/QUOTE]
Mine arrived today too :D
[img]http://imgkk.com/i/Lrr9kY.jpg[/img]
What's with everyone getting the same book?
[QUOTE=bigdoggie;16374934]What's with everyone getting the same book?[/QUOTE]
Eh, it's a mainstay, like ([b]not[/b] on Safari, bit of a pity). The cover's also rather bitching.
[img]http://www.cubeupload.com/files/87ac00picture7.png[/img]
I see.
I prefer books to online documentation. Possibly because when i'm on the computer I constantly get distracted by other things and I don't get work done, but with a book I can read for hours at a time. I probably have a pretty impressive collection, here's off the top of my head:
Programming Perl
Perl Cookbook
Perl Best Practices
Minimal Perl
Perl & LWP
Perl and CGI for the WWW
Perl for Dummies
(some other perl book, can't remember the title)
PHP visual quickstart guide
PHP visual quick[b]pro[/b] guide
C Programming
Java: A beginners guide (actually like 700 pages)
Java for the WWW visual quickstart guide
HTML 5 for the WWW
HTML for dummies
XML visual quickstart guide
Applescript something blah blah blah
and my newest edition, The Ruby Programming language. Got it yesterday :neckbeard:
[QUOTE=Kat of Night;16375784]I prefer books to online documentation. Possibly because when i'm on the computer I constantly get distracted by other things and I don't get work done, but with a book I can read for hours at a time. I probably have a pretty impressive collection, here's off the top of my head:
[/QUOTE]
Yeah, that's so true. I get so easily distracted when reading longer stuff on the internet.
[QUOTE=bigdoggie;16374934]What's with everyone getting the same book?[/QUOTE]
I heard it was a very good book for both absolute beginners and intermediate users, so I got it. So far I find it very easy to understand and really interesting.
I have a design issue. I have a base class and a few classes that inherit from it. I also have a few virtual functions in the base class. Now I would want an array that is basically an array of the base class, but I would put the inheritees in it. Well I tried it, and the compiler doesn't seem to mind, however when I call one of the virtual functions the compiler runs the function that is defined in the base class, not in the the classes that inherit the base class. I know I could have an array of pointers to the base class but put addresses of the inheritee classes, but that would mean I would have to have separate arrays for those classes, which I would like to avoid if possible. Is there a convenient solution to this?
The language is question is C++ if anyone is confused.
You can't have an array of a base class and put derived classes onto it. You have to use pointers if you're going to fill an array with derived classes, but it seems as if you misunderstood something: you can still have one array if you're using pointers.
Can you show me how?
[code]base* objects [10];
objects[0] = new derived1();
objects[1] = new derived2();
objects[2] = new derived3();[/code]
etc.
Tried that (with std::vector though, but should be the same thing), it didn't work.
[cpp]#include <vector>
#include <iostream>
class base
{
public:
virtual void stuff()=0;
};
class derived1 : public base
{
public:
void stuff()
{
std::cout << "Hello, ";
}
};
class derived2 : public base
{
public:
void stuff()
{
std::cout << " World!";
}
};
int main()
{
std::vector<base*> vec;
vec.push_back(new derived1());
vec.push_back(new derived2());
vec[0]->stuff();
vec[1]->stuff();
delete vec[0];
delete vec[1];
std::cin.get();
}[/cpp]
This works for me. Are you sure you made the inheritance public?
Yeah I did, wait I'll try again, maybe I made a small oversight.
[editline]11:21PM[/editline]
It works now.
Must have made a retarded error, well thanks.
[QUOTE=Guru-guru;16358186]Updated my java applet game. Now it has a title screen and working menu system. Added females. Now you can spawn cows. You can turn FPS on and off. You can change the options on the random map generator. To play click the link!!!
[url]http://davidjokinen.com/play.php[/url]
[img]http://davidjokinen.com/GameAlpha4.png[/img][/QUOTE]
You have some very interesting code behind that :D.
I like the ai's function names.
Working on skinning the GUI for portalized to make it more user friendly:
[code]
<skin name="awesome">
<panel>
<top_left image="awesome_deco_tl.png"/>
<top image="awesome_deco_t.png"/>
<top_right image="awesome_deco_tr.png"/>
<right image="awesome_deco_r.png"/>
<bottom_right image="awesome_deco_br.png"/>
<bottom image="awesome_deco_b.png"/>
<bottom_left image="awesome_deco_bl.png"/>
<left image="awesome_deco_l.png"/>
<middle image="awesome_deco_mi.png"/>
</panel>
</skin>
[/code]
[QUOTE=nullsquared;16380612]Working on skinning the GUI for portalized to make it more user friendly:
[code]
<skin name="awesome">
<panel>
<top_left image="awesome_deco_tl.png"/>
<top image="awesome_deco_t.png"/>
<top_right image="awesome_deco_tr.png"/>
<right image="awesome_deco_r.png"/>
<bottom_right image="awesome_deco_br.png"/>
<bottom image="awesome_deco_b.png"/>
<bottom_left image="awesome_deco_bl.png"/>
<left image="awesome_deco_l.png"/>
<middle image="awesome_deco_mi.png"/>
</panel>
</skin>
[/code][/QUOTE]
fucking xml
[QUOTE=Swebonny;16376631]
I heard it was a very good book for both absolute beginners and intermediate users, so I got it. So far I find it very easy to understand and really interesting.[/QUOTE]
Sounds like a book I should start reading, then :buddy:
[QUOTE=Catdaemon;16381322]fucking xml[/QUOTE]
What's wrong with XML? Show me the equivalent in some other format.
[QUOTE=nullsquared;16381398]What's wrong with XML? Show me the equivalent in some other format.[/QUOTE]
I dunno. I just really, really hate XML. It's so much extra work on both ends for most purposes.
Personally I'd use the old fashioned ini style for what you're doing.
[code]
[skin]
name = awesome
[panel]
top_left = awesome_deco_tl.png
top_right = awesome_deco_tr.png
[/code]
[QUOTE=Catdaemon;16381464]I dunno. I just really, really hate XML. It's so much extra work on both ends for most purposes.
Personally I'd use the old fashioned ini style for what you're doing.
[code]
[skin]
name = awesome
[panel]
top_left = awesome_deco_tl.png
top_right = awesome_deco_tr.png
[/code][/QUOTE]
What if I want multiply skins in the same file? What if I don't know what the exact parts are called, and simply want to iterate over all of them and add them to a container? What if each piece had more info associated with it than just an image?
[QUOTE=nullsquared;16381496]What if I want multiply skins in the same file? What if I don't know what the exact parts are called, and simply want to iterate over all of them and add them to a container? What if each piece had more info associated with it than just an image?[/QUOTE]
Why can you not do any of this with an ini style layout? I've seen it done many a time.
[QUOTE=Rowley;16379589]You have some very interesting code behind that :D.
I like the ai's function names.[/QUOTE]
Yeah Thanks... I when I code by myself I fall into bad habits and give things really bad names. that is why I have a function named movenicely(). But my next update will be to fix and improve the AI and also make it so the game only playable from my site.
[QUOTE=Catdaemon;16381544]Why can you not do any of this with an ini style layout? I've seen it done many a time.[/QUOTE]
Because there's only a single [skin] category in the file :downs:. It's not hierarchical.
Got the basics done
[URL=http://www.cubeupload.com][IMG]http://www.cubeupload.com/files/379000boxxx.png[/IMG][/URL]
[QUOTE=nullsquared;16381496]What if I want multiply skins in the same file? What if I don't know what the exact parts are called, and simply want to iterate over all of them and add them to a container? What if each piece had more info associated with it than just an image?[/QUOTE]
[code]
---
name: awesome
topleft: awesome_deco_tl.png
topright: awesome_deco_tr.png
...
---
name: something_terrible
topleft: gotosareokaywithme.png
topright: nahimjustkidding.png
...
[/code]
All in one file. Plus it allows you to do what you asked. Technically you could even make a mini database with yaml. You can just "GetNode", etc. etc. It's just [b]Y[/b]et [b]A[/b]nother [b]M[/b]arkup [b]L[/b]anguage
FAKE EDIT: (may have mixed up ... and ---)
[quote=nullsquared;16381398]what's wrong with xml? Show me the equivalent in some other format.[/quote]
yaml
[img]http://img370.imageshack.us/img370/3798/27247171.png[/img]
I got into the whole iso-madness. :D
Can anyone give me an idea on how to find which tile is being hovered over with the mouse?
You could do that by going though all the objects that are being displayed and comparing the mouse location with the images location and width/height and you return the first on you get. It not the most accurate but it works...
Sorry, you need to Log In to post a reply to this thread.