kandi X-RAY | CocosSharp Summary
kandi X-RAY | CocosSharp Summary
CocosSharp is an easy to use library for simple games using C# and F#. It is a .NET port of the popular Cocos2D engine, derived from the Cocos2D-X engine via Cocos2D-XNA. This library is MIT licensed.
Top functions reviewed by kandi - BETA
CocosSharp Key Features
CocosSharp Examples and Code Snippets
Trending Discussions on CocosSharp
I'm making a app that will show a line chart of the acceleration meter. The chart has to move sideways to show the new results. To draw i use the CocoSharp graphics library.
First try was to redraw the full chart every update, but this was not fast enough and somehow you cant draw transparent, this wont erase the previously drawn pixels, so my chart just filled up.
Second try was to make the chart 4 times wider than the screen and only draw the last update on 2 positions: at the position we are drawing and 2 screen widths back (out of screen). Before drawing the line i draw a black line instead of transparent to erase the previous result.
I then move the whole layer towards the left, giving a nice scrolling chart. Then when the position exceeds 2 screen widths i reset the position back to 0, but because we are drawing at 2 positions the graph is already drawn the same as where we left, making it seamlessly scroll forever.
This works very good, but after a few minutes of drawing you can notest the screen begins to lagg in framerate. I investigated everything but my drawing thread is working just fine pumping out a full update every 16ms, so i think it is the CocoSharp library.
As i stated before when you draw transparent the pixels do not get erased, which makes me think every draw update keeps in memory somehow, slowing down the gpu after a while. Could this be correct? And if so, how do i fix it?...
ANSWERAnswered 2020-Jul-25 at 12:53
Ok, seems I was right. After testing it without drawing the graph the app didn't start stuttering. I now changed the graph to work with 2 layers, in pretty much the same way I used to do, only when I reset the scroll, I also reset the previous CCDrawNode with a:
I am using the CocoSharp.PCL.Shared Nuget version 1.6.2 and I am trying to get the tile property.
Here is the TileSet.tsx:...
ANSWERAnswered 2019-Jan-11 at 14:59
I found a way to get my tile properties.
- Get a stream from the tileset.tsx
- Get the properties from a specifi tile id
- Create a function that parse the xml file tileset.tsx to make it works as cocossharp used to work.
In Program.cs, Since it inherit from activity, I am able to open all assets :
I have a Xamarin Forms app that produces background audio and thus the app can run while the device is in lock mode and/or when the screen is not active (screen sleep).
I have a need to prevent screen updates while the Xamarin Forms MainPage (a ContentPage) is not visible and active. In other words, I need to detect is the screen is disabled (in sleep mode), if the device is locked, and also preferably when the MainPage is not currently active and visible.
Using Xamarin Forms, how can I detect if the screen is not active and/or if the device is in lock mode?
- I tried using Xamarin.Essentials and checking the ScreenLock.IsActive property. This did not work, as IsActive was always false even when the device was in lock mode. Tested on iOS device (iPhone).
- The reason why I need to prevent screen updates is because I am using CocosSharp and I am periodically placing CCParticle animations on the screen. When the screen is not active, new CCParticle animations can continue to be added, but the existing ones do not run to their set duration and thus never "expire." The result is an ever-increasing number of CCParticle animations on the (hidden) screen that continuously consume resources.
ANSWERAnswered 2018-Nov-12 at 09:56
App.xaml.cs, you have the following methods:
I've got an issue when I try to load a .tmx file in a CCTileMap CocosSharp object.
Here is the code :...
ANSWERAnswered 2018-Feb-07 at 16:44
Found a way to load the TileMap file.
The solution I found :
- save the TileMap file in .xml format in Tiled software.
save the .tsx file in .xml format.
I use this code to load the tile map file :
I want to get into physics with CocosSharp. I was about to use CCPhysicsBody in my PCL project, however it's not available in the namespace "CocosSharp".
Checking my NuGet packages (CocosSharp.PCL.Shared), the last package publish date is two years old. Do I miss CCPhysicsBody, because my packages are too old? Why there is no up2date package then?...
ANSWERAnswered 2017-Nov-27 at 17:44
I got an answer here: https://forums.xamarin.com/discussion/comment/308757#Comment_308757
It's still not part of the NuGet, thus I need to compile CocosSharp with the physics flag, by myself.
I currently developing an application in ios with Xamarin and I use CocosSharp.
I try to put some Background music on it and I have an exception that always come : "Microsoft.Xna.Framework.Content.ContentLoadException Failed to load the asset file from MySong"
The song is in the content folder : Content/Sounds
To play the sound I use the following line :...
ANSWERAnswered 2017-Jul-03 at 11:52
You need to change the asset file's Build Action. Right-click on the file, scroll to Build Action and ensure that it is set to BundleResource (This is required for iOS projects). Clean/Build the project and try running it again.
I'm trying to create a Xamarin.Forms PCL client for SignalR. Every tutorial I found it's how to add SignalR to either Xamarin.Android or Xamarin.iOS. How can I add SignalR to Xamarin.Forms project?
- Should I create an separate PCL, call it "Proxy" and then just use this PCL in Xamarin.iOS, Android and Windows Mobile projects?
- If 1), should I add SignalR also in every project (besides PCL, where I'm really using it)?
- Should I add to the PCL created by default, while creating Xamarin.Forms solution?
Thanks for help,
Here's the problem I'm getting: I have a fully working Xamarin.Forms PCL project. I removed all windows stuff though. I just left PCL, iOS and Android projects. It works! I added CocosSharp only, but don't use it. Plain, empty, never touched Xamarin.Forms. Then I've added SingalR to PCL project. Complied, run - works! BUT when I add JUST this line:...
ANSWERAnswered 2017-Feb-06 at 06:43
I met the same error as you did, it seems that when installing
SignalRMicrosoft.AspNet.SignalR.Client package, the dependency packages cannot be automatically installed, the references got somehow corrupted.
To solve this issue, you can manually install those packages.
Install the following three Packages separately from Nuget:
So I'm playing around with the BouncyGame. I made it so that when you start the game you need to press the screen for it to start. I would like to implement this whenever you play a new round as well. I tried to reuse this att the bottom of my code but it made it extremely laggy....
ANSWERAnswered 2017-Jan-24 at 19:49
Figured it out! There is an "Unschedule" Method built into Cocossharp. Ref. https://developer.xamarin.com/api/namespace/CocosSharp/
I just added
at the very en of my RunGameLogic method under
if (ballSprite.PositionY < VisibleBoundsWorldspace.MinY)
So once the ballSprite is out of bounds it will Unschedule what i Scheduled in my OntouchesEnded method. That means the code goes back to listening for touches.
Might have made some errors, but this is as best I could figure it out and it works!
I had fully working Xamarin.Forms (Android and iOS). HAXM is running. Then I installed CocosSharp from nuget in my PCL project and both Android and iOS projects. iOS project works great but Android... not.
ANSWERAnswered 2017-Jan-17 at 03:03
How can I fix this? Should I manually add String.xml to the project? Really?!
I made a demo and reproduced your problem. By opening the
Resource.Designer.cs file I found that the following codes are automatically added to
I created a Blank App (Xamarin.Forms Portable). I set up and run HAXM, Android and iOS projects works great. I wanted to add a CocosSharp view, so I tried to install CocosSharp nuget package. But I'm getting this errors:
Is this another bug? How can I fix it? I just wanted to add a CocosSharp to default, blank Xamarin.Forms.
ANSWERAnswered 2017-Jan-16 at 04:33
The default (template created) Xamarin.Forms PCL-based project targets
Profile259 and that includes
SilverLight support which is not supported by
Change your PCL-based project to
Profile111 which removes
Silverlight support and you will be able to add the
No vulnerabilities reported
Reuse Trending Solutions
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page