Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Just the Basics  (Read 3244 times)

0 Members and 1 Guest are viewing this topic.

Stoort

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Just the Basics
« on: September 01, 2011, 01:51:30 am »
I`ve installed codeblocks and SFML to the best of my ability and I still would like to be able to plot a simple pixel or point to a screen/bitmap using x/y co-ordinates, and maybe read an x/y co-ord as well.

I guess this should be really simple but am still having difficulty.

Getting the settings right in CBlocks seems to be a matter of luck and randomness with Linker Settings and Search Directories being set one way when creating code and then failing to work when reloading the saved code or even the next time it`s compiled.

I would love to see a piece of code from start to finish that JUST opens up a window/screen and plots a single point to it, with the necessary settings commented so that I can at least have a definite place to start.

HELP ME SOMEBODY, please???

In hope, Stoo
redheadnotdeadhead

manasij7479

  • Newbie
  • *
  • Posts: 7
    • View Profile
Just the Basics
« Reply #1 on: September 01, 2011, 02:13:03 am »
Quote
I would love to see a piece of code from start to finish that JUST opens up a window/screen and plots a single point to it, with the necessary settings commented so that I can at least have a definite place to start.


Then you'd 'love' to open the samples folder !

Stoort

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Just the Basics
« Reply #2 on: September 01, 2011, 07:22:44 pm »
Which samples folder??
redheadnotdeadhead

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Just the Basics
« Reply #3 on: September 02, 2011, 01:56:57 am »
Quote from: "manasij7479"
Then you'd 'love' to open the samples folder !


Sometimes people write as if they still had a dial-up, with which every letter cost an extrem amount of money...  :roll:

About your Code::Block problem; I haven't had problems in the past when I used it, although that stuff is really confusing at the beginning, mostly because NONE of those basic learning-C++-books teach how to use libraries.

I suggest to use SFML 1.6 for the beginning because then you won't have compile the library first. Then I suggest to download the whole SDK. (Maybe you did that already.)

Creat a new empty project and add a file called e.g. main.cpp to the project.
Now your project should get to know the location of SFML:

1. Project->Build options->Search directories->Compiler
The compiler deals with sources files, so add 'PATH-TO-SFML/include'

2. Project->Build options->Search directories->Linker
The linker likes already created objects like libraries, add 'PATH-TO-SFML/lib'

3. Project->Build options->Linker settings
The linker now just knows where to find .lib files, but not which ones, so add them.
Which ones? The d in sfml-MODULE-d.lib stands for debug, so you probably want those.
sfml-system-d.lib
sfml-graphics-d.lib
Audio needed? sfml-audio-d.lib

To be able to run your project you'll have to copy the dll's from the SFML folder to your project folder!

Now that everything should be setup, you can browse to the sample folder (probably PATH-TO-SFML/samples) and open one that you want to look into, copy the code into Code::Blocks compile and run.
Play around with the code, study it in depth with the documentation and learn SFML (and C++).  :D

Btw check out the tutorial and wiki section!

eXpl0it3r

(okay not every answer should be that long...)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Serapth

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Just the Basics
« Reply #4 on: September 03, 2011, 05:28:10 am »
Quote from: "eXpl0it3r"
Quote from: "manasij7479"
Then you'd 'love' to open the samples folder !


About your Code::Block problem; I haven't had problems in the past when I used it, although that stuff is really confusing at the beginning, mostly because NONE of those basic learning-C++-books teach how to use libraries.



The single biggest problem(using CB) that is going to be a gigantic show stopper for a new developer, is that CodeBlocks ships with a version of MingW that is incompatible with SFML.  It's a fairly easy thing to resolve if you know what you are doing, but this goes exactly contrary to the whole being a new developer thing...


A thousand fold more confusing is the fact the "wizard" simply doesn't work.  When you figure that "wizards" are there mostly for new developers, that's what makes it more confusing.  I by no means blame this on SFML, but they are very legit pitfalls for new and experienced developers.

Stoort

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Just the Basics
« Reply #5 on: September 05, 2011, 03:20:14 pm »
Thanks all for your replies but now I`m both confused and worried

If Mingw isn`t compatible with SFML will I find myself with more insoluble compile errors that I`ll never be able to resolve??

Either way I`m going to give it another go.

Tata for now, Stoo :-)
redheadnotdeadhead

Joshua Flynn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Just the Basics
« Reply #6 on: September 05, 2011, 04:04:19 pm »
Quote from: "Stoort"
I`ve installed codeblocks and SFML to the best of my ability and I still would like to be able to plot a simple pixel or point to a screen/bitmap using x/y co-ordinates, and maybe read an x/y co-ord as well.

I guess this should be really simple but am still having difficulty.

Getting the settings right in CBlocks seems to be a matter of luck and randomness with Linker Settings and Search Directories being set one way when creating code and then failing to work when reloading the saved code or even the next time it`s compiled.

I would love to see a piece of code from start to finish that JUST opens up a window/screen and plots a single point to it, with the necessary settings commented so that I can at least have a definite place to start.

HELP ME SOMEBODY, please???

In hope, Stoo


Hi! Seems to be an influx of Code::Blocks users!

You're in luck. I happen to use both code::blocks and SFML quite successfully (writing my own library built on top within research and development project).

The reason it doesn't save the settings for your project is because 'ctrl + s' is 'save file' and not 'save project' - given the settings are project based, you have to explicitly save them, by right-clicking the project name, and clicking 'save project'. This is a minor irritant but given Code::Blocks is free, and quite possibly the most useable interface I've seen in a long while (both free and paid), it's my preferrence of choice.

If you look here, I posted a reply giving a quick explanation on setup:
http://www.sfml-dev.org/forum/viewtopic.php?t=5758

As for the single pixel thing, not familiar, but it'd be easier to try rendering an image to screen first, then figuring out the fiddly bits.

 

anything