1. Post #1441
    T3hGamerDK's Avatar
    January 2011
    2,551 Posts
    I've hacked with Desura and I've used HOLLY to make a Fraps thing all using LD_LIBRARY_PATH, would you mind sharing the shell script you're launching, the directory structure, the library filenames, outputs, etc. Just anything that would help.
    what
    Reply With Quote Edit / Delete Linux Denmark Show Events

  2. Post #1442
    Richy19's Avatar
    May 2010
    5,382 Posts
    I've hacked with Desura and I've used HOLLY to make a Fraps thing all using LD_LIBRARY_PATH, would you mind sharing the shell script you're launching, the directory structure, the library filenames, outputs, etc. Just anything that would help.
    Did you ever release the linux/holly fraps thing? If so mind linking?
    Reply With Quote Edit / Delete Linux United Kingdom Show Events

  3. Post #1443
    Gold Member
    Naelstrom's Avatar
    June 2010
    2,687 Posts
    He probably redirected the LD_LIBRARY_PATH to use his own libraries, which he can inject his own code into.
    Reply With Quote Edit / Delete Linux United States Show Events

  4. Post #1444
    Mr.Heal's Avatar
    January 2012
    128 Posts
    Anyone know any good materials for learning 2D Games in Java? I would like to use just plan java, no libraries. I can't seem to find any good resources on how to start.
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  5. Post #1445
    Gold Member
    Jookia's Avatar
    July 2007
    6,768 Posts
    Did you ever release the linux/holly fraps thing? If so mind linking?
    Uh, nope. Here it is. It segfaults though, but that's probably due to aging.

    He probably redirected the LD_LIBRARY_PATH to use his own libraries, which he can inject his own code into.
    I think the term for this on Windows is DLL injection, except it's really hard to do.
    Reply With Quote Edit / Delete Linux Australia Show Events

  6. Post #1446
    Anyone here know how Advance Tile Loader library for Love2D works? I been trying to learn and I been trying to fix this problem for like 2 days. Basically I made it so the player moves more smoothly instead of tile by tile but this broke a lot that I can't seem to fix. Before I was able to check if the next tile was an obstacle and/or useable tile. It still does this but not what I want. It does collision on my sprite's foot and I can't do any interacting with useable tiles. I'd appreciate the help.

    Link to .love file.

    https://docs.google.com/open?id=0B9C...HNCNDNlOVl4alk
    Reply With Quote Edit / Delete Windows XP United States Show Events

  7. Post #1447
    Doom's Avatar
    August 2011
    591 Posts
    So I'm new to C# and I was wondering how everytime I try to change something in the middle of my code it highlights an entire letter, and if I then write something it deletes everything infront of that letter which makes me have to type everything all over.

    Sorry for the dumb question
    Reply With Quote Edit / Delete Windows 8 Denmark Show Events

  8. Post #1448
    Gold Member
    hexpunK's Avatar
    August 2008
    15,316 Posts
    So I'm new to C# and I was wondering how everytime I try to change something in the middle of my code it highlights an entire letter, and if I then write something it deletes everything infront of that letter which makes me have to type everything all over.

    Sorry for the dumb question
    Have you pressed the Insert key by mistake by any chance.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 4 (list)

  9. Post #1449
    Doom's Avatar
    August 2011
    591 Posts
    Have you pressed the Insert key by mistake by any chance.
    Thanks, that solved it!
    Reply With Quote Edit / Delete Windows 8 Denmark Show Events Funny Funny x 10Friendly Friendly x 1 (list)

  10. Post #1450
    DevBug's Avatar
    July 2010
    1,059 Posts
    I'm trying to create and destroy a lot of objects every frame in my game in C++. It's an attempt to implement Bullet's debug-drawer, which gives me objects one primitive at a time (line, sphere, box, etc.)

    This works fine until I try to draw terrain-collision, which is fed to me one line at a time and can be 7k line primitives+ each frame.

    My current debug system takes each primitive request, generates a Vertex and Index buffer and pushes it back into a std::vector. Then, at the end of each frame it sees which ones have expired lifetimes (since it supports long-term objects, not just every frame) and removes those.

    However, when trying to create and delete 7K+ objects per frame, the std::vector is becoming problematic because of allocation/deconstruction time, even with 10,000 CBaseDebugPrimitive *'s pre-reserved.

    I know I need to reduce allocations, and reuse existing ones each frame, but I can't come up with a solid solution. If I just pre-allocate say 10,000 lines and keep them in a list, I still have to search through the entire list each time I add an object to find the first free spot, and that becomes slower and slower the more objects there are.

    Am I missing something obvious?

    Edit:
    I thought about combining like draw-calls into one big set of GPU buffers, but that still has the problem of 'holding' them until the end of the frame, and checking to see if they exist already can be a very slow process.

    Second Edit:
    All of the Bullet demos just use immediate-drawing mode in OpenGL and skip creating a buffer, etc. I'm using directX 10, so this is NOT an option as far as I know.
    Object pools. Also, PhysX.
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  11. Post #1451
    Gold Member
    Lord Ned's Avatar
    April 2006
    3,702 Posts
    Object pools. Also, PhysX.
    Yeah I did fix it. I just allocated 10,000 'line' instances (start, end, 3 bytes for color) which turns out to be ~230mb but it's debug-only so it'll do for now. At the end of each frame we just set the index of which we're using to zero, incriment each time a line is added during the frame, and generate a VBO/IBO from all of the instances once at each frame. Works great.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  12. Post #1452
    Philly c's Avatar
    February 2008
    557 Posts
    I would make a suitably sized vertex buffer (it doesn't have to be able to store all of them at once, in fact don't waste space), and map it at the start of the frame, copy vertexes straight in to it from bullet, unmap it and draw the amount. If it maxes draw and keep going. Use line list primitive type to avoid index buffer.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  13. Post #1453
    Gold Member
    Lord Ned's Avatar
    April 2006
    3,702 Posts
    I would make a suitably sized vertex buffer (it doesn't have to be able to store all of them at once, in fact don't waste space), and map it at the start of the frame, copy vertexes straight in to it from bullet, unmap it and draw the amount. If it maxes draw and keep going. Use line list primitive type to avoid index buffer.
    That does sound like a less-memory intensive, more stable and more futureproof method. I don't know what would happen if I drew it immediately when it hit max, could end up rendering behind the sky. I do understand what you're getting at however.

    Thanks!
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  14. Post #1454
    Philly c's Avatar
    February 2008
    557 Posts
    That does sound like a less-memory intensive, more stable and more futureproof method. I don't know what would happen if I drew it immediately when it hit max, could end up rendering behind the sky. I do understand what you're getting at however.

    Thanks!
    Fair point actually. What I said about drawing at max then and there could easily come out of order.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  15. Post #1455
    Gold Member
    Number-41's Avatar
    August 2005
    4,288 Posts
    When doing Love2D stuff, does every function have to be a member function of love? (love.xxxx ())
    Reply With Quote Edit / Delete Windows 7 Belgium Show Events

  16. Post #1456
    Glorious GNU/Linux Master Race
    kaukassus's Avatar
    May 2010
    5,217 Posts
    C# + Microsoft excel question:

    Is it possible to add a module/macro into an excel sheet using c#?

    I need to create something like this:
    A console program, that adds a macro to all excel sheets in the same folder.
    Reply With Quote Edit / Delete Windows 7 Switzerland Show Events

  17. Post #1457
    Richy19's Avatar
    May 2010
    5,382 Posts
    If I have this array:
    Block* chunk[16][16][16];
    
    for(int z = 0; z < 16; z++)
            for(int y = 0; y < 16; y++)
                for(int x = 0; x < 16; x++)
                    chunk[z][y][x] = new Block();
    

    is this the correct way to delete the array?

    for(int z = 0; z < 16; z++)
        {
            for(int y = 0; y < 16; y++)
            {
                delete[] chunk[z][y];
            }
    
            delete[] chunk[z];
        }
    
        delete[] chunk;

    it gave me memory errors so instead I just :
    for(int z = 0; z < 16; z++)
        {
            for(int y = 0; y < 16; y++)
            {
                for(int x = 0; x < 16; x++)
                {
                    delete chunk[z][y][x];
                    chunk[z][y][x] = NULL;
                }
            }
        }
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Agree Agree x 1 (list)

  18. Post #1458
    Richy19's Avatar
    May 2010
    5,382 Posts
    Another problem, I realize theres lots of code but if anyone can have a look it would be much appreciated:


    Block header:

    #ifndef BLOCK_HPP_INCLUDED
    #define BLOCK_HPP_INCLUDED
    #include <GL/glew.h>
    #include <SOGLF.hpp>
    #include <glm/glm.hpp>
    #include <vector>
    
    struct Side
    {
        SOGLF::Triangle tri[2];
        void setTri(int t, const SOGLF::Triangle &tr)
        {
            tri[t] = tr;
        }
    };
    
    class Block
    {
    public:
        enum Sides
        {
            Front,
            Right,
            Back,
            Left,
            Top,
            Bottom
        };
    
    protected:
        Side sides[6];
        unsigned char TextureID;
        glm::vec3 Position;
    
    public:
        Block();
        Block(const glm::vec3 &pos, float scale);
        ~Block();
        const Side &getSide(Sides s);
    };
    
    #endif // BLOCK_HPP_INCLUDED
    

    Block cpp
    #include "Block.hpp"
    
    Block::Block() {}
    
    Block::Block(const glm::vec3 &pos, float scale)
    {
        Position = pos;
        TextureID = 0;
        float hscale = scale / 2.0f;
    
        SOGLF::Vertex v[8];
        v[0] = SOGLF::Vertex( glm::vec3( pos.x - hscale, pos.y - hscale, pos.z + hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
        v[1] = SOGLF::Vertex( glm::vec3( pos.x - hscale, pos.y + hscale, pos.z + hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
        v[2] = SOGLF::Vertex( glm::vec3( pos.x + hscale, pos.y + hscale, pos.z + hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
        v[3] = SOGLF::Vertex( glm::vec3( pos.x + hscale, pos.y - hscale, pos.z + hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
    
        v[4] = SOGLF::Vertex( glm::vec3( pos.x + hscale, pos.y - hscale, pos.z - hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
        v[5] = SOGLF::Vertex( glm::vec3( pos.x + hscale, pos.y + hscale, pos.z - hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
        v[6] = SOGLF::Vertex( glm::vec3( pos.x - hscale, pos.y + hscale, pos.z - hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
        v[7] = SOGLF::Vertex( glm::vec3( pos.x - hscale, pos.y - hscale, pos.z - hscale ) , glm::vec2(0.0, 0.0) , glm::vec3(0.0) );
    
    
        SOGLF::Triangle t[12];
        t[0] = SOGLF::Triangle(v[0], v[1], v[3]);
        t[1] = SOGLF::Triangle(v[3], v[1], v[2]);
    
        t[2] = SOGLF::Triangle(v[3], v[2], v[4]);
        t[3] = SOGLF::Triangle(v[4], v[2], v[5]);
    
        t[4] = SOGLF::Triangle(v[4], v[5], v[7]);
        t[5] = SOGLF::Triangle(v[7], v[5], v[6]);
    
        t[6] = SOGLF::Triangle(v[7], v[6], v[0]);
        t[7] = SOGLF::Triangle(v[0], v[6], v[1]);
    
        t[8] = SOGLF::Triangle(v[7], v[0], v[4]);
        t[9] = SOGLF::Triangle(v[4], v[0], v[3]);
    
        t[10] = SOGLF::Triangle(v[1], v[6], v[2]);
        t[11] = SOGLF::Triangle(v[2], v[6], v[5]);
    
    
    
        for(int i = 0; i < 12; i++)
            sides[ (i/2) ].setTri( (i%2), SOGLF::Triangle(t[i]) );
    }
    
    
    Block::~Block()
    {
    
    }
    
    const Side &Block::getSide(Sides s)
    {
        return sides[s];
    }
    

    Chunk header
    #ifndef CHUNK_HPP_INCLUDED
    #define CHUNK_HPP_INCLUDED
    
    #include "Block.hpp"
    #include "soglf/Texture.hpp"
    #include "soglf/Drawable.hpp"
    #include "soglf/Shader.hpp"
    
    struct BlockSidesIndices
    {
        int F, L,B, R, T, Bot;
        int F2, L2,B2, R2, T2, Bot2;
    };
    
    class Chunk
    {
        Block* chunk[16][16][16];
        GLuint vertexbuffer;
        GLuint uvbuffer;
        GLuint normalbuffer;
        GLuint indexbuffer;
        std::vector<glm::vec3> PosList;
        std::vector<glm::vec2> UVList;
        std::vector<glm::vec3> NormList;
        std::vector<GLuint> IndexList;
        std::vector<BlockSidesIndices> chunkBlockIndex;
    
        SOGLF::Texture bitmap;
        SOGLF::Shader shader;
        glm::mat4 MVP;
    
        GLuint TextureID;
        GLuint NormalsID;
        GLuint MVPID;
        GLuint PositionID;
        GLuint UVID;
        GLuint DrawLinesID;
    
    public:
        Chunk();
        ~Chunk();
        void Recompute();
        void Draw();
    };
    
    #endif // CHUNK_HPP_INCLUDED
    

    chunk cpp
    #include "Chunk.hpp"
    
    Chunk::Chunk()
    {
    
        shader = SOGLF::Shader("./basic.vert" , "./basic.frag");
    
        MVPID = glGetUniformLocation(shader.GetShaderID(), "MVP");
        TextureID = glGetUniformLocation(shader.GetShaderID(), "Texture");
        DrawLinesID = glGetUniformLocation(shader.GetShaderID(), "DrawLines");
        PositionID = glGetAttribLocation(shader.GetShaderID(), "Position");
        UVID = glGetAttribLocation(shader.GetShaderID(), "UV");
        NormalsID = glGetAttribLocation(shader.GetShaderID(), "Normals");
    
        for(int z = 0; z < 16; z++)
        {
            for(int y = 0; y < 16; y++)
            {
                for(int x = 0; x < 16; x++)
                {
                    chunk[z][y][x] = new Block(glm::vec3( x - 8,  y-8, z-8 ) , 1.0f);
    
                    for(int i = 0; i < 6; i++)
                    {
    
                        Side s = chunk[z][y][x]->getSide( (Block::Sides)i );
    
                        SOGLF::Triangle tri1 = s.tri[0];
                        SOGLF::Triangle tri2 = s.tri[1];
    
                        PosList.push_back(tri1.vertex[0].Position);
                        PosList.push_back(tri1.vertex[1].Position);
                        PosList.push_back(tri1.vertex[2].Position);
    
                        PosList.push_back(tri2.vertex[0].Position);
                        PosList.push_back(tri2.vertex[1].Position);
                        PosList.push_back(tri2.vertex[2].Position);
    
                        UVList.push_back(tri1.vertex[0].UV);
                        UVList.push_back(tri1.vertex[1].UV);
                        UVList.push_back(tri1.vertex[2].UV);
    
                        UVList.push_back(tri2.vertex[0].UV);
                        UVList.push_back(tri2.vertex[1].UV);
                        UVList.push_back(tri2.vertex[2].UV);
    
                        NormList.push_back(tri1.vertex[0].Normal);
                        NormList.push_back(tri1.vertex[1].Normal);
                        NormList.push_back(tri1.vertex[2].Normal);
    
                        NormList.push_back(tri2.vertex[0].Normal);
                        NormList.push_back(tri2.vertex[1].Normal);
                        NormList.push_back(tri2.vertex[2].Normal);
    
    
                    }
    
                    int currBlock = x + (y + z * 16) * 16;
                    BlockSidesIndices bsi;
                    bsi.F = currBlock + 0;
                    bsi.F = currBlock + 1;
                    bsi.R = currBlock + 2;
                    bsi.R = currBlock + 3;
                    bsi.B = currBlock + 4;
                    bsi.B = currBlock + 5;
                    bsi.L = currBlock + 6;
                    bsi.L = currBlock + 7;
                    bsi.T = currBlock + 8;
                    bsi.T = currBlock + 9;
                    bsi.Bot = currBlock + 10;
                    bsi.Bot = currBlock + 11;
    
                    chunkBlockIndex.push_back(bsi);
                }
            }
        }
        glGenBuffers(1, &vertexbuffer);
        glGenBuffers(1, &uvbuffer);
        glGenBuffers(1, &normalbuffer);
        glGenBuffers(1, &indexbuffer);
    
        glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
        glBufferData(GL_ARRAY_BUFFER, PosList.size() * sizeof(glm::vec3), &PosList[0], GL_STATIC_DRAW);
    
        glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
        glBufferData(GL_ARRAY_BUFFER, UVList.size() * sizeof(glm::vec2), &UVList[0], GL_STATIC_DRAW);
    
        glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
        glBufferData(GL_ARRAY_BUFFER, NormList.size() * sizeof(glm::vec3), &NormList[0], GL_STATIC_DRAW);
    
        Recompute();
    
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexbuffer);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, IndexList.size() * sizeof(GLuint), &IndexList[0], GL_STATIC_DRAW);
    
    
    }
    
    Chunk::~Chunk()
    {
        glDeleteBuffers(1, &vertexbuffer);
        glDeleteBuffers(1, &uvbuffer);
        glDeleteBuffers(1, &normalbuffer);
        glDeleteBuffers(1, &indexbuffer);
    
        for(int z = 0; z < 16; z++)
        {
            for(int y = 0; y < 16; y++)
            {
                for(int x = 0; x < 16; x++)
                {
                    delete chunk[z][y][x];
                    chunk[z][y][x] = NULL;
                }
            }
        }
    }
    
    void Chunk::Recompute()
    {
        for(int z = 0; z < 16; z++)
        {
            for(int y = 0; y < 16; y++)
            {
                for(int x = 0; x < 16; x++)
                {
    
                    BlockSidesIndices currBlock = chunkBlockIndex[(x + (y + z * 16) * 16)];
    
                    if(chunk[z][y][x] != NULL)
                    {
                        if( z == 0 )
                        {
                            IndexList.push_back(currBlock.B );
                            IndexList.push_back(currBlock.B2 );
                        }
    
                        if( z == 15 )
                        {
                            IndexList.push_back(currBlock.F );
                            IndexList.push_back(currBlock.F2 );
                        }
    
                        if( y == 0 )
                        {
                            IndexList.push_back(currBlock.T );
                            IndexList.push_back(currBlock.T2 );
                        }
    
                        if( y == 15 )
                        {
                            IndexList.push_back(currBlock.Bot );
                            IndexList.push_back(currBlock.Bot2 );
                        }
    
                        if( x == 0 )
                        {
                            IndexList.push_back(currBlock.L );
                            IndexList.push_back(currBlock.L2 );
                        }
    
                        if( x == 15 )
                        {
                            IndexList.push_back(currBlock.R );
                            IndexList.push_back(currBlock.R2 );
                        }
    
    
    
    
    
    
    
                        if( z > 0 )
                        {
                            if(chunk[z-1][y][x] == NULL)
                            {
                                IndexList.push_back(currBlock.B );
                                IndexList.push_back(currBlock.B2 );
                            }
                        }
    
                        if( z < 15 )
                        {
                            if(chunk[z+1][y][x] == NULL)
                            {
                                IndexList.push_back(currBlock.F );
                                IndexList.push_back(currBlock.F2 );
                            }
                        }
    
                        if( y > 0 )
                        {
                            if(chunk[z][y-1][x] == NULL)
                            {
                                IndexList.push_back(currBlock.T );
                                IndexList.push_back(currBlock.T2 );
                            }
                        }
    
                        if( y < 15 )
                        {
                            if(chunk[z][y+1][x] == NULL)
                            {
                                IndexList.push_back(currBlock.Bot );
                                IndexList.push_back(currBlock.Bot2 );
                            }
                        }
    
                        if( x > 0 )
                        {
                            if(chunk[z][y][x-1] == NULL)
                            {
                                IndexList.push_back(currBlock.L );
                                IndexList.push_back(currBlock.L2 );
                            }
                        }
    
                        if( x < 15 )
                        {
                            if(chunk[z][y][x+1] == NULL)
                            {
                                IndexList.push_back(currBlock.R );
                                IndexList.push_back(currBlock.R2 );
                            }
                        }
                    }
                }
            }
        }
    }
    
    void Chunk::Draw()
    {
        glm::mat4 Model = glm::translate(glm::mat4(1.0f), 0.0f , 0.0f, 20.0f);
        MVP = SOGLF::Matrices::Matrix.GetProjection() * SOGLF::Matrices::Matrix.Camera * Model;
    
        shader.Bind();
        glUniformMatrix4fv(MVPID, 1, GL_FALSE, &MVP[0][0]);
    
        glActiveTexture(GL_TEXTURE0);
        bitmap.Bind();
        glUniform1i(TextureID, 0);
    
        glEnableVertexAttribArray(PositionID);
        glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
        glVertexAttribPointer(
            PositionID,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
            3,                  // size
            GL_FLOAT,           // type
            GL_FALSE,           // normalized?
            0,                  // stride
            (void*)0            // array buffer offset
        );
    
        glEnableVertexAttribArray(UVID);
        glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
        glVertexAttribPointer(
            UVID,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
            2,                  // size
            GL_FLOAT,           // type
            GL_FALSE,           // normalized?
            0,                  // stride
            (void*)0            // array buffer offset
        );
    
    
        glEnableVertexAttribArray(NormalsID);
        glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
        glVertexAttribPointer(
            NormalsID,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
            3,                  // size
            GL_FLOAT,           // type
            GL_FALSE,           // normalized?
            0,                  // stride
            (void*)0            // array buffer offset
        );
    
        // Index buffer
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexbuffer);
    
    // Draw the triangles !
        glDrawElements(
            GL_TRIANGLES,      // mode
            IndexList.size(),    // count
            GL_UNSIGNED_INT,   // type
            (void*)0           // element array buffer offset
        );
    
        glDisableVertexAttribArray(NormalsID);
        glDisableVertexAttribArray(UVID);
        glDisableVertexAttribArray(PositionID);
    
    
        SOGLF::Texture::Unbind();
        SOGLF::Shader::Unbind();
    }
    
    

    It compiles and runs fine, but nothing is drawn. The index and vertex lists have the correct number of elements
    Reply With Quote Edit / Delete Linux United Kingdom Show Events

  19. Post #1459
    Gold Member
    Kybalt's Avatar
    July 2008
    8,171 Posts
    so im working on a top down zombie city simulation thing in java, and im trying to keep all the entities in a single arraylist. now i have a class called entity and a class that extends entity called zombie and one that extends them called wall. how would i store store both the walls and the zombies in the same arraylist?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  20. Post #1460
    Gold Member
    BlkDucky's Avatar
    May 2008
    6,485 Posts
    When doing Love2D stuff, does every function have to be a member function of love? (love.xxxx ())
    uh, no. Only these.

    Don't add to love.x.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Informative Informative x 1 (list)

  21. Post #1461
    Ohfoohy's Avatar
    November 2008
    1,193 Posts
    So I'm re-learning VB. (I'll move on to C# or C++ eventually) and need some quick help.
    I have a login form, and when I enter Admin as the username and password as the password, I want to login form to close and form1 to open. Easy right?
    I thought so, but when I try it out, the whole program closes.
    If I take Me.Close out, it works fine, but I want it to close.
    Here's what I have

    I don't have any kind of fancy user database, but if that's possible, it would be nice to know how to make.

    Also, how do I go about making a database type of thing?
    What I want is to make a storage area for inputs. For example, when I hit the "correct!" button, I want $300 stored in one spot, and split into 2 other spots; The one spot would just keep track of all the total deposits, the other two spots would be checking and savings, I want that 300 to get split up so that 40% goes to checking and 60% goes to savings. Ya feel me? Any help on either of these will be appreciated.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  22. Post #1462
    mlbfan560's Avatar
    June 2005
    76 Posts
    Another problem, I realize theres lots of code but if anyone can have a look it would be much appreciated:

    ...

    It compiles and runs fine, but nothing is drawn. The index and vertex lists have the correct number of elements
    Try introducing a vertex array object. You would generate it in the chunk constructor and bind it in the draw function.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  23. Post #1463
    MickeyCantor's Avatar
    May 2012
    44 Posts
    were is a good place to start learning openGL for C++, i wanna start making some 3d projects but i dont wanna have to port DirectX code
    Reply With Quote Edit / Delete Windows 7 United States Show Events Optimistic Optimistic x 1 (list)

  24. Post #1464
    Follow me on GitHub!
    Ziks's Avatar
    June 2011
    2,024 Posts
    so im working on a top down zombie city simulation thing in java, and im trying to keep all the entities in a single arraylist. now i have a class called entity and a class that extends entity called zombie and one that extends them called wall. how would i store store both the walls and the zombies in the same arraylist?
    If it's the same project as the one you showed in WAYWO, which appears to be grid based, why not store the world as a 2D array. Each element of the array can be null, a zombie or a wall, so you can use Entity[][] as the array type.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  25. Post #1465
    Neigh
    CarlBooth's Avatar
    June 2007
    28,550 Posts
    So I'm re-learning VB. (I'll move on to C# or C++ eventually) and need some quick help.
    I have a login form, and when I enter Admin as the username and password as the password, I want to login form to close and form1 to open. Easy right?
    I thought so, but when I try it out, the whole program closes.
    If I take Me.Close out, it works fine, but I want it to close.
    Here's what I have

    I don't have any kind of fancy user database, but if that's possible, it would be nice to know how to make.

    Also, how do I go about making a database type of thing?
    What I want is to make a storage area for inputs. For example, when I hit the "correct!" button, I want $300 stored in one spot, and split into 2 other spots; The one spot would just keep track of all the total deposits, the other two spots would be checking and savings, I want that 300 to get split up so that 40% goes to checking and 60% goes to savings. Ya feel me? Any help on either of these will be appreciated.
    project options > untick "End when first form closes" tickbox

    Edited:

    oh wait its a drop down

    "Shutdown mode" > when first form closes

    change it to When last form closes

    Edited:


    Public Class Form1
    
        Dim AvailableCash As Integer
        Dim PotChecking As Integer
        Dim PotSavings As Integer
    
    
        Private Sub btnCorrect_Click(sender As System.Object, e As System.EventArgs) Handles btnCorrect.Click
    
            PotSavings += 0.6 * AvailableCash
            PotChecking += 0.4 * AvailableCash
    
        End Sub
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
            AvailableCash = 300
    
        End Sub
    End Class
    
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Useful Useful x 1 (list)

  26. Post #1466
    I hide under your bed
    Dennab
    July 2011
    1,877 Posts
    i'm messing around with XNA.

    Code:
    FrameRateCounterFont = contentManager.Load<SpriteFont>("Fonts/frameRateCounterFont");
    this gives me "Error loading "Fonts\frameRateCounterFont". File not found."

    the file is there, i can see it. something is buggered with the directory, how can i fix it? or rather, where is the content directory specified?
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  27. Post #1467
    NovembrDobby's Avatar
    April 2007
    1,147 Posts
    i'm messing around with XNA.

    Code:
    FrameRateCounterFont = contentManager.Load<SpriteFont>("Fonts/frameRateCounterFont");
    this gives me "Error loading "Fonts\frameRateCounterFont". File not found."

    the file is there, i can see it. something is buggered with the directory, how can i fix it? or rather, where is the content directory specified?
    I'm not sure what they've done to it since XNA 3.1, but you should have a content project set up somewhere in your solution. You can add files/folders to that and load them using your content manager.

    Edited:

    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  28. Post #1468
    I hide under your bed
    Dennab
    July 2011
    1,877 Posts
    My content manager is a separate project in the solution. I was copying how they did it in some examples i looked at. Should i simply include my content manager in the same project?

    at any rate, the way it is currently set up should have no problems... the content folder is set properly so there should be no problems :/

    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  29. Post #1469
    Neigh
    CarlBooth's Avatar
    June 2007
    28,550 Posts
    Change forward slash to a double backslash
    Reply With Quote Edit / Delete United Kingdom Show Events Artistic Artistic x 1 (list)

  30. Post #1470
    Please waste more of your money changing this title again.
    Gmod4ever's Avatar
    August 2005
    6,739 Posts
    Hey guys.

    So I decided to try the Win32 API for C++ again. I decided to use the MSDN's tutorial on it.

    I was able to get it to compile fine, but I am getting the message box that the RegisterClassEx's failure triggers (IE I am getting a message box saying "Call to RegisterClassEx failed!"

    I currently have my WndProc function simply returning 0, because I just wanted to see if I could get this much to work.

    Note that the "compile with: /D_UNICODE /DUNICODE /DWIN32 /D_WINDOWS /c" in the comments at the top of the full-code sample at the bottom, I don't know exactly what it wants me to do with that, if that's part of the problem.

    Here's the full code I am using, if anyone wants to see it.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  31. Post #1471
    Absolute tosser, manchild, and belligerent douche-nozzle.
    download's Avatar
    July 2006
    6,648 Posts
    I'm having trouble finding information on Try/Catch in Java. Anyone think they could tell me how to use it to catch someone entering something that is not an integer?
    Reply With Quote Edit / Delete Windows 7 Australia Show Events

  32. Post #1472
    NovembrDobby's Avatar
    April 2007
    1,147 Posts
    I've hacked with Desura and I've used HOLLY to make a Fraps thing all using LD_LIBRARY_PATH, would you mind sharing the shell script you're launching, the directory structure, the library filenames, outputs, etc. Just anything that would help.
    Ok, here's some stuff:

    executable location: /home/dobby/Desktop/Rotion/Release/ ("Rotion" is the filename)

    My shell script that runs the game properly, /home/dobby/Desktop/Rotion/Release/run.sh:

    Code:
    #!/bin/sh
    
    DIR="$(dirname $(readlink -f $0))"
    
    echo -n "\033]0;Rotion\007"
    export LD_LIBRARY_PATH="$DIR/libs":$LD_LIBRARY_PATH
    exec $DIR/Rotion $*
    Next to the executable there's the libs folder, containing the SFML libs: libsfml-graphics.so.2.0 etc. Full list here.

    Running the executable directly seems to do nothing, I assume it's silently erroring since running it from a terminal gives me this:



    I tried moving the libs into the same folder, no luck. It'd be too messy for my liking anyway.

    Edited:

    I don't think this'll matter for Desura since they all seem to launch via a shell script anyway, but it'd still be nice to have.
    Reply With Quote Edit / Delete Linux United Kingdom Show Events

  33. Post #1473
    Gold Member
    esalaka's Avatar
    July 2007
    10,136 Posts
    I tried moving the libs into the same folder, no luck.
    The current directory should never be in LD_LIBRARY_PATH by default anyway, why would you even consider trying?
    Reply With Quote Edit / Delete Windows 7 Finland Show Events

  34. Post #1474
    NovembrDobby's Avatar
    April 2007
    1,147 Posts
    The current directory should never be in LD_LIBRARY_PATH by default anyway, why would you even consider trying?
    Chill, I know almost nothing about Linux.

    Edited:

    Is it so terrible to think it might be able to work when the libs are in the same place as the executable, regardless of some environment setting
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Agree Agree x 1 (list)

  35. Post #1475
    Gold Member
    Naelstrom's Avatar
    June 2010
    2,687 Posts
    Chill, I know almost nothing about Linux.

    Edited:

    Is it so terrible to think it might be able to work when the libs are in the same place as the executable, regardless of some environment setting
    Yeah it is actually, Linux doesn't need libraries included with their programs as they can be installed as a dependency. This also means that the versions of the libraries won't always be the same. This is why it's a good idea to create a build system using autotools or cmake that'll automatically build your program for the target system and link against whatever version of library their distro has. This unfortunately also means you'll have to release source code with it.

    Although if you don't want to give your code to paying customers, you can do something like the penumbra or overgrowth team. They have some weird installer called Nixstaller that manages to configure the application to the system and install it properly without exposing any code.

    Edited:

    If you chat me up on steam or gmail chat (naelstrof @ gmail.com) I'll talk to you how I got the build system in my engine working. It even compiles to windows.
    It can be found on github here:
    https://github.com/naelstrof/Astrostruct
    Reply With Quote Edit / Delete Linux United States Show Events

  36. Post #1476
    Richy19's Avatar
    May 2010
    5,382 Posts
    These are my shaders for diffused lighting:
    
    #version 120
    uniform mat4 MVP;
    uniform mat4 Model;
    attribute vec4 Position;
    attribute vec2 UV;
    attribute vec3 Normals;
    varying vec2 uv;
    varying vec3 normals;
    
    void main(){
        vec3 norm =  (Model * Position * vec4(Normals, 1.0f) ).xyz;
    	normals = normalize( norm );
        uv = UV;
        gl_Position =  MVP * Position;
    }
    

    and:
    #version 120
    varying vec2 uv;
    uniform sampler2D Texture;
    uniform bool DrawLines;
    varying vec3 normals;
    uniform vec4 AmbientLight;
    uniform vec4 DiffuseLight;
    
    
    void main(){
        vec4 textureColor = texture2D( Texture, uv ).rgba;
    
        vec4 AmbientColor = vec4(AmbientLight.rgb, 1.0f) * AmbientLight.a;
    
        float DiffuseFactor = dot(normals, -1 * DiffuseLight.rgb);
        vec4 DiffuseColor = vec4(0, 0, 0, 0);
        if (DiffuseFactor > 0.0f) {
            DiffuseColor = vec4(AmbientLight.rgb, 1.0f) * DiffuseLight.a * DiffuseFactor;
        }
    
        vec4 color = textureColor  * (AmbientColor + DiffuseColor);
        gl_FragColor = vec4(color.rgb, textureColor.a);
    }
    

    The normals for the blocks are calculated as:
    if( !(v[0].HasNormals() && v[1].HasNormals() && v[2].HasNormals() ) )
        {
            glm::vec3 U = (v2.Position - v1.Position);
            glm::vec3 V = (v3.Position - v1.Position);
    
            glm::vec3 norm = glm::cross(U, V);
    
            v[0].Normal = norm;
            v[1].Normal = norm;
            v[2].Normal = norm;
        }

    when I apply this lighting setting it seems to work fine:
    Code:
    chunk->SetAmbient(glm::vec4(0.8f, 0.6f, 0.5f, 0.5f) );
    chunk->SetDiffuse(glm::vec4(0.0f, 0.0f, 0.6f, 0.9f) );
    producing:


    Yet when I use this:
    chunk->SetAmbient(glm::vec4(0.8f, 0.6f, 0.5f, 0.5f) );
    chunk->SetDiffuse(glm::vec4(0.6f, 0.0f, 0.0f, 0.9f) );

    Which I would have assumed gives only the right side lighting i get this:


    Is that normal?
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Funny Funny x 1 (list)

  37. Post #1477

    January 2012
    416 Posts
    I'm having trouble finding information on Try/Catch in Java. Anyone think they could tell me how to use it to catch someone entering something that is not an integer?
    http://docs.oracle.com/javase/tutori...tions/try.html
    Reply With Quote Edit / Delete Windows 7 Canada Show Events Useful Useful x 1 (list)

  38. Post #1478
    Gold Member
    hexpunK's Avatar
    August 2008
    15,316 Posts
    I'm having trouble finding information on Try/Catch in Java. Anyone think they could tell me how to use it to catch someone entering something that is not an integer?
    It's quite simple really. Here's some example code;
    Code:
    int whatever;
    
    SomeInput input = new SomeInput(); // This could be anything, a JOptionDialogue, or whatever you use.
    
    try {
        whatever = Integer.parseInt(input.getValue()); // Again, this isn't accurate.
    } catch (NumberFormatException e) { // This exception will happen if something isn't an Integer.
        // Handle the exception.
    }
    There are exceptions for quite a few things. And all you need to do to test for Integer values it put a Integer.parseInt() call inside a try block. I assume the same can be said for most of the other base types too.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Friendly Friendly x 1Informative Informative x 1 (list)

  39. Post #1479
    I like the fat, greasy nerds that wear MLP shirts three sizes too small
    Dennab
    February 2010
    1,417 Posts
    Quick Java question:

    When reading from a file, is it possible to make the FileReader ignore some parts of the data in the file? For example, assume my file contains the following text:
    Code:
    Records: 3
    Max's Severed Head: 2
    Lugermorph: 1
    Officer's Ushanka: 5
    I want the program to read the numbers after the text and associate them to certain variables. Is there a way to use a loop and check for the colon mark within the file and set the value that follows it to an integer variable? If there is, how would I go about doing it?
    Reply With Quote Edit / Delete Windows 7 Canada Show Events

  40. Post #1480
    Absolute tosser, manchild, and belligerent douche-nozzle.
    download's Avatar
    July 2006
    6,648 Posts
    It's quite simple really. Here's some example code;
    Code:
    int whatever;
    
    SomeInput input = new SomeInput(); // This could be anything, a JOptionDialogue, or whatever you use.
    
    try {
        whatever = Integer.parseInt(input.getValue()); // Again, this isn't accurate.
    } catch (NumberFormatException e) { // This exception will happen if something isn't an Integer.
        // Handle the exception.
    }
    There are exceptions for quite a few things. And all you need to do to test for Integer values it put a Integer.parseInt() call inside a try block. I assume the same can be said for most of the other base types too.
    So, try something that only works on integers, if it breaks it goes to catch?
    Reply With Quote Edit / Delete Windows 7 Australia Show Events