网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
02月14日漏签0天
sdl吧 关注:4,210贴子:12,543
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 3回复贴,共1页
<<返回sdl吧
>0< 加载中...

SDL定义为类以后的问题~

  • 只看楼主
  • 收藏

  • 回复
  • 维系888
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
为什么把SDL里的Screen方法转化成类就会显示这个呀? 我后来照着源码打了一遍,然后又显示第二个问题。。求解
#ifndef SCREEN_H
#define SCREEN_H
#include <SDL2/SDL.h>
class ScreenSurface
{
private:
static int screenNum;
int width;
int height;
int bpp;
Uint32 flags;
SDL_Surface* pScreen;
public:
ScreenSurface();
ScreenSurface(int w, int h, int b = 0, Uint32 f = 0);
~ScreenSurface();
SDL_Surface* point() const;
bool flip() const;
};
#endif
int ScreenSurface::screenNum = 0;
ScreenSurface::ScreenSurface():
width(640), height(480), bpp(32), flags(0)
{
if ( screenNum > 0 )
throw "DONOT create more than ONE screen!";
if ( SDL_Init(SDL_INIT_VIDEO < 0 ) )
throw SDL_GetError();
pScreen = SDL_SetVideoMode(width, height, bpp, flags);
screenNum++;
}
ScreenSurface::ScreenSurface(int w, int h, int b, Uint32 f):
width(w), height(h), bpp(b), flags(f)
{
if ( screenNum > 0 )
throw "DONOT create more than ONE screen!";
if ( SDL_Init(SDL_INIT_VIDEO < 0 ) )
throw SDL_GetError();
pScreen = SDL_SetVideoMode(width, height, bpp, flags);
screenNum++;
}
ScreenSurface::~ScreenSurface()
{
SDL_Quit();
}
SDL_Surface* ScreenSurface::point() const
{
return pScreen;
}
bool ScreenSurface::flip() const
{
if ( SDL_Flip(pScreen) < 0 )
return false;
else return true;
}
#include"screen.h"
#include<iostream>
int main(int argc,char * args[])
{
using namespace std;
ScreenSurface am;
return 0;
}



  • 维系888
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
厚着脸皮问一句。。。工程要怎么写呢?


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 3回复贴,共1页
<<返回sdl吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示