Library acess some core function and other not

I, I’m trying to create my own library and it’s not so easy.
The small class I create don’t recognize the “color” type even he is in processing.core.

public class Triangle {
	color[] colors = new color[3];}

The function sh = createShape(); is not recognize and noStroke(); triangle() also.

The triangle class begin with package minimap; import processing.core.*;
Here’s an expert in the place ?

1 Like

Function color() exists in Processing’s API:

  1. PApplet
  2. PGraphics

But Processing’s primitive datatype color is the same as Java’s int.

2 Likes

I agree, ofCourse. But eclipse bug on these lines. How to access all processing function in my lib ?

Java programming outside the PDE is pretty much like having “.java” file tabs on the PDE: :coffee:



1 Like

Sorry, I don’t understand.
I think it’s an eclipse configuration mistake because I can use PVector but not color and there are both in processing.core.

1 Like

Not in the same way. PVector is defined in Processing’s library API – however color as a datatype is a keyword handled by the preprocessor that turns pde files into java files before executing them. It does this:

  1. finds the word “color” used as a datatype
  2. replaces it with int

If you are writing java, then you aren’t running your code through the preprocessor. This means:

  1. you have to write “public” or “private” – the preprocessor wont add them for you
  2. you have to use “int” – the preprocessor won’t change color into int for you.
  3. et cetera
2 Likes