Slide the popup in libgdx not work - libgdx

I am trying to develop a libgdx game. i want to implement a selection screen. Till now i have implemented horizontal scrollpane and it is working fine.
Now i want to implement scrolling on the click on the button. You can check the image attached.

Try instead to use json pack
This works for me:
_skin = new Skin();
TextureAtlas buttonAtlas = new TextureAtlas("images/buttons.pack");
_skin.addRegions(buttonAtlas);
_textButtonStyle = new TextButtonStyle();
_textButtonStyle.font = _game.getFont();
_textButtonStyle.up = _skin.getDrawable("button-orange");
_textButtonStyle.down = _skin.getDrawable("button-blue");
buttons.pack:
buttons.png
size: 234,195
format: RGBA8888
filter: Nearest,Nearest
repeat: none
button-orange
rotate: false
xy: 0, 0
size: 236, 67
split: 25, 25, 14, 14
orig: 236, 67
offset: 0, 0
index: -1
button-blue
rotate: false
xy: 0, 67
size: 236, 67
split: 25, 25, 14, 14
orig: 236, 67
offset: 0, 0
index: -1
button-navy
rotate: false
xy: 0, 134
size: 236, 67
split: 25, 25, 14, 14
orig: 236, 67
offset: 0, 0
index: -1

Try in create method
yourImage = new Image(new Texture("images/image.png"));
stage.add(yourImage);
Try in render method
yourImage.setPosition(yourX, yourY)

for the answer look this link https://github.com/krustnic/HorizontalSlidingPane

Related

Geotools MismatchedDimensionException when using smooth()

I am experimenting with Geotools java library, and specificaly with the smooth method. In the Geotools documentation there is this example:
WKTReader reader = new WKTReader();
Geometry tShape = reader.read(
"POLYGON((10 0, 10 20, 0 20, 0 30, 30 30, 30 20, 20 20, 20 0, 10 0))");
Geometry tLoose = JTS.smooth(tShape, 0.0);
Geometry tTighter = JTS.smooth(tShape, 0.75);
when I execute this I keep getting this error:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/opengis/geometry/MismatchedDimensionException
in line Geometry tLoose = JTS.smooth(tShape, 0.0); (same happens with next line)
Why am I getting this error?

Looking To Update/Increase Embedded Array Objects Numeric Value

I have the following item within my Mongo DB Collection
db.teams.insert({
team_id: "spa2",
date_founded: new Date("Nov 04, 1914"),
league: "La Liga",
points: 72,
name: "Real Madrid",
players: [ { p_id: "Ronaldo", goal: 135, caps: 134, age: 28 },
{ p_id: "Bale", goal: 75, caps: 45, age: 27 },
{ p_id: "Marcelo", goal: 11, caps: 25, age: 31 },
{ p_id: "Benzema", goal: 125, caps: 95, age: 22 } ]
});
I want to be able to increase the number of goals scored by 3.
I have tried all morning to find a demo of this, but cant find anything near enough for me to get it to work.
To increase the number you should use $inc operator. To do that for one particular document inside players array you should use positional operator.
So entire operations should look like this:
db.teams.update({_id: ObjectId("5a48d65f3a1e3fc4b06b787f"), "players.p_id": "Ronaldo"}, {$inc: {"players.$.goal": 3}})
This will update only goals for Ronaldo. If you want to update goals for all players you should use the new all positional operator $[]
db.teams.update({_id: ObjectId("5a48d65f3a1e3fc4b06b787f")}, {$inc: {"players.$[].goal": 3}})

meaning of index in texture atlas files

I am following libgdx tutuorial on texture atlases. This is an excerpt from a texture atlas file. What is the meaning of index parameter and in what situations it is useful to the programmer? All texture region have it and it is the same namely -1, in all of them.
prehistoric.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
background
rotate: false
xy: 2, 2
size: 1280, 720
orig: 1280, 720
offset: 0, 0
index: -1
trex
rotate: false
xy: 1286, 479
size: 179, 243
orig: 179, 243
offset: 0, 0
index: -1
caveman
rotate: false
xy: 1286, 319
size: 83, 156
orig: 83, 156
offset: 0, 0
index: -1
From the Javadoc:
The number at the end of the original image file name, or -1 if none.
When sprites are packed, if the original file name ends with a number, it is stored >as the index and is not considered as part of the sprite's name.
I should also add, that this index is also used on findRegion(String name, int index) method which returns the first region found with the specified name and index.
It's typically used for animations. You can append frame numbers to the file names of each frame of animation before you pack them into the atlas, i.e. run0.png, run1.png, run2.png, etc. During texture packing, the number is removed from the sprite's name and used as its index. Then you can load the animation all at once:
animation = new Animation(0.1f, atlas.findRegions("run"));
The index is -1 when the original file name did not end in a number.

How to count running time of merge-sort?

I've been having a little trouble figuring out how to calculate the time complexity for merge-sorting this series of numbers: 44, 112, 178, 48, 10, 22, 28, 186, 66, 86, 128, 82, 168. The numbers should end up in ascending order.
I'm not sure if this will help or not, but here's a diagram showing the merge-sorting function being run on a different set of numbers: http://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Merge_sort_algorithm_diagram.svg/300px-Merge_sort_algorithm_diagram.svg.png

Does the data object have a maximum query length?

I have an old vb6 program which queries an access 2000 database. I have a fairly long query which looks something like this:
Select * from table where key in ( 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 19, 20, 21, 24, 27, 29, 30, 35, 38, 39, 40, 42, 43, 44, 46, 47, 49, 50, 53, 56, 59, 60, 61, 63, 64, 65, 66, 67, 68, 72, 76, 80, 84, 86, 89, 90, 91, 93, 94, 98, 99, 10041, 10042, 10045, 10046, 10047, 10049, 10057, 10060, 10089, 32200, 32202, 32203, 32204, 32205, 32207, 32214, 32245, 32303, 32314, 32403, 32405, 32414, 32415, 32503, 32703, 32803, 32903, 33003, 33014, 33102, 33103, 33303, 33403, 33405, 33601, 33603, 33604, 33614, 33705, 33714, 33901, 33903, 33914, 34001, 34105, 34114, 34203, 34303, 34401, 34501, 34601, 34603, 34604, 34605, 34803, 41001, 41005, 41007, 41013, 42001, 42005, 42007, 42013, 43001, 43002, 44001, 44007, 46001, 46007, 99999, 9999999)
However, when I look at the RecordSource of the data object, it seems that the query is being truncated to this (which is obviously not syntactically valid and throws an error):
Select * from table where key in ( 0, 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 19, 20, 21, 24, 27, 29, 30, 35, 38, 39, 40, 42, 43, 44, 46, 47, 49, 50, 53, 56, 59, 60, 61, 63, 64, 65, 66, 67, 68, 72, 76, 80, 84, 86, 89, 90, 91, 93, 94, 98, 99, 100
My data source looks like this:
Begin VB.Data dtaList
Caption = "dtaList"
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 960
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 4440
Visible = 0 'False
Width = 2295
End
I've tried running the full query in the access database itself which works fine.
Is this a limitation in the VB.Data object, or is there some other explanation? Is there any way I can get around this issue?
Unfortunately I am unable to upgrade to a newer version of access.
The truncated version of the SQL statement you posted is 246 characters long, so it appears that something along the line is limiting the length of the SQL string to somewhere around 255 characters. As you have discovered by pasting the query into Access itself, the actual size limit of an Access query string is much larger (around 64,000 characters, I believe).
I remember running across a similar issue years ago but my problem was an INSERT statement that was writing some rather long strings to the database. The workaround in that case was to use a parameter query (which I realize, in hindsight, that I should have been using anyway). It greatly shortened the length of the SQL string because the parameters were passed separately. Unfortunately that workaround probably wouldn't help you because even if you dynamically created a parameterized version of the query it wouldn't be all that much shorter than the current SQL string.
Another workaround would be to write all of those numbers for the IN clause as rows in a temporary table named something like [inValues], and then use the query
SELECT [table].*
FROM
[table]
INNER JOIN
[inValues]
ON [table].[key] = [inValues].[key]