- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用 Microsoft Visual Studio 2010,尝试使用 Allegro.h 库编写游戏代码。
重点是
这是我的代码:
void BinaCizdir1(BITMAP *buf1){
int r;
int renk;
int say=0;
BITMAP *turuncu_beton=load_bitmap("turuncu.bmp",NULL);
BITMAP *sari_beton=load_bitmap("sari.bmp",NULL);
BITMAP *pembe_beton=load_bitmap("pink.bmp",NULL);
BITMAP *oyunu1_resmi=load_bitmap("topbu.bmp",NULL);
//Birinci oyuncunun x koordinatını belirledik.Random olarak!
int oyuncu1_y_koor=0;
int oyuncu1_x_koor1= (1+rand()%4);
if (oyuncu1_x_koor1==1){
oyuncu1_x_koor1=30;
}
if (oyuncu1_x_koor1==2){
oyuncu1_x_koor1=150;
}if (oyuncu1_x_koor1==3){
oyuncu1_x_koor1=270;
}if (oyuncu1_x_koor1==4){
oyuncu1_x_koor1=390;
}
if(kontrol==0){
renk=(rand()%3);r= (1+rand()%6)*30;
for(int x=0;x<1080;x=x+30){
for(int y=600;y>450-r;y=y-30){
if(oyuncu1_x_koor1==x){
oyuncu1_y_koor=390-r;
draw_sprite(buf1,oyunu1_resmi,oyuncu1_x_koor1,oyuncu1_y_koor);
}
if(renk==0){
draw_sprite(buf1,turuncu_beton,x,y);
}
if(renk==1){
draw_sprite(buf1,sari_beton,x,y);
}
if(renk==2){
draw_sprite(buf1,pembe_beton,x,y);
}
}
if( say%3==2 && x!=1020){
renk=(rand()%3);
r= (1+rand()%6)*30;
x=x+30;
}
say++;
/*
velocityY = velocityY +acc*dt; // updating the y component of the velocity
x = x + (velocityX*dt); // updating the x position
y = y + (velocityY*dt) + 0.5*acc*(dt*dt);// updating the y position.
rest(5);
draw_sprite(buf1,oyunu1_resmi,x,y);
*/
}
kontrol=1;
}
draw_sprite(screen,buf1,0,0);
}
这是我的动态bmp图片代码:
velocityY = velocityY +acc*dt; // updating the y component of the velocity
x = x + (velocityX*dt); // updating the x position
y = y + (velocityY*dt) + 0.5*acc*(dt*dt);// updating the y position.
rest(5);
draw_sprite(buf1,oyunu1_resmi,x,y);
最佳答案
对不起,我不太明白这个说法;听起来你在问双缓冲。
您会将建筑物绘制到屏幕外帧缓冲区上。然后你将你的球绘制到屏幕外帧缓冲区上。然后您将等待屏幕的垂直刷新。 (这一步很可能由 Allegro 自动完成)然后你将交换缓冲区,使屏幕外的帧缓冲区成为屏幕上的。(重复)
比照。 https://wiki.allegro.cc/index.php?title=Double_buffering
关于c++ - 如何在一个屏幕中使用两个缓冲区?是否可以 ? (快板.h),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27623472/
嗨,我必须编写一个代码,将 NASM(汇编)与 C 和 allegro 库结合起来 CC = gcc OBJ = main.o func.o BIN = program CFLAGS = -m32 $
我的问题与 Allegro 5 C++ 有关。这是我的代码的某些部分,它们必须在屏幕上绘制文本。我已经完成了所有的声明,错误肯定在这部分代码中。 所以一开始我声明了一个全局变量ALLEGRO_FONT
我的调试文件夹中有一个名为“x.bmp”的 114x114 位图和这个简单的代码 #include BITMAP *Sprite; int main(){ allegro_init();
这是困扰我多年的问题。 这是我的game.h 和game.cpp 文件: game.h #ifndef GAME_H_INCLUDED #define GAME_H_INCLUDED #include
如何让 allegro 5 在绘图时使用抗锯齿?我需要使对角线看起来平滑。目前,它们只是阴影像素线,边缘看起来很硬。 最佳答案 为图元启用抗锯齿: // before creating the dis
这个问题困扰我好久了。当我编译这部分代码时,它在位图上方显示黑线。可能是什么问题,是否有任何解决方案? void start() { FONT *verdana; PALETTE pa
我正在尝试制作一个简单的程序,其中包含一个作为“背景”的 BITMAP 和另一个我可以移动的 BITMAP,我尝试了不同的方法,比如将背景直接绘制到屏幕上,尝试制作两个缓冲区,我尝试将两者都放入一个缓
我是 C++ 的新手,由于统一要求,我们都在使用代码块。我在 10.10.5 OS X 上使用它。现在我必须做一个使用 allegro5 库的项目,但我无法安装它!我花了很多时间尝试学习不同的教程,例
我正在尝试通过 youtube 教程学习一些 allegro 5 原则,这是我的第一个问题。 #include #include #include #include #define ScreenWid
我刚开始用 allegro 编程,但我编写的第一个简单程序检查它是否处于工作状态返回错误: "Unhandled exception at 0x0F4C590B (allegro-5.0.7-mono
我一直在研究如何使用 Allergo 5 在屏幕上绘制字符串,并且知道 al_draw-textf() 据说它的工作方式类似于 stdio.h 中的 printf() 。所以当我想在控制台窗口上打印一
我正在使用 Microsoft Visual Studio 2010,尝试使用 Allegro.h 库编写游戏代码。 重点是 我使用缓冲区通过 draw_sprite(screen,buf1,0,0)
我已经构建了一个 C++ Allegro map 编辑器。其中一个请求是要有一个日志,所以我将它放在控制台窗口中进行的每个 Action ...现在的问题是控制台窗口位于主窗口下方(使用 GFX_AU
我正在 Visual Studio 2017 中的 Allegro 5 游戏中实现操纵杆控件。我尝试过两种方式:让我的事件队列在我的主循环中监听操纵杆事件,并使用 ALLEGRO_JOYSTICK_S
我想将第三方 lisp 库保存到独立的二进制文件中?这在 Allegro CL 中是否可行(我似乎在文档中找不到任何相关信息)? 最佳答案 看起来 Allegro 有一些关于这个主题的文档 here和
我一直致力于此平台化 Allegro 5 测试,稍后我将把它变成游戏。直到现在,当我尝试使用音频播放我在 Audacity 中制作的 .ogg 文件时,Allegro 的每个附加组件都运行良好。我正在
我开始使用 Allegro 5 在 C++ 的 Visual Studio 2017 中创建游戏。为了更轻松地管理图像,我创建了一个 ImageLoader 类,该类将加载和存储所有事件图像,并在必要
使用 Allegro 5,如何在全屏模式下初始化游戏,使其符合屏幕格式(宽屏 16:9 与普通 3:4) al_create_display (w, h) 让我们选择您想要的任何比例。例如,无论屏幕大
我是游戏编程新手。这里我有一些 Sprite ,比如 Sprite 表中的马里奥 Sprite 。每个 Sprite 只有 32 x 32 像素。一个 Sprite 包含一个 Action ,马里奥的
我是一名优秀的程序员,十分优秀!