Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (606)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Game Development / Newbie & Debugging Questions / Creating shapes n stuff out of the BufferedImage.. on: 2014-12-06 16:33:00
I know, I'm going back to this subject again

I see a post by BurntPizza when searching on google about the bufferedimage which dated back to 2012

so lets say you set up this:

1  
2  
BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();


then you create the packed interger  (which is what ive learnt and understood from this forum)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public static int pack(int r, int g, int b) {
   //clamp to range [0, 255]
   if (r < 0)
      r = 0;
   else if (r > 255) r = 255;
   if (g < 0)
      g = 0;
   else if (g > 255) g = 255;
   if (b < 0)
      b = 0;
   else if (b > 255) b = 255;
   
   //pack it together
   return (255 << 24) | (r << 16) | (g << 8) | (b);
}


then you can unpack it or whatever

But.... with setting the pixels to be manipulated, how would I then go about creating shapes to use in an update method?

Also one last Q, what benefit does this have adding / import seperate PNG type sprites into this?

I'm finding it difficult this last few months with this bufferedimage thing, and its something I wana get to terms with --- and yes, I do use OpenGL so no engine thing here please

Thanks peeps!!
2  Game Development / Newbie & Debugging Questions / Re: Pura java scrolling background with Tiledmap type based game/engine on: 2014-12-05 12:57:19
I understand that you want to learn. I implemented something similar but with a single image in Python about ten years ago. Good luck.

Sussed it kind of, but got lots of errors on other stuff

1  
2  
3  
   // move the map
      tileMap.setx((int) (Game.WIDTH / 2 - x));
      tileMap.sety((int) (Game.HEIGHT / 2 - y));
3  Game Development / Newbie & Debugging Questions / Re: Pura java scrolling background with Tiledmap type based game/engine on: 2014-12-05 10:51:38
Your right, but with LibGDX the cam stuff has plenty of functions to manipulate it but with PJ it'd require to write your own code.

Stuck as in, limited to what I can do and learn. I've mentioned this before and its difficult to get the message across on text, I'm not really into gaming - hardly play games unless I see people on here who've made them which makes me keen to check out, I'm more into the technical side on how they work hence the question on software rendering cameras.

Now, you may think, just use LWJGL library then, which is what I usually get from responses. That has cams to which I've run into, scalling resolutions by keeping the window size with the viewport, flipping the camera, moving the camera. But PJ to me, alone is a excellent language which is a hobbie aimed towards a Java career in the future along with taking in turns servlets, jsp, mysql etc, hence learning all the technical bits using just this language without having to worry about hardware level GPU stuff and be able to run on things from what I've learned on the language with Rasberry PI, or simular smaller homebrew type PC's - Yeah they have light versions opengl but I'm repeating myself again.

I am into OpenGL dont get me wrong but my post was on how to create some camera to move left with the player
4  Game Development / Newbie & Debugging Questions / Pura java scrolling background with Tiledmap type based game/engine on: 2014-12-05 10:11:30
Heres my topic of the day, I could of looked harder but its cool to keep in touch here with everyones wicked responses.

I'm using a notch style PJ engine, I'm working on the tilemap class which works with external txt files for tile maps... which is based on Foreign Guy Mike type code

It's 20 x 15, now how would I create a camera to move with the player for instance? I know this is pretty simple with LibGDX which is what I've been hammering for the last few weeks but have decided to move back to PJ for a while as I got a bit lost with LibGDX and feel I need to work on my Java skills for a while before moving on to bigger and more complex external libraries, just a personal thing.

I want to keep this pixelated though, like scaled. As I'm a massive fan of the pixel look which is something I can do from lots of tutorials I've been through

I'm just stuck on how I would implement a kind of a camera with a tilebased game, if this is a complex question and would take a while to explain, if you could explain for instance, how I would move a camera maybe 60 tiles wide, and kept at 15 tiles high.

Thanks and big love to the JGO newb crew
5  Game Development / Newbie & Debugging Questions / Re: Loading a font without Slick. on: 2014-12-05 10:03:40
Why would you not want to use Slick's internal Font classes?

Just curious, because it's possible whatever functionality you're trying to gain Slick can already do, you just don't know how to do it. Smiley

I had the problem with Slicks font class with drawing/transparency issues hence using the class I suggested which is very basic though

If I was to use Slicks fonts it would not let me display OpenGL drawings, even did a load of google searching without success. Something to do without it renders, but it would let me display images, I'm guessing Slicks method of fonts is transfering them to images for display

Retro-Pixel Castles actually uses Slick's font classes, I just built a wrapper around them that I funnel through so I can have quick/easy methods like drawStringCentered(). Have you tried using AngleCodeFont instead? That's the one I use, it uses BMFonts instead of standard ones, and can be rendered with no Anti-Aliasing what so ever.

Excellent, that retro pixels looks amazing, is there any demo anywhere? I'm short of funds at the moment but been dying to play it!

As for your comment, there is also this great bit of code using java GL with fonts..

http://potatoland.org/code/gl/source/glapp/GLFont.java
6  Game Development / Newbie & Debugging Questions / Re: Shaders in Slick? on: 2014-12-05 10:00:33
I'd say its possible if you import the main LWJGL library and do some googling on how to use shaders with that as thats what slick is using to render, I don't know much about shaders personally its something I'm going to be looking at soon though..

Here is a topic that may help:

http://slick.ninjacave.com/forum/viewtopic.php?t=3212

7  Game Development / Newbie & Debugging Questions / Re: Declaring variables a lengthy way..? on: 2014-12-04 14:28:35
Great thanks I understand

It was from a Java4K game though, maybe used for memory / performance reasons, avoid constants etc?

But its not just that, it can be midly seen in Libgdx peoples sources to. But like everyones said above, you can see more visually why its done, because of like a doc thing when your using box2d vars outside box2ds world variables. Making sense?
8  Game Development / Newbie & Debugging Questions / Declaring variables a lengthy way..? on: 2014-12-03 11:26:20
I keep asking myself lately and its bugging me, out of curiosity why do people declare variables like this....

1  
int level_width = current_level / 4 * 384 + 640;


When it could be:

1  
int level_width = current_level / 2176;
?

Is it to save using a calculator? Sorry if it sounds stupid, I have been pretty anxious to ask on here....
9  Game Development / Newbie & Debugging Questions / Re: Loading a font without Slick. on: 2014-12-03 11:22:13
Why would you not want to use Slick's internal Font classes?

Just curious, because it's possible whatever functionality you're trying to gain Slick can already do, you just don't know how to do it. Smiley

I had the problem with Slicks font class with drawing/transparency issues hence using the class I suggested which is very basic though

If I was to use Slicks fonts it would not let me display OpenGL drawings, even did a load of google searching without success. Something to do without it renders, but it would let me display images, I'm guessing Slicks method of fonts is transfering them to images for display
10  Game Development / Newbie & Debugging Questions / Re: Loading a font without Slick. on: 2014-12-02 16:31:56
Paste bin, use it lol

Sorry mate - I'll know next time pretty new to this Smiley
11  Game Development / Newbie & Debugging Questions / Re: Loading a font without Slick. on: 2014-12-02 12:08:42
@ CopyableCougar4  --- That looks ace, I'll check out that for my work

There is also simpletext that gets thrown around youtube:

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  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
package com.base.engine;

import static org.lwjgl.opengl.GL11.*;

public class SimpleText
{

   public static void drawString(String s, int x, int y, int height)
   {
      float scale = height / 8f;
      glTranslatef(x, y, 0);
      glScalef(scale, scale, 1f);
      drawString(s, 0, 0);
      glScalef(1f / scale, 1f / scale, 1f);
      glTranslatef(0 - x, 0 - y, 0);
   }

   public static void drawString(String s, int x, int y)
   {
      s = s.toLowerCase();
      int startX = x;
      glBegin(GL_LINES);
      //glPointSize(3F); // POINT SIZE / BOLDNESS
      for (char c : s.toLowerCase().toCharArray()) {
         if (c == 'a') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 7, y + 4);
            x += 8;
         } else if (c == 'b') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y);
            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 7, y + 4);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 7, y + 5);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 5);
            x += 8;
         } else if (c == 'c') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y);
            glVertex2f(x + 6, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 6, y + 8);

            glVertex2f(x + 6, y);
            glVertex2f(x + 6, y + 2);

            glVertex2f(x + 6, y + 6);
            glVertex2f(x + 6, y + 8);

            x += 8;
         } else if (c == 'd') {
            glVertex2f(x + 7, y + 2);
            glVertex2f(x + 7, y + 6);

            glVertex2f(x + 5, y);
            glVertex2f(x + 2, y);
            glVertex2f(x + 5, y + 8);
            glVertex2f(x + 2, y + 8);

            glVertex2f(x + 5, y);
            glVertex2f(x + 7, y + 2);
            glVertex2f(x + 5, y + 8);
            glVertex2f(x + 7, y + 6);

            glVertex2f(x + 2, y);
            glVertex2f(x + 2, y + 8);

            x += 8;
         } else if (c == 'e') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y + 0);
            glVertex2f(x + 7, y + 0);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 6, y + 4);

            x += 8;
         } else if (c == 'f') {
            glVertex2f(x, y);
            glVertex2f(x, y + 8);

            glVertex2f(x, y + 8);
            glVertex2f(x + 6, y + 8);

            glVertex2f(x, y + 4);
            glVertex2f(x + 5, y + 4);

            x += 8;
         } else if (c == 'g') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 3);
            glVertex2f(x + 5, y + 3);
            glVertex2f(x + 7, y + 3);

            glVertex2f(x + 7, y + 6);
            glVertex2f(x + 7, y + 8);

            x += 8;
         } else if (c == 'h') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 7, y + 4);

            x += 8;
         } else if (c == 'i') {
            glVertex2f(x + 3, y);
            glVertex2f(x + 3, y + 8);

            glVertex2f(x + 1, y + 0);
            glVertex2f(x + 5, y + 0);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 5, y + 8);

            x += 7;
         } else if (c == 'j') {
            glVertex2f(x + 6, y);
            glVertex2f(x + 6, y + 8);

            glVertex2f(x + 1, y);
            glVertex2f(x + 6, y + 0);

            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 2);
            x += 8;
         } else if (c == 'k') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y + 3);
            glVertex2f(x + 6, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 2.5f, y + 4.5f);
            x += 8;
         } else if (c == 'l') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y);
            glVertex2f(x + 6, y);

            x += 7;
         } else if (c == 'm') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 4, y + 5);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 4, y + 5);
            glVertex2f(x + 7, y + 8);

            x += 8;
         } else if (c == 'n') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 7);
            glVertex2f(x + 7, y + 1);
            x += 8;
         } else if (c == 'o') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 1, y + 0);
            glVertex2f(x + 7, y + 0);

            x += 8;
         } else if (c == '0') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 1, y + 0);
            glVertex2f(x + 7, y + 0);

            glVertex2f(x + 1, y + 1);
            glVertex2f(x + 7, y + 7);

            x += 8;
         } else if (c == 'p') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 6, y + 8);
            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 6, y + 4);

            glVertex2f(x + 6, y + 4);
            glVertex2f(x + 6, y + 8);
            x += 8;
         } else if (c == 'q') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 3);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 1, y + 0);
            glVertex2f(x + 4, y);

            glVertex2f(x + 4, y);
            glVertex2f(x + 7, y + 3);

            glVertex2f(x + 4, y + 3);
            glVertex2f(x + 7, y);
            x += 8;
         } else if (c == 'r') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 6, y + 8);
            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 6, y + 4);

            glVertex2f(x + 6, y + 8);
            glVertex2f(x + 6, y + 4);

            glVertex2f(x + 2, y + 4);
            glVertex2f(x + 6, y);
            x += 7;
         } else if (c == 's') {
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 1, y + 4);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 7, y + 4);
            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y);

            glVertex2f(x + 7, y + 4);
            glVertex2f(x + 7, y);
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 2);
            x += 9;
         } else if (c == 't') {
            glVertex2f(x + 4, y);
            glVertex2f(x + 4, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            x += 8;
         } else if (c == 'u') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 0);
            glVertex2f(x + 7, y + 0);

            x += 8;
         } else if (c == 'v') {
            glVertex2f(x + 1, y + 3);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 3);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 3);
            glVertex2f(x + 4, y);
            glVertex2f(x + 7, y + 3);
            glVertex2f(x + 4, y);
            x += 9;
         } else if (c == 'w') {
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 7, y);

            glVertex2f(x + 4, y + 3);
            glVertex2f(x + 1, y);

            glVertex2f(x + 4, y + 3);
            glVertex2f(x + 7, y);

            x += 8;
         } else if (c == 'x') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);

            x += 8;
         } else if (c == 'y') {
            glVertex2f(x + 4, y);
            glVertex2f(x + 4, y + 4);

            glVertex2f(x + 4, y + 4);
            glVertex2f(x + 1, y + 7);
            glVertex2f(x + 1, y + 7);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 4, y + 4);
            glVertex2f(x + 7, y + 7);
            glVertex2f(x + 7, y + 7);
            glVertex2f(x + 7, y + 8);
            x += 8;
         } else if (c == 'z') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y + 8);

            x += 8;
         } else if (c == '1') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 5, y);

            glVertex2f(x + 3, y);
            glVertex2f(x + 3, y + 8);

            glVertex2f(x + 1, y + 6);
            glVertex2f(x + 3, y + 8);
            x += 7;
         } else if (c == '2') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 6, y);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 6, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 1, y + 6);

            glVertex2f(x + 6, y + 8);
            glVertex2f(x + 6, y + 5);
            glVertex2f(x + 6, y + 5);
            glVertex2f(x + 1, y);
            x += 8;
         } else if (c == '3') {
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 6, y + 8);
            glVertex2f(x + 1, y);
            glVertex2f(x + 6, y);

            glVertex2f(x + 6, y);
            glVertex2f(x + 6, y + 8);

            glVertex2f(x + 2, y + 4);
            glVertex2f(x + 6, y + 4);

            x += 8;
         } else if (c == '4') {
            glVertex2f(x + 1, y + 3);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y + 3);
            glVertex2f(x + 6, y + 3);

            glVertex2f(x + 6, y);
            glVertex2f(x + 6, y + 8);

            x += 7;
         } else if (c == '5') {
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y + 1);
            glVertex2f(x + 2, y);

            glVertex2f(x + 2, y);
            glVertex2f(x + 7, y);

            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 4);

            glVertex2f(x + 7, y + 4);
            glVertex2f(x + 1, y + 4);
            x += 8;
         } else if (c == '6') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y);
            glVertex2f(x + 7, y);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 6, y + 4);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 6, y + 8);

            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 3);
            glVertex2f(x + 7, y + 3);
            glVertex2f(x + 6, y + 4);
            x += 8;
         } else if (c == '7') {
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 7, y + 6);

            glVertex2f(x + 7, y + 6);
            glVertex2f(x + 1, y);
            x += 8;
         } else if (c == '8') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 1, y + 0);
            glVertex2f(x + 7, y + 0);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 7, y + 4);

            x += 8;
         } else if (c == '9') {
            glVertex2f(x + 7, y);
            glVertex2f(x + 7, y + 8);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 1, y + 8);

            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 7, y + 8);
            glVertex2f(x + 2, y + 0);
            glVertex2f(x + 7, y + 0);

            glVertex2f(x + 1, y + 4);
            glVertex2f(x + 7, y + 4);
            x += 8;
         } else if (c == '.') {
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 1);
            x += 2;
         } else if (c == '\'') {
            glVertex2f(x + 1, y + 6);
            glVertex2f(x + 1, y + 8);
            x += 2;
         } else if (c == '
!') {
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 1, y + 3);
            glVertex2f(x + 1, y);
            glVertex2f(x + 1, y + 1);
            x += 2;
         } else if (c == '
:') {
            glVertex2f(x + 1, y + 5);
            glVertex2f(x + 1, y + 7);
            glVertex2f(x + 1, y + 1);
            glVertex2f(x + 1, y + 3);
            x += 2;
         } else if (c == '
?') {
            glVertex2f(x + 1, y + 6);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 1, y + 8);
            glVertex2f(x + 5, y + 8);
            glVertex2f(x + 5, y + 8);
            glVertex2f(x + 5, y + 5);
            glVertex2f(x + 5, y + 5);
            glVertex2f(x + 3, y + 5);
            glVertex2f(x + 3, y + 5);
            glVertex2f(x + 3, y + 3);
            glVertex2f(x + 3, y);
            glVertex2f(x + 3, y + 1);
            x += 6;
         } else if (c == '
,') {
            glVertex2f(x + 1, y - 1);
            glVertex2f(x + 1, y + 1);
            x += 2;
         } else if (c == '
\n') {
            y -= 10;
            x = startX;
         } else if (c == '
') {
            x += 8;
         }
      }
      glEnd();
   }
}
12  Discussions / General Discussions / Re: Scaled, zoomed, pixelated retro effect in LibGDX on: 2014-12-02 12:05:19
I've found out how to do it anyway now. I just came across a tutorial by ForeignGuyMike and this gives me the effect I want but didn't know it was this easy with rendering to OpenGL considoring when I was using pure java they did the same thing with the window but you had to do stuff with a pixel array

1  
2  
3  
public static final int V_WIDTH = 320;
   public static final int V_HEIGHT = 240;
   public static final int SCALE = 2;


13  Discussions / General Discussions / Re: Scaled, zoomed, pixelated retro effect in LibGDX on: 2014-12-01 10:53:09
Not sure why this post or your other post "Using TWL..." were in OpenGL development. If it doesn't fit into a sub-forum category, just post it in general.

Oh, I thought they rendered to a OpenGL window. Must be mistaken, apologies
14  Discussions / General Discussions / Re: Scaled, zoomed, pixelated retro effect in LibGDX on: 2014-11-30 14:25:30
Thats great, but for a small game I'm sure it wouldn't be that hard to work with a pixelated type thing. I was just looking for the best ways from peoples experience to start with, you do make sense though here.. But I'd enjoy debugging the game whilst making it with a pixelated effect - hope this makes sense.
15  Discussions / General Discussions / Re: Using TWL with todays versions of LibGDX? on: 2014-11-30 14:23:24
Thanks a million

I love simulations to, Demo 3 has a steep learning curve, I'm always getting in debt with GDP so far but its dead fun and easy to mod. Its very inspirational. I was thinking of creating a research chemical simulator, mixing chems together and having effects of them, anti depressents, anti anxiety. I had a big list of chems from a website when I was about to do it with C# and .NET framework for GUI but the list was big and crashed and gave up but now thinking about it I should of started with a smaller array tbh but was young at the time so this is my idea really with Java. A bit of a junkie idea but I don't think its been done, I don't know nothing about chemistry but that makes it fun I guess. It doesn't have to be 99% chem 'spot on' as its a 'game' and not a real simulator. The whole idea would be to use decent random Algorithms than pure randomness. I.E if you mixed 3 chems together, random kinda outcome, but it'd have to have the same results using them particular 3 if you was to play again etc etc, then you'd have an output where you'd have 'people paid contracted' lab rats (which yes, you do get in real life, how nuts eh?) with described effects, then you'd market and sell it through black market or commercial.

Its all something I'd plan out on paper as there would be a lot to implement, but after installing shite loads of game engines, trying to learn multiple languages as you do, these are one of the ideas I've had in my mind for some years a long with smaller games like pong etc that I could work on on the side whilst working on the smaller games for XP. Smiley
16  Discussions / General Discussions / Scaled, zoomed, pixelated retro effect in LibGDX on: 2014-11-30 13:09:04
Its time I start a real project from start to finish after 2 years of hard study with Java and third party libraries, they say you learn a lot more by actually 'doing it' - At first I wanted to do everything with pure Java, it become quiet tedious and lonely with the bufferedImage thing and I felt I was pretty limited as a newb and was always getting told to use LibGDX and such, and now is the time...

I loved breakout when I was a kid so my main aim is to design it all on paper, pipeline etc, I'm sticking to a really good color palette I found on google which is 16bit based.

I do want it to be pixelated, zoomed. When I was working with bufferedImage with java, on a lot of tutorials I noticed the SCALE constant thing, like when you init the sizes you get WIDTH * SCALE etc for the pixel zoom effect. Now this is what I'm wanting with libgdx, I'm guessing so far you would use the ortho camera and zoom in? But would there be a way of making collision of the camera view width of the screen, seeing as I'm creating breakout, you should get what I mean?
17  Discussions / General Discussions / Re: Using TWL with todays versions of LibGDX? on: 2014-11-30 13:02:20
Great thank you just what I needed

I had a GUI like the Democracy 3 in mind for future plans, some kind of other simulator, you should check out that game if you havent already - would this kind of thing be possible with SceneUI then? I'm guessing so...
18  Discussions / General Discussions / Using TWL with todays versions of LibGDX? on: 2014-11-30 12:24:52
Is this possible?

I've tried adding the latest TWL gui lib to the build path in Libgdx but its not letting me import when I create 'private TWL' even though there is  TWL.jar in the the build path like I say

Even if I did get it to work, does it still work under the hood with the rest of LibGDX?

Correct me if I'm wrong, but I see that TWL looks really cool with all its widgets compared to Scene2D

Thanks
19  Game Development / Newbie & Debugging Questions / Re: 2D Destructable Terrain / Lemmings / Worms... The easiest way? on: 2014-11-21 13:37:40
try your way to it, and you will learn alot along the way

give that one a try =D

Good point, this is where I think I fail a lot sometimes. Programming is very fun for me but seem to be doing more theory than practice and most of the time it doesn't get you any better IMO

I'll give it a shot Smiley
20  Game Development / Newbie & Debugging Questions / Re: How would I make one of the tiles disappear from this array? on: 2014-11-21 12:00:05
SOLVED Smiley

Used a method:

grid.setTile(4, 8, TileType.water);

1  
2  
3  
public void setTile(int xCoord, int yCoord, TileType type) {
      map[xCoord][yCoord] = new Tile(xCoord * 64, yCoord * 64, 64 , 64, type);
   }
21  Game Development / Newbie & Debugging Questions / Re: How would I make one of the tiles disappear from this array? on: 2014-11-21 10:31:26
Thank you

I have 2 questions regarding this, would it be easier, for the future.. to use arraylist for tilemaps? that way you can delete them?

or..

Changing the value of the array, lets say:

0 0 0 0 0
1 1 1 0 1
1 1 1 0 1
0 0 0 1 0

to:
        _
0 0 0 1 0
1 1 1 0 1
1 1 1 0 1
0 0 0 1 0

I think I have cracked it right there? Is this what you mean by flagging?

edit: well four questions in a way before anyone says owt Smiley
22  Game Development / Newbie & Debugging Questions / Re: 2D Destructable Terrain / Lemmings / Worms... The easiest way? on: 2014-11-21 10:27:07
Thanks peeps

@ VIrtueeL  : would the quads here be simular to working with:

1  
2  
3  
4  
5  
6  
7  
8  
public static void DrawQuad(float x, float y, float width, float height) {
      glBegin(GL_QUADS);
      glVertex2f(x, y); // top left corner
      glVertex2f(x + width, y); // top right corner
      glVertex2f(x + width, y + height); // bottom right corner
      glVertex2f(x, y + height); // bottom left
      glEnd();
   }


?? obviously manipulating them?
23  Game Development / Newbie & Debugging Questions / How would I make one of the tiles disappear from this array? on: 2014-11-20 16:58:38
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
public TileGrid() {
      map = new Tile[20][15];
      for(int i = 0; i < map.length; i++) {
         for (int j = 0; j < map[i].length; j++) {
            map[i][j] = new Tile (i * 64, j * 64, 64, 64, TileType.futurefloor);
         }
      }
   }
   
   public void Draw() {
      for (int i = 0; i < map.length; i++) {
         for (int j = 0; j < map[i].length; j++) {
            Tile t = map[i][j];
            DrawQuadTex(t.getTexture(), t.getX(), t.getY(), t.getWidth(), t.getHeight());
         }
      }
   }


I've moved from Java software rendering to LWJGL which someone suggested on one of my newb posts, I'm finding it more fun and effective. I've got a question here about a tilemap array I've managed to draw to the screen.

 How would I go about removing tiles, lets say upon a mouse click?

Thanks
24  Game Development / Newbie & Debugging Questions / Re: 2D Destructable Terrain / Lemmings / Worms... The easiest way? on: 2014-11-19 12:32:18
manipulate pixels for terrain and set pixel rgb to what ever when blowtorch is near pixels

And I'm guessing this would be using pixel data for collision? So when the player hits the terrain in some form, you'd use a method like 'getPixelData()' which would return the current pixels, then use something like 'deletePixels()' ?
25  Game Development / Newbie & Debugging Questions / 2D Destructable Terrain / Lemmings / Worms... The easiest way? on: 2014-11-19 11:45:13
I have done some research but I'm having a difficult time understanding

What would be the simplest way to make a sprite/object 'rub out' the terrain. I'm guessing from research you would use alpha channels?

For example,

One sprite player controlled with WSAD
Simple bitmap as the terrain that the player walks along with collision
Background with stars/sun/moon or whatever

The player walks/runs along the terrain and decides to dig like lemmings by pressing the mouse on them, or the worm walks along and you press it for the blowtorch

How would you put this into code?
26  Discussions / Miscellaneous Topics / Re: The C family, should I dig deeper? on: 2014-11-13 23:29:58
C is great for microcontrollers which is my 2nd best thing from Java, MikroC for PIC is my IDE of choice which is ace (Although the latest versions have gone a bit over the top of my head). I'd suggest if you have the money to proberbly invest in a second hand kit, its not really that expensive considering. You'll probably find a development board around the same price as as a full on Arduino kit.

I'm mentioning this due to the fact I've learned a hell of a lot with C and some basic ARM/PIC assembly, not an expert but it helps understand the 'computer' in 'science'. basic I/O, interfacing.

This is proberly why they use C for GL shaders, because its the lowest language to the machine which where OpenGL is interfacing with the 'hardware' - again, I'm pretty new to Java2D not to mention OpenGL

I've seen your replys to my posts regarding Java 2D lately since I've joined and you seem to know the score when it comes to the subject so I would certainly recommened using something like C with microcontrollers rather than the Arduino with its own C++ librarys because trust me, you wouldn't learn as good from this, its hard to explain but its like in comparison 'Processing' vs 'Java2D in Eclipse' with... 'Arduinos C++ vs MikroC / ASM with PIC/AMTEL' --- Mentioning this just incase you did want to delve into it.

I hope this helps, I feel I need to share 'what I know' to contribute to your efforts with my problems Smiley

EDIT: Also, my favourite book out of my C collection to understand it in lamers terms, or if things get a bit rusty - "Head First C", explains things clearly in diagrams, pictures. Some book people would shrug themselfs upon but if your open minded it does the job.
27  Game Development / Game Play & Game Design / Re: Any decent links to Java2D / BufferedImage / Math type FX tutorials? on: 2014-11-13 19:44:38
Thanks for the excellent response and agreed on the presentation/intro, also, when starting his videos he goes on to much about his life mostly, then your itching to get on with it - I like to download the YT videos so I have more control on the pausing, double screen issues etc. So when your watching one after another, he should of thought about this in the first place for people downloading them for future reference, they'd be worthless putting onto your project drive for that purpose because you'd be hearing 'his missis has just had a fight with his mum over the cat she ran over on a night out when he was hungover in town the other day'

On your reponse regrading the timers, you might be able to help me out here. You don't sound so bad now you've shed a bit more detail, I'm new to this so can be awkward.... On the timers when you mentioned animation how the hell does a BufferedImage created a whirl of pixels when chernos not created a paint method? All he did was create a bufferedimage in memory by the look of it... Best example would be looking at that video I posted above, once I've cracked how to view pixels from the BufferedImage then I can use these timers we mentioned to create cool stuff, I made a post the other day richy and gibbo helped us with but that was packing pixels into an interger... But cherno seems to have created pixels straight from the bufferedImage and put it into an array then timed/looped it to create what he did in the video.

If you could shed some light on this that'd be great and that'd be the topic solved, as from then all I'd need to do is look up formulas and port the code if this makes sense... from things like bufferedimage rather than paint.drawLine etc

Hope this makes sense

EDIT: I forgot to add, how hes displaying coloured pixels from bufferedimage that is, any small example code would be greatful, just in one method so I could understand it...
28  Game Development / Game Play & Game Design / Re: Any decent links to Java2D / BufferedImage / Math type FX tutorials? on: 2014-11-13 17:31:49
Already know about that, I'm always studying Java. I've also played all of his others, that fedora cap game, minicraft, miners4k etc. Hes got cool ideas but didn't cherno clearly states that hes inspired from notchs idea and that there friends? Notch also used ideas for minecraft from that space block game, Bill Gates used ideas from altair, Steve Jobs used ideas with the mouse thing, everyone 'steals' ideas, its all to do with putting the work down and making it evolve n if it turns out more user friendly and people seem to get on with it more and find it more fun (flappy bird for example) your onto a winner. I mean, someone invented electricity but someone would of found out about it eventually but the bloke whos not on alive anymore still recieves all the credit for it, now its evolved.

Nearly all simular tutorials by different people use the tick method on top of the fps algorithm, from a beginners point of view, I'd say thats how Java game programming evolves in general, just like an electro house or dubstep producer using sample packs from third party sources.

I don't want to start a debate, I've not used this forum very long. It's all been so welcoming and very helpful so far, its helped me improve but I don't want you to take this the wrong way but your responses seem a little grumpy from what I've seen around the forum.
29  Game Development / Game Play & Game Design / Re: Any decent links to Java2D / BufferedImage / Math type FX tutorials? on: 2014-11-12 20:09:26
[snip]

TheCherno is a terrible tutor and is highly inexperienced. Don't watch his tutorials unless you want to destroy a few IQ points.

- Jev

I found he explains things a lot more than just coding than many I've seen on youtube, yeah he can hault and stall a lot "ok, ok, sooo ok, right, right" but tbh he does go into detail and has helped me.

Then you have the show offs just using notepad who just storm through it with no explaination and call it a tutorial.

Each to there own taste, if you have anything to share topic related please let me know...

- C
30  Game Development / Game Play & Game Design / Re: Any decent links to Java2D / BufferedImage / Math type FX tutorials? on: 2014-11-12 10:47:13
Thanks for the advice, I'll give it a whirl when I boot up GameMaker  Roll Eyes

Heres a good one I found yesterday which is interesting, start of a pure Java 3d game tutorial testing out the start of the engine:

<a href="http://www.youtube.com/v/dwn_UrItwfw?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/dwn_UrItwfw?version=3&amp;hl=en_US&amp;start=</a>
Pages: [1] 2
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Elsealabs (18 views)
2014-12-28 10:39:27

CopyableCougar4 (20 views)
2014-12-28 02:10:29

BurntPizza (25 views)
2014-12-27 22:38:51

Mr.CodeIt (15 views)
2014-12-27 04:03:04

TheDudeFromCI (20 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (58 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (98 views)
2014-12-09 22:41:13

BurntPizza (116 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!