Cocos2d Android CCRenderTexture example - android

CCSprite texture1 = CCSprite.sprite("menu_background.png");
CCRenderTexture layerRenderTexture = CCRenderTexture.renderTexture(width, height);
layerRenderTexture.begin();
texture1.visit(CCDirector.gl);
layerRenderTexture.end();
this.addChild(layerRenderTexture);
I haven't seen any CCRenderTexture example on Internet. When I try to use it as above, I expected to see a nice background. Instead I see black :)
What am I doing wrong?
Thanks for your help.

I haven't seen any CCRenderTexture example on Internet.
I think you may have been looking on the wrong Internet? :)
Check out my article and Ray's article. Both come out on top when you google for CCRenderTexture. They use cocos2d-iphone, but the same principles apply.
In your particular case I don't see you adding the layerRenderTexture as child to the scene or another node. That would explain why you're not getting any results.

Related

Finding an element by id in Appium

I have got id associated with the element, but when tried locating this using findElement(By.id()) it doesn't work.
Also, I had gone through few blogs with the same question as given here, but I saw the resource-id in there was prefixed with packagename and :id. In my case, these aren't associated. Screenshot for the element details is below :
I have used the below code to locate the element by id.
- driver.findElement(By.id("loginHome"));
- driver.findElement(By.id("com.packagename:id/loginHome"));
- driver.findElement(By.id("android:id/loginHome"));
- driver.findElement(By.xpath(//*[#id='loginHome']));
But none of the above code snippets worked. Can someone please help me get through with this. Thanks in Advance.
Not exactly answering your question, but providing an alternative method for you to complete the test.
I follow this link https://github.com/appium/appium-dot-app and it works.
You don't need to code everything. The application provides some easy ways to record your clicks and gestures.
For example, when I click something, it will print out the script automatically.
wd.find_element_by_xpath("//android.view.View[1]/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[2]/android.widget.RelativeLayout[1]").click()
And you just need to choose your favorite programming language and save it after testing is done.
One thing that I have to point out is that the swipe function is corrupted. Use the following code to perform swipe gestures
wd.swipe(421, 424, 70, 424, 500)
You can try other options as well. Try this:
//add some wait command before the element
Thread.sleep(2000);
driver.findElementsByXPath("//*[#class='android.widget.Button' and #index='4']");
Try adding explicit sleep for page to load before clicking usind ID.
First try to wait for the particular element
MobileElement expelement=(MobileElement) (new WebDriverWait(driver, 15)).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//android.widget.Button[#index='4']")));
Then try to do the click(or the activity you suppose to do)
driver.findElement(By.xpath("//android.widget.Button[#index='4']")).click();

Android TeeChart Line Chart Touch Sensitivity

I realized that the Line Chart Drag Point is not really sensitive and it is difficult to select a point to drag. Aside from that, occasionally might trigger the wrong point. I wanted to ask is there workaround can solve this issue? I checked the example code the DragPoint basically selects the entire Line but not the point (I guess?). Other than that, TeeChart is a great library for charts! Any comments and answers will be highly appreciated.
Line seriesLine;
seriesLine = new Line(chart.getChart());
seriesLine.fillSampleValues(5);
SeriesPointer tmpPointer = seriesLine.getPointer();
tmpPointer.setInflateMargins(true);
tmpPointer.setVisible(true);
tmpPointer.setVertSize(10);
tmpPointer.setHorizSize(10);
DragPoint toolDragPoint;
toolDragPoint = new DragPoint(seriesLine);
toolDragPoint.setStyle(DragPointStyle.BOTH);
You are right. It seems the pointer isn't clickable&draggable.
I've found the fix for the problem here also fixes this. So I've applied the same fix for the Java version.
This will be available with the next maintenance release.

AndEngine astar pathfinding

Could anyone give me an example of source code which uses astar pathfinding algorithm with AndEngine on the TMXTiledMap. I am using AndEngine downloaded from https://github.com/nicolasgramlich/AndEngine.
Any suggestion would be appreciated. Thanks!
This is the official TMXTiledMapExample, but it doesn't contain A* pathfinding. It can teach you about tiled maps, though.
Here is another example from the forums which does contain it. It isn't really an example, but the pathfinding code provided there works. I don't think there is any real example of A* pathfinding, never seen any tutorial of it (The best way to learn is to read the code yourself. Better take a look at AStarPathFinder.java code).
The important parts for you in the forum post are are (lines):
123: Initializing the AStarPathFinder
205 - 213: Converting screen/scene coordinates to map tiles and using the pathfinder.
224: The method loadPathFound - using the path returned by the pathfinder to move an entity.
The MyMap class in the third post.

Draw SurfaceView from layout xml, Ask information about answer

I found the following answer
Draw SurfaceView from layout xml
It works GREAT. However,I cannot figure out how to call a method/function from the extended SurfaceDraw class.I couldn't figure out how to ask a question of a particular answer either.
It seems like the following code should work. However, no matter where I put it it generates a null value so i can't make a call to a method/function.
DrawingSurfaceView drawingsurface = (DrawingSurfaceView)findViewById(R.id.DrawingSurfaceView);
DrawingSurfaceView.MyMethod();
I am so very close to accomplishing my goals. Any help with this is issue is greatly appreciated.
I got it. I will post an anser when the system lets me.
I moved:
DrawingSurfaceView drawingsurface = (DrawingSurfaceView)findViewById
(R.id.DrawingSurfaceView);
to onCreate() and it started working.

Multi line messagefield in mobileIconItemRenderer FLex

I have a problem with my ItemRenderer in Flex. I'm developping a mobile application and I'm using a list. One of the items is to set a date. But when the date is wrong I want to set a text in my messageField like : The To date must be after the From date.
The problem is I don't know (and don't seem to find it anywhere) where you can set the messagefield in multiline.
I read on a forum that's possible but no explanation how.
click me to see example
Here you can see an example of what I want (the 5the item in the list is using multiline).
I have a function in my itemrenderer to set the messagefield:
private function messageLabelFunction(item:Object):String
{
var eventMessageParameter:EventMessageParameterCount =
EventMessageParameterCount(item);
return eventMessageParameter.details;
}
I hope someone can help me.
Thanks in advance!
Kind regards,
Thibault Heylen
I found the best solution:
I kept searching and on a site there was lik e method : variableRowHeight but this didn't work in flex 4.5. I searched then again adobe forums and found this threat: adobe forum topic
So it's actually very simple. Just add height in you itemrenderer.
I hope I can help someone with this
Kind regards,
Thibault Heylen

Categories

Resources