This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - nemo
Pages: 1 ... 11 12 [13] 14 15 ... 82
181
« on: December 31, 2010, 12:12:44 am »
I love everything about Java, except that the source is VERY insecure.
you can always just bundle everything up in a couple meaningless wrapper classes, have one-letter var names, method names and classes. and make all your classes implement random interfaces completely off-base to their real purpose. define a final constant True as 0, and False as 1. write comments that lie. of course this really just bloats your code and makes it unmaintainable.. BUT, no one's going to pick through it.
182
« on: December 30, 2010, 11:12:06 pm »
ColorChooser! it has more range than MS Paint, which really isn't saying much because the actual color-oriented math is done by java. change the final int SIZE in ColorChooser to make the size larger.
here's the source:
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*;;
public class ColorChooserTest extends JFrame{
public ColorChooserTest(){ setSize(400,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("hi"); ColorChooser panel = new ColorChooser(); getContentPane().add(panel); setVisible(true); while(true) panel.repaint(); } public static void main(String[] args){ new ColorChooserTest(); } }
class ColorChooser extends JPanel implements MouseMotionListener,MouseListener{ private final int SIZE = 200; private BufferedImage gradient = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_4BYTE_ABGR); private BufferedImage hueStrip = new BufferedImage(15, SIZE, BufferedImage.TYPE_4BYTE_ABGR); private Rectangle hueRect = new Rectangle(SIZE + 20,10,15,SIZE); private Rectangle gradientRect = new Rectangle(10,10,SIZE,SIZE); private float hue = 0; private Color selectedColor = Color.RED; public ColorChooser(){ addMouseListener(this); addMouseMotionListener(this); setFocusable(true); generateHueStrip(); } public void paintComponent(Graphics g){ Graphics2D g2d = (Graphics2D) g; generateGradient(); g2d.drawImage(gradient,null,10,10); g2d.drawImage(hueStrip,null,SIZE + 20,10); g2d.setColor(selectedColor); g2d.fillRect(10,SIZE+20,30,30); } private void generateHueStrip(){ for(int i = 0; i < SIZE; i++){ Color hsb = Color.getHSBColor((float)(i/(double)SIZE),(float) 1.0,(float) 1); for(int k = 0; k < 15; k++) hueStrip.setRGB(k,i,hsb.getRGB()); } } private void generateGradient(){ for(int saturation = SIZE-1; saturation >= 0; saturation--){ for(int value = SIZE-1; value >= 0; value--){ Color hsb = Color.getHSBColor(hue, (float) saturation / SIZE, (float) value / SIZE); gradient.setRGB(value, SIZE - 1 -saturation, hsb.getRGB()); } } } public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); if(hueRect.contains(x,y)){ x -= SIZE + 20; y -= 10; Color rgb = new Color(hueStrip.getRGB(x,y)); int red = rgb.getRed(); int blue = rgb.getBlue(); int green = rgb.getGreen(); hue = Color.RGBtoHSB(red, green, blue, null)[0]; } else if(gradientRect.contains(x,y)) selectedColor = new Color(gradient.getRGB(x-10,y-10)); } public void mouseDragged(MouseEvent e) { mouseClicked(e); } public void mouseMoved(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e){} }
183
« on: December 30, 2010, 02:30:35 pm »
Yeah, I saw one. So, will you help with color?
what's the problem? you don't know how to set it or you don't know how to parse it?
184
« on: December 30, 2010, 01:59:00 am »
doubling the size of the tiles is as easy as doing g2d.setTransform(AffineTransform.getScaleInstance(2,2)); where g2d is a Graphics2D object. everything drawn will be drawn 2x wider and 2x higher.
you could even find the coefficient to go from your normal tile-size to full-screen, regardless of the user's resolution. Fullscreen tile : fullscreen ratio(use getCenterPoint())
just saying
edit: also, i don't *think* you'll experience much of a slowdown using this method, but don't quote me on that. i should try it with juggernaut before i say this kind of stuff..
Ooh thanks i'll look into this, this might be very interesting!
EDIT: Scaling might not work though... i don't have access to the image that is actually being displayed. I specify a bunch of objects and a background image and the library displays all of them for me.
oh well... it's probably not a good idea anyway. i managed to get it to work on juggernaut, but the slowdown is massive. i used to get around 25-30 fps and now it looks like i get somewhere from 2 to 4. edit: even scaling by 1.1 kills the speed completely.
185
« on: December 30, 2010, 01:25:59 am »
Fullscreen is not planned unfortunately, i would have to redesign the entire game, as well as the engine. Plus, i don't even know if i can do fullscreen with the library i am using. And i think the shadow casting would go really slowly with such a large space, unless i doubled the size of the tiles, which means re-spriting over 200 sprites. In short, i really don't see fullscreen happening
doubling the size of the tiles is as easy as doing g2d.setTransform(AffineTransform.getScaleInstance(2,2)); where g2d is a Graphics2D object. everything drawn will be drawn 2x wider and 2x higher. you could even find the coefficient to go from your normal tile-size to full-screen, regardless of the user's resolution. Fullscreentile : fullscreen ratio(use getCenterPoint()) just saying edit: also, i don't *think* you'll experience much of a slowdown using this method, but don't quote me on that. i should try it with juggernaut before i say this kind of stuff..
186
« on: December 30, 2010, 12:39:49 am »
I know. I just can't figure out how to make it so that EVERYTHING generates a KeyEvent, disabled or not. I just had an idea though...
EDIT: By the way Graph, I was at Mall of America today, and I saw your avatar on a sign
could you go into more detail? or provide some source i could try to figure out how to make it work.
187
« on: December 29, 2010, 10:34:56 pm »
Not in the sense of Turing completeness, where you have to disregard speed of execution. Of course, one would never use BASIC to write an OS because it would be almost as slow as TI-OS v2.53
we disagree on our standard of capability then. yours is just Turing completeness. i gauge the capability of a language on more than that. (e.g. speed).
188
« on: December 29, 2010, 10:24:01 pm »
Most languages are Turing complete, which means they can technically be used for any project. TI-BASIC is one of those languages.
By use, I'm assuming you have a few thousand years to do the computations, given how slow BASIC is
you don't consider quickness of execution as a capability? by the way, i don't mean to bash basic here. i'm painting with a broad stroke, including all languages calculator and computer.
189
« on: December 29, 2010, 10:15:19 pm »
Eventually I became frustruated with the slow speed and lack of capability of basic.
I have to ask: what capabilities does BASIC lack, aside from disabling the obvious run indicator and crashing the calc?
i'm just going to say that's a pretty open-ended question. really, you could ask the question about any language. there is no catch-all language that has all the capabilities needed to program any project.
190
« on: December 29, 2010, 09:45:18 pm »
i think i've designed the final level where you're still captive by the juggernaut. he'll probably have a little soliloquy about how he's tempting you with all those switches and you can't get to them (evil laugh). i'm not 100% sure it's solvable but.. hey. i'll find out after i implement breakable blocks. also, i want to add more enemies but don't know where.
edit: implemented breakable blocks. this level is brutal... i'm having tons of trouble finishing it.
191
« on: December 29, 2010, 06:52:00 pm »
whoever makes an exodus knockoff gets my vote.
192
« on: December 29, 2010, 01:30:34 pm »
193
« on: December 28, 2010, 09:38:58 pm »
EDIT: Special thanks to nemo, for being nemo.
it's hard work, but i make it happen. someone has to be me
194
« on: December 28, 2010, 07:43:54 pm »
shouldn't 9A be sbc a,d?
195
« on: December 28, 2010, 07:36:14 pm »
Yeah he definitively got the scary effects right. It really works. Now imagine if the game was full screen and he added a scene requiring cyan/red 3D glasses with a 3D face popping up.
Btw is full screen possible with that Java library?
full screen is possible in java, yes. i forget how though.
Pages: 1 ... 11 12 [13] 14 15 ... 82
|