draw

Remove Actors from Stage?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 06:08:17
I use LibGDX and move only the camera in my game. Yesterday I founded a way to draw the ground in my game. I'm trying to make a clone of Flappy Bird, but I have problems with drawing the ground which is moving on the screen. In every render call I add a new Actor to the Stage , but after a few times the drawing is no more flowing. The frames per second sink very fast. Is there another way to draw ground in games? If I'm reading correctly, you're problem is that once actors go off the screen, they are still being processed and causing lag, and you want them to be removed. If that's the case,

iPad (very) simple drawing

走远了吗. 提交于 2019-12-03 04:40:35
问题 I'm trying to implement a very simple drawing view in my app. This is only a small part of my app but it's turning into a real hassle. This is what I have so far, but all it's displaying right now is morse code like dots and lines. - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docsPath = [paths objectAtIndex:0]; NSString *savePath =

android fast pixel access and manipulation

馋奶兔 提交于 2019-12-03 03:45:16
I'm trying to port an emulator that i have written in java to android. Things have been going nicely, I was able to port most of my codes with minor changes however due to how emulation works, I need to render image at pixel level. As for desktop java I use int[] pixelsA = ((DataBufferInt) src.getRaster().getDataBuffer()).getData(); which allow me to get the reference to the pixel buffer and update it on the fly(minimize object creations) Currently this is what my emulator for android does for every frame @Override public void onDraw(Canvas canvas) { buffer = Bitmap.createBitmap(pixelsA, 256,

Draw Rectangle View with curve bottom In Android

那年仲夏 提交于 2019-12-03 03:45:01
Good day.I want to draw an rectangle as a view but which bottom shall be curved.I do not want to apply background image like that or use any views,because if i use an view and set background,the curve part will still have invisible empty space and i would not be able to attach another curve image to the bottom curve of the custom view.So how shall i draw an rectangle with bottom curved line and use it as a view to set any background color i want? Notice: i have heard something and read about quadTo() and cubicTo() android methods but i have no clue even how to use them i mean i did not

OpenGL is it better to batch draw or to have static VBOs

巧了我就是萌 提交于 2019-12-03 02:49:43
问题 What is preferrable, from an effiency point of view (or another point of view if it's important) ? Situation An OpenGL application that draws many lines at different positions every frame (60 fps). Lets say there are 10 lines. Or 100 000 lines. Would the answer be different? #1 Have a static VBO that never changes, containing 2 vertices of a line Every frame would have one glDrawArrays call per line to draw, and in between there would be matrix transformations to position our one line #2

iPhone CGContext: drawing two lines with two different colors

余生长醉 提交于 2019-12-03 02:35:41
I am having some troubles using the CGContext with an iPhone app. I am trying to draw several lines with different colors, but all the lines always end up having the color which was used last. I tried several approaches, but haven't been lucky. I set up a small sample project to deal with that issue. This is my code, I use in the drawRect method. I am trying to draw a red and a blue line: - (void)drawRect:(CGRect)rect{ NSLog(@"drawrect!"); CGContextRef bluecontext = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(bluecontext, 2.0); CGContextSetStrokeColorWithColor(bluecontext, [UIColor

Draw solid color triangle using XAML only

 ̄綄美尐妖づ 提交于 2019-12-03 01:58:24
Is it possible to draw a filled in triangle using XAML only (not a code behind solution)? Triangle should be like on the image below to represent sort direction Ascending/Descending along with a sort button on a chart control: EDIT: The solution, thanks to SpeziFish : Ascending: <Polygon Points="0,0 8,5, 0,10" Stroke="Black" Fill="Black" /> Descending: <Polygon Points="8,0 0,5, 8,10" Stroke="Black" Fill="Black" /> <Polygon Points="0,0 80,50, 0,100" Stroke="Black" Fill="Black" /> See API or Example . I want to add these to their collection: <Polygon Points="5,0 10,10, 0,10" Stroke="Black" Fill=

Drawing Rectangles in iOS

你说的曾经没有我的故事 提交于 2019-12-02 23:48:57
My goal for my app is for the user to be able to sort through different scheduling options by swiping to the left and right of an iPhone screen. How would I draw and remove rectangles as the user sorts through these different scheduling options? I have a UIViewController.h, UIViewController.m, and UIViewController.xib files to manipulate. Do I need a separate UIView class? If so, how do I connect that UIView class to the view in my .xib file? Wow... so many complicated solution, here is what you need: UIView *myBox = [[UIView alloc] initWithFrame:CGRectMake(180, 35, 10, 10)]; myBox

Beginner iphone question: drawing a rectangle. What am I doing wrong?

随声附和 提交于 2019-12-02 19:45:10
Trying to figure out what I'm doing wrong here. Have tried several things, but I never see that elusive rectangle on the screen. Right now, that's all I want to do -- just draw a single rectangle on the screen. I'm getting an "invalid context" on everything but the CGContextSetRGBFillColor(). Getting the context after that seems kinda wrong to me, but I'm not at home looking at the examples I was using last night. Have I messed up something else as well? I really would like to get at least this much done tonight... - (id)initWithCoder:(NSCoder *)coder { CGRect myRect; CGPoint myPoint; CGSize

How can I draw a vertical line in an Activity when a button is pressed?

99封情书 提交于 2019-12-02 19:39:44
I want to draw a straight vertical line in my Android activity when a button is pressed. Please explain how I can draw the line with a position & length I want. Elaboration: I have a linear layout with vertical orientation. A set of buttons constitute this linear layout. When I press one button, I want a line to appear to the right of these buttons, as if dividing the screen halfway - a straight line of width=2dip and height=200dip. kiki I have solved it myself. All you need to do is define a View with appropriate parameters and fill the background with color. You may want to use nested linear