Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Inline syntax highlighting tag  (Read 1067 times)
0 Members and 1 Guest are viewing this topic.
Offline Best Username Ever

Junior Member





« Posted 2012-12-05 01:08:03 »

We need a version of the code tag that does syntax highlighting as inline text. For example, I might like to say "You can write add on to a list of numbers by using stringBuilder.append(", ").append(number); or just stringBuilder.append(number); if it's the first number in the list." Or maybe "You typed array[index] instead array[index - 1]." Code tags break up a paragraph even if it's only one line.

So... We can haz
...
tag, please?
Offline theagentd
« Reply #1 - Posted 2012-12-05 02:20:24 »

+1 from me.

Myomyomyo.
Offline ReBirth
« Reply #2 - Posted 2012-12-05 02:40:12 »

There's one more thing annoys me when posting code, tab.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Riven
« League of Dukes »

JGO Overlord


Medals: 438
Projects: 4


Hand over your head.


« Reply #3 - Posted 2012-12-05 02:47:26 »





You can write add on to a list of numbers by using
stringBuilder.append(", ").append(number);
or just
stringBuilder.append(number);
if it's the first number in the list.





You typed
array[index]
instead of
array[index - 1]
.





The problem is most likely caused by how you calculate your tile positions in combination with float rounding.

For example, mathematically equal multiplications and additions might not equal the exact same value. For example
x = y*2 + y;
might not give the exact same result as
x = y*3;


The reason why I took this exact example is because that's most likely what you're doing for your sprite positions (or what LibGDX does). Consider a tile, it goes from
x1 = tileX * tileSize;
to
x2 = tileX * tileSize + tileSize;


However, the tile next to it at index tileX+1 will start at
x1 = (tileX + 1) * tileSize;


Now there's a chance for those two to be different since
tileX * tileSize + tileSize
may not be equal to
(tileX + 1) * tileSize


Rounding the values therefore eliminates the problem, but is not a very elegant solution. =S





System.out.println("Only because you asked so kindly.");
Kiss


Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline theagentd
« Reply #4 - Posted 2012-12-05 02:53:47 »

Riven.getInstance().giveMedal();


Yes, Riven is a singleton! Who knew? =D

Myomyomyo.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 438
Projects: 4


Hand over your head.


« Reply #5 - Posted 2012-12-05 03:02:11 »

1  
int underscoresNowSupported = 1_000_000L;

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline Best Username Ever

Junior Member





« Reply #6 - Posted 2012-12-05 03:03:19 »

Much better. Smiley
Offline Regenuluz
« Reply #7 - Posted 2012-12-05 08:15:40 »

Mhmm, inline code. Nice addition to the feature set! Smiley
Offline ReBirth
« Reply #8 - Posted 2012-12-05 12:52:48 »

Shouldn't it
1  
long underscoresNowSupported = 1_000_000L;

Offline sproingie
« Reply #9 - Posted 2012-12-05 20:05:55 »

Widening conversion baby, doesn't matter if the literal's already an int.  And as you can see, the highlighter picks up the L (I imagine it just meant adding underscore to the token regex for numbers)
Games published by our own members! Check 'em out!
Try the Free Demo of Revenge of the Titans
Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #10 - Posted 2012-12-05 21:07:29 »

YES! Very useful feature!
Thanks Riven!

Online Riven
« League of Dukes »

JGO Overlord


Medals: 438
Projects: 4


Hand over your head.


« Reply #11 - Posted 2012-12-06 17:17:04 »

Ha! Enough medals for this month. See ya in 2013, slackers!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (100 views)
2013-05-17 21:29:12

alaslipknot (108 views)
2013-05-16 21:24:48

gouessej (138 views)
2013-05-16 00:53:38

gouessej (133 views)
2013-05-16 00:17:58

theagentd (145 views)
2013-05-15 15:01:13

theagentd (131 views)
2013-05-15 15:00:54

StreetDoggy (174 views)
2013-05-14 15:56:26

kutucuk (196 views)
2013-05-12 17:10:36

kutucuk (198 views)
2013-05-12 15:36:09

UnluckyDevil (204 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.144 seconds with 22 queries.