Show Posts
|
|
Pages: [1] 2 3
|
|
2
|
Game Development / Shared Code / Re: EzEngine - Easy Wrapper for LWJGL
|
on: 2013-04-17 13:43:07
|
hi I took a quick look at the source of your textrenderer and you probably should take a look at for loops
I know, just threw that TextRenderer together for an other project. (It's actually my first working text renderer  ) plus there are some font alignment issues(if you scroll down you'll see). There were alot of copy-paste, but i'll probably look into adding some for loops at a later date.
|
|
|
|
|
3
|
Game Development / Shared Code / Re: EzEngine - Easy Wrapper for LWJGL
|
on: 2013-04-17 12:00:31
|
After some a long time in the dark, this engine is now back. I have already implemented TextRenderer and a 2D Graphics lib  Example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| import org.ezlwjgl.GL.*; import org.lwjgl.input.Keyboard;
public class Example {
public static void main(String[] args) { WindowManager.enableMouse = true; WindowManager.mouseGrab = true; WindowManager.enableKeyboard = true; WindowManager.createWindow("Test", 800, 600, 60); int texture = TextureLoader.loadTexture("/shop.png"); while (true) { Renderer.make3D(); Renderer.make2D(); Graphics.drawString("Center Aligned Text", Graphics.ALIGN_CENTER);
Graphics.drawString("Absolute Coordinate Text", 1, 32, 250, 0);
Graphics.drawString("Small text", .5, 32, 265, 0);
Graphics.drawString("Big text", 2, 32, 275, 0);
Graphics.drawTexture(texture, 0, 0, 32, 32); Graphics.drawString("<- Full texture draw", 1, 40, 8, 0); Graphics.drawTexture(texture, 0, 0, 16, 16, 32, 32, 0, 40, 32, 32);
Graphics.drawString("<- Tiled texture draw", 1, 40, 48, 0); if (WindowManager.update() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { break; } } WindowManager.destroyWindow(); } } |
Produces: 
|
|
|
|
|
7
|
Game Development / Game Mechanics / Re: Smooth Graphics Algorithm?
|
on: 2013-04-03 08:35:29
|
... Also how do you get the Memory Allocated?
Something like this: 1 2
| memUse = (int) (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024; bufferGraphics.drawString(String.format("Memory Usage: %sMB/%sMB", memUse, World.run.maxMemory() / 1024 / 1024), debugX + 1, debugY + 61); |
It might not be completly accurate, but it works.
|
|
|
|
|
10
|
Game Development / Shared Code / Re: Reducing class file sizes (Java4K)
|
on: 2013-03-15 17:23:16
|
Wait, you're talking about reducing class files for java4k but why all I see is lwjgl with physics?
Yes, this project originally was about using JBox2D with LWJGL as graphics lib. But when i started editing(shortening variables), the class file started shrinking dramatically(~50bytes  ). Then i started thinking why not try to make it smaller and smaller. This way I will learn about shrinking games for Java4K (this game is not a Java4K game).
|
|
|
|
|
11
|
Game Development / Shared Code / Reducing class file sizes (Java4K)
|
on: 2013-03-15 15:05:44
|
A little project i have, trying to reduce the size of a Java Class file. Without removing any features. Original Size: 5736bytesCurrent reduction: 3150bytes removed (~55% reduction) (Pure javac compile, no compression or proguard) With Proguard(class only): 3219bytes removed (~56% reduction) Compressed Jar: 4219bytes removed (~73% reduction) Compressed Proguard Jar: 4304bytes removed (~75% reduction) NOTES:Rolling your own builder in eclipse pays off, got a ~550b reduced class file size  Fell free to leave any comments/tips which can help in my quest Source Code:Final - http://pastebin.java-gaming.org/311b3907443v1.4 - http://pastebin.java-gaming.org/e905a337341v1.3 - http://pastebin.java-gaming.org/9e9052a7343v1.2 - http://pastebin.java-gaming.org/19e90157a43v1.1 - http://pastebin.java-gaming.org/619e900754av1.0 - http://pastebin.java-gaming.org/4619e996045 - This is not the first version, it's the first version i had access to. I kept a little changelog: (Number prefixes are class sizes in bytes) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Prefix = bytes
5736 First
5712 Changed .76f to .75f 5707 Chaged wall/roof/floor size to 50 instead of 1000 5693 .. Some random shit (but it still works) 5687 .. Some random shit (but it still works) 5449 Removed debugging(box pos) 5330 Removed boolean isAlive and changed to !Display.isCloseRequested 5169 Shortened some variable names 5096 Removed unnecessary code. 4984 Removed unnecessary code. 4708 Reusing variables 4640 Reusing variables 4638 Shortened Variable name 4610 Changed !Display.isCloseRequested() to !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) 4609 Removed unnecessary code. 4603 Changed some floats to ints 4055 Reused some variables FixtureDef, BodyDef & PolygonShape (used .clone()) 3882 Removed unnecessary code. 3855 Removed unnecessary code. 3653 Removed unnecessary code. 3598 Changed Math.toDegrees() to Radian * (180 / 3.1415) 3547 Changed getContactList() to b.getPosition().y < .77f 3518 Removed unnecessary code. 3363 Reused some variables. 3339 Removed unnecessary code. 3275 Various fixes. 3238 Removed glDisable(GL_DEPTH_TEST) as it was never enabled by glEnable() 2683 Implemented custom builder into Eclipse. psuedo cmd: javac -cp "PROJECT_CP" -g:none SOURCE_FILE -d OUT_FOLDER 2586 Removed unnecessary code and various fixes. |
|
|
|
|
|
14
|
Game Development / Newbie & Debugging Questions / Re: JBox2D & LWJGL Problem
|
on: 2013-03-14 15:56:28
|
I just took a quick look and in the shrunk version you overwrite bS, fS, pS all the time and in the other version you have separate objects for boxDef, groundDef etc. Perhaps that has something to do with it?
I read on the Box2D forums, that the *Def can be reused. But maybe i did something wrong somewhere... :s On a sidenote: Is the shrunk version only shorter variable names? In that case I think you should ditch the shrunken version. Why would you want to change your code to something that´s much harder to read?  It makes the final Class file smaller  I'm secretly practicing for Java4K! EDIT: PolygonShape has a .clone() so thats not the problem, as I clone it before I reuse it. EDIT2: On the other hand, maybe reusing variables only work in the C/C++ version 
|
|
|
|
|
20
|
Game Development / Newbie & Debugging Questions / Re: Noob Projects?
|
on: 2013-02-04 11:27:34
|
Screw around with Console(as in text-based) Games, just to get the feel of making a game(not concerning yourself about graphics or sound), then move on to Java2D(or similar, libGDX, slick, etc.), then you can move on to learning OpenGL and make a OpenGL Accelerated 2D games with basic sound(OpenAL), and finally move onto 3D(OpenGL). But don't get to excited, this is not a small learning curve. It will take time and dedication to get from start to finish... Good Luck 
|
|
|
|
|
22
|
Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering
|
on: 2013-02-01 10:07:15
|
|
Uploaded a Jar Library, which you can include in your project. You will also need to include the LWJGL libs too.
I'm now going to make a small/medium game with this library, and I will only use the functions included in this library. By doing this I can implement missing features into the library.
|
|
|
|
|
28
|
Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering
|
on: 2013-01-28 12:23:45
|
reAdded GLRenderer class. You can now create your own renderer. Example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public class MyGLRenderer implements GLRenderer {
public void render(Model m) { glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, 0, m.getModel());
if (m.isColored()) { glEnableClientState(GL_COLOR_ARRAY); if (m.isRGBA()) glColorPointer(4, 0, m.getColor()); else glColorPointer(3, 0, m.getColor()); }
if (m.isTextured()) { glEnableClientState(GL_TEXTURE_COORD_ARRAY); glBindTexture(GL_TEXTURE_2D, m.getTexture()); glTexCoordPointer(2, 0, m.getTextureCoords()); }
glDrawArrays(GL_TRIANGLES, 0, m.getVertexNum() / 3); glDisableClientState(GL_VERTEX_ARRAY);
if (m.isColored()) glDisableClientState(GL_COLOR_ARRAY); if (m.isTextured()) glDisableClientState(GL_TEXTURE_COORD_ARRAY); }
} |
|
|
|
|
|
30
|
Game Development / Shared Code / Re: [LWJGL] EzRender - Easier Rendering
|
on: 2013-01-24 10:00:43
|
I'm planning on adding the following features(in the near feature): 1 2 3 4 5 6 7 8 9 10
| Renderer r;
r.renderCube(float x, float y, float z, float size); r.renderTexturedCube(float x, float y, float z, float size, int textures[]); r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{0, 0, 0, 0, 0, 0} ); r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, 0, 0, 0, 0}); r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, textureSides, -1, -1, -1}); r.renderTexturedCube(0f, 0f, 0f, 1f, new int[]{textureTop, textureBottom, textureSides}); |
I will probably also add other primitive shapes.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|