permaculture playing cards*
The moose likes Game Development and the fly likes Moving a StringBuilder object around the x,y cartesian coordinates of a shell - is it possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Moving a StringBuilder object around the x,y cartesian coordinates of a shell - is it possible?" Watch "Moving a StringBuilder object around the x,y cartesian coordinates of a shell - is it possible?" New topic
Author

Moving a StringBuilder object around the x,y cartesian coordinates of a shell - is it possible?

Ted North
Ranch Hand

Joined: Jan 02, 2012
Posts: 193
    
    1

Hi,

I am trying to make a shell game but immediately ran into an obstacle with being able to move a StringBuilder around the x, y space of a terminal shell. Is this possible? I know it is possible with a GUI using things like JLabels that can hold pictures and stuff...

Thank-you for reading.

Respectfully,

Tedster
Maxim Karvonen
Ranch Hand

Joined: Jun 14, 2013
Posts: 104
    
  11
Hi, Ted.

May you clarify your question? StringBuilder is not a visual component. It resides in the computer memory and there are no notion of "x" or "y". Terminal displays some characters, but these characters are not a StringBuilder thing. They are just character on a terminal (they may originate from some StringBuilder however).

Do you want to output text in some specific places of a console? In this case google for "java curses" or "java ncurses". There are several libraries available. I can't suggest any specific library because I never used them.
Ted North
Ranch Hand

Joined: Jan 02, 2012
Posts: 193
    
    1

Maxim Karvonen wrote:Hi, Ted.

May you clarify your question? StringBuilder is not a visual component. It resides in the computer memory and there are no notion of "x" or "y". Terminal displays some characters, but these characters are not a StringBuilder thing. They are just character on a terminal (they may originate from some StringBuilder however).

Do you want to output text in some specific places of a console? In this case google for "java curses" or "java ncurses". There are several libraries available. I can't suggest any specific library because I never used them.


Maxim,

Thank-you for the reply! I did not think about java curses or know there was such a thing until your reply. I have seen this type of display technology elsewhere, python, but did not know java had a version of it or something. It is a bummer I would have to learn a whole new API though and can not use the the basic JDK.

The curses framework maybe my best option. I was wanting to do something like Space Invaders in a terminal shell or command prompt.

Regards,

Ted
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11448
    
  16

remember, the terminal is really a legacy of printers. Back in the day, they didn't have CRT screens, and everything was printed out on a piece of paper. so graphics don't really make sense. You print it, the paper scrolls up, you print the next line.

It sounds like it is possible, but it's probably not the best way to do it. If you want graphics and things to move around, you'd do better to use tools that are designed for such things, such as the GUI/Swing components.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ted North
Ranch Hand

Joined: Jan 02, 2012
Posts: 193
    
    1

fred rosenberger wrote:remember, the terminal is really a legacy of printers. Back in the day, they didn't have CRT screens, and everything was printed out on a piece of paper. so graphics don't really make sense. You print it, the paper scrolls up, you print the next line.

It sounds like it is possible, but it's probably not the best way to do it. If you want graphics and things to move around, you'd do better to use tools that are designed for such things, such as the GUI/Swing components.


Thank-you for the interesting reply Fred. With this in mind I think I am going to use a 3D game engine like jMonkey, or the built in Swing classes, or give JavaFX a spin.

Respectfully,

Ted
 
jQuery in Action, 2nd edition
 
subject: Moving a StringBuilder object around the x,y cartesian coordinates of a shell - is it possible?