[QUOTE=Tamschi;40831363]Have a look at [url=http://facepunch.com/showthread.php?t=1273159]this thread[/url], use version control (I recommend Mercurial with TortoiseHg.), start very very small and be patient.
Don't give up! Programs are usually more complicated to make than it seems but you will start to get faster eventually.[/QUOTE]
Thanks! I appreciate your advice, gives me a fuzzy warm feeling on the inside. However, do you know any guides/videos/books/etc which might come in handy for learning for example C#? Or is that up to me and Google to find?
I'm using OpenGL for the first time, and I'm getting this horrible Z-fighting
[url=http://i.imgur.com/S2lA02N.jpg][img]http://i.imgur.com/S2lA02Nl.jpg[/img][/url]
What can cause it? I've played around with different zNear and zFar values, and it didn't help to fix it.
EDIT: Nevermind, figured it out. I had to glClear(GL_DEPTH_BUFFER_BITS)
[QUOTE=PredGD;40831679]Thanks! I appreciate your advice, gives me a fuzzy warm feeling on the inside. However, do you know any guides/videos/books/etc which might come in handy for learning for example C#? Or is that up to me and Google to find?[/QUOTE]
[URL="http://openbook.galileocomputing.de/visual_csharp_2012/"]The one I used is in German[/URL], so it's probably not useful to you. There's a [URL="http://facepunch.com/showthread.php?t=1260635"]thread[/URL] about this too though.
Edit:
[URL="http://msdn.microsoft.com/en-us/library/w0x726c2.aspx"]MSDN[/URL] is a good library for looking things up, but probably not good for starting.
For [URL="http://mercurial.selenic.com/"]Mercurial[/URL] you can find guides [URL="http://mercurial.selenic.com/wiki/"]here[/URL].
If you google the class names or methods you almost always find the relevant MSDN page as first match. If not add C# to the query.
Edit:
If you're a student you can most likely get Visual Studio 2012 for free.
If not, use [URL="https://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products#product-express-summary"]Visual Studio Express 2012 for Windows Desktop[/URL]. It doesn't support extensions but all the core features are included.
I'm seeing a weird visual bug in some of my sprites.
[img]http://i.imgur.com/EaJzFKN.png[/img]
On the right are the original images made in Paint.NET (scaled up 3x for this post), and on the left are how those images appear ingame. There's a slight distortion about halfway down, and I don't know what's causing it.
[editline]30th May 2013[/editline]
It doesn't seem to be happening if I start drawing an image later on, but the sprites which are drawn from startup have this issue.
[editline]30th May 2013[/editline]
Fixed it! Every frame I was updating the sprites' positions by setting them to the center of their current cell, but my method for getting the center was flawed:
[code]
public Vector2f getCenter()
{
return new Vector2f(bounds.getCenterX(), bounds.getCenterY());
}
I changed it to this:
public Vector2f getCenter()
{
return new Vector2f(Math.round(bounds.getCenterX()), Math.round(bounds.getCenterY()));
}
[/code]
Fixed, yo.
Are you absolutely sure it's in front of the geometry?
I'm reading this book about C# and must say I'm really loving it as far as I've come (not that far really). Problem is I don't understand what the author is trying to say on this page.
[IMG]http://puu.sh/34rbn.png[/IMG]
Should I replace the entire method line or should I partially replace it? Or should I write a new line along with it?
It's telling you to add that highlighted line
[editline]30th May 2013[/editline]
Basically just make your code look like the code on that page?
Oh wow, I never saw that the line had been put into the code, I thought he told me to add it somewhere but didn't say where. :v:
Thanks.
[editline]Wut[/editline]
[IMG]http://puu.sh/34t6L.png[/IMG]
How can I solve this?
[QUOTE=PredGD;40840009]Oh wow, I never saw that the line had been put into the code, I thought he told me to add it somewhere but didn't say where. :v:
Thanks.
[editline]Wut[/editline]
[IMG]http://puu.sh/34t6L.png[/IMG]
How can I solve this?[/QUOTE]
There is example code [URL="http://msdn.microsoft.com/en-us/library/bb896160.aspx"]here[/URL], but without seeing more of the code I can't tell you how to insert it.
This most likely happened because the book was written for an earlier version for Visual Studio.
I've been getting some help with this on the raspberry pi forum and I was hoping you guys would be able to help me with the last bit. How would I do the for loop mentioned in the comment?
[code]def step_forward(self): # this does just one step in the sequence, you might want to do more
# "per click", if so, put all of this in a for loop
self.do_step(self.sequence[self.position])
self.position += 1
if self.position >= len(self.sequence):
self.position = 0
[/code]
[code]import RPi.GPIO as gpio
import time
from Tkinter import *
master = Tk()
master.wm_title("Motor Control")
master.configure(background='black')
class Stepper(object):
def __init__(self, pins, sequence, delay=0.001):
self.pins = pins
self.sequence = sequence
self.delay = delay
self.position = 0
def setup(self):
gpio.setmode(gpio.BOARD)
for pin in self.pins:
gpio.setup(pin, gpio.OUT)
def cleanup(self):
gpio.cleanup()
def step_forward(self):
# this does just one step in the sequence, you might want to do more
# "per click", if so, put all of this in a for loop
self.do_step(self.sequence[self.position])
self.position += 1
if self.position >= len(self.sequence):
self.position = 0
def step_backward(self):
self.position -= 1
if self.position < 0:
self.position = len(self.sequence)-1
self.do_step(self.sequence[self.position])
def do_step(self, step):
for pin in self.pins:
gpio.output(pin, gpio.HIGH) if pin in step else gpio.output(pin, gpio.LOW)
time.sleep(self.delay) # may not be needed for button
PINS = [18,22,24,26]
SEQA = [(18,),(18,22),(22,),(22,24),(24,),(24,26),(26,),(26,18)]
stepper = Stepper(PINS, SEQA)
stepper.setup()
clockwise = Button(master, text="clockwise", bg="black", fg="green", repeatdelay="100", repeatinterval="1", command=stepper.step_forward)
clockwise.grid(row=2, column=1)
anticlockwise = Button(master, text="anti-clockwise", bg="black", fg="green", repeatdelay="100", repeatinterval="1", command=stepper.step_backward)
anticlockwise.grid(row=2, column=2)
cleanup = Button(master, text="cleanup", bg="black", fg="green", repeatdelay="500", repeatinterval="100", command=stepper.cleanup)
cleanup.grid(row=1, column=2)
setup = Button(master, text="setup", bg="black", fg="green", repeatdelay="500", repeatinterval="100", command=stepper.setup)
setup.grid(row=1, column=1)
mainloop()
[/code]
I am new to programming and all, currently got a problem which is kind of hard to explain. I got several objects with the same name and added number behind it. So basically "name1", "name2" etc.
Is there a way to modify them with a for counter? If there were only 6 of them it would not be a problem, but there are over 36 and it would be huge pain in the ass to write one by one manually. On top of that it's also in Java.
[QUOTE=diwako;40842185]I am new to programming and all, currently got a problem which is kind of hard to explain. I got several objects with the same name and added number behind it. So basically "name1", "name2" etc.
Is there a way to modify them with a for counter? If there were only 6 of them it would not be a problem, but there are over 36 and it would be huge pain in the ass to write one by one manually. On top of that it's also in Java.[/QUOTE]
[url]http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html[/url]
[QUOTE=robmaister12;40842264][url]http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html[/url][/QUOTE]
Arrays? I feel dumb now.. Thank you
[QUOTE=diwako;40842185]I am new to programming and all, currently got a problem which is kind of hard to explain. I got several objects with the same name and added number behind it. So basically "name1", "name2" etc.
Is there a way to modify them with a for counter? If there were only 6 of them it would not be a problem, but there are over 36 and it would be huge pain in the ass to write one by one manually. On top of that it's also in Java.[/QUOTE]
Such a naming scheme is very much bad practice. If you have a lot of the same objects, use an array like rob suggested, and don't name all of them, find a different way to identify them (such as by their position in the array if they don't change position such as in your case).
[QUOTE=Tamschi;40840808]There is example code [URL="http://msdn.microsoft.com/en-us/library/bb896160.aspx"]here[/URL], but without seeing more of the code I can't tell you how to insert it.
This most likely happened because the book was written for an earlier version for Visual Studio.[/QUOTE]
The book told me to install Visual C# 2010 Express, which I did. Dunno where that could be placed considering I've only written about 1 line of code and done some SQL local database things.. The rest have been generated by the IDE (visuals).
[editline]watwat[/editline]
I feel more interested in learning C++ over C# (mostly because I see it more widely used). Would it be too hard for a inexperienced programmer to start there?
[QUOTE=PredGD;40844536]The book told me to install Visual C# 2010 Express, which I did. Dunno where that could be placed considering I've only written about 1 line of code and done some SQL local database things.. The rest have been generated by the IDE (visuals).[/QUOTE]
There really is not enough info for us to help you, unless someone reading this has the same book.
Can you upload the SQL database things to pastebin?
I know that eternalflamez has the same book (thanks a lot to him who told me about the book!).
Which parts would I want to upload?
[IMG]http://puu.sh/34Kgi.png[/IMG]
[QUOTE=PredGD;40844536]I feel more interested in learning C++ over C# (mostly because I see it more widely used). Would it be too hard for a inexperienced programmer to start there?[/QUOTE]
Definitely harder than C#.
C++ error messages are often very uninformative compared to C# and there are more pitfalls and things you need to learn before getting started.
It's doable I think, but I wouldn't recommend it.
Could a person do pretty much the same things with C# which you can do with C++? I'm sort of scared that I won't be able to create things which I might have been able to create with C++.
[QUOTE=PredGD;40845807]I know that eternalflamez has the same book (thanks a lot to him who told me about the book!).
Which parts would I want to upload?
[IMG]http://puu.sh/34Kgi.png[/IMG][/QUOTE]
The cs file, that should be the only one with C# code. I don't know much about databases but if you use a connection string somewhere I can insert the code to update the database.
[QUOTE=PredGD;40845832]Could a person do pretty much the same things with C# which you can do with C++? I'm sort of scared that I won't be able to create things which I might have been able to create with C++.[/QUOTE]
For most intents and purposes, yes. C# will serve you just as well as C++.
[QUOTE=PredGD;40845832]Could a person do pretty much the same things with C# which you can do with C++? I'm sort of scared that I won't be able to create things which I might have been able to create with C++.[/QUOTE]
Every language that can call the system API can do everything possible on that system.
With C# you just will get there faster in 90% of cases because it's more convenient. C++ doesn't do as much work for you.
The is a small performance impact when you call native libraries (OpenGL...), but it's usually not enough to warrant switching to native code.
[QUOTE=Tamschi;40845840]The cs file, that should be the only one with C# code. I don't know much about databases but if you use a connection string somewhere I can insert the code to update the database.[/QUOTE]
[url]http://tny.cz/77efbcdf[/url]
Keep in mind that the only things which I've done with the database is creating the tables.
[QUOTE=PredGD;40845888][url]http://tny.cz/77efbcdf[/url]
Keep in mind that the only things which I've done with the database is creating the tables.[/QUOTE]
Looks like the code generator has horrible formatting settings :v:
Sorry, I thought you created them manually from code.
I can't help you with the built-in database feature, never used it.
A let down, but thanks for your help anyway!
Problem is I don't feel like venturing further into the book if I'm stuck where I currently am. I could have done something wrong which can haunt me in later parts, so I don't want to risk that.
Why is C++ more widely used than C# by the way? If C# is "easier" to use, then why would people move over to a harder language when a person can accomplish the same things with a easier language?
By the way: If the book doesn't have a section on XNA it won't hurt to use VS 2012 Express for Windows Desktop instead.
It's a bit faster and there are a few small improvements that make it nicer to work with. The GUI designer has also been improved a lot.
snip, thought you answered this post in the above post. :v:
[QUOTE=PredGD;40846033]A let down, but thanks for your help anyway!
Problem is I don't feel like venturing further into the book if I'm stuck where I currently am. I could have done something wrong which can haunt me in later parts, so I don't want to risk that.
Why is C++ more widely used than C# by the way? If C# is "easier" to use, then why would people move over to a harder language when a person can accomplish the same things with a easier language?[/QUOTE]
C++ has been around longer. It's currently being replaced in desktop application by C# because the latter is just much more convenient.
In games it's sometimes necessary to use C++ if you want to target consoles for example, or need very high performance (in which case the engine is built in C++ and the game logic is often implemented in a scripting language. The new Sim City uses JavaScript for a huge part of the game.).
There are C++ to C compilers and C compilers exist for virtually any programmable device on this planet that isn't locked to Java.
Nice to know. Suppose I'll stick with C# for now. Anyway, I still don't feel like I should continue venturing out in the book without fixing this problem. Should probably contact eternalflamez and see what he has to say.
[QUOTE=PredGD;40846104]Are there any noticeable differences between VS 2012 versus the 2010 edition?[/QUOTE]
It's possible that there are small changes in the names of some menu options, but I'm not sure.
The only major changes I noticed are the visual style and the GUI editor.
Otherwise you can use the async feature and there were [URL="http://msdn.microsoft.com/en-US/library/vstudio/hh678682"]a few small changes to remove common pitfalls[/URL].
Sorry, you need to Log In to post a reply to this thread.