i'm working on a school project using CSFML (The SFML library but in C), i'm trying to display a line between two points but impossible for me to find any good documentation to do it, if someone know how to do it, please help me.
i've got his doc:
https://www.sfml-dev.org/tutorials/2.0/graphics-shape-fr.php
and my code look like this:
sfRenderWindow_clear(window.window, sfBlack);
sfRectangleShape *rectangle = sfRectangleShape_create();
sfRectangleShape line(rectangle);
sfRenderWindow_display(window.window);
but there is nothing on my window.
The doc tell something like window.draw(); to draw it but it's not recognized as a valid function so...
Thank you
Related
So I'm making a 2D platformer called "agent 404". I'm right now making the enemy but can't seem to make it. So I looked for a tutorial but couldn't find any tutorials related to a 2D platformer enemy that follows the player I tried all but most of them but all end up wrong. I want to ask if any of you know a way or a tutorial that could help me?
If you're using a tilemap you can use a Navigation2D to do nearly "out-of-the-box" pathfinding.
GDQuest explains some of it in this tutorial:
https://www.youtube.com/watch?v=0fPOt0Jw52s
Since you're making a platformer however, you might run into the same problem where the only tiles with navigation on them are blank and so aren't filled in by the autotiler. If that's the case you can find a workaround here (something I was just stuck on myself :-) ):
navigation tilemaps without placing walkable tiles manually
Ok so this is my first question here. I am currently an IT student and I am taking a fundamentals of programming class. I seem to be spending more time lost and confused than I feel as if I should. We are using Python as the programming language. The topic for this week is arrays and lists. From what I have gathered through reading many other forums, Python does not use array but lists. Therefore the assignment does not make since to me. Any help or guidance would be greatly appreciated.
Create a FLOWCHART and a STORYBOARD for each problem.
Use the information below to create a storyboard (which can be a text based description for solving the problems) and a flowchart (using flowchart symbols to illustrate how you would program) to solve each problem. You may use Microsoft Word® for your Storyboard and Microsoft PowerPoint® for your flowchart.
Problem 1: Create an array that contains the days of the week.
Problem 2: Create a loop to print the content above.
So what would the flowchart for this look like? The assignment next week builds on this by actually writing the program in Python. What would the script look like? Thanks for any help.
This is just for hinting, I won't write your program for you. In your comment, you assigned to the list (you're right, they're not called "arrays" in Python) correctly. Now you need to iterate over it to print each item individually. I'd suggest you refresh your memory in the Python Tutorial on how to control program flow, especially the for statement. Remember, the general idea is:
for item in collection_of_items:
do_something_with(item)
days = ['monday','tuesday','wednessday','thursday','friday','saturday','sunday']
for day in days:
print(day)
Edit:
what would the flowchart for this look like?
This problem is quite simple, try to make your own flowchart. Try to practice thinking at the very first lesson of programming course.
What would the script look like?
It would look like above code. But you can do it better and more professional, try to figure it out.
I'm trying to save color of vertices using vcglib but failed. Even if I read a file in and save it out without doing anything, the color of the original file is lost.
Here is the code I wrote:
vcg::tri::io::ImporterPLY<MyMesh>::Open(*srcMesh,"bunny.ply");
vcg::tri::io::ExporterPLY<MyMesh>::Save(*srcMesh,"out.ply");
After doing this, out.ply has no color while the source ply bunny.ply does.
Could anybody give me some sample code to make this thing done?
Thank you!
I had the exact same problem a couple of weeks ago.
After spending some time with the debugger and browsing through lots of source code, I discovered that the the open and save methods need to share an int mask. This allows the Open method to convey which attributes have been read from the original mesh (Also, make sure you've added the Colour4b attribute to your mesh definition.
int mask=0;
vcg::tri::io::ImporterPLY<MyMesh>::Open(*srcMesh,"bunny.ply",mask);
vcg::tri::io::ExporterPLY<MyMesh>::Save(*srcMesh,"out.ply",mask);
I hope that helps.
Need to use c for a project and i saw this screenshot in a pdf which gave me the idea
http://i983.photobucket.com/albums/ae313/edmoney777/Screenshotfrom2013-11-10015540_zps3f09b5aa.png
It say's you can treat each pixel of an image as a graph node(or vertex i guess) so i was wondering how
i would do this using OpenCV and the CvGraph set of functions. Im trying to do this to learn about and how
to use graphs in computer vision and i think this would be a good starting point.
I know i can add a vetex to a graph with
int cvGraphAddVtx(CvGraph* graph, const CvGraphVtx* vtx=NULL, CvGraphVtx** inserted_vtx=NULL )
and the documentation says for the above functions vtx parameter
"Optional input argument used to initialize the added vertex (only user-defined fields beyond sizeof(CvGraphVtx) are copied)"
is this how i would represent a pixel as a graph vertex or am i barking up the wrong tree...I would love to learn more about
graphs so if someone could help me by maybe posting code, links, or good ol' fashioned advice...Id be grateful=)
http://vision.csd.uwo.ca/code has an implementation on Mulit-label optimization. GCoptimization.cpp file has a GCoptimizationGridGraph class, which I guess is what you need. I am not a C++ expert, so can't still figure out how it works. I am also looking for some simpler solution.
I try to draw with libcairo, it draws nothing. I downloaded the diagram sample, it works fine [draw.c], but code example from the site doesn't draw: like http://cairographics.org/samples/fill_and_stroke2/
why?
Thanks!
The code you linked to looks fine. But of course, it's not a complete program. Without seeing what code you've wrapped around the example to make it run, all I can guess is that you may need to call cairo_show_page() and cairo_surface_flush().