简体   繁体   中英

Where should i store my texture files in Eclipse Project

The code I use to create textures looks like this:

GImage ballTexture = createTexture("ballTexture.png", (int) BALL_SIZE,
            (int) BALL_SIZE);

method:

private GImage createTexture(String importedImage, int width, int height) {
    Image importResult = getImage(getCodeBase(), importedImage);
    GImage textureResult = new GImage(importResult);
    textureResult.setSize(width, height);
    return textureResult;

My project file structure is this (Java is general folder for all projects):

在此处输入图片说明

I put 5 texture files inside bin folder after I found that they were not imported otherwise (from different locations). I had a copy of 3 inside PongGame , and another copy inside src but those I did not update, and after i chose to rename my project with File -> Rename... and my bin folder was lost, 2 files were lost and 3 were replaced with outdated versions (i dont know which copy was used to replace those)

So my question would be: how should i properly store textures and then import them into my game?

I believe if you add it to your src folder it will be copied to the bin folder for you. Generally I make a res folder inside src to keep things more organized. Might not be best but it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM