[英]how to change screen of same window opened in C++ with createwindowex()
[英]How to make the window size the same as the image opened in C++/Cinder
我使用cinder / c ++(我正在使用Xcode)制作了一個程序,該程序可讓您打開圖像並將其顯示在窗口中。 我想知道如何使窗口的大小與打開的圖片的大小相同?
這是我的代碼:
#include "cinder/app/AppNative.h"
#include "cinder/gl/Texture.h"
#include "cinder/Text.h"
#include "cinder/ImageIo.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class ConvexSpiralApp : public AppNative {
public:
void setup();
void draw();
gl::Texture myImage;
};
void ConvexSpiralApp::setup()
{
try
{
ci::fs::path p = getOpenFilePath( "", ImageIo::getLoadExtensions());
if( ! p.empty() )
{ // an empty string means the user canceled
myImage = gl::Texture( loadImage( p ) );
}
}
catch( ... )
{
console() << "Unable to load the image." << std::endl;
}
}
void ConvexSpiralApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
gl::draw( myImage, getWindowBounds() );
}
CINDER_APP_NATIVE( ConvexSpiralApp, RendererGl )
大風
我做的!
myImage = gl::Texture( processedImage );
setWindowSize(myImage.getWidth(), myImage.getWidth() );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.