Show Posts

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 - ben_g

Pages: 1 ... 57 58 [59] 60 61 ... 71
871
Computer Programming / Setting the background of a JFrame
« on: July 16, 2011, 10:52:48 am »
I'm trying to set the background color of an undecorated JFrame to black, but the SetBackground methot does nothing.

My Window creation code:
Code: [Select]
JFrame.setDefaultLookAndFeelDecorated(true);
    Loading = new JFrame("");
    Loading.setAlwaysOnTop(true);
    Loading.setLayout(null);
    Loading.setUndecorated(true);
    Loading.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    JLabel LoadingText = new JLabel("Loading... - Please wait.");
    LoadingText.setBounds(250,0,500,15);
    LoadingText.setHorizontalAlignment((int)JFrame.CENTER_ALIGNMENT);
    LoadingText.setForeground(Color.WHITE);
    LoadingBar.setMinimum(0);
    LoadingBar.setMaximum(100);
    LoadingBar.setValue(0);
    LoadingBar.setForeground(Color.GREEN);
    LoadingBar.setBackground(Color.RED);
    LoadingBar.setBounds(0,30,1000,30);
    Loading.getContentPane().add(LoadingText);
    Loading.getContentPane().add(LoadingBar);
    Loading.setBounds(Toolkit.getDefaultToolkit().getScreenSize().width/2-500,Toolkit.getDefaultToolkit().getScreenSize().height/2-100,1000,200);
    Loading.setBackground(Color.BLACK);
    Loading.setFocusable(true);
    Loading.setVisible(true);

And this is the result:


You can see that the SetBackground method hasn't done anything. Is there a way to make the background of a JFrame black?

872
ASM / Re: Really Long Source Code
« on: July 16, 2011, 09:02:33 am »
A java game I'm working at has 9 files, each with an average of 2000 lines. That's a total of around 18000 lines of java code. And I still have a lot to do.
My largest basic program is almost 700 lines and over 11Kb large, which is large for a basic program which has almost no text in it.
Largest axe program: 40 lines. I haven't coded much in axe...
My largest (and only) asm program is now around 2500 lines, and also with this program, I still have a lot to code. I think I'm abouth halfway thereof the coding part, then I still have to make levels..

I don't think I can beat someone with the lenght of my programs, but maybe with the lenght of routines: My longest ams routine is 798 lines of (unoptimised) code.

873
TI Z80 / Re: My Last Minute Contest Entry - Easy Game
« on: July 16, 2011, 08:41:35 am »
It's great that someone could make a playable game in such a short time.

874
ASM / Re: Texture drawing
« on: July 14, 2011, 06:42:07 pm »
The ret z dit couse the crash.

But it still doesn't work. It draws a line instaed while it should draw the top third of the quad in solid black (the texture is an 8x8 solid rectangle).


875
ASM / Re: Texture drawing
« on: July 14, 2011, 05:18:07 pm »
Now that is one of the scariest pieces of code I have ever seen.
How do you mean?

But, as to why it's not actually working. Your loop should theoretically work as long as you are giving it valid numbers. (It will actually finish no matter what you give it though) So that leads me to believe that the problem is with your pixel plotting. Most likely, you are trying to plot pixels that are off screen and that is what is causing all of your problems. You end up plotting pixels in your program code, which causes crashes.

If you are really unlucky, you might even be plotting pixels at _ty.
I tried jumping over the plotting part, and it still crashes. By the way, this is done in an app, and ass variables defined inside the app itself won't work, then isn't the program protected against SMC?

By the way: thanks for the optimization.

876
ASM / Re: Texture drawing
« on: July 14, 2011, 11:06:00 am »
I have ported half of the code to asm. This code should draw the top third of a textured quad. My problem is that it doesn't draw anything. It gets stuck in an endless loop, and I don't know why.

Spoiler For The code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;TexQuad
;in: x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, x4, y4, u4, v4
;out: textured quad is drawn to the buffer
TexQuad:
  ld a, (y1)
  ld b, a
  ld a, (y2)
  sub b
  ld (temp), a
  ld a, (x1)
  ld b, a
  ld a, (x2)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dx1), hl
  ld a, (y1)
  ld b, a
  ld a, (y3)
  sub b
  ld (temp), a
  ld a, (x1)
  ld b, a
  ld a, (x3)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dx2), hl
  ld a, (y2)
  ld b, a
  ld a, (y4)
  sub b
  ld (temp), a
  ld a, (x2)
  ld b, a
  ld a, (x4)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dx3), hl
  ld a, (y3)
  ld b, a
  ld a, (y4)
  sub b
  ld (temp), a
  ld a, (x3)
  ld b, a
  ld a, (x4)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dx4), hl
  ld a, (y1)
  ld b, a
  ld a, (y2)
  sub b
  ld (temp), a
  ld a, (u1)
  ld b, a
  ld a, (u2)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (du1), hl
  ld a, (y1)
  ld b, a
  ld a, (y3)
  sub b
  ld (temp), a
  ld a, (u1)
  ld b, a
  ld a, (u3)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (du2), hl
  ld a, (y2)
  ld b, a
  ld a, (y4)
  sub b
  ld (temp), a
  ld a, (u2)
  ld b, a
  ld a, (u4)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (du3), hl
  ld a, (y3)
  ld b, a
  ld a, (y4)
  sub b
  ld (temp), a
  ld a, (u3)
  ld b, a
  ld a, (u4)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (du4), hl
  ld a, (y1)
  ld b, a
  ld a, (y2)
  sub b
  ld (temp), a
  ld a, (v1)
  ld b, a
  ld a, (v2)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dv1), hl
  ld a, (y1)
  ld b, a
  ld a, (y3)
  sub b
  ld (temp), a
  ld a, (v1)
  ld b, a
  ld a, (v3)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dv2), hl
  ld a, (y2)
  ld b, a
  ld a, (y4)
  sub b
  ld (temp), a
  ld a, (v2)
  ld b, a
  ld a, (v4)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dv3), hl
  ld a, (y3)
  ld b, a
  ld a, (y4)
  sub b
  ld (temp), a
  ld a, (v3)
  ld b, a
  ld a, (v4)
  sub b
  ld h, a
  ld l, 0
  ld de, (temp)
  ld e, 0
  call DivFP
  ld (dv4), hl
  ld hl, (x1)
  ld l, 0
  ld (tx1), hl
  ld hl, (x2)
  ld l, 0
  ld (tx2), hl
  ld hl, (u1)
  ld l, 0
  ld (tu1), hl
  ld hl, (v1)
  ld l, 0
  ld (tv1), hl
  ld hl, (u2)
  ld l, 0
  ld (tu2), hl
  ld hl, (v2)
  ld l, 0
  ld (tv2), hl
  ld hl, (y1)
  ld l, 0
  ld (_ty), hl

QuadDrawLoop1:
  ld a, (tx1)
  ld (temp), a      ;i=temp

QuadPlotLoop1:
  ld a, (tx1)
  ld b, a
  ld a, (tx2)
  sub b
  ld c, a
  ld a, (tx1)
  ld d, a
  ld e, 0
  ld a, (temp)
  sub b
  ld h, a
  ld l, 0
  call DivFP
  ld a, h
  ld (temp+1), a   ;tmp=temp+1
  ld b, a
  ld a, 1
  sub b
  ld d, a
  ld e, 0
  ld a, (tu1)
  ld b, a
  ld c, 0
  call MulFP
  push hl
  ld de, (temp+1)
  ld e, 0
  ld bc, (tu2)
  ld c, 0
  call MulFP
  pop de
  add hl, de
  ld a, h
  ld (temp2), a      ;u=temp2
  ld a, (temp+1)
  ld b, a
  ld a, 1
  sub b
  ld d, a
  ld e, 0
  ld a, (tv1)
  ld b, a
  ld c, 0
  call MulFP
  push hl
  ld de, (temp+1)
  ld e, 0
  ld bc, (tv2)
  ld c, 0
  call MulFP
  pop de
  add hl, de
  ld a, h
  ld (temp2+1), a      ;v=temp2+1
;Get the pixel at (u,v) from the texture
  ld a, (temp2+1)   ;load the v coordinate in a
  ld hl, texture
  ld d, 0
  ld e, a
  add hl, de
  ld a, (hl)      ;and load the byte of the v coordinate in a
  ld c, a
  ld a, (temp2)
  ld b, 1
  cp b
  jr c, BitShiftDone   ;no shifting if u=0
  ld b, a

BitShiftLoop:
  sll c
  djnz BitShiftLoop

BitShiftDone:
  push bc         ;1
  ld a, (_ty)
  ld l, a
  ld a, (temp)

getPixel:
   ld   h, 0
   ld   d, h
   ld   e, l
   
   add   hl, hl
   add   hl, de
   add   hl, hl
   add   hl, hl
   
   ld   e, a
   srl   e
   srl   e
   srl   e
   add   hl, de
   
   ld   de, PlotSScreen
   add   hl, de
   
   and   7
   ld   b, a
   ld   a, $80
   ret   z
   
   rrca
   djnz   $-1

  pop bc         ;0
  bit 7, c
  jr z, ResPixel

SetPixel:
  or (hl)
  ld (hl), a
  jr EndPlot

ResPixel:
  cpl
  and (hl)
  ld (hl), a

EndPlot:

  ld hl, (tx1)
  ld de, (dx1)
  add hl, de
  ld (tx1), hl
  ld hl, (tx2)
  ld de, (dx2)
  add hl, de
  ld (tx2), hl
  ld hl, (tu1)
  ld de, (du1)
  add hl, de
  ld (tu1), hl
  ld hl, (tu2)
  ld de, (du2)
  add hl, de
  ld (tu2), hl
  ld hl, (tv1)
  ld de, (dv1)
  add hl, de
  ld (tv1), hl
  ld hl, (tv2)
  ld de, (dv2)
  add hl, de
  ld (tv2), hl
  ld a, (_ty)
  inc a
  ld (_ty), a
  ld c, a
  ld a, (y2)
  ld h, a
  ld a, c
  ld c, h
  cp c
  jp nz, QuadDrawLoop1
  ret      ;voorlopig

All of the math routines are for 8.8 signed floating point math. These are all fully tested so they don't couse the cash.

877
TI Z80 / Re: (Another) DoodleJump for TI
« on: July 13, 2011, 04:29:10 pm »
It's great. Especially for being a first game.

You can make animated screenshots with wabbitemu. Just press backspece.
Just in case that won't work on your computer, I made a screenshot for you.

EDIT: THE GAME over screen would probably look a lot better when you copy what's on the display to the back buffer, and the text to the front buffer. then you can make the background grey and the text black.

And: the jumping would look a lot more realistic with accelleration and decelleration.

878
News / Re: Farewell
« on: July 12, 2011, 02:50:34 pm »
I really hate to see you go. Omnimaga is the most active calc programming community, and almost all of the good programs for TI calculators are made by omnimaga users. Withouth you, the calc comunity would be dead for a looooooong time.

Could you please try to still check the site once in a while? And maybe coming back after letting it rest for some time.

We all will miss you DJ_O

879
ASM / Re: Texture drawing
« on: July 01, 2011, 06:07:44 pm »
But anyway, Why would you think I'm an uber 1337 coder when I'm just a newb?

* ben_g turns of his computer and will be gone for 10 days.

880
ASM / Re: Texture drawing
« on: July 01, 2011, 06:03:18 pm »
Your previous post lets me think your name is Brandon. Am I correct?

881
ASM / Re: Texture drawing
« on: July 01, 2011, 05:59:58 pm »
uBer coders?

Yes, my name starts with a B. My real name is Ben, and my surname starts with a G. That's how I've shosen my name.

882
Introduce Yourself! / Re: Hi friends..
« on: July 01, 2011, 05:54:42 pm »
http://www.cleverbot.com/ < Scary.
cleverbot isn't clever at all. He's stupid. He even says it himself:

After he complained abouth not being a bot for some time:
Quote from: CleverBot
ME:                 Do you complain abouth not being a bot in every sentence with 'bot' in it?
CLEVERBOT:Yes.
ME:                 Wow, you're smarter than i thought.
CLEVERBOT:No.
ME:                 So you're stupid?
CLEVERBOT:Yes.

883
Computer Programming / Re: Anyone good with OpenGL?
« on: July 01, 2011, 03:12:03 pm »
what exactely do you want to know abouth textures in openGL? How to write shaders to display them?

884
Maybe you can first try a hardware emulator (if you find one that is compatible with all of the microships you are going to use). There are some freeware emulators, but I think the best ones aren't free (only the legal versions of them, actually ;) ), but they should cost less than buying all of the hardware anyway, so that might be the best choice. An extra avantage is of cource that an emulator can be reset, while when you break real hardware, you'll have to buy new.

A friend of mine knows a great emulator. I'll ask him if you want. (might take a while. I haven't seen him IRL for almost a year, so I'll have to send an email)

885
Humour and Jokes / Re: 9001 signs you're addicted to calcs and Omni
« on: June 29, 2011, 05:36:18 pm »
1718: you almost have an heart attack every time you think you have lost your calc
1719: you have calcsys installed on your calc
171A: You have tried to archive a blue screen by quickly turning the contrast all the way up and down.
171B: You haven't even noticed that i started counting in HEX

Pages: 1 ... 57 58 [59] 60 61 ... 71