当前位置: 首页 > wzjs >正文

东莞网站建设网站建设多少钱wordpress缓存接口数据

东莞网站建设网站建设多少钱,wordpress缓存接口数据,大型门户网站开发公司,除了seo还可以做哪些推广呢SDL(Simple DirectMedia Layer)是一个开源的跨平台多媒体开发库,使用C语言编写,主要用于游戏、模拟器和媒体播放器等多媒体应用的开发。它提供了控制图像、声音、输入输出等功能的函数,使开发者能够用相同的代码开发跨…

SDL(Simple DirectMedia Layer)是一个开源的跨平台多媒体开发库,使用C语言编写,主要用于游戏、模拟器和媒体播放器等多媒体应用的开发。它提供了控制图像、声音、输入输出等功能的函数,使开发者能够用相同的代码开发跨平台(如Linux、Windows、macOS等)的应用程序。

本文使用VS2022

参考

官方文档 SDL3/FrontPage - SDL Wiki  

API SDL3/APIByCategory - SDL Wiki

SDL3_image/FrontPage - SDL WikiSDL3_image SDL3_image/FrontPage - SDL Wiki 

SDL3_ttf/FrontPage - SDL WikiSDL3_tff SDL3_ttf/FrontPage - SDL Wiki

Free SDL3 Tutorials

SDL3

01. Visual Studio 配置 SDL3_哔哩哔哩_bilibili

按照上述视频配置。似乎使用Cmake可以简化很多流程

拓展库

注意所有下载的版本都是devel,即开发者版!)

SDL3_image:如果要加载png等多种格式的图片,需要下载

SDL3_tff:渲染文字​(ttf表示TrueType Font),注意SDL3_ttf 不自带字体文件,它是一个用于加载和渲染 TrueType (.ttf) 或 OpenType (.otf) 字体文件的库,但需要自行提供字体文件。

  • 你需要自行获取合法的字体文件(如 Arial.ttfSimHei.ttf 等),并放在项目目录中(例如 assets/fonts/)。

  • 字体来源

    • 系统自带字体(如 Windows 的 C:\Windows\Fonts)。

    • 免费字体网站(如 Google Fonts)。

    • 注意遵守字体版权许可。

测试 

测试SDL3

如果配置成功,会创建一个窗口,并在3s后关闭

#include<iostream>
#include"SDL3/SDL.h"int main(int argc, char* argv[])
{//a test to exam whether SDL3 has been added properly.SDL_Window* window;SDL_Init(SDL_INIT_VIDEO);window = SDL_CreateWindow("test_SDL", 480, 600, SDL_WINDOW_OPENGL);if (window == NULL){SDL_LogError(SDL_LOG_CATEGORY_ERROR, "failed to create a window\n");return EXIT_FAILURE;}SDL_Delay(3000);SDL_DestroyWindow(window);SDL_Quit();return EXIT_SUCCESS;
}

 测试SDL3_image

注意换成自己图片的路径,成功则会显示图片

#include<iostream>
#include "SDL3_image/SDL_image.h"  //"SDL3/SDL.h" is inside
using namespace std;int main(int argc, char* argv[])
{//a test to exam whether SDL3_image has been added properly.SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);float width = 1080;float height = 720;SDL_Window* win = SDL_CreateWindow("test for SDL3_image", width, height, 0);if (win == nullptr) {std::cerr << "SDL_CreateWindow Error: " << SDL_GetError() << std::endl;SDL_Quit();return 1;}SDL_Renderer* ren = SDL_CreateRenderer(win, NULL);if (ren == nullptr) {std::cerr << "SDL_CreateRenderer Error: " << SDL_GetError() << std::endl;SDL_DestroyWindow(win);SDL_Quit();return 1;}SDL_Surface* imag = IMG_Load("resources/0.png"); //the path of the fileif (!imag){cout << "failed to load the image\n";SDL_DestroyRenderer(ren);SDL_DestroyWindow(win);SDL_Quit();return 1;}SDL_Texture* tex = SDL_CreateTextureFromSurface(ren, imag);//转化为纹理SDL_DestroySurface(imag);if (tex == nullptr) {std::cerr << "SDL_CreateTextureFromSurface Error: " << SDL_GetError() << std::endl;SDL_DestroyRenderer(ren);SDL_DestroyWindow(win);SDL_Quit();return 1;}SDL_Event e;bool quit = false;while (!quit) { SDL_RenderClear(ren);SDL_RenderTexture(ren, tex, NULL, NULL);SDL_RenderPresent(ren);while (SDL_PollEvent(&e)) {if (e.type == SDL_EVENT_QUIT) {quit = true;}}}SDL_DestroyTexture(tex);SDL_DestroyRenderer(ren);SDL_DestroyWindow(win);SDL_Quit();return 0;
}

 测试SDL3_tff

把字体换成相应路径

#include "SDL3_image/SDL_image.h"  //"SDL3/SDL.h" is inside
#include <SDL3_ttf/SDL_ttf.h>
#include<vector>
#include<iostream>
using namespace std;int main(int argc, char* argv[])
{//a test to exam whether SDL3_ttf has been added properly.// Initialize SDL3SDL_Init(SDL_INIT_VIDEO);TTF_Init();float width = 1080;float height = 720;// Create SDL WindowSDL_Window* window = SDL_CreateWindow("SDL3 Unicode Text", 420, 300, SDL_WINDOW_RESIZABLE);if (!window) {std::cerr << "Failed to create window: " << SDL_GetError() << std::endl;return -1;}// Create RendererSDL_Renderer* renderer = SDL_CreateRenderer(window, NULL);if (!renderer) {std::cerr << "Failed to create renderer: " << SDL_GetError() << std::endl;SDL_DestroyWindow(window);return -1;}// Load FontTTF_Font* font = TTF_OpenFont("resources/FontRoboto/static/Roboto_Condensed-Black.ttf", 16);if (!font) {std::cerr << "Failed to load font: " << SDL_GetError() << std::endl;SDL_DestroyRenderer(renderer);SDL_DestroyWindow(window);return -1;}// Unicode text to renderstd::wstring text = L"A test for SDL3_ttf";// Vector of surfacesstd::vector<SDL_Surface*> surfaces;surfaces.reserve(text.size());// Render each character as a surfacefor (size_t i = 0; i < text.size(); i++) {SDL_Surface* textSurface = TTF_RenderGlyph_LCD(font, text[i], SDL_Color{ 255, 255, 255, 255 }, SDL_Color{ 0, 0, 0, 255 });if (!textSurface) {std::cerr << "Failed to create text surface: " << SDL_GetError() << std::endl;continue; // Skip if surface creation fails}surfaces.push_back(textSurface);}// Calculate total width and max height for the combined surfaceint totalWidth = 0;int maxHeight = 0;for (auto& surf : surfaces) {totalWidth += surf->w + 5; // Add spacing between glyphsif (surf->h > maxHeight) {maxHeight = surf->h;}}SDL_FRect rect{ 5, 50, static_cast<float>(totalWidth), static_cast<float>(maxHeight) };// Create the final combined surfaceSDL_Surface* combinedSurface = SDL_CreateSurface(totalWidth, maxHeight, SDL_PIXELFORMAT_RGBA32);if (!combinedSurface) {std::cerr << "Failed to create combined surface: " << SDL_GetError() << std::endl;return -1;}// Blit each glyph onto the combined surfaceint xOffset = 0;for (auto& surf : surfaces) {SDL_Rect destRect = { xOffset, 0, surf->w, surf->h };SDL_BlitSurface(surf, NULL, combinedSurface, &destRect);xOffset += surf->w + 5; // Move to the next position with spacingSDL_DestroySurface(surf); // Free individual surfaces after blitting}surfaces.clear(); // Clear the vector since we don't need it anymore// Convert the combined surface to a textureSDL_Texture* combinedTexture = SDL_CreateTextureFromSurface(renderer, combinedSurface);SDL_DestroySurface(combinedSurface); // Free the surface after conversion// Event loopbool running = true;SDL_Event event;while (running) {while (SDL_PollEvent(&event)) {if (event.type == SDL_EVENT_QUIT ||(event.type == SDL_EVENT_KEY_DOWN && event.key.scancode == SDL_SCANCODE_ESCAPE)) {running = false;}}SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);SDL_RenderClear(renderer);// Render the combined text textureSDL_RenderTexture(renderer, combinedTexture, NULL, &rect);SDL_RenderPresent(renderer);}// CleanupSDL_DestroyTexture(combinedTexture);TTF_CloseFont(font);SDL_DestroyRenderer(renderer);SDL_DestroyWindow(window);// Shutdown SDL3 and TTFTTF_Quit();SDL_Quit();return 0;
}

结果


文章转载自:

http://4VwtqipQ.tztgq.cn
http://Jm9LP7H7.tztgq.cn
http://ctGohjI9.tztgq.cn
http://zKCM9sJ6.tztgq.cn
http://kxEWwpRk.tztgq.cn
http://y1FvpSZt.tztgq.cn
http://3WpnyACJ.tztgq.cn
http://RzrBoiHR.tztgq.cn
http://3xHbN4Lx.tztgq.cn
http://CGb36ELV.tztgq.cn
http://l2GSAqHW.tztgq.cn
http://qUkIG74y.tztgq.cn
http://AglrUUbW.tztgq.cn
http://qSx3zwPo.tztgq.cn
http://TxrKS9nV.tztgq.cn
http://I1JW3qjO.tztgq.cn
http://WUuEvcCr.tztgq.cn
http://VgFmIVCn.tztgq.cn
http://VeoVG1Yp.tztgq.cn
http://9nrHIQhB.tztgq.cn
http://uXQHjl9d.tztgq.cn
http://10Um3kfF.tztgq.cn
http://AnrQqdeY.tztgq.cn
http://IkasXzKK.tztgq.cn
http://SrqA2rjX.tztgq.cn
http://PV1ZpYsK.tztgq.cn
http://u6auJXza.tztgq.cn
http://iEpNIEX4.tztgq.cn
http://GV5pW262.tztgq.cn
http://8T7O2mfq.tztgq.cn
http://www.dtcms.com/wzjs/605315.html

相关文章:

  • 长沙高新区建设局网站百度助手app下载安装
  • 品牌建设传播网站公司lol视频网站源码
  • 如何做电商网站设计单页面视频网站模板
  • 如何利用服务器做网站免费咨询律师不收费的平台
  • 学软件开发好还是网站开发好中国建筑装饰网官网
  • 如何做兼职网站平台北京开网站建设公司
  • 购买的网站平台建设服务计入承德北京网站建设
  • 北京做环评备案的网站企业策划书怎么写
  • 建设020网站需要多少钱wordpress前台修改密码
  • 网站设计文档王烨江婉柔
  • 什么样的网站开发比较吃香知名网络营销推广
  • 云主机配置网站信息管理网站开发实验报告
  • 视频网站做app还是h5莒县住房和建设局网站
  • 做视频编辑哪个网站素材比较好网站免费的正能量漫画
  • wordpress搭建教育网站上犹建设局网站
  • 安卓网站开发环境本地网站建设
  • 美食网站建设背景成都网站设计策划免费
  • 来广营做网站公司网页前端技术有哪些
  • 什么网站能买建设摩托车网站建设与网页设计考试题
  • 怎样看一个网站的浏览量1元建网站
  • 网站怎么做丰富的tag标签页怎么刷网站点击量
  • 绍兴网站建设网站怎样建设企业网站 用于宣传
  • 网站建设模板报价wordpress对网站排名
  • 网站建设系统怎么样wordpress另一更新
  • 怎么样做一家装修竞标网站个人备案20字备注
  • 南通专业网站建设公司建设工程合同约定仲裁违反专属管辖吗
  • 电商创客网站建设方案学网站前端
  • 企业图案设计图片seo搜索引擎优化的内容
  • 福田网站建设罗湖网站建设建e网室内设计网手机版
  • 网站开发 定义教育机构如何引流与推广