Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nmare

Pages: [1]
1
Support / Problem when leaving the app to external operation.
« on: September 04, 2013, 01:10:51 am »
Hi Ogen!

I have a problem when i leave the my app to go on google billing or on a web page.

when i finish this "external" operation and come back in my app, everything is messed up.   Is there a way i can force a "full reload" w/o using  system.exit()?   

 I think the best stable solution will be to recall everything from Oncreate?

Thx

2

Found a bug and probably few ways to boost it...  I will post some change soon.   I think i will communicate with the original author to see if i can publish a new version of his tool (with the original credits of course).

3
Projects / Puzzker
« on: August 11, 2013, 12:51:08 am »
Puzzker

Puzzker is a mix between a game of poker and a puzzle. Line up cards horizontally or vertically to create poker's hands to complete the objectives and gain tons of tokens.







Compatibility: smartphones/tablets, android 2.2 and +

Website: www.puzzker.com

Creator: Stephane Boivin, Quebec city, Canada for DevGeek studio enr.

Cost: 1$ to unlock at level 10. You can also buy virtual Currency (puzzles).

todo list:  - Buttons on the right of the screen. (puzzle tool, config, shop, unlock )
         - Tutorial
         - Game over screen half completed.

Will probably be released in october.

This is my first indie project for DevGeek Studio (www.devgeek.ca), my new entreprise.

4
Hi devs,

Im using jpct-ae since at least 1 year now and i want to contribute to the community. So i offer you guys this little addon to the GLFont lib.  This is a way to say thank to Egon Olsen for his nice  support.

I needed for my GUI to display text in multi line with color codes. So I worked on my Label object to add this features. It gave an horrible code with terrible performances and
I quickly realized that I had to work directly in the GLFont class to get there.

The following code is not perfect. it work with a sacrifice of 20 FPS, so it is especially useful for text displays in the online help, credit pages or things like that. DO NOT USE IN A HUD.
If you need to keep fps high, you have to use the usual method.
 
I really worked hard to improve it, but the use of regex (even compiled) slowed everything.  It look like nothing, but i worked 3 evening on that thing...

Dont be shy to make change and you can easily add colors by adding the colors in the SwitchColor function and modifying the patternReplace pattern. Tell me if you see a way to optimize it.


How it work 

Carriage return: You add a '|' in your string every time you want to do a carriage return.  This function will also force a carriage return when you go past the bounds (with word wrap).

Color: You add a color code in your string to switch colors.  Color codes are /#0 to /#9. 


Text sample:

<string name="txtcredit">Game design by /#2Stephane Boivin/#9 (devgeek studio/www.puzzker.com)
||Programming (Web, 2d, 3d, android, database) by /#2Stephane Boivin/#9 (devgeek studio/www.puzzker.com)
||Opengl engine (jpct ae) was developed by /#2Egon Olsen/#9 (www.jpct.net)
||Illustrations by /#2Alexandre C./#9 (alex@alexbd.com, www.alexbd.com)
|||/#4(C) 2013 All right reserved to devgeek studio (www.devgeek.ca) </string>

Screen shot:



How to add it to your lib:

First you need to add this line of code in the properties of the GLFont Class. (Yeah, you can make it private also, but i needed it somewhere else)

Code: [Select]
public Paint PaintObject; // Make the paint object public for later use

And at the beginning of the GLFont(...) function, you add :    

Code: [Select]
PaintObject = paint;

Then you add this piece of code at the end of the GLFont class just before the "}". 

Code: [Select]
// Color Switch
// return true if color changed.
private boolean SwitchColor(String str) {
if( str.startsWith("/#") ) {
if( str.equals("/#0") ) color = RGBColor.BLACK;
if( str.equals("/#1") ) color = RGBColor.BLUE;
if( str.equals("/#2") ) color = RGBColor.GREEN;
if( str.equals("/#3") ) color = RGBColor.RED;
if( str.equals("/#4") ) color = new RGBColor(255,255,0); // yellow
if( str.equals("/#5") ) color = new RGBColor(15,5,120); // purple
if( str.equals("/#6") ) color = new RGBColor(235,65,235); // pink
if( str.equals("/#7") ) color = new RGBColor(215,155,35); // orange
if( str.equals("/#8") ) color = new RGBColor(128,128,128); // gray
if( str.equals("/#9") ) color = RGBColor.WHITE;
return true;
}
return false;
}

/* Made by Stephane Boivin from DevGeek Studio ( devgeek.ca / puzzker.com ) 2013
* Same of blitString but add special color codes, carriage return and a text width.
* @param buffer
*            buffer to blit into
* @param s
*            string to blit
* @param x
*            leftmost point
* @param transparency
*            transparency value, make sure >= 0
* @param width
*            text size (limit on x)
* @param y
*            baseline
* Codes:
* Color code: /#0 to /#9
* Carriage return: |
*/
public RGBColor color = RGBColor.WHITE; // Default color.
public void blitStringSpecial(FrameBuffer buffer, String s, int x, int y, int width, int transparency) {
char c;
int xPos = x; // char position
Point size;
boolean skip = false;
String chunk = "";
int charSpace = 0; // Chars count before next space
Pattern patternSplit = Pattern.compile("[ \\|]");
Pattern patternReplace = Pattern.compile("/#[0-9]"); // use "/#[0-9][A-Z]" to add more color code (/#A)
y -= baseline;

for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);

// Carriage return if the next chunk of string go past the bounds
charSpace--;
if( charSpace <= 0 ) {
chunk = patternSplit.split(s.substring(i),0)[0]; // get next chunk
charSpace = chunk.length()-1;
chunk = patternReplace.matcher(chunk).replaceAll(""); // remove color codes

// Carriage return
if( xPos + (int)PaintObject.measureText(chunk) > x + width) { 
xPos = x;
y += this.fontHeight; 
}
}

// Check Color code
if( i+3 < s.length()) skip = SwitchColor(s.substring(i,i+3));

if( !skip ) {
int index = alphabet.indexOf(c);
if (index == -1)
index = alphabet.indexOf('?');
if (index != -1) {

if( c == '|' ) { // carriage return
xPos = x;
y += this.fontHeight; 
} else { // blit
size = pack.blit(buffer, index, xPos, y, transparency, false, color);
xPos += size.x;
}

}
} else i += 2; // skip the color code
}
}



Sample use:   
Code: [Select]
Font.color = RGBColor.WHITE;  // this line is optional as the default color is white anyway
Font.blitStringSpecial(fb, Text, TxtPosY, TxtPosX, Width - (Margin*2), 15);

Hope this help you.  I made this for my actual project (puzzker.com) an android puzzle game that will be released in the next month. I will add it this week end in the Project section of this forum.

P.S  Sorry for the grammar, english is my 2nd language.

5
Support / Re: crash while using textureinfo and blending
« on: July 23, 2013, 11:19:50 pm »

i have a version before december 2012...

But i found a soluce finnally....     i reload the .obj each time i need to change the texture.   It give a small fps pike but this is a puzzle game so lag is not a problem.


6
Support / crash while using textureinfo and blending
« on: July 23, 2013, 06:53:38 pm »

Hi!

i have this error message when i assign a texture that i made using TextureInfo with some blending.

07-23 12:37:17.193: I/jPCT-AE(16956): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
07-23 12:37:17.193: I/jPCT-AE(16956):    at com.threed.jpct.Object3D.setTexture(Object3D.java:3411)
07-23 12:37:17.193: I/jPCT-AE(16956):    at com.nmare.puzzker.LoopPhase2.SetupPhase2(LoopPhase2.java:78)
07-23 12:37:17.193: I/jPCT-AE(16956):    at com.nmare.puzzker.Gameloop.loop(Gameloop.java:290)
07-23 12:37:17.193: I/jPCT-AE(16956):    at com.nmare.puzzker.Puzzker$MyRenderer.onDrawFrame(Puzzker.java:591)
07-23 12:37:17.193: I/jPCT-AE(16956):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
07-23 12:37:17.193: I/jPCT-AE(16956):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)


This is weird, because in the reload session phase, at some other place i use the same function to do it and it work well.

Code: [Select]
if( game.CardState.Card[game.Table.Content[x][y]] == 2 ) {
Logger.log("Frozen OK");
game.card[game.Table.Content[x][y]].setTexture( game.FreezeCard.FreezeTexture( game.Table.Content[x][y] ) );
}

but in the gameloop, it give an error on

Code: [Select]
if( game.NextCardFrozen ) {
game.NextCardFrozen = false;
game.card[game.Deck.Deck[CardId]].setTexture( game.FreezeCard.FreezeTexture( game.Deck.Deck[CardId] ) );

}
   

after some debug, i can see that the error appear right  after the game.FreezeCard.FreezeTexture function. 

here the FreezeTexture class

Code: [Select]
public TextureInfo FreezeTexture( int CardId ) {

// Blend a texture to the card
TextureInfo ti = new TextureInfo( TextureManager.getInstance().getTextureID("frozencard"));
ti.add(TextureManager.getInstance().getTextureID("card" + Integer.toString( CardId+1 )) , TextureInfo.MODE_MODULATE   );

return ti;
}

whats  wrong?  I never strip my objects because i have to change em alot.


7
Support / Re: blending texture with textureinfo
« on: January 21, 2013, 11:44:55 pm »
Ahahahaha it work now...

But the card look burned instead of frosted...    Will have to work on the blending and the frost texture.      And now i have a Burned card status  ;D

8
Support / Re: blending texture with textureinfo
« on: January 21, 2013, 11:10:36 pm »
Hi

Quote
I think this happens because you are trying to add additional layers after the object has been compiled (and maybe stripped). This isn't supposed to work anyway, because it would require a recompile of the object. Have you tried to add that second layer right after loading the object and initialize it using some transparent texture?

woops...    objects are already compiled and stripped when i change the texture.   I had not seen it in the forum... or maybe im blind  ;D

Ok, so i have to destroy my object and then rebuild it with a new skin each time?  Ill give a try.   


Quote
Please try the latest beta version: http://jpct.de/download/beta/jpct-ae.jar. I don't think that this will help, but just to be sure...

My game will be ready for the market in the next month, so i dont want to use a beta version if possible.   


thx for your fast answer like usual  :)

9
Support / blending texture with textureinfo
« on: January 21, 2013, 02:52:49 am »
hi!

i actually try to transform a texture when an object have a special status.   In this case, a frozen card.   So i have a normal texture for each cards and a icy texture of the same size
using the same uv mapping format.    My objects have their own UV Mapping (Using 3ds), in fact all cards use the same cloned object.

So i want to blend both textures

here the code i use

Code: [Select]
TextureInfo ti = new TextureInfo( TextureManager.getInstance().getTextureID("card" + Integer.toString( CardId+1 )) );
ti.add(TextureManager.getInstance().getTextureID("frozencard"), TextureInfo.MODE_BLEND );
game.card[CardId].setTexture(ti);

If i use only one texture. It work fine.  I can see the card texture or the frozencard texture.   when i try to blend both im getting this error on the setTexture line:

01-20 20:26:20.187: I/jPCT-AE(26561): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
01-20 20:26:20.187: I/jPCT-AE(26561):    at com.threed.jpct.Object3D.setTexture(Object3D.java:3411)
01-20 20:26:20.187: I/jPCT-AE(26561):    at com.nmare.puzzker.anims.Freeze.FreezeCard(Freeze.java:37)

ti.MAX_PHYSICAL_TEXTURE_STAGES give me 4.

Im out of idea.  Whats wrong? 

Thx for the help

10
Support / screen size and view port
« on: December 21, 2012, 01:29:21 am »
Hello!

i started a jpct project last year on a cellphone.   Now i want to make this project work on cells and tablets.


so, working with different screen size is easy for the blit part.    But for the 3d viewport?    How it work?

the viewport will be the same size on a bigger screen?   or do i have to play with the camera distance or play with the size of my objects?

thank you for your answer

Pages: [1]