It returns an int that represents a color. See http://www.programmingsimplified.com/c/graphics.h/colors for more info. Also google getColor for more explanation.
You could use the actual color numbers in your code, or you could add something like
#define RED 4
#define YELLOW 14
at the top of your program (and remove the quotes in the if tests).
As such, the Stanford Portable Library is under a GNU license, which makes it legal for us (or in fact, me) to redistribute it to you, or anyone else, as stated by the license:
/* Stanford Portable Library /
/ Copyright (C) 2013 by Eric Roberts /
/ This program is free software: ...
Are you doing anything with x ? Checking it to make sure that you don't go outside (ie, checking that it is within the bounds of width of the window?) And when you do that, make sure you take into account the width of the paddle itself.
Let's say that window is 400px wide and your paddle is 10px wide.
If you move your mouse to the very edge, getX(event) ...
Be sure that you have Makefile from the src4m file in the same directory and use make click to compile. This Makefile contains compilation rules for each specific file that override the generic one of the default make command.
The "unused variable" error is actually a warning, but the default compilation command toggles the -Werror option, which treats all ...
the SPL is originally written in Java. as you probably know, Java is an object-oriented programming language.
basically a C program that makes use of the SPL creates a process in the background running the program called spl.jar (located under /usr/lib/ in appliance 2014) through an intermediate layer.
spl.jar a Java program that the SPL provides which ...
I'm afraid there is no way for the SPL to work on the CS50 IDE the same way it works on the appliance. what you can do though is to download VMware's alternative, Oracle's VirtualBox, which is free of charge, import your appliance there, then use it as much as you want.
follow the steps here for specific instructions on how to set things up with VBox!
You should be able to use whatever fonts are installed in your machine (i.e., in the appliance). You can see them by running the Settings Manager app from the CS50 menu. Choose Appearance and then Fonts to see the list.
Then, in your code, use setFont(label, 'URW Gothic L-24'); for example.
Just for reference, the problem was that the OP installed Oracle's JDK manually, and the directories containing the JDK's programs were not on root's PATH. That's why sudo make install failed, when it was trying to use jar.
There's more than one solution to this problem, including putting these directories on root's PATH, or softlinking the program's to ...
You need to recompile the c source in order to get a binary file that the Debian system can execute. However, even if you compile for your Debian system, you will run into some more problems. The SPL library that provides the graphic objects is not available in source. It is compiled for the Fedora 32 bit system. Which means that even though your source code ...
As Kareem said in his comment, you need to recompile your code in the Debian environment in order to run it in that environment.
When you compile C source code, the compiler translates it into the appropriate machine code for the current system. This is why a lot of software comes in different versions for different operating systems. Each Linux ...
x_coord is incrementing by 10 each time, yet your brick width is set to 30. Looks like you might have mixed your x's and y's up!
x_coord = x_coord + 10;
Instead of 10, you will need to increment by 30 plus whatever you have calculated as the gap.
This is because you are trying to compile the 2015 version of breakout with the 2014 version of the appliance.
The best thing you can do is install the new appliance and then the files in src4m/ should compile with no problem. Also this way you will avoid possible problems in the problem sets that are different from the ones in 2014.
But if you want to ...
If you want to find a easier way, go for a compiler like devcpp which also compiles C code.
Since the souce for SPL is available in the comments already shared above, you can compile them and get a lib as output.
Since you're good with cygwin already, use the makefile file that surely would be coming with the SPL library and make sure the libspl.a file is ...
Even I have faced the same problem.
You cannot use the default Make command to compile programs which use the Stanford Portable Library.
The default Make command doesn't link this library.
That is the reason a different Makefile is provided when you download the pset3.zip which links spl.
For personal use of spl, i execute -> clang file.c -o file -lcs -lm
The 2015 breakout problem set was modified slightly from last year. You are using Appliance 19 from 2014, but you seem to be following the 2015 problem set specification judging by your include statement, #include <spl/gevents.h>. Last year the include statement was #include "gevents.h", because the SPL header files had to be downloaded in the src5m ...
two main solutions
copy the Makefile of breakout to the directory where your source code file is, open it, alternate every "breakout" with the name of your program then navigate to this directory using the terminal and execute
to manually write and execute the compilation command as follows
The provided version of the Stanford Portable Library does provide GRectangle. Your code just needs to include the correct .h file in order to be able to use it. In this case, the file you need is gtypes.h:
As for the documentation being incorrect, this does seem to be the case in some instances. However, you can refer to the .h files ...
This is what i did to get this working on osx el capitan. (I already have a working cs50 library installed)
you will need to install git first https://git-scm.com/
open a terminal and clone the spl git repo
user@mbp:~/$ git clone https://github.com/cs50/spl.git
user@mbp:~/$ cd spl
this will compile the libcs.a library and the spl.jar ...