When should SelectFont be Called? [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I was fixing an issue to do with scaling and the solution was that we had to call SelectFont afer DrawText.
If SelectFont is called before DrawText the font isn't scaled correctly.
I cant see how that would make a difference, is there any reason?

SelectFont essentially selects a font in the Device Context you pass in. If you call DrawText before selecting a font, then a default font (System) will be used and not the font you want to select.
This means that the font you are using isn't scaling well as the results seem better with the default system font.

Related

How to develop ue4 plugins to simulate the viewpoint in unity 3D? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 months ago.
Improve this question
Unity 3d has two viewpoints, one is game and another isscene. when you move objects in scene you can see changes happened in game in the same time. while the reverse is true. But UE4 doesn't have this function. So I wonder if I can develop a plugin for UE4 to achieve that? does anyone have a clue?
enter image description here
Unreal 4: Go to Window -> Viewport 2. Drag the window somewhere and you will have 2 viewports:
Press play, only one viewport will display the "gameview" and the other remains as "sceneview" - Moving stuff in the 2nd Viewport will not update the game!
But I found this plugin:
https://github.com/jackknobel/GameViewportSync
You can see if that works for you or use it as a reference to get started developing your own plugin.

position button in window depending on window size [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am creating this game in Visual Studio for my school project using SFML to render and create sprite.
I have created this button which I currently places at
x=1000, y = 600 on my screen size.
I have retina display macbook.
I tested the position of the button and it changes it's location depending on the screen size. if the screen size is something smaller then my x and y then button would not even show on the screen so how would i make it dynamic for all the different screens and how can i make it scale to the same size in different sizes.
thanks,
Start with sf::VideoMode::GetDesktopMode() to determine the size of the desktop you're running on and divide/multiply your button coordinates appropriately. You could also approach the scaling problem with sf::Views - http://www.sfml-dev.org/tutorials/2.2/graphics-view.php

Drawing to a GDI+ Bitmap [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am trying to move everything from GDI to GDI+. As it stands I am drawing to a buffer DC (GDI). I am wanting to have it instead drawn to a HBITMAP and only have it drawn once. I have tried
things with pointers and Image, but could not find anything useful. There is no istream or file, and I am not using the flat api version (found a constructor for that.)
http://pastebin.com/bcw07Suq
Solved. Here is how you can create the bitmap and then proceed to draw.
Graphics g(hDC);
Bitmap foobar(100,100,PixelFormat32bppPARGB);
g.DrawImage(&foobar,100,100);
SolidBrush brush(Color::Blue);
g.FillRectangle(&brush, 0,0,10,10);

How can I make zoomable square table in SFML? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How can I make zoomable square table like in the picture below?
At first, there is no tile in squares.
but when zoom in, tiles are slowly appearing inside squares.
And another question, can I have paint bucket tool and use to fill my tile then store information into array?
In SFML this can be done using a so-called sf::View. This allows you to have a world defined and have different and changing views on it, like in your example.
There is a very good introduction to Views in SFML here.

How can I make a banner in QT, like the news banner of CNN/FOX? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
as the title says, I want to add my main window a banner in the bottom of the window that shows text that runs from left to right, just like you can see in your TV when watching fox/CNN...
I'm using QT 4.5.2
Thanks a lot :)
You have many options. You could:
Create a custom widget and override QWidget::paintEvent()
Drawing your text to an image and then repainting that image as often as needed
Creating a QGraphicsScene and then moving an appropriate text item around.
QTimeline and/or QTimer will likely be useful in your implementation. The key idea is that you need to draw something at different positions at consistent intervals. If you redraw frequently enough, it will look like an animation.