Search Results

Search found 902 results on 37 pages for 'circle'.

Page 7/37 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Big level objects collision system for 2d game

    - by Aristarhys
    I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones). We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check. Step 1 - Let p1, p2 are some sprites lets first just check with circle collision - because large distance between p1, p2 this fails and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view. Step 2 - Add basic column system, now we don't bother with p2 if it's in a column far from p1 column, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail. Step 3 - Lets improve column system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this is all great until comes BIG OBJs which is some kind of platforms. They are much bigger then grid cell. Circle test for will be successful, but deep check for whole big obj will fail And that the part I can't get. How do I store the grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am I do it wrong? My possible solution:

    Read the article

  • Moving 2d camera in the y direction

    - by Alex
    I'm developing a simple game for the iphone and am struggling to work out the best way for the camera to follow the main character. The following picture hightlights the three main components: There are 3 components to this: Circle - the main character Green line - terrain Black background The terrain is simply made from an array of points (approx 20 points per screen width). The terrain is moved in the x direction relative to the black background in order to keep the circle in its position shown. The distance to move the terrain is simply: movex = circle.position.x - terrain.position.x with a constant to fix the circle at some distance from the left of the screen. I am struggling to determine the best way to position the terrain in the y plane keep the focus in the character. I want to move the terrain in the y direction smoothly and not fix it to the position of the circle, so the circle can move in the y plane. If I take the same approach as the x positioning, the character is fixed at a point on the screen and the terrain moves. I could sample some terrain points either side of the character and produce an average, but in my implementation this was not smooth. I thought another approach might be to create a camera 'line' that is a smooth version of the terrain line and make the camerea follow this, but I'm not sure if this is the optimum solution. Any advice is much appreciated!

    Read the article

  • Using interfaces in java..Newb question

    - by Rahul
    Suppose there in an interface Displaceable and a class Circle which implements Displaceable. Displaceable has a method named move() which of course is implemented in Circle. What would happen in the following scenario? Circle a = new Circle(..); Displaceable b = a; b.move() Would the object refer to the Circle's move method?

    Read the article

  • How is covariance cooler than polymorphism...and not redundant?

    - by P.Brian.Mackey
    .NET 4 introduces covariance. I guess it is useful. After all, MS went through all the trouble of adding it to the C# language. But, why is Covariance more useful than good old polymorphism? I wrote this example to understand why I should implement Covariance, but I still don't get it. Please enlighten me. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Sample { class Demo { public delegate void ContraAction<in T>(T a); public interface IContainer<out T> { T GetItem(); void Do(ContraAction<T> action); } public class Container<T> : IContainer<T> { private T item; public Container(T item) { this.item = item; } public T GetItem() { return item; } public void Do(ContraAction<T> action) { action(item); } } public class Shape { public void Draw() { Console.WriteLine("Shape Drawn"); } } public class Circle:Shape { public void DrawCircle() { Console.WriteLine("Circle Drawn"); } } public static void Main() { Circle circle = new Circle(); IContainer<Shape> container = new Container<Circle>(circle); container.Do(s => s.Draw());//calls shape //Old school polymorphism...how is this not the same thing? Shape shape = new Circle(); shape.Draw(); } } }

    Read the article

  • How do I draw a filled circle onto a graphics object in a hexadecimal colour? (C#)

    - by George Powell
    I need to draw a circle onto a bitmap in a specific colour given in Hex. The "Brushes" class only gives specific colours with names. Bitmap bitmap = new Bitmap(20, 20); Graphics g = Graphics.FromImage(bitmap); g.FillEllipse(Brushes.AliceBlue, 0, 0, 19, 19); //The input parameter is not a Hex //g.FillEllipse(new Brush("#ff00ffff"), 0, 0, 19, 19); <<This is the kind of think I need. Is there a way of doing this? The exact problem: I am generating KML (for Google earth) and I am generating lots of lines with different Hex colours. The colours are generated mathematically and I need to keep it that way so I can make as many colours as I want. I need to generate a PNG icon for each of the lines that is the same colour exactly.

    Read the article

  • How do I draw a filled circle onto a graphics object in a hexadecimal colour?

    - by George Powell
    I need to draw a circle onto a bitmap in a specific colour given in Hex. The "Brushes" class only gives specific colours with names. Bitmap bitmap = new Bitmap(20, 20); Graphics g = Graphics.FromImage(bitmap); g.FillEllipse(Brushes.AliceBlue, 0, 0, 19, 19); //The input parameter is not a Hex //g.FillEllipse(new Brush("#ff00ffff"), 0, 0, 19, 19); <<This is the kind of think I need. Is there a way of doing this? The exact problem: I am generating KML (for Google earth) and I am generating lots of lines with different Hex colours. The colours are generated mathematically and I need to keep it that way so I can make as many colours as I want. I need to generate a PNG icon for each of the lines that is the same colour exactly.

    Read the article

  • how to fill a part of a circle using PIL?

    - by valya
    hello. I'm trying to use PIL for a task but the result is very dirty. What I'm doing is trying to fill a part of a piece of a circle, as you can see on the image. Here is my code: def gen_image(values): side = 568 margin = 47 image = Image.open(settings.MEDIA_ROOT + "/i/promo_circle.jpg") draw = ImageDraw.Draw(image) draw.ellipse((margin, margin, side-margin, side-margin), outline="white") center = side/2 r = side/2 - margin cnt = len(values) for n in xrange(cnt): angle = n*(360.0/cnt) - 90 next_angle = (n+1)*(360.0/cnt) - 90 nr = (r * values[n] / 5) max_r = r min_r = nr for cr in xrange(min_r*10, max_r*10): cr = cr/10.0 draw.arc((side/2-cr, side/2-cr, side/2+cr, side/2+cr), angle, next_angle, fill="white") return image

    Read the article

  • Graphics Question: How do I restrict the mouse cursor to within a circle?

    - by Dan
    I'm playing with XNA. When I click the left mouse button, I record the X,Y co-ordinates. Keeping the mouse button held down, moving the mouse draws a line from this origin to the current mouse position. I've offset this into the middle of the window. Now, what I'd like to do is restrict the mouse cursor to within a circle (with a radius of N, centred on the middle of the screen). Restricting the mouse to a rectangular region is easy enough (by adjusting the origin by the difference of the mouse position and the size of the region), but I haven't a clue on how to start doing it for a circular region. Can anyone explain how to do this? Any advice on where to start would be helpful.

    Read the article

  • Public class DiscoLight help

    - by luvthug
    Hi All, If some one can point me in the right direction for this code for my assigment I would really appreciate it. I have pasted the whole code that I need to complete but I need help with the following method public void changeColour(Circle aCircle) which is meant to allow to change the colour of the circle randomly, if 0 comes the light of the circle sgould change to red, 1 for green and 2 for purple. public class DiscoLight { /* instance variables */ private Circle light; // simulates a circular disco light in the Shapes window private Random randomNumberGenerator; /** * Default constructor for objects of class DiscoLight */ public DiscoLight() { super(); this.randomNumberGenerator = new Random(); } /** * Returns a randomly generated int between 0 (inclusive) * and number (exclusive). For example if number is 6, * the method will return one of 0, 1, 2, 3, 4, or 5. */ public int getRandomInt(int number) { return this.randomNumberGenerator.nextInt(number); } /** * student to write code and comment here for setLight(Circle) for Q4(i) */ public void setLight(Circle aCircle) { this.light = aCircle; } /** * student to write code and comment here for getLight() for Q4(i) */ public Circle getLight() { return this.light; } /** * Sets the argument to have a diameter of 50, an xPos * of 122, a yPos of 162 and the colour GREEN. * The method then sets the receiver's instance variable * light, to the argument aCircle. */ public void addLight(Circle aCircle) { //Student to write code here, Q4(ii) this.light = aCircle; this.light.setDiameter(50); this.light.setXPos(122); this.light.setYPos(162); this.light.setColour(OUColour.GREEN); } /** * Randomly sets the colour of the instance variable * light to red, green, or purple. */ public void changeColour(Circle aCircle) { //student to write code here, Q4(iii) if (getRandomInt() == 0) { this.light.setColour(OUColour.RED); } if (this.getRandomInt().equals(1)) { this.light.setColour(OUColour.GREEN); } else if (this.getRandomInt().equals(2)) { this.light.setColour(OUColour.PURPLE); } } /** * Grows the diameter of the circle referenced by the * receiver's instance variable light, to the argument size. * The diameter is incremented in steps of 2, * the xPos and yPos are decremented in steps of 1 until the * diameter reaches the value given by size. * Between each step there is a random colour change. The message * delay(anInt) is used to slow down the graphical interface, as required. */ public void grow(int size) { //student to write code here, Q4(iv) } /** * Shrinks the diameter of the circle referenced by the * receiver's instance variable light, to the argument size. * The diameter is decremented in steps of 2, * the xPos and yPos are incremented in steps of 1 until the * diameter reaches the value given by size. * Between each step there is a random colour change. The message * delay(anInt) is used to slow down the graphical interface, as required. */ public void shrink(int size) { //student to write code here, Q4(v) } /** * Expands the diameter of the light by the amount given by * sizeIncrease (changing colour as it grows). * * The method then contracts the light until it reaches its * original size (changing colour as it shrinks). */ public void lightCycle(int sizeIncrease) { //student to write code here, Q4(vi) } /** * Prompts the user for number of growing and shrinking * cycles. Then prompts the user for the number of units * by which to increase the diameter of light. * Method then performs the requested growing and * shrinking cycles. */ public void runLight() { //student to write code here, Q4(vii) } /** * Causes execution to pause by time number of milliseconds */ private void delay(int time) { try { Thread.sleep(time); } catch (Exception e) { System.out.println(e); } } }

    Read the article

  • iPhone animation: how do I animate the filling up of an area?

    - by Sandeep
    Consider a circle. Now consider a radius of the circle, drawn from the center of the circle towards the right. Now imagine that the radius is rotating about the center of the circle, sweeping out an area as it rotates. My problem is: I want to use iPhone's animation techniques to fill up the swept out area with a different color from the background area of the circle, as the radius rotates from 0 degrees to any chosen number of degrees about the circle. I've looked through the Core Animation API, KeyFrame Animations, etc. but I am not able to find out how to do this. Any hints will be most welcome. Thanks, Sandeep

    Read the article

  • Unresolved External Symbol linker error (C++)

    - by Niranjan
    Hi, I am trying to develop abstract design pattern code for one of my project as below.. But, I am not able to compile the code ..giving some compile errors(like "unresolved external symbol "public: virtual void __thiscall Xsecs::draw_lines(double,double)" (?draw_lines@Xsecs@@UAEXNN@Z)" ).. Can any one please help me out in this... #include "stdafx.h" #include <iostream> #include <vector> #include "Xsecs.h" using namespace std; //Product class class Xsecs { public: virtual void draw_lines(double pt1, double pt2); virtual void draw_curves(double pt1, double rad); }; class polyline: public Xsecs { public: virtual void draw_lines(double pt1,double pt2) { cout<<"draw_line in polygon"<<endl; } virtual void draw_curves(double pt1, double rad) { cout<<"Draw_curve in circle"<<endl; } /*void create_polygons() { cout<<"create_polygon_thru_draw_lines"<<endl; }*/ }; class circle: public Xsecs { public: virtual void draw_lines(double pt1,double pt2) { cout<<"draw_line in polygon"<<endl; } virtual void draw_curves(double pt1, double rad) { cout<<"Draw_curve in circle"<<endl; } /*void create_circles() { cout<<"Create circle"<<endl; }*/ }; //Factory class class Factory { public: virtual polyline* create_polyline()=0; virtual circle* create_circle()=0; }; class Factory1: public Factory { public: polyline* create_polyline() { return new polyline(); } circle* create_circle() { return new circle(); } }; class Factory2: public Factory { public: circle* create_circle() { return new circle(); } polyline* create_polyline() { return new polyline(); } }; int _tmain(int argc, _TCHAR* argv[]) { Factory1 f1; Factory * fp=&f1; return 0; }

    Read the article

  • Making Visual C++ DLL from C++ class

    - by prosseek
    I have the following C++ code to make dll (Visual Studio 2010). class Shape { public: Shape() { nshapes++; } virtual ~Shape() { nshapes--; }; double x, y; void move(double dx, double dy); virtual double area(void) = 0; virtual double perimeter(void) = 0; static int nshapes; }; class __declspec(dllexport) Circle : public Shape { private: double radius; public: Circle(double r) : radius(r) { }; virtual double area(void); virtual double perimeter(void); }; class __declspec(dllexport) Square : public Shape { private: double width; public: Square(double w) : width(w) { }; virtual double area(void); virtual double perimeter(void); }; I have the __declspec, class __declspec(dllexport) Circle I could build a dll with the following command CL.exe /c example.cxx link.exe /OUT:"example.dll" /DLL example.obj When I tried to use the library, Square* square; square->area() I got the error messages. What's wrong or missing? example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall ... Square::area(void)" (?area@Square@@UAENXZ) ADDED Following wengseng's answer, I modified the header file, and for DLL C++ code, I added #define XYZLIBRARY_EXPORT However, I still got errors. example_unittest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __th iscall Circle::Circle(double)" (__imp_??0Circle@@QAE@N@Z) referenced in function "protected: virtual void __thiscall TestOne::SetUp(void)" (?SetUp@TestOne@@MAEXXZ) example_unittest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __th iscall Square::Square(double)" (__imp_??0Square@@QAE@N@Z) referenced in function "protected: virtual void __thiscall TestOne::SetUp(void)" (?SetUp@TestOne@@MAEXXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Square::area(void)" (?area@Square@@UAENXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Square::perimeter(void)" (?perimeter@Square@@UAENXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Circle::area(void)" (?area@Circle@@UAENXZ) example_unittest.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall Circle::perimeter(void)" (?perimeter@Circle@@UAENXZ)

    Read the article

  • Change ID to text in paragraph with jQuery

    - by Reuben
    I would like to take what text is in my p tag and make that the p tags parent (div) that ID. I would also like to add a _ for any spaces in the p tag. Example: <div class="circle"><p>Apple</p></div> <div class="circle"><p>Banana</p></div> <div class="circle"><p>Carrot Juice</p></div> to <div id="Apple" class="circle"><p>Apple</p></div> <div id="Banana" class="circle"><p>Banana</p></div> <div id="Carrot_Juice" class="circle"><p>Carrot Juice</p></div>

    Read the article

  • How to Find Intersections with Ellipses in PGF/TikZ

    - by infblnpf
    Hello, I am trying to display a sphere in PGF/TikZ to illustrate the idea of great circles. The code for my current result is: \begin{tikzpicture} \tikzfading[name=fade right, left color=transparent!20, right color=transparent!90] \tikzfading[name=fade out, inner color=transparent!100, outer color=transparent!10] \tikzfading[name=fade right gc, left color=transparent!0, right color=transparent!70] \draw [<->, dashed] (0,-5) -- (0,5); % y-axis \draw [->, dashed] (0, 0) -- (20:5); % x-axis \draw [->, dashed] (0, 0) -- (200:5); % x-axis \draw [->, dashed] (0, 0) -- (340:5); % z-axis \draw [->, dashed] (0, 0) -- (160:5); % z-axis \fill [color=cyan, opacity=0.15, path fading=fade out] (0,0) circle (4cm); % bounding circle \fill [color=cyan, opacity=0.25, path fading=fade right, fading angle=90] (0,0) ellipse (4cm and 1cm); % x-y-axis area % great circle 1 \draw [rotate=-40, color=red, path fading=fade right gc, fading angle=40] (0,0) ellipse (4cm and 1cm); % great circle 2 \draw[rotate=5, color=red, path fading=fade right gc, fading angle=5] (0,0) ellipse (1.5cm and 4cm); \end{tikzpicture} How do I find the two points of intersection of the two red ellipses (commented as great circle 1 and 2), find the point of intersection of a line (originating at the center (0,0)) with a ellipse, and place a little circle or rectangle there? Placing a little circle or rectangle there is not an issue. Thank you very much!

    Read the article

  • how can i get MC in stage function??

    - by eblek
    function createCircles(evt:Event):void { for(i=0; i<3; i++) { var figure:Sprite=new Sprite(); figure.circle.x=10; figure.circle.y=i*figure.square.height*1.02; figure.circle.buttonMode=true; figure.circle.addEventListener(MouseEvent.MOUSE_DOWN,downFNC); addChild(figure.circle); } } function downFNK(evt:MouseEvent):void{ current_mc=MovieClip(evt.target); current_mc.x=mouseX; current_mc.y=mouseY; stage.addEventListener(Event.ENTER_FRAME,appear); } function appear (evt:Event):void { current_mc=??? current_mc.x=mouseX; current_mc.y=mouseY; if(mouseX stage.width/2) current_mc.visible=false; else current_mc.visible=true; stage.addEventListener(MouseEvent.MOUSE_UP, upFNC); } function upFNC(evt:MouseEvent):void { stage.removeEventListener(Event.ENTER_FRAME, appear); } hi, i create three circles. if a circle is dragged to right side of the stage, it becomes invisible and vice versa. when MOUSE_UP is invoked, it must stay in its last position. so in the appear() function how can i assign the selected circle to current_mc?

    Read the article

  • Detecting wether a point is inside or outside of a raphael.js shape

    - by betamax
    I have a raphael.js shape which I am plotting circle's on top of. I only want a circle to appear if the circle does not go off the boundary of the shape it is being plotted on to. To make this more clear, here is an example of what I do not want to happen: I want the circles outside of the grey area not to appear. How would I detect wether a circle is inside or outside of the grey shape?

    Read the article

  • How can I keep a graphics object centered (like a circle) when zooming in or out on it?

    - by sonny5
    using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Drawing2D; using System.Drawing.Imaging; namespace testgrfx { public class Form1 : System.Windows.Forms.Form { float m_Scalef; float m_Scalefout; Rectangle m_r1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.ComponentModel.Container components = null; private void InitializeComponent() { m_Scalef = 1.0f; // for zooming purposes Console.WriteLine("opening m_Scalef= {0}",m_Scalef); m_Scalefout = 1.0f; Console.WriteLine("opening m_Scalefout= {0}",m_Scalefout); m_r1 = new Rectangle(50,50,100,100); this.AutoScrollMinSize = new Size(600,700); this.components = new System.ComponentModel.Container(); this.button2 = new System.Windows.Forms.Button(); this.button2.BackColor = System.Drawing.Color.LightGray; this.button2.Location = new System.Drawing.Point(120, 30); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(72, 24); this.button2.TabIndex = 1; this.button2.Text = "Zoom In"; this.button2.Click += new System.EventHandler(this.mnuZoomin_Click); this.Controls.Add(button2); this.button3 = new System.Windows.Forms.Button(); this.button3.BackColor = System.Drawing.Color.LightGray; this.button3.Location = new System.Drawing.Point(200, 30); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(72, 24); this.button3.TabIndex = 2; this.button3.Text = "Zoom Out"; this.button3.Click += new System.EventHandler(this.mnuZoomout_Click); this.Controls.Add(button3); //InitMyForm(); } public Form1() { InitializeComponent(); Text = " DrawLine"; BackColor = SystemColors.Window; // Gotta load these kind at start-up ... not with button assignments this.Paint+=new PaintEventHandler(this.Form1_Paint); } static void Main() { Application.Run(new Form1()); } /// Clean up any resources being used. protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } // autoscroll2.cs does work private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics dc = e.Graphics; dc.PageUnit = GraphicsUnit.Pixel; dc.PageScale = m_Scalef; Console.WriteLine("opening dc.PageScale= {0}",dc.PageScale); dc.TranslateTransform(this.AutoScrollPosition.X/m_Scalef, this.AutoScrollPosition.Y/m_Scalef); Pen pn = new Pen(Color.Blue,2); dc.DrawEllipse(pn,m_r1); Console.WriteLine("form_paint_dc.PageUnit= {0}",dc.PageUnit); Console.WriteLine("form_paint_dc.PageScale= {0}",dc.PageScale); //Console.Out.NewLine = "\r\n\r\n"; // makes all double spaces } private void mnuZoomin_Click(object sender, System.EventArgs e) { m_Scalef = m_Scalef * 2.0f; Console.WriteLine("in mnuZoomin_Click m_Scalef= {0}",m_Scalef); Invalidate(); // to trigger Paint of entire client area } // try: System.Drawing.Rectangle resolution = Screen.GetWorkingArea(someForm); private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { // Uses the mouse wheel to scroll Graphics dc = CreateGraphics(); dc.TranslateTransform(this.AutoScrollPosition.X/m_Scalef, this.AutoScrollPosition.Y/m_Scalef); Console.WriteLine("opening Form1_MouseDown dc.PageScale= {0}", dc.PageScale); Console.WriteLine("Y wheel= {0}", this.AutoScrollPosition.Y/m_Scalef); dc.PageUnit = GraphicsUnit.Pixel; dc.PageScale = m_Scalef; Console.WriteLine("frm1_moudwn_dc.PageScale= {0}",dc.PageScale); Point [] mousep = new Point[1]; Console.WriteLine("mousep= {0}", mousep); // make sure to adjust mouse pos.for scroll position Size scrollOffset = new Size(this.AutoScrollPosition); mousep[0] = new Point(e.X-scrollOffset.Width, e.Y-scrollOffset.Height); dc.TransformPoints(CoordinateSpace.Page, CoordinateSpace.Device,mousep); Pen pen = new Pen(Color.Green,1); dc.DrawRectangle(pen,m_r1); Console.WriteLine("m_r1= {0}", m_r1); Console.WriteLine("mousep[0].X= {0}", mousep[0].X); Console.WriteLine("mousep[0].Y= {0}", mousep[0].Y); if (m_r1.Contains(new Rectangle(mousep[0].X, mousep[0].Y,1,1))) MessageBox.Show("click inside rectangle"); } private void Form1_Load(object sender, System.EventArgs e) { } private void mnuZoomout_Click(object sender, System.EventArgs e) { Console.WriteLine("first line--mnuZoomout_Click m_Scalef={0}",m_Scalef); if(m_Scalef > 9 ) { m_Scalef = m_Scalef / 2.0f; Console.WriteLine("in >9 mnuZoomout_Click m_Scalef= {0}",m_Scalef); Console.WriteLine("in >9 mnuZoomout_Click__m_Scalefout= {0}",m_Scalefout); } else { Console.WriteLine("<= 9_Zoom-out B-4 redefining={0}",m_Scalef); m_Scalef = m_Scalef * 0.5f; // make it same as previous Zoom In Console.WriteLine("<= 9_Zoom-out after m_Scalef= {0}",m_Scalef); } Invalidate(); } } // public class Form1 }

    Read the article

  • JavaScript: Container with draggable. Constrain draggable to a circle shape, in container.

    - by ritsuke
    Hey guys, I'm looking for a simple solution to place a draggable element inside of a box container. When the user begins to interact with the draggable, the draggable element should remain constrained to a circular shape, within the container. At a complete loss as to how I should accomplish this. Thank you! :-) Additional: Box container would be 100 pixels wide and tall Draggable would be 20 pixels wide and tall http://tool-man.org/examples/dragging.html This is on the TODO list, but of course this site is no longer maintained

    Read the article

  • Storing member function pointers of derived classes in map

    - by Kiran Mohan
    Hello, I am trying to implement a factory for two classes Circle, Square both of which inherits from Shape. class Shape { public: virtual static Shape * getInstance() = 0; }; class Circle : public Shape { public: static const std::string type; Shape * getInstance() { return new Circle; } }; const std::string Circle::type = "Circle"; class Square : public Shape { public: static const std::string type; Shape * getInstance() { return new Square; } }; const std::string Square::type = "Square"; I want to now create a map with key as shape type (string) and value as a function pointer to getInstance() of the corresponding derived class. Is it possible? Thanks, Kiran

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >