[QUOTE=mobrockers2;39993441]I liked it up until I had to switch to eclipse, forced by my college, and I couldn't load my old projects because I found out Netbeans likes to use it's own special frame and panel classes when you use the UI editor. What I also found highly annoying when I used it is that you can't edit any of the code generated by the UI editor.[/QUOTE]
I've never actually done GUI stuff on a desktop platform with Java so I guess I wouldn't really know v:v:v
I was thinking I'd like to make a nice application that I can put game shortcuts into (including Steam/Origin) and then have nice big cover icons. I essentially want to make a coverflow application, but for games that I can launch. I'm trying real hard to think of how I'd go about doing this, but I'm not programmer enough to think of where to start. Visual Basic or C# would be nice, but I'd be willing to learn whatever's the easiest. Any ideas of how I could load shortcuts and icons in after-the-fact?
Hello,
I have a little background knowledge in programming, and know the basic concepts.
I want to learn Java, and I have never programmed in Java before.
I will not take any lessons, because where I live, shits expensive. It costs like $1000 for a cover of a language.
I just want the best Java book you can get for beginners. What do you guys recommend?
Dario
So i have been trying to learn some OpenGL and i keep getting -1 when i call glGetAttribLocation can't figure out whats wrong for the life of me. Could have sworn this was working a few days ago.
vertex shader:
[code]
#version 150
in vec3 vert;
void main() {
gl_Position = vec4(vert, 1);
}
[/code]
c++
[code]
Program::Program() {
this->program = glCreateProgram();
}
...
GLint Program::getAttribLocation(const char* attrib) {
GLint location = glGetAttribLocation(this->program, attrib);
if (location == -1) {
throw std::runtime_error(std::string("Program attribute not found: ") + attrib);
}
return location;
}
...
GLint vertAttrib = program.getAttribLocation("vert");
[/code]
I get "Program attribute not found: vert", any help is much appreciated.
So i'm trying to allocate some space for my 2d array(size [1][1]), tried it like this char** Temp = (char**)malloc(sizeof(char*)), and as i i'm getting new(fgets) words for Temp to store(first dimension position of a word, second dimension word itself) i want to keep extending size of Temp as long as i need it. How do i do that
i'm trying to write a tic tac toe game for my c++ class with 2d arrays (a search for it gives roughly 8 million results so i assume it's a fairly widespread assignment)
my teacher is a jerk though and refuses to let me pass through token (which I'm using as the variable for X or O, depending on the player) into the check to see if there's a winner so instead of eight checks i have to do sixteen, eight for x and eight for O. which is super inconvenient.
currently my code looks like this (I apologize for the shitty writing)
[IMG_THUMB]http://i.imgur.com/8MqKZ9E.jpg[/IMG_THUMB]
i can't tell if that's the most efficient way to write it. I guess theoretically I could just do some nested if then statements, like i know if 0,0 isn't X then it can't be three or four different combinations...but i'm not sure if that will be super efficient or not. any comments?
it's more a question of efficiency at this point, i think
I'm starting to learn C++ for the Source Engine: does anybody know whether to use Visual Studio 2010 or 2012?
[QUOTE=Zinayzen;40006140]i'm trying to write a tic tac toe game for my c++ class with 2d arrays (a search for it gives roughly 8 million results so i assume it's a fairly widespread assignment)
my teacher is a jerk though and refuses to let me pass through token (which I'm using as the variable for X or O, depending on the player) into the check to see if there's a winner so instead of eight checks i have to do sixteen, eight for x and eight for O. which is super inconvenient.
currently my code looks like this (I apologize for the shitty writing)
[IMG_THUMB]http://i.imgur.com/8MqKZ9E.jpg[/IMG_THUMB]
i can't tell if that's the most efficient way to write it. I guess theoretically I could just do some nested if then statements, like i know if 0,0 isn't X then it can't be three or four different combinations...but i'm not sure if that will be super efficient or not. any comments?
it's more a question of efficiency at this point, i think[/QUOTE]
No compiler or interpreter I know of can process text on paper
Therefore why are you writing code on paper?
[editline]23rd March 2013[/editline]
Programming is designed to be done on a terminal. The symbols used in many languages are uncommon; few people can do curly braces, ampersands and the various vertical lines in consistent and distinguishable ways.
The only things you should be doing on paper is math and (flow) diagrams. Even so, it'd be preferable you made them digital for other people's benefit.
i'm just writing it down because my program and codes and shit are all on my school computer and i'm on spring break and like an idiot i didn't bring it with me
i'm just writing it down now so when i get to a computer i can type it in quickly and noth ave to worry about it
you act like you've never seen paper before, did it really not cross your mind that this isn't my final draft
[QUOTE=Zinayzen;40006140]i'm trying to write a tic tac toe game for my c++ class with 2d arrays (a search for it gives roughly 8 million results so i assume it's a fairly widespread assignment)
my teacher is a jerk though and refuses to let me pass through token (which I'm using as the variable for X or O, depending on the player) into the check to see if there's a winner so instead of eight checks i have to do sixteen, eight for x and eight for O. which is super inconvenient.
currently my code looks like this (I apologize for the shitty writing)
[IMG_THUMB]http://i.imgur.com/8MqKZ9E.jpg[/IMG_THUMB]
i can't tell if that's the most efficient way to write it. I guess theoretically I could just do some nested if then statements, like i know if 0,0 isn't X then it can't be three or four different combinations...but i'm not sure if that will be super efficient or not. any comments?
it's more a question of efficiency at this point, i think[/QUOTE]
If you have that big of a statement, its a pretty good indication there is a better way to do it.
[QUOTE=cardboardtheory;40006181]I'm starting to learn C++ for the Source Engine: does anybody know whether to use Visual Studio 2010 or 2012?[/QUOTE]
Higher numbers are better.
[editline]23rd March 2013[/editline]
[QUOTE=MayorBee;40002327]So i have been trying to learn some OpenGL and i keep getting -1 when i call glGetAttribLocation can't figure out whats wrong for the life of me. Could have sworn this was working a few days ago.
vertex shader:
[code]
#version 150
in vec3 vert;
void main() {
gl_Position = vec4(vert, 1);
}
[/code]
c++
[code]
Program::Program() {
this->program = glCreateProgram();
}
...
GLint Program::getAttribLocation(const char* attrib) {
GLint location = glGetAttribLocation(this->program, attrib);
if (location == -1) {
throw std::runtime_error(std::string("Program attribute not found: ") + attrib);
}
return location;
}
...
GLint vertAttrib = program.getAttribLocation("vert");
[/code]
I get "Program attribute not found: vert", any help is much appreciated.[/QUOTE]
All the code you posted is correct.
You probably forgot to compile/link your program/shaders
[editline]23rd March 2013[/editline]
[QUOTE=A big fat ass;39996547]I was thinking I'd like to make a nice application that I can put game shortcuts into (including Steam/Origin) and then have nice big cover icons. I essentially want to make a coverflow application, but for games that I can launch. I'm trying real hard to think of how I'd go about doing this, but I'm not programmer enough to think of where to start. Visual Basic or C# would be nice, but I'd be willing to learn whatever's the easiest. Any ideas of how I could load shortcuts and icons in after-the-fact?[/QUOTE]
You should learn a programming language first, then start working on a project like this.
Also, C# is generally the way to go.
Okey, i'm going to restate my question. I want a 2d array(e.g. char Potential[20][500]- where first dimension is the position of the word, and the second one is word itself) and i also have a temp array in which words are temporary stored whilst fgetc reads a textdocument where there are words written in lines(without spaces) and maximum lenght of the name is 499
this is how it looks
[code]
char Temp[500];
char Potential[20][500];
char FileName[100];
printf("Insert the name of the textFile you want to read from: ");
scanf("%s", FileName);
FILE *file = fopen(FileName,"r");//r za textfajle, rb za non-textfajle
for(int i = 0; fgets(Temp, 500, file) != EOF; i++ ){
Potential[i] = Temp;
}
[/code]
I'm obviously doing something very wrong, but i don't know what
[QUOTE=Zinayzen;40007173]i'm just writing it down because my program and codes and shit are all on my school computer and i'm on spring break and like an idiot i didn't bring it with me
i'm just writing it down now so when i get to a computer i can type it in quickly and noth ave to worry about it
you act like you've never seen paper before, did it really not cross your mind that this isn't my final draft[/QUOTE]
Because you definitely can't use something like Notepad++ or, mad as it may seem, Visual Studio Express right?
[QUOTE=RandomDexter;40009846]Okey, i'm going to restate my question. I want a 2d array(e.g. char Potential[20][500]- where first dimension is the position of the word, and the second one is word itself) and i also have a temp array in which words are temporary stored whilst fgetc reads a textdocument where there are words written in lines(without spaces) and maximum lenght of the name is 499
this is how it looks[/QUOTE]
The only problem is that fgets doesn't return EOF on eof, it sets the eof indicator on the file, which can be checked with feof.
[code]
for(int i = 0; ! feof(file); i++ ){
// put the fgets call right here
Potential[i] = Temp;
}
[/code]
[QUOTE=account;40010760]The only problem is that fgets doesn't return EOF on eof, it sets the eof indicator on the file, which can be checked with feof.
[code]
for(int i = 0; ! feof(file); i++ ){
// put the fgets call right here
Potential[i] = Temp;
}
[/code]
[/QUOTE]
Okey, i did this but it stil crashes
[code]
for(int i = 0; ! feof(file); i++ ){
fgets(Potential[i][0], 500, file);
}
[/code]
or
[code]
for(int i = 0; ! feof(file); i++ ){
fgets(Temp, 500, file);
Potential[i][0] = Temp;
}
[/code]
[QUOTE=Zinayzen;40006140]i'm trying to write a tic tac toe game for my c++ class with 2d arrays (a search for it gives roughly 8 million results so i assume it's a fairly widespread assignment)
my teacher is a jerk though and refuses to let me pass through token (which I'm using as the variable for X or O, depending on the player) into the check to see if there's a winner so instead of eight checks i have to do sixteen, eight for x and eight for O. which is super inconvenient.
currently my code looks like this (I apologize for the shitty writing)
[IMG_THUMB]http://i.imgur.com/8MqKZ9E.jpg[/IMG_THUMB]
i can't tell if that's the most efficient way to write it. I guess theoretically I could just do some nested if then statements, like i know if 0,0 isn't X then it can't be three or four different combinations...but i'm not sure if that will be super efficient or not. any comments?
it's more a question of efficiency at this point, i think[/QUOTE]
Why aren't you looping through the array? You're individually checking if each section is X or O, this means that if you had a larger array, your code would get larger (very large)
You're trying to put a string in a char, RandomDexter. It would just be
[cpp]fgets(Potential[i], 500, file);[/cpp]
I just started learning C# using the book "Head First C# Second Edition" and the first exercise's code doesn't even work for me. I'm using VS 2012, and the book uses 2010, should I revert back to an older version of VS or am I doing something really wrong?
It would help if you posted the code, it would narrow it down a bit. I think it's pretty unlikely that you would have to revert.
Nevermind. It seems that the semi-colon at the end of the code was invalid character. Also how do I line break in VS 2012? \n doesn't seem to be working.
[editline]24th March 2013[/editline]
This was the code that wasn't working for me:
[code]MessageBox.Show("Contact List 1.0.\nWritten by: AJ", "About");[/code]
[editline]24th March 2013[/editline]
After a quick search, I changed it to this because apparently \n doesn't work as the book says so.
[code]MessageBox.Show("Contact List 1.0" + Environment.NewLine + "Written by: AJ", "About")[/code]
[editline]24th March 2013[/editline]
I found out the problem. I was using the Visual Basic project template when I started. :v:
Does LuaInterface not know about operator overloads from .net types? I'm trying to multiply an SFML Vector2f by a number, but it just crashes with "attempt to perform arithmetic on a userdata value"
This is what crashes it:
[cpp]Log(Vector2f(10, 10) * 2)[/cpp]
How would you reference a class variable of an inherited class from the constructor of the super class?
[code]
Class Parent():
VALID = []
def __init__(self, op):
if op in VALID:
self.op = op
else:
raise InvalidOPError
class Child1(Parent):
VALID = ['a', 'b', 'c']
class Child2(Parent):
VALID = ['d', 'e', 'f']
foo = Child1('a') # Fine
foo = Child2('a') # InvalidOPError
[/code]
[editline]24th March 2013[/editline]
Woops, I think I just needed to ask for the VALID member of the instance in the constructor. Is this a valid way of doing this:
[code]
Class Parent():
VALID = []
def __init__(self, op):
if op in self.VALID:
self.op = op
else:
raise InvalidOPError
class Child1(Parent):
VALID = ['a', 'b', 'c']
class Child2(Parent):
VALID = ['d', 'e', 'f']
foo = Child1('a') # Fine
foo = Child2('a') # InvalidOPError
[/code]
I had a 'static const int' which i changed it's value in the header. But when i build my solution it had no effect on the code.
Apparently i had to press "Rebuild solution" instead of "Build solution". Why is this?, What's the difference?
It's possible it was [url="http://en.wikipedia.org/wiki/Precompiled_header"]precompiling the headers[/url] and only recompiled them when you hit rebuild.
Alright this shit is getting on my nerves. I'm debugging a shell program that uses native university libraries, so I can only debug it in gdb on their terminal. That's fine with me. Except when I run gdb, I get this shit:
[code]
(gdb) run
Starting program: ... program name here ...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Cannot find new threads: generic error
[/code]
What in the fuck. There is nothing in my program remotely resembling the use of threads. I don't even have thread libraries included.
How do I disable the thread debugging feature? It's preventing me from doing normal debugging, and Google searches have turned up nothing so far.
[QUOTE=thirty9th;40025086]Alright this shit is getting on my nerves. I'm debugging a shell program that uses native university libraries, so I can only debug it in gdb on their terminal. That's fine with me. Except when I run gdb, I get this shit:
[code]
(gdb) run
Starting program: ... program name here ...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Cannot find new threads: generic error
[/code]
What in the fuck. There is nothing in my program remotely resembling the use of threads. I don't even have thread libraries included.
How do I disable the thread debugging feature? It's preventing me from doing normal debugging, and Google searches have turned up nothing so far.[/QUOTE]
You might be linking to some library that uses multithreading. Someone suggested that actually linking to libpthread yourself might fix this.
[QUOTE=esalaka;40025111]You might be linking to some library that uses multithreading. Someone suggested that actually linking to libpthread yourself might fix this.[/QUOTE]
Yeah I tried linking to it myself. It didn't help.
All of the libraries I included are absolutely necessary; leaving them out to avoid this problem is not an option.
So is there a way to manually disable this libthread_db debugging? I have no reason to use threads in this application.
So I've got my other problems fixed, however I have a new one related to audio. When the score on the game gets to a certain point, an image pops up along with audio. My code is
[code]
if(score1>=15)
{
//draw image, blah blah blah
//audio stuff below:
try
{
InputStream is1 = new FileInputStream("scorescreen1.wav");
AudioStream aud1 = new AudioStream(is1);
AudioPlayer.player.start(aud1);
}
catch(FileNotFoundException fnf1)
{
System.out.println(fnf1.getMessage());
}
catch(IOException ioex1)
{
System.out.println(ioex1.getMessage());
}
}
[/code]
Now, this compiles fine and dandy, but when I run the program and get to the screen, the audio file opens up over and over and over again. I realize this is because it is stuck in the if statement and is being told to do so constantly because score1 is still >= 15. I want to know if there's a way for me to tell it to do it only once while remaining inside the if statement
[QUOTE=prooboo;40028002]So I've got my other problems fixed, however I have a new one related to audio. When the score on the game gets to a certain point, an image pops up along with audio. My code is
[code]
if(score1>=15)
{
//draw image, blah blah blah
//audio stuff below:
try
{
InputStream is1 = new FileInputStream("scorescreen1.wav");
AudioStream aud1 = new AudioStream(is1);
AudioPlayer.player.start(aud1);
}
catch(FileNotFoundException fnf1)
{
System.out.println(fnf1.getMessage());
}
catch(IOException ioex1)
{
System.out.println(ioex1.getMessage());
}
}
[/code]
Now, this compiles fine and dandy, but when I run the program and get to the screen, the audio file opens up over and over and over again. I realize this is because it is stuck in the if statement and is being told to do so constantly because score1 is still >= 15. I want to know if there's a way for me to tell it to do it only once while remaining inside the if statement[/QUOTE]
Unless I'm missing something.. add another variable that's false initially, set to true in the statement then check it's false in the if.
[QUOTE=chaz13;40028382]Unless I'm missing something.. add another variable that's false initially, set to true in the statement then check it's false in the if.[/QUOTE]
Thanks! I fixed it by putting:
[code]
boolean audiocheck1 = true;
//all the other shit
//gameloop code, blah blah blah
if(score1>=15)
{
//draw image, blah blah blah
//audio stuff below:
if(audiocheck1)
{
try
{
InputStream is1 = new FileInputStream("scorescreen1.wav");
AudioStream aud1 = new AudioStream(is1);
AudioPlayer.player.start(aud1);
audiocheck1 = false;
}
catch(FileNotFoundException fnf1)
{
System.out.println(fnf1.getMessage());
}
catch(IOException ioex1)
{
System.out.println(ioex1.getMessage());
}
}
}
[/code]
Sorry, you need to Log In to post a reply to this thread.