Hello Guest

render text and game problems.

  • 20 Replies
  • 26079 Views
Re: render text and game problems.
« Reply #15 on: June 18, 2011, 16:50:45 »
Code: [Select]
[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:

Code: [Select]
           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!
« Last Edit: June 18, 2011, 18:33:29 by thatdude624 »

Re: render text and game problems.
« Reply #16 on: June 18, 2011, 22:04:26 »
Nice.

Re: render text and game problems.
« Reply #17 on: June 20, 2011, 10:17:54 »
thanks for all your help!
Check, I put you in the credits:

And yes, Notch is my role model.

Re: render text and game problems.
« Reply #18 on: June 20, 2011, 11:15:44 »
 :D Haha thanks dude. Not necessary but thanks for the spot.

If you want to include my name: Chris Molini

Re: render text and game problems.
« Reply #19 on: January 13, 2014, 23:19:17 »
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 :)
« Last Edit: January 13, 2014, 23:21:58 by pinnouse »

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: render text and game problems.
« Reply #20 on: January 14, 2014, 16:08:35 »
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.