Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / draw_rectangle vs image for bullet
- - By mydoghasworms Date 2013-02-19 10:38
Hi guys!

Firstly, let may say a HUGE thanks for this project! Finally I am able to write a game in my favorite language (Ruby)!

I am writing a Space Invaders game where I am drawing bullets on the screen, which will basically be a 10x2px monochrome stripe on the screen, and will only face one direction.

What is quicker: calling draw_rectange or using a 2x10 image?

Thanks!
Parent - By lol_o2 Date 2013-02-19 11:51
I'm not sure if there's much difference, but if you want to use image, remember to load it only once for all bullets.
Parent - By jlnr (dev) Date 2013-02-19 14:50
I would go with images for everything. Makes it easier to add any kind of effect later on too (e.g. glow).

Glad you enjoy Gosu :)
Parent - - By Donna111 Date 2013-12-31 07:34
HI there
Here is a code for that:
        public static void Test()
        {
            try
            {
                RectangleAnnotation obj = new RectangleAnnotation();
                // set annotation size
                obj.X = 60.0F;
                obj.Y = 45.0F;
                obj.Width = 561.0F;
                obj.Height = 228.0F;

                //set annotation edge property
                obj.OutLine = new LinePen();
                obj.OutLine.Width = 5.0F;//set annotation edge width
                obj.OutLine.Brush = new AnnotationBrush();
                obj.OutLine.Brush.FillType = RasterEdge.Imaging Annotation.FillType.Solid;//set annotation edge style
                obj.OutLine.Brush.Solid_Color = Color.Blue;//set annotation edge color

                //set the property of filled shape
                obj.Fill = new AnnotationBrush();
                obj.Fill.FillType = RasterEdge.Imaging.Annotation.FillType.Solid;//set filled shape style
                obj.Fill.Solid_Color = Color.Gray;//set filled shape color

                //set the property of shadow
                obj.ShadowFill = new AnnotationBrush();
                obj.ShadowFill.FillType = RasterEdge.Imaging.Annotation.FillType.Solid;//set shadow style
                obj.ShadowFill.Solid_Color = Color.DarkGreen;//set shadow color
                obj.ShadowX = 10.0F;//set shadow position
                obj.ShadowY = 12.0F;
                obj.ShowShadow = true;//show shadow or not

                string folderName = "C:/";
                Bitmap img = obj.Create Rectangel Annotation();
                img.Save(folderName + "RectangleAnnotation.png");
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
Hope to help you.
Parent - By IgorJorobus Date 2014-01-08 16:02
Think he said ruby...
Up Topic Gosu / Gosu Exchange / draw_rectangle vs image for bullet

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill