I don't understand why would you want to have info on some subclass in any of your classes. Just merge these classes together or create inner class.
The Big Programming Thread - Page 99
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
Spidinko
Slovakia1174 Posts
I don't understand why would you want to have info on some subclass in any of your classes. Just merge these classes together or create inner class. | ||
nakam
Sweden245 Posts
On December 12 2011 09:46 Spidinko wrote: @nakam : When object of MySubClass is being created, constructor of MyMainClass is called, which then tries to create test (object of MySubClass). That should be stack overflow imo. I don't understand why would you want to have info on some subclass in any of your classes. Just merge these classes together or create inner class. I'm trying to learn the concept of the different types of classes (extended for example), not necessarily something I'm gonna use. I see your point and I think I understand now. Thank you! | ||
Deleted User 124618
1142 Posts
So I tried to learn some Scala during last weekend, and I was pleasantly surprised. Scala is like Java in sense that both run on JVM, and Scala is able to use Java libraries. Example: val list = List("First","Second","Third","Fourth") val startInd = 1 val endInd = 3 for(i <- startInd to endInd){ println(list(i)) } This will result in following output: Second Third Fourth I've only gone through the very basics of Scala, but from what I've learned it seem like a promising language. So easy to bend to your will. | ||
weareallclowns
Denmark113 Posts
I have some skill in thinking through algorithms and creating pseudo codes, though in the area of actual writing of c and c++, I have close to none. I'm gonna get Walter J. Savitchs "Problem Solving with C++" for the rudimentary stuff (because of a class atm.), but would like, as I said, something that deals with creating graphics, preferably (if possible) with some text on implementing external inputs, like a camera, microsoft kinect and stuff like that as well.. Thx. | ||
fabiano
Brazil4644 Posts
On December 17 2011 09:29 weareallclowns wrote: Hey. I am looking for the best introductory book on c++ graphics, and was hoping for some answers from TL. I went to have a look at amazon recommendations, and found some stuff, though I thought I would like an unbiased answer from someone with experience. I have some skill in thinking through algorithms and creating pseudo codes, though in the area of actual writing of c and c++, I have close to none. I'm gonna get Walter J. Savitchs "Problem Solving with C++" for the rudimentary stuff (because of a class atm.), but would like, as I said, something that deals with creating graphics, preferably with some text on implementing external inputs, like a camera, microsoft kinect and stuff like that. Thx. by graphics you mean user interfaces or gaming? For user interfaces I would recommend a book on QT. QT should be very easy to understand and start building apps rightaway. For gaming you can look into OpenGL or use a framework such as Ogre3D. Both of these will take a little more time to code something "functional". I dont know any books to recommend though, I dont read them cause I'm too lazy ![]() | ||
Detri
United Kingdom683 Posts
On December 17 2011 09:29 weareallclowns wrote: Hey. I am looking for the best introductory book on c++ graphics, and was hoping for some answers from TL. I went to have a look at amazon recommendations, and found some stuff, though I thought I would like an unbiased answer from someone with experience. I have some skill in thinking through algorithms and creating pseudo codes, though in the area of actual writing of c and c++, I have close to none. I'm gonna get Walter J. Savitchs "Problem Solving with C++" for the rudimentary stuff (because of a class atm.), but would like, as I said, something that deals with creating graphics, preferably (if possible) with some text on implementing external inputs, like a camera, microsoft kinect and stuff like that as well.. Thx. #1 dont jump in the deep end so quickly #2 coding is like cooking, you dont ice the cake before you bake it #3 Accelerated C++ by koneg/moo is excellent, go read it #4 ^^ after you do all that, then GUI's #5 yuo may not want to listen to me cause i've half a bottle of Laphroaig down my gullet | ||
weareallclowns
Denmark113 Posts
On December 17 2011 09:38 fabiano wrote: by graphics you mean user interfaces or gaming? For user interfaces I would recommend a book on QT. QT should be very easy to understand and start building apps rightaway. For gaming you can look into OpenGL or use a framework such as Ogre3D. Both of these will take a little more time to code something "functional". I dont know any books to recommend though, I dont read them cause I'm too lazy ![]() I was thinking of neither ![]() edit: Generating patterns and changing them, that sort of thing. Thx for the answer btw. | ||
fabiano
Brazil4644 Posts
You could take a look at OpenCV, but it might be hard for starters. I've never worked with OpenCV before. | ||
weareallclowns
Denmark113 Posts
On December 17 2011 09:41 Detri wrote: #1 dont jump in the deep end so quickly #2 coding is like cooking, you dont ice the cake before you bake it #3 Accelerated C++ by koneg/moo is excellent, go read it #4 ^^ after you do all that, then GUI's #5 yuo may not want to listen to me cause i've half a bottle of Laphroaig down my gullet Haha.. I found that recommendation somewhere else.. I'll take a closer look at it. I've been programming graphics for some time, though only through applications like Processing (Java) vvvv (node based, don't laugh!) and flash's actionscript 2,0 when I was a kid. I will listen to you, because you've had half a bottle of Laphroaig. Thx | ||
weareallclowns
Denmark113 Posts
On December 17 2011 09:46 fabiano wrote: oh, you mean Computational Vision then. You could take a look at OpenCV, but it might be hard for starters. I've never worked with OpenCV before. Okay, I will look further into it. Thanks. edit: the speed of the replies was pretty much astounding, I gotta say. | ||
Millitron
United States2611 Posts
I used Visual Studio 2007, but I wouldn't recommend it, as the IDE's built-in debugger causes more problems than it solves. For instance, it absolutely will not run anything involving image maps if you try to run it within the environment. You have to compile it and run it as a stand-alone, which can be annoying if you have to test-run it a lot. I would suggest using Eclipse for your IDE, as its been great whenever I've used it, though to be honest, I never used it for graphical work. | ||
GiygaS
Canada1043 Posts
Code: + Show Spoiler + ![]() What I get back (note the one tile in the bottom center(the bottom right of the tileset): + Show Spoiler + ![]() | ||
tec27
United States3690 Posts
On December 20 2011 13:41 GiygaS wrote: Can anyone here help me with a problem that's been bugging me all day? I want to make a tile-based movement system for a Roguelike I'm trying to make in Visual Basic.net with the relatively low knowledge that I have (I want this project to be a learning experience). Anyway, I've run in to a problem with the controls.add function, where it only adds the one it's doing right now in the loop. This results in the 49,49 location of hte loop being hte only picture to display. Anyway around this? Here's the code and the result of the code if you want it: Code: + Show Spoiler + ![]() What I get back (note the one tile in the bottom center(the bottom right of the tileset): + Show Spoiler + ![]() What's baseline? Looks to me like you're initializing all of your PictureBoxes to the same reference (does VB even have references like that? I can't recall), which means that when you set various properties on the different array indices you're actually setting the properties on the same object over and over again. Try initializing each slot in the array to a new instance of PictureBox instead. Also, there's pretty much no reason to use VB in this day and age with the plethora of easy and decent beginner languages available ![]() | ||
GiygaS
Canada1043 Posts
On December 20 2011 13:51 tec27 wrote: What's baseline? Looks to me like you're initializing all of your PictureBoxes to the same reference (does VB even have references like that? I can't recall), which means that when you set various properties on the different array indices you're actually setting the properties on the same object over and over again. Try initializing each slot in the array to a new instance of PictureBox instead. Also, there's pretty much no reason to use VB in this day and age with the plethora of easy and decent beginner languages available ![]() Baseline is just a random picturebox I have placed through the designer. I was getting an error because none of them had anything in it before using the New keyword, so i just did that. All information(at leas the important stuff) is actually placed on to the individual array slots in the second double loop. I should have been more clear with the post. The rest of my code is fine, I just can't find a way to add these individual array slots to the control all at the same time (like I said, only the last one is registered :/). @VB thing: I learned it in my class, and I have no alternative right now ![]() | ||
tec27
United States3690 Posts
On December 20 2011 13:57 GiygaS wrote: Baseline is just a random picturebox I have placed through the designer. I was getting an error because none of them had anything in it before using the New keyword, so i just did that. All information(at leas the important stuff) is actually placed on to the individual array slots in the second double loop. I should have been more clear with the post. The rest of my code is fine, I just can't find a way to add these individual array slots to the control all at the same time (like I said, only the last one is registered :/). @VB thing: I learned it in my class, and I have no alternative right now ![]() As I said, you need to initialize each index in the array with its own Picturebox, or they'll all reference the same thing. As it is now, you're setting all 2500 slots to point to the same component, and then when you do things like set their X, Y, etc., you're setting that value 2500 times on the same component. Do something like 'pictile(intindex, intindex2) = new System.Windows.Forms.PictureBox()' instead of setting them equal to baseline and your problem should be solved. It has nothing to do with "not being able to add them to the controls at the same time", you just can't put theh same component on the form 2500 times and expect it to magically have different properties stored in the same memory ![]() | ||
GiygaS
Canada1043 Posts
On December 20 2011 14:03 tec27 wrote: As I said, you need to initialize each index in the array with its own Picturebox, or they'll all reference the same thing. As it is now, you're setting all 2500 slots to point to the same component, and then when you do things like set their X, Y, etc., you're setting that value 2500 times on the same component. Do something like 'pictile(intindex, intindex2) = new System.Windows.Forms.PictureBox()' instead of setting them equal to baseline and your problem should be solved. It has nothing to do with "not being able to add them to the controls at the same time", you just can't put theh same component on the form 2500 times and expect it to magically have different properties stored in the same memory ![]() It worked! Thanks, so much! That actually helps me understand quite a bit too. ![]() | ||
green.at
Austria1459 Posts
![]() | ||
Millitron
United States2611 Posts
On December 22 2011 01:04 green.at wrote: Hey guy's quick question: In a 2D game with maps that are 2Darrays how would i implement multiple levels of altitude on one map. I think adding a z-axis is too wasteful, and placing smaller arrays "on top" of my ground level array seems suboptimal. any suggestions? ![]() What kind of 2D are we talking? Side-to-side, or top-down? | ||
green.at
Austria1459 Posts
| ||
weareallclowns
Denmark113 Posts
On December 18 2011 14:30 Millitron wrote: OpenGL is really good, once you get all the libraries and DLL's installed. It was kind of a pain to do on Windows 7 64 bit; it kept saying it couldn't find files that I was absolutely sure were in the right place, but once it's installed, its great. I used Visual Studio 2007, but I wouldn't recommend it, as the IDE's built-in debugger causes more problems than it solves. For instance, it absolutely will not run anything involving image maps if you try to run it within the environment. You have to compile it and run it as a stand-alone, which can be annoying if you have to test-run it a lot. I would suggest using Eclipse for your IDE, as its been great whenever I've used it, though to be honest, I never used it for graphical work. Late reply, but I felt a thanks was on it's place. I will try Eclipse out. | ||
| ||