Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (794)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2] 3 4 ... 10
 11 
 on: 2019-07-18 05:12:36 
Started by pavul - Last post by pavul
Hello everyone, its me again after a year, so i made progress using JavaFX for game Development as hobby, and basically what i am doing is putting a canvas in a node and that node in the stage, all the game is processed on that canvas, however, i would like to implement some blend effects, but so far all examples that exist online are using different nodes, does anyone knows if its possible to use blend using a sole canvas ( node ) instance?, i tried to make this with no result until now, thanks in advance.

 12 
 on: 2019-07-18 05:07:38 
Started by pavul - Last post by pavul
i dont know if there are something like this in the forum( just let me know in that case ), here are some functions i created for a project i am working and are usefull for game dev, i am using JavaFX with Canvas only, dunno if they work on swing, any CC or sugestion will gradly received

CLAMP
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
/**
 * if value is mayor than max value, max value will be returned,
 * if value is minor than min value, min value will be returned,
 * if value is in range between mayor and minor values, then
 * value will be returned
 * @param value
 * @param minValue
 * @param maxValue
 * @return value will never falls below minValue or goes over maxValue
 */

public static float clamp( float value, float minValue, float maxValue )
{
    // value must be between minValue and maxValue
    return (value > maxValue) ? maxValue : (value < minValue) ? minValue : value;
}


LERP
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
/**
 * this function creates linear interpolation depending on argument t,
 * which is the percentage of v0 until v1
 * @example lerp(0, 10, 0.5): will return 5.0, because is the middle ( 0.5 ) between 0 and 10
 * @param v0
 * @param v1
 * @param t
 * @return
 */

public static float Lerp(float v0, float v1, float t)
{
    return (1-t)*v0 + t*v1;
}



LENGHT_DIR_X
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
/**
 * returns X position of the vector determined by length and angleDirection
 * <b>NOTE: you must add to this value to originX where will be added this vector
 * for example sprite.getX()+lengthdirX( 100, 45 )</b>
 * @param length
 * @param angleDirection
 * @return
 */

public static float lengthdirX( float length, float angleDirection )
{
return (float)Math.cos( angleDirection * (Math.PI/180) ) * length;
}


LENGHT_DIR_Y
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
/**
 * returns Y position of the vector determined by length and angleDirection
 * <b>NOTE: you must add to this value to originY where will be added this vector
 * for example sprite.getY()+lengthdirY( 100, 45 )</b>
 * @param length
 * @param angleDirection
 * @return
 */

public static float lengthdirY( float length, float angleDirection )
{
return (float)Math.sin( angleDirection * (Math.PI/180) ) * length;
}


 13 
 on: 2019-07-18 05:01:07 
Started by pavul - Last post by pavul
just recently implemented this in some project i am working, there are some examples of this in stackoverflow but not especifically with a canvas ( i am not 100% sure about that), when this method is called it will create a  UUID.png file on the root of the project, any CC or sugestiong will be gladly received.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
/**
 * this takes an snapshoot of the current game and is stored on the
 * root where the game resides in PNG format
 * @param  canvas
 * @param width width of the image
 * @param height height of the image
 */

public static void takeSnapshot(Canvas cnavas, int width, int height)
{
    WritableImage wim = null;//new WritableImage(width, height);
   
   try
   {
      String fileName = UUID.randomUUID().toString();
   
      File file =  new File( fileName+".png" );
      wim = gm.snapshot( null, null );
      ImageIO.write( SwingFXUtils.fromFXImage( wim ,null ), "png", file );
     
   }
   catch(IOException ioe)
   {
       System.err.println( "::: error when creating snapshot "+ioe.getMessage() );
   }
}//

 14 
 on: 2019-07-17 16:28:15 
Started by BurntPizza - Last post by TritonDreyja
More tweaks to world generation have been made. Caves have a more organic form and whatnot.
Next is tweaking  my lighting engine to improve performance.

 15 
 on: 2019-07-17 08:08:31 
Started by BurntPizza - Last post by Guerra2442
After my 3-month break I'm back with improved contact shadows, this time is an hybrid ray-march instead of a pure ray-tracer.







Still needs improvements but it's way better than the previous one.

 16 
 on: 2019-07-14 01:46:40 
Started by TritonDreyja - Last post by TritonDreyja
Been working on TF for 12 hours today, and solved many problems.

Colored lighting now works, terrain generation algorithm has been reconfigured, and libGDX particles now work with the game properly Smiley


Click to Play

 17 
 on: 2019-07-11 03:23:21 
Started by LeoOno - Last post by SugarBlood
ahah, but this is a nice stuff anyway Grin

 18 
 on: 2019-07-10 10:26:45 
Started by LeoOno - Last post by LeoOno
hey SugarBlood thank you ! it's just i still couldn't learn other graphic libraries xD ...

 19 
 on: 2019-07-10 04:52:10 
Started by princec - Last post by ddyer
Implement reader thread that fills a queue, and a writer thread driven from a queue.
You will never see timeouts again, but it won't fix whatever other bugs there are
In the code generating or absorbing data.

 20 
 on: 2019-07-10 04:27:32 
Started by princec - Last post by prasanna_iitr
Please advise if you able to find any solution to this problem. I  am facing a similiar issue.

Pages: 1 [2] 3 4 ... 10
 
hadezbladez (3181 views)
2018-11-16 13:46:03

hadezbladez (1151 views)
2018-11-16 13:41:33

hadezbladez (3151 views)
2018-11-16 13:35:35

hadezbladez (629 views)
2018-11-16 13:32:03

EgonOlsen (3918 views)
2018-06-10 19:43:48

EgonOlsen (4402 views)
2018-06-10 19:43:44

EgonOlsen (2622 views)
2018-06-10 19:43:20

DesertCoockie (3441 views)
2018-05-13 18:23:11

nelsongames (3573 views)
2018-04-24 18:15:36

nelsongames (4620 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!