<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=MonoGame%E3%81%A7%E3%83%9E%E3%82%A6%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B</id>
	<title>MonoGameでマウスを使用する - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=MonoGame%E3%81%A7%E3%83%9E%E3%82%A6%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B"/>
	<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=MonoGame%E3%81%A7%E3%83%9E%E3%82%A6%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;action=history"/>
	<updated>2026-06-05T14:21:02Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://monobook.org/w/index.php?title=MonoGame%E3%81%A7%E3%83%9E%E3%82%A6%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=9288&amp;oldid=prev</id>
		<title>2017年11月22日 (水) 07:55に172.68.253.253による</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=MonoGame%E3%81%A7%E3%83%9E%E3%82%A6%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=9288&amp;oldid=prev"/>
		<updated>2017-11-22T07:55:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2017年11月22日 (水) 07:55時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MonoGameでマウスを使用する。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[MonoGame]]で[[マウス]]を使用する。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;主にMouseクラスのGetStateメソッドを使ったサンプル。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;主に[[MonoGame/クラスライブラリ/Mouseクラス|Mouseクラス]]のGetStateメソッドを使ったサンプル。マウスで「[[ぷにコン]]」みたいのを表示してみる。少し改造して[[MonoGame/クラスライブラリ/TouchPanelクラス| TouchPanelクラス]]に置き換えれば[[Android]]などで[[ぷにコン]]もどきになると思われる。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;このサンプルではC3.MonoGame.Primitives2Dを使用し、その[[MonoGame/クラスライブラリ/SpriteBatchクラス|SpriteBatchクラス]]拡張メソッド群で円や直線の描画を行っている。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;このサンプルではC3.MonoGame.Primitives2Dを使用し、その[[MonoGame/クラスライブラリ/SpriteBatchクラス|SpriteBatchクラス]]拡張メソッド群で円や直線の描画を行っている。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>172.68.253.253</name></author>
	</entry>
	<entry>
		<id>https://monobook.org/w/index.php?title=MonoGame%E3%81%A7%E3%83%9E%E3%82%A6%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=9287&amp;oldid=prev</id>
		<title>172.68.253.253: ページの作成:「MonoGameでマウスを使用する。 主にMouseクラスのGetStateメソッドを使ったサンプル。  このサンプルではC3.MonoGame.Primitives2Dを使用...」</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=MonoGame%E3%81%A7%E3%83%9E%E3%82%A6%E3%82%B9%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B&amp;diff=9287&amp;oldid=prev"/>
		<updated>2017-11-22T07:52:08Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「MonoGameでマウスを使用する。 主にMouseクラスのGetStateメソッドを使ったサンプル。  このサンプルではC3.MonoGame.Primitives2Dを使用...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;MonoGameでマウスを使用する。&lt;br /&gt;
主にMouseクラスのGetStateメソッドを使ったサンプル。&lt;br /&gt;
&lt;br /&gt;
このサンプルではC3.MonoGame.Primitives2Dを使用し、その[[MonoGame/クラスライブラリ/SpriteBatchクラス|SpriteBatchクラス]]拡張メソッド群で円や直線の描画を行っている。&lt;br /&gt;
C3.MonoGame.Primitives2DにNuGetパッケージはないのでGitHubからソースコードをダウンロードして入れよう。&lt;br /&gt;
* https://github.com/z2oh/C3.MonoGame.Primitives2D&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
using Microsoft.Xna.Framework;&lt;br /&gt;
using Microsoft.Xna.Framework.Graphics;&lt;br /&gt;
using Microsoft.Xna.Framework.Input;&lt;br /&gt;
using Microsoft.Xna.Framework.Input.Touch;&lt;br /&gt;
&lt;br /&gt;
using C3.MonoGame;&lt;br /&gt;
&lt;br /&gt;
namespace MonoGameSamples&lt;br /&gt;
{&lt;br /&gt;
    public class Game1 : Game&lt;br /&gt;
    {&lt;br /&gt;
        GraphicsDeviceManager graphics;&lt;br /&gt;
        SpriteBatch spriteBatch;&lt;br /&gt;
        Vector2? startPosition = null;&lt;br /&gt;
        Vector2? deltaPosition = null;&lt;br /&gt;
&lt;br /&gt;
        public Game1()&lt;br /&gt;
        {&lt;br /&gt;
            graphics = new GraphicsDeviceManager(this);&lt;br /&gt;
            Content.RootDirectory = &amp;quot;Content&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        protected override void Initialize()&lt;br /&gt;
        {&lt;br /&gt;
            // マウスカーソルを表示する&lt;br /&gt;
            this.IsMouseVisible = true;&lt;br /&gt;
&lt;br /&gt;
            base.Initialize();&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        protected override void LoadContent()&lt;br /&gt;
        {&lt;br /&gt;
            spriteBatch = new SpriteBatch(GraphicsDevice);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        protected override void Update(GameTime gameTime)&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
#if !__IOS__ &amp;amp;&amp;amp; !__TVOS__&lt;br /&gt;
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))&lt;br /&gt;
                Exit();&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
            var mouse = Mouse.GetState();&lt;br /&gt;
            if (mouse.LeftButton == ButtonState.Pressed)&lt;br /&gt;
            {&lt;br /&gt;
                if (startPosition == null)&lt;br /&gt;
                {// ドラッグ開始&lt;br /&gt;
                    startPosition = mouse.Position.ToVector2();&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {// ドラッグ中&lt;br /&gt;
                    deltaPosition = mouse.Position.ToVector2();&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                startPosition = null;&lt;br /&gt;
                deltaPosition = null;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
            base.Update(gameTime);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        protected override void Draw(GameTime gameTime)&lt;br /&gt;
        {&lt;br /&gt;
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);&lt;br /&gt;
&lt;br /&gt;
            spriteBatch.Begin();&lt;br /&gt;
            {&lt;br /&gt;
                if (startPosition != null)&lt;br /&gt;
                {// 始点描画&lt;br /&gt;
                    spriteBatch.DrawCircle(startPosition.Value, 20, 16, Color.Red);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                if (deltaPosition != null)&lt;br /&gt;
                {// 現在点描画&lt;br /&gt;
                    spriteBatch.DrawLine(startPosition.Value, deltaPosition.Value, Color.White);&lt;br /&gt;
                    spriteBatch.DrawCircle(deltaPosition.Value, 20, 16, Color.Red);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            spriteBatch.End();&lt;br /&gt;
&lt;br /&gt;
            base.Draw(gameTime);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 関連項目 ==&lt;br /&gt;
* [[MonoGameでマウスカーソルを表示する]]&lt;br /&gt;
&lt;br /&gt;
[[category: MonoGame]]&lt;/div&gt;</summary>
		<author><name>172.68.253.253</name></author>
	</entry>
</feed>