Hello, my name is Ivan, I'm studying c++ now in computer academy Step (Kiev, Ukraine). We study patterns, and have a task to make a pictures editor. It is a part of course "patterns editor" (make template for AnyDocumentType editor), and task is to be done in several days.
So, main features I'm worried about is that we never done anything like "Drawing pixels" unto the Windows7Console. I was doing previous exam for C++OOP, and it was "sea battle-ships game", so I used some libraries for graphics and mouse, and it worked in Win7, but when teacher run that on Win10, it didn't work ... neither compiled, nor didn't run in Visual studio... so, anyway, I've got good mark, but this time I have this interesting task, and have no idea how to make this all done properly, so that it can run in Win10 also (and probably, in some future versions - out of my academy course - to make this cross-platform, thus only making for Windows is not best idea imho).
So, teacher adviced to use SFML. He just showed how some student(s) made some simple game in SFML, but he was unable to compile that, as some libraries should have been attached, and he didn't have that. so it is up to us, up to me to use any graphics library I want.
The first which came to my mind is to use pseudo-graphics input method, which I used for sea-war exam game. So I simply pressed on keyboard cursor up-down-left-right to set new coordinate, and press space/delete to set new ship or kill enemy ship-deck, or switch to mouse mode - and that's faster - to set coordinates on two fields using mouse (one middle button to change ship orientation, and secondary mouse button to go back to keyboard input mode) ... the main problem is that I can't draw pixel in this way. I can draw some ASCII blocks, colored in some (not many) colors (I think there are just 16 colors in this mode). And it is somewhat sad, in days of millions of colors in graphics cards. Sure, we will study in future Windows Graphical interface (and not "text"/pseudo graphics console anymore), so it's kind of I don't have much time to find out what to do and how.
Just for your information: when I had on first semester an exam to make "library", and it could have had also a graphics mode, - I didn't have enough time to do that. I tried to make use of mouse, and only managed to make it move up-down, highlighting current element in list of items, but it didn't work as expected, so it remained "experimental" (to-be-done in future feature). of course this experience helped to make similar program, I mean game later - when I chose to make sea-war game. So, what I expect can be later, in some future course, that we may have more advanced tasks, and knowing something like SFML may be a good experience. Even if I don't accomplish it well now (then I'll have to use my pseudo graphics mode, and saving to own invented graphics format - just array of color-blocks with their coordinates x/y and colors, just 16 colors available, sad).
The trick is that in task I have to make available a "pallete of tools" to process picture in different ways. I'm thinking just to make at least pallete of colors. At least, if I don't have a way to draw pixels, lines, but just pseudo graphics, then what can I do? maybe set ASCII character to be drawn, and set its forecolor, and back color, that's it. I want more than that. I have some experience in C#\Unity3d, so I know how to make simple 3d games, using animations for characters etc. But never had experience with c++. Actually only half year ago on courses I started to study c++ for the first time ever. So, for me, some gradual way to study "world of c++" graphics, is a best approach. I want to make it smooth, so that I don't want to give up...
I was thinking, I can search on internet for different ways to draw lines/pixels in MS Windows7 console. But what I suspect can happen - like happened recently - it may work on WIndows7, but will not work on teacher’s laptop with Win10 etc. etc. So I want to learn from good source. I thought, I don't know any other good library which may sit me well, with support like SFML. Unreal Engine is good, but is not what we are studying now (maybe in some more or less far future). I need basic 2d graphics editor. Ideally - to draw pixels, lines, some common shapes. If I can draw precisely like in Windows - with precision up to one pixel - it would be best. I don't know if that is possible to get this precision (for mouse, and probably not for keyboard almost sure) in Windows console mode... Also, ideally I'ld need some common, simple image-file format. Maybe something like .bmp or like that, uncompressed, which writes lots of bytes. Of course, task asks to read/write many graphics files formats, but it is not necessary for now. It's just a pattern which we have to make. But I'm sure we will use this later. Like previously we had task to draw button, window, just abstract, without even showing it. Just set position, title/text, boarder style (on/off/color etc), size of window (x/y) etc. And soon when I had this task to make "sea-ships war", I was happy to have these classes abstractions already done, and thus I had enough time to make exam in time.
Task asks to make it possible even to print the picture on printer. Hm, is that possible in SFML? Opening/saving picture files: is that possible to make easy, with just attaching some libraries? Does SFML require something to be installed on PC to run source code with SFML functions within Visual Studio/c++? I mean, if I'll install it on my PC, make libraries work, will that be enough to copy whole project (source) to teacher's computer so he will be able to open it and compile and run without problem? because I'm 100% he will not be interested in installing any software just to make this run (ok, may see on my pc only, but I want more cross-platform or at least, to be run on any nowadays-common Windows version...).
Is SFML a good choice for what I ask? Will C version of SFML libraries work equally well with c++? (I use free visual studio 2019).
Actually, I’d be happy to try make simply games using SFML. Even if not for exam, but generally. I was making some hobby games in Unity3d/C# for past maybe 5 years or so (from time to time), and was quite happy, and it came out C# is not that hard (I used just Visual basic before, can't believe
)... I thought C++ is such a hard language, but now I see it is more or less like C#, good language, I may not say it is that hard as I though it is ... ;-) Just make it even more enjoyable (I'm on 1st/2nd place in my group in academy ;-) ), I want to make games... Can I make a sprite editor in SFML? I liked how I used Microsoft Agent (Visual basic/c#), it had just 256 colors maximum, but had many animations for different states. Can I have at least 256 colors with SFML in Windows console? What are perspectives to use SFML cross-platform-way (I think about Android first of all)? Does it use some common libraries (is that OpenGL?) for cross-platform compilation? Say, can I set console to OpenGL mode, and write code cross-platform from now on? So that I can have such cool picture editor/viewer even on my Android phone (as apk)? is that possible (but mouse clicks are to be generated from touching screen)? I've got touchscreen on laptop, it is fun (also for drawing, I use special stylus, for more precision) - in programs like Corel Painter / Adobe Illustrator. I understand, that making own vector/raster graphics editor is not something which can be done in one week ;-) but at least something very basic for drawing pixels, setting their coordinates/colors, saving them to file/restoring is ok. How to set graphics mode? Say, if I will like to set graphics modes for Windows/Android, how that would be different? can i compile directly from Visual Studio to Android apk when I have SFML?
I just need a direction to go. Maybe there are good examples to download, which are out-of-box with methods of setting graphics mode in Win-console, loading graphics files (better if not my own), editing something, saving etc. etc.
And yes, I’d like in future to know how to use audio & network within SFML (tried in Unity3d and it was fun) ;-)
Any help on written is welcome.
P.S. I attach my "sea-war" game, so that you can see how I made it. It's only 16 colors maximum, mouse support is there, but I'm not so happy
due to limits of graphics in the game.
So looking towards SFML ;-)
P.S.2. Can you suggest some good tutorial/example project (maybe complete game\program) to start with?