SDL1 3支援多個視窗

2021-06-05 05:59:52 字數 2828 閱讀 8806

在sdl1.2中是不支援多視窗的,而還沒有正式發布的、非穩定狀態下的sdl1.3是完全支援多視窗的。  

#include

#include

#include

#include

#include "sdl.h"

#include "sdl_shape.h"

void renderblue(sdl_renderer *renderer,sdl_texture *texture,sdl_rect texture_dimensions)

void renderred(sdl_renderer *renderer,sdl_texture *texture,sdl_rect texture_dimensions)

int _tmain(int argc,tchar** argv)

;uint32 pixelformat = 0;

int access = 0;

sdl_rect texture_dimensions;;

char *szansifile="e:";

char *szansifile2="e:";

if(sdl_videoinit(null) == -1)

sdl_pixelformat* pixformat = null;

sdl_window * win1 = sdl_createwindow("test1", 10, 10, 640,480, sdl_window_resizable | sdl_window_shown);

sdl_renderer *render1 = sdl_createrenderer(win1,-1,0);

sdl_su***ce *imgsu***ce1 = sdl_loadbmp(szansifile);

sdl_texture *texture1 = sdl_createtexturefromsu***ce(render1,imgsu***ce1);

sdl_querytexture(texture1,(uint32 *)&pixelformat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);

sdl_setwindowsize(win1,texture_dimensions.w,texture_dimensions.h);

sdl_windowshapemode shapemode1;

pixformat = imgsu***ce1->format;

if(pixformat->amask != 0)

else

sdl_setwindowshape(win1,imgsu***ce1,&shapemode1);

texture_dimensions.x = 0;

texture_dimensions.y = 0;

texture_dimensions.w = 640;

texture_dimensions.h = 480;

renderblue(render1,texture1,texture_dimensions);    

sdl_window * win2 = sdl_createwindow("test2", 650, 10, 640,480, sdl_window_resizable | sdl_window_shown);

sdl_renderer *render2 = sdl_createrenderer(win2,-1,0);

sdl_su***ce *imgsu***ce2 = sdl_loadbmp(szansifile2);

sdl_texture *texture2 = sdl_createtexturefromsu***ce(render2,imgsu***ce2);

sdl_querytexture(texture2,(uint32 *)&pixelformat,(int *)&access,&texture_dimensions.w,&texture_dimensions.h);

sdl_setwindowsize(win2,texture_dimensions.w,texture_dimensions.h);

sdl_windowshapemode shapemode2;

pixformat = imgsu***ce2->format;

if(pixformat->amask != 0)

else

sdl_setwindowshape(win2,imgsu***ce2,&shapemode2);

texture_dimensions.x = 0;

texture_dimensions.y = 0;

texture_dimensions.w = 640;

texture_dimensions.h = 480;

renderred(render2,texture2,texture_dimensions);       

sdl_delay(5000);

sdl_destroytexture(texture1);

sdl_destroyrenderer(render1);

sdl_destroywindow(win1);

sdl_freesu***ce(imgsu***ce1);

sdl_destroytexture(texture2);

sdl_destroyrenderer(render2);

sdl_destroywindow(win2);

sdl_freesu***ce(imgsu***ce2);

//call sdl_videoquit() before quitting.

sdl_videoquit();

return 0;

}

Struts2支援表單多物件提交

struts2對集合型別的轉換提供了很好的支援,你可以用集合物件來儲存表單提交的資料,這對提交多個相同類別的資訊將非常有用 1 物件中宣告屬性objectlist action中宣告list 2 頁面迴圈list list objectlist as object assign index obje...

3 支援向量機

3.1 本質 基本模型是定義在特徵空間上的間隔最大的線性分類器。核技巧使之成為實質上的非線性分類器。學習策略是間隔最大化,可形式化為求解凸二次優化問題。等價於正則化的合頁損失函式的最小化問題。學習演算法是求解凸二次規劃的最優化演算法。理解支援向量機可以從簡至繁推進 線性可分支援向量機 硬間隔svm ...

mac sublime2支援中文

一 安裝package control 按照提示複製一段python命令安裝package control,也可以直接複製這一段到控制台 ctrl import urllib2,os pf package control.sublime package ipp sublime.installed p...