您好我是JavaScript新手,并决定通过遵循w3schools游戏教程来学习更多。
我决定将其制作为平台游戏,但是我一直无法弄清楚如何在画布外添加跟随玩家的视口。
有人可以帮我吗?提前致谢。
//Background
var Background;
//Objects
var Player;
var Obstacle;
//Mobile buttons
var UpBtn;
var DownBtn;
var LeftBtn;
var RightBtn;
//End
function startGame() {
Background = new component(656, 270, "gray", 0, 0);
Player = new component(30, 30, "blue", 200, 75);
Obstacle = new component(10,100, "red", 300, 170);
//Mobile buttons
UpBtn = new component(0, 0, "black", 50, 160);
DownBtn = new component(0, 0, "black", 50, 220);
LeftBtn = new component(30, 30, "black", 20, 200);
RightBtn = new …Run Code Online (Sandbox Code Playgroud) 我完全迷路了。我正在尝试捕获30个屏幕截图,并将它们放到FFMPEGWindows 10下的视频中。它一直告诉我[swscaler @ 073890a0] bad src image pointers。结果,视频完全是绿色的。如果我将格式更改为dshow使用video=screen-capture-recorder视频,看起来大部分都是垃圾。这是我的简短代码。我完全陷入困境,甚至不知道朝哪个方向看。
MainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFuture>
#include <QFutureWatcher>
#include <QMutex>
#include <QMutexLocker>
extern "C" {
#include "libavcodec/avcodec.h"
#include "libavcodec/avfft.h"
#include "libavdevice/avdevice.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/avfiltergraph.h"
#include "libavfilter/buffersink.h"
#include "libavfilter/buffersrc.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libavutil/opt.h"
#include "libavutil/common.h"
#include "libavutil/channel_layout.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/samplefmt.h"
#include "libavutil/time.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/file.h"
#include "libswscale/swscale.h"
}
class MainWindow : public QMainWindow …Run Code Online (Sandbox Code Playgroud) 我有这两个函数可以将选定的表情符号添加到输入字段。
然而,第一次点击它不显示任何表情符号,第二次点击它显示两个表情符号,第三次点击它显示四个表情符号。
有没有什么办法解决这一问题?
谢谢。
HTML:
<a id="smiley" title="smiley" href="#" onclick="enableTxt(this)" >😃</a>
<a id="sadface" title="sadface" href="#" onclick="enableTxt(this)" >😒</a>
Run Code Online (Sandbox Code Playgroud)
查询:
function enableTxt(elem) {
var id = $(elem).attr("id");
//Add emoji to chat when clicked with selected id
$("#" + id).click(function() {
$('#usermsg').val($('#usermsg').val() + $("#" + id).html());
});
}
Run Code Online (Sandbox Code Playgroud)