render text and game problems.

Started by thatdude624, June 08, 2011, 16:51:26

Previous topic - Next topic

thatdude624

[code]            public void renderblock(int x,int y, float size)
            {
                    GL11.glBegin(GL11.GL_QUADS);
                    GL11.glVertex2f(x - size, y + size);
                    GL11.glVertex2f(x + size, y + size);
                    GL11.glVertex2f(x + size, y - size);
                    GL11.glVertex2f(x - size, y - size);
                    GL11.glEnd();
            }
        

       public void rendergame()
       {
           GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
           GL11.glLoadIdentity();
           
           object=world.updateworld(object);
           for (int ydraw = 12; ydraw < 535; ydraw+=22) {
               for (int xdraw = 12; xdraw < 785; xdraw +=22) {
                   GL11.glColor4f(0.0f, 0.5f, 0.5f,1f);//layer 1:def colour
                   colourblock((xdraw-12)/22,(ydraw-12)/22);//layer 2: block colour
                   if (world.mousecont(xdraw,ydraw,mouseX,mouseY,world.getsetting(0))==true)
                   {
                       renderblock(xdraw,ydraw,7);
                   
                       
                       mousegridX=xdraw;mousegridY=ydraw;
                   }
                   
                   renderblock(xdraw,ydraw,10);
                   
                   //GL11.glColor4f(0.0f, 0.5f, 0.5f);
                   
               }
           }
       }[/code]

that is the current gamerenderer. i think the actual drawing is important, so here is that:

           public void renderblock(int x,int y, float size)
            {
                    GL11.glBegin(GL11.GL_QUADS);
                    GL11.glVertex2f(x - size, y + size);
                    GL11.glVertex2f(x + size, y + size);
                    GL11.glVertex2f(x + size, y - size);
                    GL11.glVertex2f(x - size, y - size);
                    GL11.glEnd();
            }
        

then i have world.renderFX, but that is just some mouse-over info, and ads a smaller square to buttons, to show its state (doesn't work yet)


EDIT: nvm, i got it working without the distance thing, thanks though!
i do, however have meany more questions... ill probably start a new topic for that, though.
it looks mutch nicer now, with these transparent boxes!

CodeBunny


thatdude624

thanks for all your help!
Check, I put you in the credits:

And yes, Notch is my role model.

CodeBunny

 :D Haha thanks dude. Not necessary but thanks for the spot.

If you want to include my name: Chris Molini

pinnouse

Btw, u should use enums instead of your display thing, y'know, your if (display == 1) thing

I'm not doing this for getting credit or anything, just helping out a fellow programmer after a fellow programmer helped me  ;D

But this is up to you, if you feel as if you don't need to, I'm fine, I just find it easier for me :)

quew8

It's a valid point but I'm afraid @thatdude624 hasn't been active on these forums since 2011. If that wasn't the case I would approve wholeheartedly, but since it is I have to say that I don't think it was worth reviving this dead thread.

I'm not trying to discourage you - you seem like you'll be a great help around here (I'm going on your one other post that was excellent advice) - just that necroing threads is generally looked down upon. And there are reasons for that. It isn't just some weird forum goer practice or anything. Just suggesting you don't do it again for minor points.